/* Page frame, 12-column grid, and the shared controls. Tile files style what is inside a slot. */
*,
*::before,
*::after {
  box-sizing: border-box;
  border-radius: 0 !important;
}
/* Kit scrollbar: square 12px, thumb --acc, track --bg + 1px --line (ui-kit § Scroll). */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--acc) var(--bg);
}
*::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}
*::-webkit-scrollbar-track {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 0;
}
*::-webkit-scrollbar-thumb {
  background: var(--acc);
  border-radius: 0;
}
html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
}
body {
  background: var(--v2-line);
  color: var(--v2-text);
  font: 400 var(--v2-fs) / var(--v2-lh) var(--v2-mono);
  letter-spacing: var(--v2-track);
  -webkit-font-smoothing: none;
  min-width: 1280px;
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 90;
  background: repeating-linear-gradient(to bottom, var(--v2-scan) 0 1px, transparent 1px 3px);
  opacity: var(--v2-scan-opacity);
}
button {
  font: inherit;
  color: inherit;
}
.v2-grid {
  display: grid;
  width: 100vw;
  height: 100vh;
  /* 12 tracks, gapless. Book (cols 8–9) stays 2/12. Ticket (10–12) is ~15%
     narrower than equal thirds; chart (1–7) takes the freed width. */
  grid-template-columns: repeat(7, minmax(0, 149fr)) repeat(2, minmax(0, 140fr)) repeat(3, minmax(0, 119fr));
  grid-template-rows: var(--v2-nav-h) var(--v2-stat-h) repeat(5, minmax(0, 1fr)) var(--v2-bottom-h);
  gap: var(--v2-rule);
  background: var(--v2-line);
  position: relative;
}
/* Feed status square (top-left of the grid). ok=live, mute=retry, crit=down. */
.v2-grid::before {
  content: "";
  position: absolute;
  top: 6px;
  left: 6px;
  width: 6px;
  height: 6px;
  z-index: 20;
  pointer-events: none;
  background: var(--v2-muted);
}
.v2-grid[data-v2-feed="live"]::before {
  background: var(--ok);
}
.v2-grid[data-v2-feed="down"]::before {
  background: var(--crit);
}
.v2-feed-live {
  position: absolute;
  top: 4px;
  left: 16px;
  z-index: 20;
  font-size: var(--fs-12);
  letter-spacing: var(--v2-track-label);
  text-transform: uppercase;
  color: var(--v2-muted);
  pointer-events: none;
}
.v2-perf {
  position: fixed;
  left: 8px;
  bottom: 8px;
  z-index: 120;
  margin: 0;
  padding: 8px;
  background: var(--v2-header);
  color: var(--v2-muted);
  border: 1px solid var(--v2-line);
  font: 400 var(--v2-fs-axis) / var(--v2-lh) var(--v2-mono);
  letter-spacing: var(--v2-track);
  white-space: pre;
  pointer-events: none;
}
.v2-tile {
  background: var(--v2-tile);
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}
.v2-tile:hover {
  outline: 1px solid var(--v2-rose);
  outline-offset: -1px;
  z-index: 5;
}
.v2-hd {
  height: var(--v2-hd-h);
  flex: 0 0 var(--v2-hd-h);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px;
  background: var(--v2-header);
  border-bottom: var(--v2-rule) solid var(--v2-line);
  color: var(--v2-muted);
  /* Kit tile heading 22 (--pix); labels in the strip use --fs-pix-label below. */
  font-family: var(--pix, var(--mono));
  font-size: 22px;
  font-weight: 400;
  font-synthesis: none;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0;
  -webkit-font-smoothing: none;
  white-space: nowrap;
  min-width: 0;
}
.v2-hd .x-pix {
  font-family: var(--pix, var(--mono));
  font-weight: 400;
  font-synthesis: none;
  letter-spacing: 0;
  -webkit-font-smoothing: none;
}
/* Leftover header band → hatch (kit .x-fill). Yields first when trailing chrome needs room. */
.v2-hd .x-fill {
  flex: 1 1 0%;
  align-self: stretch;
  min-width: 0;
  margin: 0;
  background: var(--hatch);
  pointer-events: none;
}
/* Trailing header chrome: drop auto margins so .x-fill keeps the band. */
.v2-hd:has(.x-fill) > .v2-tick,
.v2-hd:has(.x-fill) > .v2-chart-meta,
.v2-hd:has(.x-fill) > .v2-acct-sp,
.v2-hd:has(.x-fill) > .v2-acct-sw,
.v2-hd:has(.x-fill) > .v2-btn {
  margin-left: 0;
}
.v2-hd .v2-tick,
.v2-hd .v2-chart-meta {
  font-family: var(--pix);
  font-size: var(--fs-pix-label, 12px);
  font-weight: 400;
  font-synthesis: none;
  letter-spacing: 0;
  -webkit-font-smoothing: none;
}
.v2-tile:hover > .v2-hd,
.v2-tile:hover > .v2-hd .v2-idx {
  background: var(--v2-rose);
  color: var(--v2-bg);
}
.v2-tile:hover > .v2-hd .x-fill {
  background: repeating-linear-gradient(45deg, var(--v2-bg) 0 1px, transparent 1px 8px);
}
.v2-idx {
  flex: 0 0 auto;
  color: var(--v2-rose);
}
.v2-body {
  flex: 1 1 auto;
  min-height: 0;
  background: var(--hatch);
}
.v2-lbl {
  font-family: var(--pix);
  font-size: var(--fs-pix-label, 12px);
  font-weight: 400;
  font-synthesis: none;
  letter-spacing: 0;
  -webkit-font-smoothing: none;
  text-transform: uppercase;
  color: var(--v2-muted);
}
.v2-up {
  color: var(--v2-buy);
}
.v2-dn {
  color: var(--v2-sell-text);
}
.v2-pix {
  position: relative;
  font-weight: 700;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}
.v2-pix::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(to right, var(--v2-checker) 0 1px, transparent 1px 2px),
    repeating-linear-gradient(to bottom, var(--v2-checker) 0 1px, transparent 1px 2px);
  opacity: var(--v2-checker-opacity);
  mix-blend-mode: multiply;
}
.v2-sq {
  width: 8px;
  height: 8px;
  display: inline-block;
  background: var(--v2-rose);
  flex: 0 0 8px;
}
/* Kit buttons (ui-kit .x-btn). .v2-btn shares the recipe so existing markup picks it up.
   Dense chrome (seg / nav / chart strips) overrides height and drops the hard shadow below. */
.x-btn,
.v2-btn {
  appearance: none;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line);
  background: var(--tile);
  color: var(--tx);
  font: 600 var(--fs-12) / 1 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  box-shadow: 2px 2px 0 var(--line);
  cursor: pointer;
  white-space: nowrap;
  /* Kit only steps transform + shadow; background/color must flip instantly (.on / side). */
  transition:
    transform 120ms steps(2, end),
    box-shadow 120ms steps(2, end);
}
.x-btn:hover,
.v2-btn:hover {
  background: var(--alt);
  color: var(--acc);
}
.x-btn:active,
.x-btn.pr,
.v2-btn:active,
.v2-btn.pr {
  transform: translate(2px, 2px);
  box-shadow: 0 0 0 var(--line);
}
/* Primary / outline / ghost / danger / icon — kit variants. */
.x-btn--p {
  background: var(--acc);
  border-color: var(--acc);
  color: var(--ink);
  box-shadow: 2px 2px 0 var(--bone);
}
.x-btn--p:hover {
  background: var(--acc);
  color: var(--ink);
}
.x-btn--o {
  background: transparent;
  border-color: var(--acc);
  color: var(--acc);
  box-shadow: 2px 2px 0 var(--line);
}
.x-btn--g {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}
.x-btn--g:hover {
  background: var(--alt);
}
.x-btn--d {
  background: var(--crit);
  border-color: var(--crit);
  color: var(--tx);
  box-shadow: 2px 2px 0 var(--line);
}
.x-btn--i {
  width: 44px;
  padding: 0;
  justify-content: center;
}
.x-btn kbd,
.v2-btn kbd {
  font: 500 var(--fs-12) / 1 var(--mono);
  padding: 0 4px;
  border: 1px solid currentColor;
  opacity: 0.7;
}
.x-btn:disabled,
.v2-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
/* Inverted-block selected (kit active): solid accent + black text. */
.x-btn.on,
.x-btn.on:hover,
.x-btn[aria-pressed="true"],
.x-btn[aria-pressed="true"]:hover,
.v2-btn.on,
.v2-btn.on:hover {
  background: var(--acc);
  border-color: var(--acc);
  color: var(--ink);
  font-weight: 700;
  box-shadow: 2px 2px 0 var(--bone);
}
.v2-nav {
  grid-column: 1 / -1;
  grid-row: 1;
  flex-direction: row;
  align-items: stretch;
  background: var(--v2-header);
}
/* Desktop: real flex row. Chromium bugs with <details>:
   (1) display:contents drops children out of the nav flex;
   (2) a closed <details> sizes to 0 even when children are display:flex.
   Pin width to five 104px tabs; keep Menu hidden; force links visible. */
.v2-nav-fold {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  align-self: stretch;
  height: 100%;
  flex: 0 0 calc(5 * 104px);
  width: calc(5 * 104px);
  min-width: calc(5 * 104px);
}
.v2-nav-more {
  display: none;
  list-style: none;
}
.v2-nav-more::-webkit-details-marker {
  display: none;
}
.v2-nav-fold > .v2-nav-links {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  width: 100%;
  height: 100%;
  min-width: 0;
}
.v2-nav-fold > .v2-nav-links .v2-navb {
  height: 100%;
}
.v2-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  font-weight: 700;
  letter-spacing: var(--v2-track-logo);
  border-right: var(--v2-rule) solid var(--v2-line);
  color: inherit;
  text-decoration: none;
  /* Fixed from first paint so layout cannot steal nav width (CLS). */
  flex: 0 0 auto;
}
a.v2-navb {
  text-decoration: none;
  color: inherit;
  box-sizing: border-box;
}
/* Nav tabs fill the 44px bar — kit min-height, no hard shadow (flush strip). */
.v2-nav .v2-btn,
.v2-navb {
  height: 100%;
  min-height: 0;
  padding: 0 10px;
  border: 0;
  box-shadow: none;
  border-radius: 0;
}
.v2-nav .v2-btn:active,
.v2-nav .v2-btn.pr,
.v2-navb:active,
.v2-navb.pr {
  transform: none;
  box-shadow: none;
}
.v2-navb {
  border-right: var(--v2-rule) solid var(--v2-line);
  width: 104px;
  flex: 0 0 104px;
  overflow: hidden;
}
.v2-nav > .v2-spacer {
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  border-right: var(--v2-rule) solid var(--v2-line);
}
.v2-cap {
  display: flex;
  align-items: center;
  padding: 0 14px;
  border-right: var(--v2-rule) solid var(--v2-line);
  font-size: var(--v2-fs);
  letter-spacing: var(--v2-track-label);
  color: var(--v2-muted);
  flex: 0 0 auto;
}
.v2-statrow {
  grid-column: 1 / -1;
  grid-row: 2;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: var(--v2-rule);
  background: var(--v2-line);
  min-width: 0;
}
.v2-stat {
  padding: 7px 10px 8px;
  justify-content: space-between;
}
.v2-chart {
  grid-column: 1 / 8;
  grid-row: 3 / 8;
}
.v2-book {
  grid-column: 8 / 10;
  grid-row: 3 / 8;
}
.v2-ticket {
  grid-column: 10 / 13;
  grid-row: 3 / 8;
}
.v2-positions {
  grid-column: 1 / 7;
  grid-row: 8;
}
.v2-account {
  grid-column: 7 / 10;
  grid-row: 8;
}
.v2-trades {
  grid-column: 10 / 13;
  grid-row: 8;
}
.v2-seg {
  display: grid;
  gap: var(--v2-rule);
  background: var(--v2-line);
  border-bottom: var(--v2-rule) solid var(--v2-line);
}
.v2-seg-2 {
  grid-template-columns: 1fr 1fr;
}
.v2-seg-3 {
  grid-template-columns: 1fr 1fr 1fr;
}
.v2-seg-4 {
  grid-template-columns: 1fr 1fr 1fr 1fr;
}
/* Seg / side heights: kit min-height 44 by default. Dense 30/42 is desktop-only
   via mobile.css (min-width 1280). Phone/touch keeps ≥44 (anh). */
.v2-seg .v2-btn {
  padding: 0 10px;
  border: 0;
  box-shadow: none;
}
.v2-seg .v2-btn:active,
.v2-seg .v2-btn.pr {
  transform: none;
  box-shadow: none;
}
.v2-side .v2-btn {
  font-size: var(--v2-fs-side);
  font-weight: 700;
  border: 0;
  box-shadow: none;
}
.v2-side .v2-btn:active,
.v2-side .v2-btn.pr {
  transform: none;
  box-shadow: none;
}
.v2-field {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-bottom: var(--v2-rule) solid var(--v2-line);
}
.v2-field input {
  flex: 1;
  min-width: 0;
  background: var(--v2-header);
  border: 0;
  border-bottom: 2px solid var(--v2-rose);
  color: var(--v2-text);
  font: 700 var(--v2-fs-input) / 1 var(--v2-mono);
  padding: 7px 8px;
  text-align: right;
  letter-spacing: var(--v2-track);
}
.v2-field label {
  flex: 0 0 52px;
}
.v2-field .v2-unit {
  color: var(--v2-muted);
  font-size: var(--v2-fs);
  width: 40px;
}
.v2-field input:focus {
  outline: 1px solid var(--v2-rose);
}
.v2-search {
  border: var(--v2-rule) solid var(--v2-line);
}
.v2-search:focus-within {
  border-color: var(--v2-rose);
}
.v2-search input:focus,
.v2-search input:focus-visible {
  outline: none;
}
.v2-power,
.v2-segbar {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: var(--v2-rule);
  background: var(--v2-line);
}
.v2-power {
  border-bottom: var(--v2-rule) solid var(--v2-line);
}
.v2-power i,
.v2-segbar i {
  display: block;
  background: var(--v2-tile);
}
.v2-power i {
  height: 20px;
}
.v2-segbar i {
  height: 12px;
}
.v2-power i.on {
  background: var(--v2-rose);
}
.v2-power i:hover {
  outline: 1px solid var(--v2-rose);
  outline-offset: -1px;
}
.v2-receipt {
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: var(--v2-fs);
  border-bottom: var(--v2-rule) solid var(--v2-line);
}
.v2-receipt div {
  display: flex;
  align-items: baseline;
  gap: 4px;
  color: var(--v2-muted);
  letter-spacing: 0.06em;
}
.v2-receipt .v2-lead {
  flex: 1;
  border-bottom: 1px dotted var(--v2-leader);
  transform: translateY(-3px);
}
.v2-receipt b {
  color: var(--v2-text);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.v2-submit .v2-btn {
  height: 46px;
  min-height: 44px;
  font-size: var(--v2-fs-input);
  font-weight: 700;
  letter-spacing: var(--v2-track-submit);
  background: var(--v2-buy);
  border-color: var(--v2-buy);
  color: var(--ink);
  box-shadow: 2px 2px 0 var(--bone);
}
.v2-submit .v2-btn:hover {
  background: var(--v2-buy);
  border-color: var(--v2-buy);
  color: var(--ink);
}
.v2-submit .v2-btn:active,
.v2-submit .v2-btn.pr {
  transform: translate(2px, 2px);
  box-shadow: 0 0 0 var(--bone);
}
.v2-submit .v2-btn.short {
  background: var(--v2-sell);
  border-color: var(--v2-sell);
  box-shadow: 2px 2px 0 var(--line);
}
.v2-submit .v2-btn.short:active,
.v2-submit .v2-btn.short.pr {
  box-shadow: 0 0 0 var(--line);
}
.v2-side .v2-btn.long.on,
.v2-side .v2-btn.long.on:hover {
  background: var(--v2-buy);
  border-color: var(--v2-buy);
  color: var(--ink);
}
.v2-side .v2-btn.short.on,
.v2-side .v2-btn.short.on:hover {
  background: var(--v2-sell);
  border-color: var(--v2-sell);
  color: var(--ink);
}
.v2-depth {
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  opacity: var(--v2-depth-opacity);
}
/* U11 overlays: opaque hatch veil (not rgba), kit x-mod, bone tooltip. */
.v2-veil,
.v2-veil.x-ov {
  position: fixed;
  inset: 0;
  background: var(--bg);
  background-image: var(--hatch);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.v2-veil.on {
  display: flex;
}
.v2-modal,
.v2-modal.x-mod {
  position: relative;
  width: min(360px, calc(100% - 32px));
  background: var(--tile);
  border: 1px solid var(--acc);
  box-shadow: 4px 4px 0 var(--acc);
  animation: x-mod-in 200ms steps(4, end);
}
.v2-modal .v2-seg {
  border-bottom: 0;
  border-top: 1px solid var(--line);
}
.v2-modal-b {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: var(--v2-fs);
  letter-spacing: 0.06em;
  color: var(--mute);
}
.v2-modal-b b {
  color: var(--tx);
}
/* Pixel dissolve grid over modal (filled/cleared by shell/chrome ask). */
.v2-modal .x-dz {
  position: absolute;
  inset: -1px -5px -5px -1px;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-template-rows: repeat(8, 1fr);
  pointer-events: none;
  z-index: 2;
}
.v2-modal .x-dz i {
  background: var(--bg);
}
.v2-modal .x-dz i.off {
  visibility: hidden;
}
@keyframes x-mod-in {
  from {
    clip-path: inset(0 0 100% 0);
  }
  to {
    clip-path: inset(0 0 0 0);
  }
}
/* Bone tooltip (kit x-tip). */
.x-tip {
  position: relative;
  display: inline-flex;
}
.x-tip [role="tooltip"] {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  white-space: nowrap;
  padding: 4px 8px;
  background: var(--bone);
  color: var(--ink);
  font: 500 12px var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  pointer-events: none;
  clip-path: inset(100% 0 0 0);
  transition: clip-path 120ms steps(3, end);
  z-index: 5;
}
.x-tip:hover [role="tooltip"],
.x-tip:focus-within [role="tooltip"] {
  clip-path: inset(0);
}
.v2-notes {
  flex: 1 1 auto;
  min-height: 0;
  background: var(--v2-header);
  border-bottom: var(--v2-rule) solid var(--v2-line);
  border-left: 2px solid var(--v2-rose);
  padding: 8px 10px;
  font-size: var(--v2-fs);
  line-height: 1.5;
  color: var(--v2-text);
  overflow: auto;
  letter-spacing: 0.02em;
}
.v2-notes b {
  color: var(--v2-rose);
  display: block;
  margin-bottom: 6px;
  letter-spacing: 0.1em;
}
.v2-toast {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--v2-rose);
  color: var(--v2-bg);
  padding: 12px 20px;
  font-size: var(--v2-fs);
  font-weight: 700;
  letter-spacing: var(--v2-track-toast);
  text-transform: uppercase;
  z-index: 110;
  display: none;
}
.v2-toast.on {
  display: block;
}
form.nofill {
  display: contents;
}
/* Kit global: disable every animation and transition when the user prefers reduced motion. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
