/* Shared header tools — square icon cluster + labeled page links.
   Used by the basic terminal, Pro Terminal, and Performance so the
   corner chrome matches across pages. Brand / Basic+Pro switches live
   in this file too so Performance (which does not load app.css) matches. */

.hdr-menu-panel.hidden { display: none !important; }

.hdr-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.hdr-icon-btn,
.hdr-text-btn {
  box-sizing: border-box;
  border: 1px solid rgba(230, 237, 243, 0.22);
  background: rgba(22, 27, 34, 0.72);
  color: #e6edf3;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
  line-height: 1;
  -webkit-appearance: none;
  appearance: none;
}

.hdr-icon-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  font-size: 16px;
}

.hdr-text-btn {
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 11px;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}

.hdr-icon-btn:hover,
.hdr-text-btn:hover {
  border-color: rgba(230, 237, 243, 0.42);
  background: rgba(48, 54, 61, 0.9);
  color: #fff;
}

.hdr-icon-btn.on,
.hdr-text-btn.on,
.hdr-icon-btn.btn-priv.on,
.hdr-icon-btn.btn-obf.on {
  border-color: rgba(139, 92, 246, 0.55);
  background: rgba(139, 92, 246, 0.16);
  color: #c4b5fd;
}

.hdr-menu {
  position: relative;
  display: inline-flex;
}

.hdr-menu-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 210px;
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 12px;
  padding: 6px;
  z-index: 95;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hdr-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: #e6edf3;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
}

.hdr-menu-item:hover { background: rgba(255, 255, 255, 0.06); }
.hdr-menu-item .hdr-menu-ico {
  font-size: 15px;
  width: 20px;
  text-align: center;
  flex: 0 0 auto;
}
.hdr-menu-item.hdr-menu-item-danger { color: #f85149; }
.hdr-menu-item.hdr-menu-item-danger:hover { background: rgba(239, 68, 68, 0.12); }

/* Three-exchange cash/portfolio box — same widget on every non-admin page. */
.venue-balances {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
}
header > h1,
header > .hdr-brand-switch,
header > .hdr-home-stack,
header > .hdr-r,
.header > h1,
.header > .hdr-brand-switch,
.header > .hdr-home-stack,
.header > .header-actions,
.topbar > .brand,
.topbar > .hdr-brand-cluster,
.topbar > .top-actions {
  flex-shrink: 0;
}

.hdr-brand-cluster {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.hdr-home-stack {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
}
.hdr-home-newtab {
  background: transparent;
  border: 1px solid var(--bd, rgba(230, 237, 243, 0.22));
  border-radius: 6px;
  color: var(--mt, #8c99aa);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .4px;
  padding: 2px 6px;
  cursor: pointer;
  text-align: center;
  line-height: 1;
  text-decoration: none;
  transition: background .12s, color .12s, border-color .12s;
}
.hdr-home-newtab:hover {
  color: var(--tx, #e6edf3);
  background: rgba(255, 255, 255, .06);
  border-color: var(--mt, #8c99aa);
}

/* Logo is the Basic ↔ Pro switch. The old text pill is gone. */
.hdr-brand-switch {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 2px;
  text-decoration: none;
  color: inherit;
  border-radius: 8px;
  min-width: 0;
}
.hdr-brand-switch h1 {
  margin: 0;
  cursor: pointer;
}
.hdr-brand-switch-hint,
.hdr-brand-switch .brand-kicker {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .7px;
  text-transform: uppercase;
  color: var(--muted, #8c99aa);
  line-height: 1;
}
.hdr-brand-switch:hover .hdr-brand-switch-hint,
.hdr-brand-switch:hover .brand-kicker {
  color: var(--ac, #58a6ff);
}
.brand.hdr-brand-switch {
  flex-direction: row;
  align-items: center;
  gap: 12px;
}

/* Eye + ≈ hug the last exchange card. Extra header space stays
   to the right of this packed group — not between Novig and 👁. */
.venue-balance-cluster {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 4px;
  flex: 1;
  min-width: 0;
}
.venue-balance-cluster > .venue-balances {
  flex: 0 1 auto;
  justify-content: flex-start;
  min-width: 0;
}
.hdr-priv-stack {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  flex-shrink: 0;
}
.hdr-priv-stack .hdr-icon-btn,
.hdr-priv-stack .btn-priv,
.hdr-priv-stack .btn-obf {
  width: 20px;
  height: 20px;
  min-width: 20px;
  padding: 0;
  font-size: 11px;
  border-radius: 5px;
  line-height: 1;
}

/* Far-right 2×2: Portfolio, Settings / Performance, More */
.hdr-tool-square {
  display: grid;
  grid-template-columns: repeat(2, 30px);
  grid-template-rows: repeat(2, 30px);
  gap: 4px;
  flex-shrink: 0;
}
.hdr-tool-square .hdr-icon-btn {
  width: 30px;
  height: 30px;
  font-size: 14px;
}
.hdr-tool-square .hdr-menu {
  display: grid;
}
.hdr-tool-square .hdr-menu > .hdr-icon-btn {
  width: 30px;
  height: 30px;
}
.venue-bal {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  flex: 0 0 auto;
  min-width: 0;
  padding: 6px 10px 6px 11px;
  border: 1px solid var(--line, var(--bd, rgba(230, 237, 243, 0.14)));
  border-radius: 9px;
  background: var(--chip, var(--sf, rgba(22, 27, 34, 0.72)));
  box-shadow: inset 2px 0 0 var(--blue, #4f8cff);
}
.venue-bal.kalshi { box-shadow: inset 2px 0 0 var(--kalshi, #00DD94); }
.venue-bal.polymarket { box-shadow: inset 2px 0 0 var(--poly, #2e5cff); }
.venue-bal.novig { box-shadow: inset 2px 0 0 var(--novig, #E8DCC4); }
.venue-bal-name {
  font-size: 8px;
  font-weight: 900;
  letter-spacing: .65px;
  text-transform: uppercase;
  color: var(--accent-soft, #a9c6ff);
  line-height: 1;
}
.venue-bal.kalshi .venue-bal-name { color: var(--kalshi-soft, #7aefc4); }
.venue-bal.polymarket .venue-bal-name { color: var(--poly-soft, #9bb4ff); }
.venue-bal.novig .venue-bal-name { color: var(--novig-soft, #F3E9D6); }
.venue-bal-cols { display: flex; align-items: flex-end; gap: 12px; }
.venue-bal-col { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.venue-bal-col strong {
  font-size: 13px;
  font-weight: 800;
  font-family: ui-monospace, SFMono-Regular, "Cascadia Mono", Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  letter-spacing: -.02em;
  line-height: 1;
  color: var(--text, var(--tx, #edf2f7));
  min-width: 7.2ch;
  transition: opacity .12s ease;
}
.venue-bal-col strong.priv-dash {
  letter-spacing: .16em;
  font-weight: 600;
  opacity: .55;
}
.venue-bal-col strong.priv-k {
  letter-spacing: -.03em;
}
.venue-bal-col span {
  font-size: 8px;
  font-weight: 700;
  color: var(--muted, var(--mt, #8c99aa));
  line-height: 1;
}

/* 👁 mask and ≈ thousands — shared so every header (including Taker Flow,
   which does not load app.css) can hide Kalshi / Poly US / Novig amounts. */
.priv-num,
.obf-num {
  transition: color .15s ease;
  position: relative;
  display: inline-block;
}
html.priv-on .priv-num,
body.priv-on .priv-num {
  color: transparent !important;
  user-select: none;
  cursor: default;
}
html.priv-on .priv-num::after,
body.priv-on .priv-num::after {
  content: "––––";
  color: var(--text, var(--tx, #edf2f7));
  position: absolute;
  inset: 0;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  font-family: ui-monospace, SFMono-Regular, "Cascadia Mono", Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  letter-spacing: .14em;
  opacity: .62;
}
html.priv-obf-on:not(.priv-on) .priv-num,
body.priv-obf-on:not(.priv-on) .priv-num,
html.priv-obf-on:not(.priv-on) .obf-num,
body.priv-obf-on:not(.priv-on) .obf-num {
  color: transparent !important;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  letter-spacing: -.02em;
}
html.priv-obf-on:not(.priv-on) .priv-num::after,
body.priv-obf-on:not(.priv-on) .priv-num::after,
html.priv-obf-on:not(.priv-on) .obf-num::after,
body.priv-obf-on:not(.priv-on) .obf-num::after {
  content: attr(data-obf);
  color: var(--priv-obf-fg, var(--text, var(--tx, #edf2f7)));
  position: absolute;
  inset: 0;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  font-family: ui-monospace, SFMono-Regular, "Cascadia Mono", Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
}
/* Venue cards paint the visible string in-place so hide/round sit on
   the same mono grid as Cash / Portfolio — no floating overlay. */
html.priv-on .venue-bal .priv-num,
html.priv-obf-on .venue-bal .priv-num,
body.priv-on .venue-bal .priv-num,
body.priv-obf-on .venue-bal .priv-num {
  color: inherit !important;
  font-family: inherit;
  letter-spacing: inherit;
  user-select: none;
  cursor: default;
}
html.priv-on .venue-bal .priv-num::after,
html.priv-obf-on .venue-bal .priv-num::after,
body.priv-on .venue-bal .priv-num::after,
body.priv-obf-on .venue-bal .priv-num::after {
  content: none !important;
}
.btn-priv.on,
.hdr-icon-btn.btn-priv.on {
  background: rgba(168, 85, 247, .18);
  border-color: var(--ac, #8b5cf6);
  color: var(--ac, #c4b5fd);
}
.btn-obf.on,
.hdr-icon-btn.btn-obf.on {
  background: rgba(88, 166, 255, .16);
  border-color: rgba(88, 166, 255, .7);
  color: var(--ac, #58a6ff);
}
