/* Deep Analysis (#/deep): the trade graph over the app's own background, dimmed right down. */
#bg-dim { transition: background-color .6s ease; }
body.deep-mode #bg-dim { background-color: rgba(0, 0, 0, .86); }
body.deep-mode { --bg-blur: 10px; }
body.deep-mode main { padding-bottom: 18px; }

.da-head { padding: 14px 2px 4px; gap: 12px; align-items: flex-end; }
.da-sub { font-size: 13.5px; margin-top: 8px; }

/* Search + filters + tools */
.da-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 14px 0 12px; }
.da-search { display: flex; align-items: center; gap: 8px; flex: 1 1 260px; max-width: 420px; height: 34px; padding: 0 12px; border-radius: 10px;
  background: rgba(0, 0, 0, .25); border: 1px solid var(--line-2); color: var(--text-3); transition: border-color .2s; }
.da-search:focus-within { border-color: rgba(255, 255, 255, .22); }
.da-search input { all: unset; flex: 1; min-width: 0; font-size: 13px; color: var(--text); }
.da-search input::placeholder { color: var(--text-3); }
.da-match { font-size: 12.5px; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.da-match[hidden] { display: none; }
.da-match b { color: var(--text); }
.da-tools { margin-left: auto; display: flex; gap: 4px; align-items: center; }
.da-tools .btn.on { background: rgba(255, 255, 255, .1); color: var(--text); }
.da-playing .da-side, .da-playing .da-bar { opacity: .35; pointer-events: none; transition: opacity .3s; }

/* Graph + insights */
.da-main { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: var(--gap); height: 640px; min-height: 480px; }
/* Full screen: Deep Analysis covers the window, the app's (dimmed) background stays behind it. */
body.deep-full .topbar, body.deep-full .tabbar, body.deep-full .sidebar, body.deep-full .announce, body.deep-full .da-head { display: none !important; }
body.deep-full .da { position: fixed; inset: 0; z-index: 40; display: flex; flex-direction: column; padding: 4px 18px 16px; }
body.deep-full .da-main { flex: 1; min-height: 0; height: auto !important; }
@media (max-width: 900px) { body.deep-full .da { overflow-y: auto; } body.deep-full .da-main { flex: none; } }
.da-stage { position: relative; min-width: 0; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); isolation: isolate; }
.da-cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; font-family: var(--font); }

.da-side { display: flex; flex-direction: column; min-height: 0; padding: 0; overflow: hidden; }
.da-tabs { padding: 16px var(--pad) 10px; gap: 18px; flex: none; border-bottom: 1px solid var(--line-2); }
.da-badge { font-size: 11px; padding: 1px 6px; border-radius: 999px; background: rgba(255, 255, 255, .12); color: var(--text); margin-left: 2px; }
.da-side-b { overflow-y: auto; flex: 1; padding: 14px var(--pad) 18px; overscroll-behavior: contain; scrollbar-width: thin; }
.da-side-b > p:first-child { margin-top: 0; }
.da-lead { font-size: 14px; margin: 0 0 4px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.da-small { font-size: 12px; line-height: 1.5; }
.da-big { font-size: 17px; }
.da-side .lbl { margin: 18px 0 8px; }

/* Rows instead of cards */
.da-item { padding: 13px 0; border-bottom: 1px solid var(--line-2); font-size: 13px; }
.da-item:last-child { border-bottom: 0; }
.da-item > .dim { margin-top: 3px; }
.da-meta { display: flex; flex-wrap: wrap; gap: 3px 12px; font-size: 12px; color: var(--text-2); margin-top: 7px; font-variant-numeric: tabular-nums; }
.da-fix { display: flex; gap: 7px; align-items: flex-start; font-size: 12.5px; color: var(--text); margin-top: 8px; line-height: 1.45; }
.da-fix svg { flex: none; margin-top: 2px; opacity: .6; }
.da-actions { display: flex; gap: 4px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.da-actions .chip-btn:first-child { margin-left: -9px; }
.da-row { display: flex; width: 100%; align-items: center; gap: 9px; padding: 8px 0; font-size: 13px; text-align: left; color: var(--text); border-bottom: 1px solid var(--line-2); transition: opacity .2s; }
.da-row:last-of-type { border-bottom: 0; }
.da-row:hover { opacity: .75; }
.da-t { font-family: var(--mono); font-size: 11px; min-width: 40px; text-align: right; }
.da-trow { display: flex; align-items: center; gap: 9px; font-size: 12.5px; padding: 6px 0; text-decoration: none; color: var(--text); }
.da-trow:hover { opacity: .75; }
.da-trow .dim { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.da-trow b:last-child { font-variant-numeric: tabular-nums; }
.da-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; flex: none; margin-right: 7px; vertical-align: middle; }
.da-row .da-dot, .da-trow .da-dot, .da-opt .da-dot { margin-right: 0; }
.da-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.da-tag { font-size: 11.5px; padding: 3px 9px; border-radius: 999px; background: rgba(255, 255, 255, .07); color: var(--text-2); white-space: nowrap; }
.da-tag.bad { color: var(--neg); background: var(--neg-bg); }
.pnl-classic .da-tag.bad, .pnl-custom .da-tag.bad { background: rgba(248, 113, 113, .12); }
.da-stats { display: grid; grid-template-columns: 1fr auto; gap: 7px 14px; font-size: 13px; }
.da-stats.cmp { grid-template-columns: 1fr auto auto; }
.da-stats b { font-weight: 500; text-align: right; font-variant-numeric: tabular-nums; }
.da-stats.cmp > span:nth-child(3n) { text-align: right; font-variant-numeric: tabular-nums; }
.da-note { margin-top: 10px; font-size: 12.5px; line-height: 1.55; color: var(--text-2); padding-left: 10px; border-left: 2px solid var(--line); white-space: pre-wrap; }

/* Display options: a popover over the graph, closed by default */
.da-display { position: absolute; z-index: 5; top: 12px; left: 12px; bottom: 50px; width: 268px; border-radius: var(--radius-sm); padding: 14px 16px 16px; overflow-y: auto;
  overscroll-behavior: contain; scrollbar-width: thin; font-size: 13px; transform: translateX(calc(-100% - 20px)); opacity: 0; pointer-events: none; transition: transform .35s var(--ease), opacity .25s; }
.da-stage.show-display .da-display { transform: none; opacity: 1; pointer-events: auto; }
.da-display .lbl { margin: 16px 0 6px; }
.da-opt { display: flex; align-items: center; gap: 9px; padding: 5px 0; font-size: 13px; color: var(--text); cursor: pointer; }
.da-opt .switch { transform: scale(.82); transform-origin: right center; }
.da-opt select { height: 30px; padding: 0 8px; font-size: 12.5px; max-width: 140px; }
.da-n { font-size: 11.5px; font-variant-numeric: tabular-nums; }
.da-range { display: block; padding: 6px 0 4px; font-size: 13px; }
.da-range span { display: flex; justify-content: space-between; margin-bottom: 8px; }
.da-range b { font-weight: 400; color: var(--text-3); font-family: var(--mono); font-size: 11.5px; }
.da-wide { width: 100%; margin-top: 10px; }
select.da-wide { height: 32px; font-size: 12.5px; }
.da-help { font-size: 12px; line-height: 2; color: var(--text-2); }
.da-help code { font-family: var(--mono); font-size: 11px; background: rgba(255, 255, 255, .07); padding: 1px 6px; border-radius: 5px; color: var(--text); white-space: nowrap; }

/* Tooltip */
.da-tip { position: absolute; z-index: 6; pointer-events: none; border-radius: var(--radius-sm); padding: 10px 13px; font-size: 12.5px; max-width: 290px; }
.da-tip[hidden] { display: none; }
.da-tip-h { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.da-tip-h b { font-size: 13.5px; }
.da-tip-n { display: flex; gap: 10px; align-items: baseline; margin-bottom: 4px; font-variant-numeric: tabular-nums; }
.da-tip-n b { font-size: 15px; }
.da-tip .da-tag { display: inline-block; margin: 4px 4px 0 0; }
.da-tip-f { font-size: 11.5px; margin-top: 7px; }

/* Trace / replay panel */
/* Docked bottom-left and nearly solid, so it reads clearly over the trace. */
.da-stage .da-hud { position: absolute; z-index: 7; left: 12px; bottom: 46px; width: min(360px, calc(100% - 24px)); border-radius: var(--radius); padding: 14px 18px 16px;
  animation: da-in .4s var(--ease); background: rgba(12, 12, 16, .93); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); box-shadow: 0 20px 50px -20px rgba(0, 0, 0, .9); }
.da-stage .da-hud::before { display: none; }
.da-hud[hidden] { display: none; }
.da-hud-big { display: flex; align-items: baseline; gap: 12px; margin: 4px 0 12px; }
.da-hud-cum { font-size: 32px; font-weight: 500; letter-spacing: -.02em; font-variant-numeric: tabular-nums; transition: color .3s; }
.da-progress { height: 2px; border-radius: 2px; background: rgba(255, 255, 255, .1); overflow: hidden; }
.da-progress i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .15s linear; }
.da-hud-d { font-size: 12.5px; margin-top: 10px; font-variant-numeric: tabular-nums; }
.da-hud-end { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line-2); animation: da-fade .4s var(--ease); }
.da-hud-end[hidden] { display: none; }
@keyframes da-in { from { opacity: 0; transform: translateY(12px); } }
@keyframes da-fade { from { opacity: 0; } }

/* Legend, count and zoom along the bottom of the graph */
.da-foot { position: absolute; z-index: 4; left: 14px; right: 10px; bottom: 10px; display: flex; align-items: center; gap: 14px; pointer-events: none; }
.da-foot > * { pointer-events: auto; }
.da-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--text-2); }
.da-legend span { display: inline-flex; align-items: center; gap: 6px; }
.da-legend i { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.da-legend i.ring { background: transparent; border: 1.5px solid; width: 8px; height: 8px; }
.da-grad { width: 70px; height: 5px; border-radius: 4px; }
.da-count { font-size: 12px; margin-left: auto; white-space: nowrap; }
.da-zoom { display: flex; gap: 2px; }
.da-zoom .icon-btn { width: 30px; height: 30px; font-size: 16px; }

.da-busy, .da-empty { position: absolute; inset: 0; z-index: 8; display: grid; place-content: center; justify-items: center; gap: 12px; text-align: center; font-size: 13px; color: var(--text-2); pointer-events: none; }
.da-busy[hidden], .da-empty[hidden] { display: none; }
.da-empty h3, .da-empty p { margin: 0; }

/* Export dialog */
.da-modal { max-width: 860px; }
.da-export { width: 100%; height: 340px; margin-top: 14px; font-family: var(--mono); font-size: 11.5px; line-height: 1.5; resize: vertical; white-space: pre; }

@media (max-width: 1100px) {
  .da-main { grid-template-columns: minmax(0, 1fr) 300px; }
  .da-tools .btn span { display: none; }
  .da-tools .btn.primary span { display: inline; }
}
@media (max-width: 900px) {
  .da-main { grid-template-columns: 1fr; height: auto !important; }
  .da-stage { height: 68vh; min-height: 420px; }
  .da-side { max-height: none; }
  .da-side-b { overflow: visible; }
  .da-search { flex-basis: 100%; max-width: none; order: -1; }
  .da-count { display: none; }
}
@media (max-width: 560px) {
  .da-tools { margin-left: 0; width: 100%; }
  .da-tools .btn.primary { margin-left: auto; }
  .da-display { width: auto; right: 12px; }
}

/* Everything that floats over the graph is nearly solid so it reads clearly. */
.da-stage .da-tip, .da-stage .da-display { background: rgba(12, 12, 16, .92); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); box-shadow: 0 18px 44px -18px rgba(0, 0, 0, .9); }
.da-stage .da-tip::before, .da-stage .da-display::before { display: none; }
