/* ===== Performance view (#view-performance, .pf-*) — tokens only ===== */
#view-performance { position: relative; }
#view-performance .pf-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: var(--gap); }
#view-performance .pf-title { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; min-width: 0; }
#view-performance .pf-title h2 { font-size: 18px; display: flex; align-items: center; gap: 8px; }
#view-performance .pf-title h2 .ic { color: var(--warn); }
#view-performance .pf-range { font-size: 12.5px; }
#view-performance .pf-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
#view-performance.pf-loading .pf-refresh svg { animation: spin .9s linear infinite; }
#view-performance.pf-loading .pf-body { opacity: .7; transition: opacity .2s; }

/* KPIs */
#view-performance .pf-kpis { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
#view-performance .pf-kpi { gap: 4px; justify-content: space-between; }
#view-performance .pf-kpi .kpi-s { font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#view-performance .pf-kpi-hero { background: radial-gradient(120% 140% at 100% 0%, var(--hero-1), transparent 60%), radial-gradient(90% 120% at 0% 100%, var(--hero-2), transparent 65%), var(--panel); border-color: var(--line-2); }
#view-performance .pf-kpi-hero .kpi-v { font-size: calc(var(--fs-kpi) + 3px); }
#view-performance .pf-kpi-ring { flex-direction: row; align-items: center; gap: 12px; justify-content: flex-start; }
#view-performance .pf-kpi-ring > div { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
#view-performance .pf-ring { width: 56px; height: 56px; flex: none; }
#view-performance .pf-ring circle { fill: none; stroke-width: 6; }
#view-performance .pf-ring-bg { stroke: var(--panel-3); }
#view-performance .pf-ring-fg { stroke-linecap: round; transition: stroke-dasharray .6s var(--ease); }
#view-performance .pf-ring-fg.up { stroke: var(--up); }
#view-performance .pf-ring-fg.down { stroke: var(--down); }
#view-performance .pf-sep { color: var(--dim); margin: 0 4px; }
#view-performance .pf-kpi-mkt { color: var(--text-2); }

/* chart */
#view-performance .pf-chart { position: relative; height: 340px; direction: ltr; }
#view-performance .pf-chart-card .card-h { flex-wrap: wrap; }

/* rows */
#view-performance .pf-row { align-items: stretch; }
#view-performance .grid.pf-row:not(.g-3) { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); }

/* heatmap */
#view-performance .pf-heat-scroll { overflow-x: auto; padding-bottom: 4px; max-width: 100%; -webkit-overflow-scrolling: touch; }
#view-performance .pf-heat { --cell: 13px; --g: 3px; display: grid; grid-template-columns: auto auto; grid-template-areas: ". m" "wd g"; column-gap: 6px; row-gap: 4px; width: max-content; margin-inline: auto; direction: ltr; }
#view-performance .pf-heat-lg { --cell: 26px; --g: 5px; }
#view-performance .pf-heat-m { grid-area: m; display: grid; column-gap: var(--g); font-size: 10.5px; color: var(--muted); height: 15px; }
#view-performance .pf-heat-m span { white-space: nowrap; overflow: visible; }
#view-performance .pf-heat-wd { grid-area: wd; display: grid; grid-template-rows: repeat(7, var(--cell)); row-gap: var(--g); font-size: 9.5px; color: var(--dim); line-height: var(--cell); text-align: right; }
#view-performance .pf-heat-g { grid-area: g; display: grid; grid-template-rows: repeat(7, var(--cell)); gap: var(--g); }
#view-performance .pf-c:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
#view-performance .pf-c { display: block; width: var(--cell); height: var(--cell); border-radius: 3px; background: var(--panel-3); outline: 1px solid transparent; outline-offset: -1px; transition: outline-color .12s, transform .12s; }
#view-performance .pf-heat-lg .pf-c { border-radius: 6px; }
#view-performance .pf-heat-g .pf-c:not(.pf-c-none):hover { outline-color: var(--text-2); transform: scale(1.15); cursor: pointer; }
#view-performance .pf-c-none { background: transparent; }
#view-performance .pf-c-out { opacity: .35; }
#view-performance .pf-c.flat { background: var(--line-2); }
#view-performance .pf-c.up.l1 { background: color-mix(in srgb, var(--up) 28%, var(--panel-3)); }
#view-performance .pf-c.up.l2 { background: color-mix(in srgb, var(--up) 50%, var(--panel-3)); }
#view-performance .pf-c.up.l3 { background: color-mix(in srgb, var(--up) 74%, var(--panel-3)); }
#view-performance .pf-c.up.l4 { background: var(--up); }
#view-performance .pf-c.down.l1 { background: color-mix(in srgb, var(--down) 28%, var(--panel-3)); }
#view-performance .pf-c.down.l2 { background: color-mix(in srgb, var(--down) 50%, var(--panel-3)); }
#view-performance .pf-c.down.l3 { background: color-mix(in srgb, var(--down) 74%, var(--panel-3)); }
#view-performance .pf-c.down.l4 { background: var(--down); }
#view-performance .pf-legend { display: flex; align-items: center; justify-content: center; gap: 3px; margin-top: 12px; font-size: 11px; color: var(--muted); direction: ltr; }
#view-performance .pf-legend .pf-c { --cell: 11px; }
#view-performance .pf-legend span { margin: 0 6px; }

/* tooltip */
#view-performance .pf-tip { position: absolute; z-index: 30; pointer-events: none; display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border-radius: var(--r-sm); background: var(--panel-2); border: 1px solid var(--line-2); box-shadow: var(--shadow); font-size: 12px; white-space: nowrap; max-width: 260px; }
#view-performance .pf-tip b { font-weight: 600; }
#view-performance .pf-tip small { color: var(--muted); font-size: 11px; }

/* insights */
#view-performance .pf-ins { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
#view-performance .pf-ins li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--r); background: var(--panel-2); border: 1px solid var(--line); border-inline-start: 3px solid var(--line-2); }
#view-performance .pf-ins li.up { border-inline-start-color: var(--up); }
#view-performance .pf-ins li.down { border-inline-start-color: var(--down); }
#view-performance .pf-ins li.flat { border-inline-start-color: var(--accent); }
#view-performance .pf-ins-ic { width: 28px; height: 28px; flex: none; border-radius: 8px; display: grid; place-items: center; background: var(--accent-bg); color: var(--accent); }
#view-performance .pf-ins li.up .pf-ins-ic { background: var(--up-bg); color: var(--up); }
#view-performance .pf-ins li.down .pf-ins-ic { background: var(--down-bg); color: var(--down); }
#view-performance .pf-ins-ic .ic { width: 15px; height: 15px; }
#view-performance .pf-ins p { font-size: 13px; line-height: 1.65; color: var(--text-2); }
#view-performance .pf-ins p .num { color: var(--text); font-weight: 600; }

/* by instrument */
#view-performance .pf-inst { display: flex; flex-direction: column; gap: 12px; max-height: 320px; overflow-y: auto; padding-inline-end: 4px; }
#view-performance .pf-inst-r { display: flex; flex-direction: column; gap: 5px; }
#view-performance .pf-inst-top { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; min-width: 0; }
#view-performance .pf-inst-n { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
#view-performance .pf-inst-s { display: flex; justify-content: space-between; font-size: 11.5px; }
#view-performance .pf-bar { height: 7px; border-radius: 7px; background: var(--panel-3); overflow: hidden; }
#view-performance .pf-bar > i { display: block; height: 100%; border-radius: inherit; transition: width .5s var(--ease); }
#view-performance .pf-bar.up > i { background: var(--up); }
#view-performance .pf-bar.down > i { background: var(--down); }

/* diverging vertical bars (weekday / hour) */
#view-performance .pf-vb { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 6px; height: 200px; }
#view-performance .pf-vb-ltr { direction: ltr; gap: 3px; height: 170px; }
#view-performance .pf-vb-c { display: grid; grid-template-rows: 1fr 1fr auto; min-width: 0; cursor: default; border-radius: 6px; transition: background .12s; }
#view-performance .pf-vb-c:hover { background: var(--panel-2); }
#view-performance .pf-vb-up, #view-performance .pf-vb-dn { position: relative; display: flex; justify-content: center; }
#view-performance .pf-vb-up { align-items: flex-end; border-bottom: 1px solid var(--line-2); }
#view-performance .pf-vb-dn { align-items: flex-start; }
#view-performance .pf-vb i { display: block; width: min(70%, 26px); min-height: 2px; }
#view-performance .pf-vb i.up { background: var(--up); border-radius: 4px 4px 0 0; }
#view-performance .pf-vb i.down { background: var(--down); border-radius: 0 0 4px 4px; }
#view-performance .pf-vb-l { font-size: 10.5px; color: var(--muted); text-align: center; padding-top: 6px; white-space: nowrap; height: 22px; }
#view-performance .pf-vb-ltr .pf-vb-l { font-family: var(--mono); }

/* distribution */
#view-performance .pf-dist { display: flex; align-items: flex-end; gap: 3px; height: 180px; padding-bottom: 1px; border-bottom: 1px solid var(--line-2); direction: ltr; }
#view-performance .pf-dist-c { flex: 1; height: 100%; display: flex; align-items: flex-end; border-radius: 4px 4px 0 0; transition: background .12s; min-width: 0; }
#view-performance .pf-dist-c:hover { background: var(--panel-2); }
#view-performance .pf-dist-c i { display: block; width: 100%; border-radius: 4px 4px 0 0; background: var(--line-2); }
#view-performance .pf-dist-c i.up { background: var(--up); }
#view-performance .pf-dist-c i.down { background: var(--down); }
#view-performance .pf-dist-ax { position: relative; display: flex; justify-content: space-between; font-size: 10.5px; color: var(--muted); padding-top: 6px; height: 22px; }
#view-performance .pf-dist-0 { position: absolute; top: 6px; transform: translateX(-50%); color: var(--text-2); }

/* transactions table */
#view-performance .pf-tx .card-h { flex-wrap: wrap; }
#view-performance .pf-tx-tools { flex-wrap: wrap; }
#view-performance .pf-search { position: relative; display: flex; align-items: center; }
#view-performance .pf-search .ic { position: absolute; inset-inline-start: 10px; width: 15px; height: 15px; color: var(--muted); pointer-events: none; }
#view-performance .pf-search .input { height: 32px; width: 220px; padding-inline-start: 32px; font-size: 13px; }
@media (pointer: coarse) { #view-performance .pf-search .input { height: 40px; } }
#view-performance .pf-tx .table-wrap { padding: 0 6px; }
#view-performance .pf-tx .t td.pf-date { text-align: start; color: var(--text-2); }
#view-performance .pf-tx .pf-ref { font-size: 11.5px; text-align: start; }
#view-performance .pf-tx tr.pf-cash td { background: var(--accent-bg); }
#view-performance .pf-tx tr.pf-cash td:first-child { box-shadow: inset -3px 0 0 var(--accent); }
[dir="ltr"] #view-performance .pf-tx tr.pf-cash td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
#view-performance .pf-pager { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 12px; font-size: 12.5px; }
#view-performance .pf-pager:empty { display: none; }

/* empty state */
#view-performance .pf-empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 48px 20px; }
#view-performance .pf-empty > .ic { width: 46px; height: 46px; color: var(--warn); padding: 10px; border-radius: 14px; background: var(--warn-bg); box-sizing: content-box; }
#view-performance .pf-empty h3 { font-size: 16px; }
#view-performance .pf-empty p { max-width: 420px; font-size: 13px; }
#view-performance .pf-empty .row { margin-top: 6px; flex-wrap: wrap; justify-content: center; }

/* responsive */
@media (max-width: 1280px) {
  #view-performance .grid.pf-row.g-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #view-performance .grid.pf-row.g-3 > :last-child { grid-column: span 2; }
}
@media (max-width: 1100px) {
  #view-performance .grid.pf-row:not(.g-3) { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  #view-performance .pf-head { flex-direction: column; align-items: stretch; }
  #view-performance .pf-tools { justify-content: space-between; }
  #view-performance .pf-csv span { display: none; }
  #view-performance .pf-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  #view-performance .pf-kpi-hero, #view-performance .pf-kpi-ring { grid-column: span 2; }
  #view-performance .pf-chart { height: 260px; }
  #view-performance .grid.pf-row.g-3 { grid-template-columns: minmax(0, 1fr); }
  #view-performance .grid.pf-row.g-3 > :last-child { grid-column: auto; }
  #view-performance .pf-heat { margin-inline: 0; }
  #view-performance .pf-heat-lg { --cell: 22px; --g: 4px; }
  #view-performance .pf-vb { height: 160px; gap: 4px; }
  #view-performance .pf-vb-ltr { gap: 1px; }
  #view-performance .pf-vb-ltr .pf-vb-l { font-size: 9px; }
  #view-performance .pf-tx-tools { width: 100%; margin-inline-start: 0; }
  #view-performance .pf-search { flex: 1; }
  #view-performance .pf-search .input { width: 100%; }
}
