/* One compact, fixed-timeframe terminal, fetched only for the inspected position. */
.position-history { --ph-green: #39cfa5; --ph-red: #f27786; position: fixed; z-index: 90; width: min(760px, calc(100vw - 24px)); max-height: calc(100svh - 24px); overflow: auto; padding: 18px 20px 14px; border: 1px solid #323a48; border-radius: 16px; background: #141920; color: #e8edf4; box-shadow: 0 18px 70px #03060966, 0 2px 9px #03060955; font-family: var(--font); color-scheme: dark; opacity: 0; transform: translateY(5px) scale(.994); transform-origin: 50% 0; transition: opacity 140ms ease, transform 140ms cubic-bezier(.2,.65,.3,1); pointer-events: none; }
.position-history.is-open { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.position-history[hidden], .position-history [hidden] { display: none !important; }
.ucase-history-trigger { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 18px; height: 18px; border-radius: 4px; color: #a2978a; transition: color 150ms; }
.ucase-history-trigger svg { width: 12px; height: 12px; flex: none; }
.ucase-history-trigger:hover, .ucase-history-trigger[aria-expanded="true"] { color: var(--accent); }
.ucase-history-trigger:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.ph-heading { display: flex; justify-content: space-between; align-items: center; gap: 14px; }
.ph-identity { display: flex; align-items: center; flex-wrap: wrap; min-width: 0; gap: 8px 12px; }
.ph-title { min-width: 0; overflow-wrap: anywhere; font-family: var(--font); font-size: 16px; font-weight: 600; line-height: 1.3; letter-spacing: -.01em; }
.ph-side { font-size: 10px; line-height: 1.3; }
.ph-roi { padding-left: 10px; border-left: 1px solid #353e4b; color: #8995a7; font-size: 11px; font-variant-numeric: tabular-nums; }
.ph-close { display: grid; place-items: center; flex: none; width: 27px; height: 27px; margin: -3px -5px 0 0; border-radius: 8px; color: #8b96a6; font-size: 23px; line-height: 1; }
.ph-close:hover { color: #fff; background: #252e3b; }
.ph-context { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 12px 0 11px; }
.ph-timeframe { display: flex; align-items: center; gap: 9px; }
.ph-interval { padding: 3px 5px; border: 1px solid #414a58; border-radius: 4px; color: #cfd8e4; font-size: 9px; font-weight: 600; line-height: 1.25; letter-spacing: .02em; }
.ph-period, .ph-quote { color: #728097; font-size: 9px; line-height: 1.4; }
.position-history .is-buy { color: var(--ph-green); }
.position-history .is-sell { color: var(--ph-red); }
.ph-chart-wrap { position: relative; min-height: 245px; }
.ph-chart { display: block; width: 100%; height: auto; min-height: 245px; overflow: visible; }
.ph-chart text { fill: #78869a; font-family: var(--font); font-size: 9px; font-weight: 400; }
.ph-grid { fill: none; stroke: #29313c; stroke-width: 1; vector-effect: non-scaling-stroke; }
.ph-candle { stroke-width: 1; vector-effect: non-scaling-stroke; }
.ph-candle.is-buy { stroke: var(--ph-green); fill: var(--ph-green); }
.ph-candle.is-sell { stroke: var(--ph-red); fill: var(--ph-red); }
.ph-price-line { stroke: #8aa0bb; fill: none; stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.ph-entry-line { fill: none; stroke: #bda45d; stroke-width: 1; stroke-dasharray: 4 5; vector-effect: non-scaling-stroke; }
.ph-chart text.ph-entry-price { fill: #cfb66e; font-size: 9px; font-weight: 500; }
.ph-trade.is-buy { fill: var(--ph-green); stroke: var(--ph-green); }
.ph-trade.is-sell { fill: var(--ph-red); stroke: var(--ph-red); }
.ph-trade path { fill: none; stroke-width: 1; vector-effect: non-scaling-stroke; }
.ph-trade rect { stroke: #141920; stroke-width: .6; vector-effect: non-scaling-stroke; }
.ph-chart .ph-trade text { fill: #111820; stroke: none; font-size: 9px; font-weight: 700; }
.ph-crosshair { fill: none; stroke: #b1bfd052; stroke-width: 1; stroke-dasharray: 3 4; vector-effect: non-scaling-stroke; pointer-events: none; }
.ph-cursor { fill: #141920; stroke: #e1e8f0; stroke-width: 1.5; vector-effect: non-scaling-stroke; pointer-events: none; }
.ph-empty { position: absolute; inset: 0 60px 0 0; display: grid; place-content: center; padding: 20px; background: radial-gradient(ellipse at center, #141920 0%, #141920ed 34%, transparent 78%); color: #8492a7; text-align: center; font-size: 11px; line-height: 1.6; }
.ph-tooltip { position: absolute; z-index: 2; width: max-content; max-width: min(360px, 92%); padding: 9px 11px 10px; border: 1px solid #3a4556; border-radius: 9px; background: #1c2634f5; box-shadow: 0 5px 18px #0003; transform: translate(-50%, calc(-100% - 11px)); pointer-events: none; }
.ph-tooltip-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.ph-tooltip-time { color: #9aa8bb; font-size: 9px; line-height: 1.4; white-space: nowrap; }
.ph-tooltip-side { color: var(--ph-green); font-size: 9px; font-weight: 600; line-height: 1.4; }
.ph-tooltip.is-sell .ph-tooltip-side { color: var(--ph-red); }
.ph-tooltip-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-top: 8px; }
.ph-tooltip-cell { display: grid; gap: 3px; }
.ph-tooltip-key { color: #76869c; font-size: 9px; line-height: 1; }
.ph-tooltip-cell strong { color: #dbe4f0; font-size: 10px; font-weight: 500; line-height: 1.25; font-variant-numeric: tabular-nums; }
.ph-tooltip-price { display: flex; align-items: baseline; gap: 6px; margin-top: 8px; }
.ph-tooltip-price strong { color: #e9eff7; font-size: 15px; font-weight: 500; line-height: 1.2; font-variant-numeric: tabular-nums; }
.ph-tooltip-price > span { color: #7f8fa6; font-size: 9px; }
.ph-dates { display: flex; justify-content: space-between; padding: 0 78px 0 10px; color: #647187; font-size: 8px; line-height: 1.4; }
.ph-summary { margin: 9px 0 0; color: #b19b75; font-size: 10px; line-height: 1.6; }
.ph-footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 14px; padding-top: 11px; border-top: 1px solid #29313c; }
.ph-legend { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 15px; font-size: 9px; line-height: 1.4; }
.ph-legend > span { display: inline-flex; align-items: center; gap: 5px; }
.ph-legend > span::before { content: ""; width: 4px; height: 4px; border-radius: 1px; background: currentColor; }
.ph-legend .ph-entry-legend { color: #bca45f; }
.ph-legend .ph-entry-legend::before { width: 12px; height: 0; border-top: 1px dashed currentColor; background: none; }
.ph-source { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 20px; border-radius: 4px; color: #73839a; }
.ph-source:hover { color: #dce7f4; background: #273140; }
.ph-retry { margin-top: 5px; color: #c8ab62; font-size: 10px; min-height: 26px; }
.ph-retry:disabled { opacity: .45; cursor: default; }
.ph-close:focus-visible, .ph-chart:focus-visible, .ph-retry:focus-visible, .ph-source:focus-visible { outline: 2px solid #c8ab62; outline-offset: 2px; }
@media (max-width: 680px) {
  .position-history { left: 12px !important; right: 12px !important; top: auto !important; bottom: 12px; width: auto !important; max-height: calc(100svh - 24px) !important; padding: 16px 13px 13px; border-radius: 14px; }
  .ph-title { font-size: 14px; }
  .ph-identity { gap: 6px 9px; }
  .ph-roi { padding-left: 8px; font-size: 10px; }
  .ph-chart-wrap, .ph-chart { min-height: 215px; }
  .ph-tooltip { max-width: 88%; }
  .ph-tooltip-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 20px; }
  .ph-legend { gap: 5px 12px; }
}
@media (prefers-reduced-motion: reduce) { .position-history, .ucase-history-trigger { transition: none; } .position-history { transform: none; } }
