/* ════════════════════════════════════════════════════════════════
 * QRL Quant Signal Radar — CSS (extended radar + header radar +
 * settings). Black metal / gunmetal / silver industrial instrument
 * language shared with the Signal UFO / Active Signal UFO family.
 * Green = LONG, Red = SHORT, dark/neutral = no signal. No large
 * cyan surfaces, no neon wash. (spec §22)
 * ════════════════════════════════════════════════════════════════ */

:root {
  --qradar-long: #3fb950;
  --qradar-long-glow: #39d353;
  --qradar-short: #f85149;
  --qradar-short-glow: #ff6a5f;
  --qradar-metal: #3a424e;
  --qradar-metal-hi: #5c6672;
  --qradar-gunmetal: #232a33;
  --qradar-panel: #141920;
  --qradar-recess: #0c1015;
  --qradar-ink: #c9d1d9;
  --qradar-ink-dim: #7d8892;
  --qradar-white: #f0f6fc;
}

/* ── shared industrial panel ───────────────────────────────────── */
.qradar-panel {
  position: relative;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.035) 0%, rgba(255,255,255,0) 8%),
    linear-gradient(180deg, #171d25 0%, #0f131a 100%);
  border: 1px solid #333c47;
  border-top-color: #48525e;
  border-radius: 4px;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.05),
    inset 0 0 0 1px rgba(0,0,0,0.35),
    0 1px 3px rgba(0,0,0,0.45);
}
/* corner screws */
.qradar-panel::before,
.qradar-panel::after {
  content: '';
  position: absolute;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #8b96a3, #3a434e 55%, #191e25 100%);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.5);
  z-index: 2;
}
.qradar-panel::before { top: 3px; left: 3px; }
.qradar-panel::after  { top: 3px; right: 3px; }

/* ── Extended radar (chart-terminal right panel tab) ───────────── */
.qradar {
  display: flex;
  flex-direction: column;
  color: var(--qradar-ink);
  font-size: 11px;
}

.qradar-title {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.6px;
  color: var(--qradar-white);
  text-shadow: 0 0 8px rgba(160,200,255,0.25);
  border-bottom: 1px solid #222a34;
  background: linear-gradient(180deg, #141a22 0%, #0e1319 100%);
}
.qradar-title .qradar-plate {
  margin-left: auto;
  font-size: 8px;
  letter-spacing: 3px;
  color: #66707d;
  border: 1px solid #2a333d;
  padding: 1px 5px;
  border-radius: 2px;
}

/* instrument tabs */
.qradar-instruments {
  display: flex;
  gap: 3px;
  padding: 6px 8px 4px;
  border-bottom: 1px solid #1b222b;
  overflow-x: auto;
  scrollbar-width: none;
}
.qradar-instruments::-webkit-scrollbar { display: none; }
.qradar-inst {
  flex: 0 0 auto;
  min-width: 30px;
  padding: 3px 7px;
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--qradar-ink-dim);
  background: linear-gradient(180deg, #181e26, #10151b);
  border: 1px solid #2a333d;
  border-radius: 3px;
  cursor: pointer;
  user-select: none;
}
.qradar-inst:hover { color: var(--qradar-ink); border-color: #3a434e; }
.qradar-inst.active {
  color: var(--qradar-white);
  border-color: #48525e;
  background: linear-gradient(180deg, #262e38, #161c24);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04), 0 0 6px rgba(120,150,190,0.15);
}
.qradar-inst .qradar-inst-n {
  display: block;
  font-size: 8px;
  color: #66707d;
  font-weight: 400;
}

/* matrix (fixed column widths — border-box so borders never break alignment) */
.qradar-mx-corner,
.qradar-mx-group,
.qradar-mx-tf,
.qradar-family-label,
.qradar-cell,
.qradar-header-grid .qradar-cell {
  box-sizing: border-box;
}
.qradar-matrix-wrap {
  flex: 0 0 auto;
  overflow-x: auto;
  overflow-y: hidden;
  border-bottom: 1px solid #1b222b;
}
.qradar-matrix {
  display: inline-block;
  min-width: 100%;
  padding: 0 8px 8px;
}
.qradar-mx-row {
  display: flex;
  align-items: stretch;
}
.qradar-mx-row.qradar-mx-groups { align-items: center; }
.qradar-mx-row.qradar-mx-tfs { margin-bottom: 2px; }

.qradar-mx-corner {
  flex: 0 0 58px;
  font-size: 8px;
  color: #66707d;
  letter-spacing: 1px;
  text-align: right;
  padding-right: 6px;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  padding-bottom: 1px;
}

.qradar-mx-group {
  text-align: center;
  font-size: 8px;
  letter-spacing: 1.2px;
  color: #8b96a3;
  border-bottom: 1px solid #2a333d;
  padding: 1px 0;
  flex: 0 0 auto;
}
.qradar-mx-tf {
  text-align: center;
  font-size: 8px;
  color: #66707d;
  padding: 1px 0;
  flex: 0 0 auto;
  border-left: 1px solid #161c23;
}

/* family row */
.qradar-family-row {
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid #161c23;
}
.qradar-family-label {
  flex: 0 0 58px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--qradar-ink);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 6px;
  cursor: pointer;
  text-align: right;
}
.qradar-family-label:hover { color: var(--qradar-white); }
.qradar-family-label .qradar-fam-n {
  font-size: 8px;
  color: #66707d;
  font-weight: 400;
  margin-left: 3px;
}

.qradar-cell {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: radial-gradient(circle at 50% 35%, #11171e, #0a0e13);
  border: 1px solid #1b222b;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.55);
  cursor: default;
}
.qradar-cell:hover { border-color: #3a434e; z-index: 3; }
.qradar-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  box-shadow: 0 0 6px 1px currentColor;
}
.qradar-dot.long  { background: #2ea043; color: var(--qradar-long-glow); }
.qradar-dot.short { background: #cf222e; color: var(--qradar-short-glow); }

/* strategies families (detail blocks) */
.qradar-families {
  max-height: 340px;
  overflow-y: auto;
  padding: 6px 8px 4px;
}
.qradar-fam-block {
  margin-bottom: 4px;
  border: 1px solid #202833;
  border-radius: 3px;
  background: linear-gradient(180deg, #12171e, #0d1116);
  overflow: hidden;
}
.qradar-fam-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  cursor: pointer;
  user-select: none;
}
.qradar-fam-head:hover { background: rgba(255,255,255,0.025); }
.qradar-fam-caret { color: #66707d; font-size: 9px; width: 8px; }
.qradar-fam-name {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--qradar-ink);
}
.qradar-fam-meta {
  margin-left: auto;
  font-size: 8px;
  color: #66707d;
  letter-spacing: 0.5px;
}
.qradar-fam-meta b { color: var(--qradar-ink); font-weight: 700; }
.qradar-fam-meta .m-long { color: var(--qradar-long); }
.qradar-fam-meta .m-short { color: var(--qradar-short); }

.qradar-fam-body { border-top: 1px solid #1b222b; padding: 3px 6px 5px; }
.qradar-fam-table { width: 100%; border-collapse: collapse; font-size: 9px; }
.qradar-fam-table th {
  text-align: left;
  color: #66707d;
  font-weight: 400;
  letter-spacing: 0.5px;
  padding: 2px 4px;
  border-bottom: 1px solid #1b222b;
}
.qradar-fam-table td { padding: 2px 4px; border-bottom: 1px solid #141a21; color: var(--qradar-ink); }
.qradar-fam-table td.variant { font-weight: 700; color: var(--qradar-white); }
.qradar-fam-table td.dir { font-weight: 700; }
.qradar-fam-table td.dir.long { color: var(--qradar-long); }
.qradar-fam-table td.dir.short { color: var(--qradar-short); }
.qradar-fam-table td.age { color: #66707d; text-align: right; white-space: nowrap; }
.qradar-signal-link { color: #8ab4f8; text-decoration: none; cursor: pointer; }
.qradar-signal-link:hover { text-decoration: underline; }
.qradar-fam-empty { color: #4b5560; font-size: 9px; padding: 3px 4px; }

/* active signals */
.qradar-active {
  flex: 0 0 auto;
  max-height: 260px;
  display: flex;
  flex-direction: column;
  border-top: 1px solid #222a34;
  background: linear-gradient(180deg, #10151b, #0c1014);
}
.qradar-active-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: var(--qradar-ink);
  border-bottom: 1px solid #1b222b;
}
.qradar-counts {
  margin-left: auto;
  font-size: 9px;
  font-weight: 400;
  letter-spacing: 0.3px;
  color: #66707d;
}
.qradar-counts .n-act { color: var(--qradar-white); }
.qradar-counts .n-long { color: var(--qradar-long); }
.qradar-counts .n-short { color: var(--qradar-short); }
.qradar-active-list { overflow-y: auto; padding: 2px 0; }
.qradar-active-row {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  font-size: 9px;
  border-bottom: 1px solid rgba(27,34,43,0.5);
}
.qradar-active-row:hover { background: rgba(255,255,255,0.02); }
.qradar-active-row .t { color: #66707d; font-family: monospace; white-space: nowrap; }
.qradar-active-row .s { color: var(--qradar-white); font-weight: 700; white-space: nowrap; }
.qradar-active-row .tf { color: #8b96a3; white-space: nowrap; }
.qradar-active-row .d { font-weight: 700; }
.qradar-active-row .d.long { color: var(--qradar-long); }
.qradar-active-row .d.short { color: var(--qradar-short); }
.qradar-active-row .a { margin-left: auto; color: #66707d; white-space: nowrap; }

.qradar-empty {
  padding: 14px 10px;
  text-align: center;
  color: #4b5560;
  font-size: 10px;
  letter-spacing: 1px;
}

/* tooltip */
.qradar-tip {
  position: absolute;
  z-index: 50;
  max-width: 240px;
  padding: 7px 9px;
  font-size: 9px;
  line-height: 1.5;
  color: var(--qradar-ink);
  background: #10151c;
  border: 1px solid #333c47;
  border-radius: 3px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.55);
  pointer-events: none;
}
.qradar-tip .tip-instr { color: var(--qradar-white); font-weight: 700; }
.qradar-tip .tip-row { white-space: nowrap; }
.qradar-tip .tip-long { color: var(--qradar-long); }
.qradar-tip .tip-short { color: var(--qradar-short); }
.qradar-tip .tip-dim { color: #66707d; }

/* ── Header radar — full reference layout (v3 DOM, industrial). ──
 *   Bands top→bottom: title · instrument tabs (with per-instrument score)
 *   → KPI ACTIVE/LONG/SHORT → strategy × timeframe matrix (grouped)
 *   → INSTRUMENT OVERVIEW (per-instrument long/short bar + score).
 *   Same black-metal / gunmetal / silver family as the extended radar.
 *   Fully dynamic DOM — no baked plate (spec §31). ── */
/* The header radar shares the header-right row with the Active Signal UFO
 * monitor. The ROW HEIGHT is fixed by the header band / resizable panel;
 * each child takes its width from its own aspect-ratio (radar 3:2, UFO
 * 1448:1086) so both grow/shrink in lockstep when the user resizes the
 * header band. Seit der Kombination ist die Radar-Huelle DAS Geraet der
 * rechten Kopfspalte: der Slot fuellt die Spalte vollstaendig (kein eigenes
 * aspect-ratio mehr — das haelt nur noch .qr-shell, weil die Huelle
 * (shell-wide.png, 3:1) sonst gestreckt wuerde). */
.header-right .qradar-header {
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
  min-width: 0;
  align-self: stretch;
  display: flex;
  flex-direction: column;
}
.qradar-header {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-size: 9px;
  color: var(--qradar-ink);
}
/* title */
.qhr-title {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  padding: 4px 8px 3px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--qradar-white);
  text-shadow: 0 0 8px rgba(160,200,255,0.25);
  border-bottom: 1px solid #222a34;
  background: linear-gradient(180deg, #141a22 0%, #0e1319 100%);
}
.qhr-title .qhr-plate {
  margin-left: auto;
  font-size: 7px;
  letter-spacing: 3px;
  color: #66707d;
  border: 1px solid #2a333d;
  padding: 1px 5px;
  border-radius: 2px;
}
.qhr-title .qhr-gear {
  margin-left: 4px;
  background: transparent;
  color: #8b96a3;
  border: 1px solid #2a333d;
  border-radius: 3px;
  width: 18px; height: 18px;
  line-height: 1;
  cursor: pointer;
  font-size: 10px;
  padding: 0;
}
.qhr-title .qhr-gear:hover { color: var(--qradar-white); border-color: #48525e; }

/* instrument tabs */
.qhr-tabs {
  flex: 0 0 auto;
  display: flex;
  gap: 3px;
  padding: 4px 6px;
  border-bottom: 1px solid #1b222b;
  overflow-x: auto;
  scrollbar-width: none;
}
.qhr-tabs::-webkit-scrollbar { display: none; }
.qhr-inst {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  background: linear-gradient(180deg, #181e26, #10151b);
  border: 1px solid #2a333d;
  border-radius: 3px;
}
.qhr-inst-name { font-size: 9px; font-weight: 700; color: var(--qradar-ink); letter-spacing: 0.3px; }
.qhr-inst-score { font-size: 8px; color: #66707d; }
.qhr-inst-light { width: 6px; height: 6px; border-radius: 50%; background: #1b222b; box-shadow: inset 0 1px 2px rgba(0,0,0,0.6); }
.qhr-inst-light.long  { background: #2ea043; box-shadow: 0 0 6px 1px var(--qradar-long-glow); }
.qhr-inst-light.short { background: #cf222e; box-shadow: 0 0 6px 1px var(--qradar-short-glow); }
.qhr-inst-light.both  { background: linear-gradient(90deg,#2ea043 50%,#cf222e 50%); box-shadow: 0 0 6px 1px #fff; }

/* KPI band */
.qhr-kpi {
  flex: 0 0 auto;
  display: flex;
  gap: 4px;
  padding: 4px 6px;
  border-bottom: 1px solid #1b222b;
}
.qhr-kpi-cell {
  flex: 1 1 0;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
  padding: 3px 4px;
  background: radial-gradient(circle at 50% 0%, #161c23, #0d1116);
  border: 1px solid #202833;
  border-radius: 3px;
  white-space: nowrap;
}
.qhr-kpi-cell b { font-size: 11px; font-weight: 700; }
.qhr-kpi-cell span { font-size: 7px; letter-spacing: 1px; color: #66707d; }
.qhr-kpi-cell b.n-act { color: var(--qradar-white); }
.qhr-kpi-cell b.n-long { color: var(--qradar-long); }
.qhr-kpi-cell b.n-short { color: var(--qradar-short); }

/* matrix */
.qhr-matrix-wrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  border-bottom: 1px solid #1b222b;
}
.qhr-matrix { display: inline-block; min-width: 100%; padding: 2px 6px 4px; }
.qhr-table { border-collapse: collapse; }
.qhr-table th, .qhr-table td { padding: 0; text-align: center; }
.qhr-corner { font-size: 7px; color: #66707d; text-align: right !important; padding-right: 4px !important; letter-spacing: 0.5px; white-space: nowrap; }
.qhr-grp { font-size: 6px; letter-spacing: 1px; color: #8b96a3; border-bottom: 1px solid #2a333d; padding: 1px 0 !important; white-space: nowrap; }
.qhr-tf { font-size: 6px; color: #66707d; border-left: 1px solid #161c23; padding: 1px 1px !important; white-space: nowrap; }
.qhr-fam { font-size: 6px; font-weight: 700; color: var(--qradar-ink); text-align: right !important; padding-right: 4px !important; white-space: nowrap; }
.qhr-cell { width: 15px; height: 13px; }
.qhr-cell .qradar-dot { width: 5px; height: 5px; }

/* instrument overview */
.qhr-overview {
  flex: 0 0 auto;
  border-top: 1px solid #222a34;
  background: linear-gradient(180deg, #10151b, #0c1014);
}
.qhr-ov-head {
  padding: 3px 8px 2px;
  font-size: 7px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: #66707d;
}
.qhr-ov-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  padding: 0 8px 5px;
}
.qhr-ov-item { display: flex; align-items: center; gap: 4px; }
.qhr-ov-name { font-size: 7px; color: #8b96a3; letter-spacing: 0.3px; }
.qhr-ov-bar {
  display: inline-flex;
  width: 34px;
  height: 6px;
  border-radius: 2px;
  overflow: hidden;
  background: #0a0e13;
  border: 1px solid #1b222b;
}
.qhr-ov-bar i.lg { background: #2ea043; box-shadow: 0 0 4px var(--qradar-long-glow); }
.qhr-ov-bar i.sh { background: #cf222e; box-shadow: 0 0 4px var(--qradar-short-glow); }
.qhr-ov-score { font-size: 8px; font-weight: 700; color: var(--qradar-white); }

/* ── Settings modal ────────────────────────────────────────────── */
.qradar-settings-overlay {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 8, 12, 0.62);
  backdrop-filter: blur(2px);
}
.qradar-settings {
  width: min(620px, 92vw);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.qradar-settings-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid #222a34;
}
.qradar-settings-head .t {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--qradar-white);
}
.qradar-settings-head .sub {
  font-size: 9px;
  letter-spacing: 1px;
  color: #66707d;
  text-transform: uppercase;
}
.qradar-settings-close {
  margin-left: auto;
  background: #141a20;
  color: #8b96a3;
  border: 1px solid #2a333d;
  border-radius: 3px;
  width: 22px; height: 22px;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
}
.qradar-settings-close:hover { color: var(--qradar-white); border-color: #3a434e; }

.qradar-settings-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 10px 14px;
}
.qradar-settings-section { margin-bottom: 14px; }
.qradar-settings-section > h4 {
  margin: 0 0 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: #8b96a3;
  border-bottom: 1px solid #1b222b;
  padding-bottom: 3px;
}
.qradar-settings-section > h4 .hint {
  float: right;
  font-weight: 400;
  font-size: 8px;
  color: #4b5560;
  letter-spacing: 0.5px;
}
.qradar-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  margin: 2px;
  font-size: 9px;
  color: #8b96a3;
  background: linear-gradient(180deg, #161c23, #0f1419);
  border: 1px solid #2a333d;
  border-radius: 3px;
  cursor: pointer;
  user-select: none;
}
.qradar-chip:hover { color: var(--qradar-ink); border-color: #3a434e; }
.qradar-chip.on {
  color: var(--qradar-white);
  border-color: #48525e;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.05);
}
.qradar-chip.on::before {
  content: '✓';
  font-size: 8px;
  color: var(--qradar-long);
}
.qradar-fam-group { margin: 4px 0 2px; }
.qradar-fam-group .fam-label {
  font-size: 8px;
  letter-spacing: 1px;
  color: #66707d;
  text-transform: uppercase;
  margin: 4px 2px 1px;
  display: block;
}
.qradar-settings-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid #222a34;
}
.qradar-btn {
  padding: 6px 12px;
  font-size: 10px;
  letter-spacing: 1px;
  border-radius: 3px;
  cursor: pointer;
  border: 1px solid #2a333d;
  background: linear-gradient(180deg, #161c23, #0f1419);
  color: #8b96a3;
}
.qradar-btn:hover { color: var(--qradar-ink); border-color: #3a434e; }
.qradar-btn.primary {
  color: #0b0e12;
  background: linear-gradient(180deg, #e6ebf1, #b7c1cd);
  border-color: #8b96a3;
  font-weight: 700;
}
.qradar-btn.reset { margin-right: auto; }

/* signal flash-in (dezent) */
@keyframes qradar-flash {
  0%   { box-shadow: 0 0 0 1px rgba(120,180,255,0.7), 0 0 12px rgba(120,180,255,0.35); }
  100% { box-shadow: 0 0 0 1px rgba(120,180,255,0), 0 0 0 rgba(120,180,255,0); }
}
.qradar-cell.flash { animation: qradar-flash 1.4s ease-out; }

/* right-panel 4th tab (UFO COMMAND QUEUE | Watchlist | Trading | QUANT SIGNAL RADAR) */
.right-panel-tabs.rp-tabs-4 { display: flex; width: 100%; }
.right-panel-tabs.rp-tabs-4 .rp-tab {
  flex: 1;
  padding: 4px 2px;
  font-size: 9px;
  line-height: 1.25;
  text-align: center;
  white-space: normal;
  word-break: break-word;
}
