/* SpyQiNex combined header (concepts 4 + 7 + 14). Additive; loaded after redesign.css.
   Uses only the skin tokens (--bg --surface --surface2 --border --border-light --text --muted
   --muted2 --accent --on-accent --green --red) so every base and accent swatch, light or dark,
   restyles it with no per-theme rules. */

.sqx-retired, .sqx-retired-el { display: none !important; }

.sqx-hd { position: sticky; top: 0; z-index: 850; background: var(--bg); flex: none; }
.sqx-hd .sqx-nav { position: static; height: auto; min-height: 58px; flex-wrap: wrap; row-gap: 6px; padding: 6px 18px; backdrop-filter: none; background: var(--bg); }
#sidebar.sqx-drawer { top: 94px; }

/* ---- row 1: telemetry ribbon ---- */
.sqx-rib { display: flex; align-items: stretch; height: 36px; border-bottom: 1px solid var(--border); font: 500 11px 'Geist Mono', ui-monospace, monospace; letter-spacing: .04em; color: var(--muted); background: var(--bg); }
.sqx-tk { display: flex; align-items: center; gap: 9px; padding: 0 16px; border-right: 1px solid var(--border); white-space: nowrap; }
.sqx-tk i { font-style: normal; color: var(--muted); letter-spacing: .12em; }
.sqx-tk strong { color: var(--text) !important; font-weight: 500 !important; min-width: 9ch; display: inline-block; text-align: right; font-variant-numeric: tabular-nums; }
.sqx-mq { flex: 1; min-width: 0; overflow: hidden; display: flex; align-items: center; -webkit-mask-image: linear-gradient(90deg, transparent, #000 28px, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(90deg, transparent, #000 28px, #000 calc(100% - 28px), transparent); }
.sqx-trk { display: flex; width: max-content; animation: sqxmq 55s linear infinite; }
.sqx-mq:hover .sqx-trk { animation-play-state: paused; }
.sqx-half { display: flex; flex: none; }
.sqx-half > span { padding: 0 22px; white-space: nowrap; color: var(--muted); letter-spacing: .1em; }
.sqx-half > span b { color: var(--text); font-weight: 500; letter-spacing: .02em; }
.sqx-half > span.sqx-off b { color: var(--muted); }
.sqx-half > span[data-k="mode"] { color: var(--accent); }
.sqx-half > span[data-k="mode"].sqx-live { color: var(--red); }
.sqx-half > span[data-k="mode"] b { color: inherit; letter-spacing: .12em; }
@keyframes sqxmq { to { transform: translateX(-50%); } }
.sqx-clk { display: flex; align-items: center; padding: 0 16px; border-left: 1px solid var(--border); white-space: nowrap; color: var(--muted) !important; }
.sqx-clk span { color: var(--muted) !important; }
.sqx-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) {
  .sqx-trk { animation: none; }
  .sqx-half[data-dup] { display: none; }
  .sqx-half > span:nth-child(n+6) { display: none; }
}

/* ---- row 2: nav, transport, safety ---- */
.sqx-hd .sqx-right { display: flex; align-items: center; gap: 12px; margin-left: auto; flex-wrap: wrap; }

/* Start / Stop / state as one transport control */
.sqx-seg { display: inline-flex; align-items: stretch; border: 1px solid var(--border-light); border-radius: 999px; overflow: hidden; background: var(--surface); }
html .sqx-seg .header-btn { border: 0 !important; border-radius: 0 !important; padding: 8px 16px !important; margin: 0 !important; background: transparent !important; font: 500 12px 'Geist', sans-serif !important; display: inline-flex; align-items: center; gap: 6px; }
html .sqx-seg .sqx-go { background: var(--accent) !important; color: var(--on-accent) !important; }
html .sqx-seg .sqx-go:hover { filter: brightness(1.1); background: var(--accent) !important; }
html .sqx-seg .sqx-st { color: var(--red) !important; }
html .sqx-seg .sqx-st:hover { background: var(--red-dim) !important; }
.sqx-seg .sqx-state { display: inline-flex; align-items: center; gap: 8px; padding: 0 16px; border-left: 1px solid var(--border-light); color: var(--text); white-space: nowrap; }
.sqx-seg .sqx-state #statusText { font: 500 12px 'Geist', sans-serif !important; color: var(--text) !important; }
.sqx-seg .sqx-state .status-indicator { flex: none; }

/* control cluster */
.sqx-ctl { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sqx-ctl .trading-mode-panel { display: flex; align-items: center; gap: 10px; padding: 0 8px !important; border: 0 !important; background: transparent !important; }
.sqx-ctl .mode-label { display: none; }
.sqx-ctl .mode-status { font: 600 11px 'Geist Mono', monospace !important; letter-spacing: .12em !important; }
html .sqx-ib { background: transparent !important; background-image: none !important; color: var(--muted2) !important; border: 1px solid var(--border-light) !important; border-radius: 999px !important; padding: 7px 13px !important; margin: 0 !important; font: 500 11px 'Geist', sans-serif !important; letter-spacing: .02em !important; box-shadow: none !important; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; white-space: nowrap; width: auto; min-width: 0; height: auto; }
html .sqx-ib:hover { background: var(--surface2) !important; color: var(--text) !important; border-color: var(--muted) !important; }
html .sqx-ib.sqx-ico { padding: 7px 9px !important; }
html .sqx-ib span, html .sqx-ib .mute-text { color: inherit !important; font: 500 11px 'Geist', sans-serif !important; }
html .sqx-ib svg { width: 14px; height: 14px; opacity: .85; }
html .sqx-ib.sqx-dn { color: var(--red) !important; border-color: color-mix(in srgb, var(--red) 50%, var(--border-light)) !important; }
html .sqx-ib.sqx-dn:hover { background: var(--red) !important; color: #fff !important; border-color: var(--red) !important; }
html .sqx-ib.sqx-dn svg { display: none; }

/* E-STOP: one red ring, label inside */
html .sqx-hd .emergency-stop.sqx-es { width: 52px !important; height: 52px !important; margin: 0 4px !important; padding: 0 !important; border-radius: 50% !important; border: 2px solid var(--red) !important; background: transparent !important; color: var(--red) !important; display: grid !important; place-items: center; font: 600 9.5px/1 'Geist Mono', ui-monospace, monospace !important; letter-spacing: .06em !important; text-transform: uppercase; cursor: pointer; box-shadow: none !important; transition: background .15s, color .15s, box-shadow .15s; }
html .sqx-hd .emergency-stop.sqx-es:hover { background: var(--red) !important; color: #fff !important; box-shadow: 0 0 0 5px color-mix(in srgb, var(--red) 22%, transparent) !important; }
html .sqx-hd .emergency-stop.sqx-es:active { transform: scale(.95) !important; }
html .sqx-hd .emergency-stop.sqx-es:focus-visible { outline: 2px solid var(--red); outline-offset: 4px; }

/* user chip */
.sqx-ctl #sqnUserBar { display: flex; align-items: center; gap: 8px; padding: 0 0 0 8px !important; border-left: 1px solid var(--border) !important; }
.sqx-ctl #sqnCurrentUser { color: var(--muted2) !important; font: 500 12px 'Geist', sans-serif !important; }
.sqx-ctl #sqnLogoutBtn { border-color: var(--border-light) !important; color: var(--muted2) !important; background: transparent !important; border-radius: 999px !important; }

/* settings/profile icon links keep the same ghost style */
@media (max-width: 1500px) { .sqx-ctl .sqx-ico { display: none !important; } }
@media (max-width: 1280px) { .sqx-hd .sqx-arrange { display: none; } .sqx-clk { display: none; } }
@media (max-width: 760px) { .sqx-tk strong { min-width: 7ch; } .sqx-tk { padding: 0 9px; } .sqx-hd .sqx-nav { padding: 6px 10px; } }

/* ---- fixes from first visual review ---- */
.sqx-hd .sqx-groups { flex: 0 0 auto; }
.sqx-hd .sqx-right { flex: 1 1 auto; justify-content: flex-end; min-width: 0; }
.sqx-hd .sqx-appear { white-space: nowrap; }
.sqx-clk span + span { margin-left: 10px; }
.sqx-ctl .mode-status { display: none !important; }
.sqx-ctl .trading-mode-panel .switch { transform: none !important; margin: 0; }
html .sqx-ib.sqx-ico { width: 32px !important; height: 32px !important; padding: 0 !important; justify-content: center; }
html .sqx-ib.sqx-ico svg, html .sqx-ib.sqx-ico i { width: 15px !important; height: 15px !important; }
html[data-skin][data-theme] .sqx-seg .sqx-go, html[data-skin][data-theme] .sqx-seg .sqx-go:hover { background: var(--accent) !important; color: var(--on-accent) !important; }
html[data-skin][data-theme] .sqx-seg .sqx-go svg { color: var(--on-accent) !important; opacity: 1; }
@media (max-width: 1750px) { .sqx-hd .sqx-arrange { display: none; } }
@media (max-width: 1500px) { .sqx-ctl #sqnCurrentUser { display: none; } }
/* ---- appearance: only Light / Dark is exposed in the header ---- */
.sqx-hd .sqx-appear-wrap { display: none !important; }
html[data-skin="white"], html[data-skin="mist"] { --accent: #17694A; --accent-dim: rgba(23,105,74,.12); --on-accent: #FFFFFF; --green: #0B7F59; }
/* Dark = graphite steel with a calm azure accent (replaces the neon lime) */
html, html[data-skin="dark"] {
  --bg: #0F1318; --surface: #151A21; --surface2: #1B222B; --surface3: #232C37;
  --border: #252F3A; --border-light: #364352;
  --text: #E6EAF0; --muted: #8E99A8; --muted2: #AAB5C3;
  --accent: #7CC8F0; --accent-dim: rgba(124,200,240,.14); --on-accent: #07131C;
  --green: #4FD1A5; --green-dim: rgba(79,209,165,.13);
  --red: #F0766B; --red-dim: rgba(240,118,107,.13);
  --blue: #7CC8F0;
}
html[data-skin="dark"] .sqx-hd .sqx-nav, html[data-skin="dark"] .sqx-rib { background: var(--bg); }
html[data-skin="dark"] .sqx-seg { background: var(--surface); }
html[data-skin="dark"] .sqx-half > span b { color: var(--text); }