/* ==========================================================
   Overview view — all selectors under #view-overview / .ov-
   Uses only tokens from app.css (works in dark + light).
   ========================================================== */

/* entrance (staggered) */
#view-overview .ov-in { animation: ovIn .5s var(--ease) both; animation-delay: calc(var(--i, 0) * 45ms); }
@keyframes ovIn { from { opacity: 0; transform: translateY(10px) scale(.99); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { #view-overview .ov-in { animation: none; } }

/* ---------- hero ---------- */
#view-overview .ov-hero {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 18px 22px; margin-bottom: var(--gap);
  border: 1px solid var(--line); border-radius: var(--r-xl);
  background:
    radial-gradient(120% 140% at 100% 0%, var(--hero-1), transparent 55%),
    radial-gradient(90% 120% at 0% 100%, var(--hero-2), transparent 60%),
    radial-gradient(60% 90% at 50% 120%, var(--hero-3), transparent 70%),
    var(--panel);
  box-shadow: var(--shadow-card);
  position: relative; overflow: hidden; min-width: 0;
}
#view-overview .ov-hero::after {
  content: ''; position: absolute; inset: -1px; border-radius: inherit; pointer-events: none; padding: 1px;
  background: linear-gradient(120deg, var(--edge-1), transparent 35%, transparent 65%, var(--edge-2));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude;
}
#view-overview .ov-hello { min-width: 0; }
#view-overview .ov-hello h2 {
  font-size: 22px; font-weight: 700;
  background: linear-gradient(90deg, var(--text), var(--accent));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
#view-overview .ov-hello p { margin-top: 4px; font-size: 13px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
#view-overview .ov-hello p b { color: var(--text); font-weight: 600; }
#view-overview .ov-hero-r { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
#view-overview .ov-date { font-size: 12.5px; color: var(--text-2); padding: 0 6px; }

/* ---------- KPIs ---------- */
#view-overview .ov-kpis { margin-bottom: var(--gap); }
/* padding / hover / value size come from base .card.kpi + .kpi-v */
#view-overview .ov-kpi .kpi-v { transition: color .3s; }
#view-overview .ov-kpi .kpi-s { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-height: 18px; }
#view-overview .ov-kic {
  width: 22px; height: 22px; display: grid; place-items: center; border-radius: 6px;
  background: var(--accent-bg); color: var(--accent);
}
#view-overview .ov-kic .ic { width: 13px; height: 13px; }
#view-overview #ov-k-equity { background: linear-gradient(160deg, var(--accent-bg), transparent 70%), var(--panel); }
#view-overview .ov-meter { width: 100%; margin-bottom: 2px; }

/* ---------- grid + cards ---------- */
#view-overview .ov-card { display: flex; flex-direction: column; }
#view-overview .ov-card .ov-body { flex: 1; min-height: 0; }
#view-overview .ov-card .card-h .sub { display: inline-flex; align-items: center; gap: 6px; }
#view-overview .ov-pad { padding: 0 var(--card-pad) 12px; }
#view-overview .ov-center { display: flex; justify-content: center; padding-bottom: 8px; }

/* equity chart */
#view-overview .ov-chart { width: 100%; height: 260px; direction: ltr; }
#view-overview .ov-chart-skel { height: 260px; display: flex; flex-direction: column; justify-content: center; }
#view-overview .ov-chart-skel .skel i { height: 22px; }

/* risk + sessions cards: let widgets breathe */
#view-overview #ov-risk .ov-body, #view-overview #ov-sessions .ov-body { min-height: 120px; }

/* ---------- positions ---------- */
#view-overview #ov-pos .card-h { padding-bottom: 0; }
#view-overview .ov-pos-wrap { max-height: 380px; overflow: auto; padding: 0 6px 6px; }
#view-overview .ov-pos-t { width: 100%; border-collapse: collapse; font-size: 13px; }
#view-overview .ov-pos-t td .num, #view-overview .ov-pos-t td span[data-price],
#view-overview .ov-pos-t td span[data-pnl], #view-overview .ov-pos-t td span[data-pts] { padding: 2px 4px; border-radius: 5px; }
#view-overview .ov-pnl { font-weight: 600; }
#view-overview .ov-row-act { display: flex; gap: 4px; justify-content: flex-end; opacity: .55; transition: opacity .15s; }
#view-overview .ov-pos-t tr:hover .ov-row-act { opacity: 1; }
#view-overview .ov-pos-t tr:focus-within .ov-row-act { opacity: 1; }
#view-overview .ov-row-act .ov-x:hover { color: var(--down); border-color: var(--down); }
@media (hover: none) { #view-overview .ov-row-act { opacity: 1; } }

#view-overview .ov-sltp {
  position: relative; width: 96px; height: 6px; border-radius: 6px;
  background: linear-gradient(to left, var(--down), var(--panel-3) 50%, var(--up));
  opacity: .9;
}
#view-overview .ov-sltp-e { position: absolute; top: -3px; width: 2px; height: 12px; background: var(--muted); border-radius: 2px; transform: translateX(50%); }
#view-overview .ov-sltp-m {
  position: absolute; top: 50%; width: 11px; height: 11px; border-radius: 50%;
  background: var(--text); border: 2px solid var(--panel); box-shadow: var(--shadow-sm);
  transform: translate(50%, -50%); transition: inset-inline-start .4s var(--ease);
}

/* ---------- movers ---------- */
#view-overview .ov-mv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
#view-overview .ov-mv-col h4 { font-size: 11.5px; font-weight: 600; margin-bottom: 6px; }
#view-overview .ov-mvs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
#view-overview .ov-mv {
  display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; column-gap: 6px;
  padding: 7px 8px; border-radius: var(--r-sm); cursor: pointer; transition: background .12s;
}
#view-overview .ov-mv:hover { background: var(--panel-2); }
#view-overview .ov-mv-n { font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#view-overview .ov-mv-p { font-size: 11.5px; color: var(--text-2); grid-column: 1; text-align: start; border-radius: 4px; justify-self: start; }
#view-overview .ov-mv .chip { grid-row: 1 / span 2; grid-column: 2; align-self: center; }
#view-overview .ov-none { font-size: 12px; padding: 8px; }

/* ---------- performance ---------- */
#view-overview .ov-perf-top { display: flex; align-items: center; gap: 16px; }
#view-overview .ov-ring-w { position: relative; width: 84px; height: 84px; flex: none; }
#view-overview .ov-ring { width: 100%; height: 100%; }
#view-overview .ov-ring-bg { fill: none; stroke: var(--panel-3); stroke-width: 8; }
#view-overview .ov-ring-fg { fill: none; stroke-width: 8; stroke-linecap: round; stroke: var(--accent); transition: stroke-dasharray .8s var(--ease); }
#view-overview .ov-ring-fg.up { stroke: var(--up); }
#view-overview .ov-ring-fg.down { stroke: var(--down); }
#view-overview .ov-ring-t { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1; }
#view-overview .ov-ring-t b { font-size: 17px; }
#view-overview .ov-ring-t small { font-size: 10px; color: var(--muted); }
#view-overview .ov-perf-net { display: flex; flex-direction: column; gap: 3px; min-width: 0; font-size: 12px; }
#view-overview .ov-perf-net b { font-size: 22px; font-weight: 700; text-align: start; }
#view-overview .ov-perf-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
#view-overview .ov-perf-stats > div { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
#view-overview .ov-perf-stats small { font-size: 10.5px; color: var(--muted); }
#view-overview .ov-perf-stats b { font-size: 13px; text-align: start; overflow: hidden; text-overflow: ellipsis; }
#view-overview .ov-ins { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
#view-overview .ov-ins li { display: flex; gap: 8px; align-items: flex-start; font-size: 12px; color: var(--text-2); line-height: 1.55; }
#view-overview .ov-ins li .ic { width: 14px; height: 14px; margin-top: 3px; color: var(--accent); }
#view-overview .ov-ins li.up .ic { color: var(--up); }
#view-overview .ov-ins li.down .ic { color: var(--down); }
#view-overview .ov-ins li.warn .ic { color: var(--warn); }

/* ---------- activity feed ---------- */
#view-overview .ov-feed { list-style: none; margin: 0; padding: 0; max-height: 340px; overflow-y: auto; position: relative; }
#view-overview .ov-ev { display: flex; gap: 10px; padding: 8px 2px; position: relative; }
#view-overview .ov-ev[data-epic]:not([data-epic=""]) { cursor: pointer; }
#view-overview .ov-ev:not(:last-child)::before {
  content: ''; position: absolute; inset-inline-start: 15px; top: 38px; bottom: -6px; width: 1px; background: var(--line);
}
#view-overview .ov-ev-ic {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--panel-3); color: var(--muted);
}
#view-overview .ov-ev-ic .ic { width: 14px; height: 14px; }
#view-overview .ov-ev-opened .ov-ev-ic { background: var(--up-bg); color: var(--up); }
#view-overview .ov-ev-closed .ov-ev-ic { background: var(--accent-bg); color: var(--accent); }
#view-overview .ov-ev-edited .ov-ev-ic { background: var(--warn-bg); color: var(--warn); }
#view-overview .ov-ev-order .ov-ev-ic { background: var(--panel-3); color: var(--info); }
#view-overview .ov-ev-rej .ov-ev-ic { background: var(--down-bg); color: var(--down); }
#view-overview .ov-ev-b { flex: 1; min-width: 0; }
#view-overview .ov-ev-t { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; }
#view-overview .ov-ev-t time { font-size: 11px; white-space: nowrap; }
#view-overview .ov-ev-d { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); margin-top: 2px; }
#view-overview .ov-ev-d .dir { font-size: 9.5px; padding: 3px 5px; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  #view-overview .ov-grid > .span-2 { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  #view-overview .ov-hero { padding: 14px 16px; border-radius: var(--r-lg); }
  #view-overview .ov-hello h2 { font-size: 18px; }
  #view-overview .ov-hero-r { width: 100%; }
  #view-overview .ov-date { flex: 1 1 100%; padding: 0; }
  #view-overview .ov-hero-r .btn { flex: 1; justify-content: center; }
  #view-overview .ov-grid > .span-2 { grid-column: auto; }
  #view-overview .ov-chart, #view-overview .ov-chart-skel { height: 210px; }
  #view-overview .ov-row-act { opacity: 1; }
  #view-overview .ov-mv-grid { grid-template-columns: 1fr; }
  #view-overview .ov-card .card-h { flex-wrap: wrap; }
}
