/* HK-Pulse commercial terminal — full dark quant desk (t436) */
:root {
  /* t459 OKX-inspired pure-black desk — HK-Pulse brand, layout unchanged */
  --bg: #000000;
  --panel: #0D0E10;
  --panel-2: #121317;
  --panel-3: #16181D;
  --border: #1E2025;
  --border-strong: #2A2D33;
  --row-line: #16181D;
  --text: #FFFFFF;
  --muted: #8E929B;
  --label: #8E929B;
  --label-strong: #FFFFFF;
  /* channel aliases: back/赌 green signal; lay/吃 amber — direction labels unchanged */
  --blue: #00D170;
  --blue-solid: #00D170;
  --blue-text: #00D170;
  --blue-soft: rgba(0, 209, 112, 0.10);
  --orange: #F0B90B;
  --orange-text: #F0B90B;
  --orange-soft: rgba(240, 185, 11, 0.10);
  --green: #00D170;
  --green-hover: #00B861;
  --red: #FF4D6A;
  --amber: #F0B90B;
  --topbar-h: 52px;
  --rail-w: 280px;
  --rail-pad: 16px;
  --books-rail-w: 376px;
  --font: Inter, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  max-height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  border: 0;
}

.num, .data-table td.num, .data-table th.num,
input.num, td, .account-facts dd, #acct-balance {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.data-table th.num,
.data-table td.num,
.stepper input,
#acct-balance {
  text-align: right;
}

.desk-body {
  height: 100%;
  max-height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}
/* No blur/backdrop on text containers (t443) */
.panel, .rail, .books-rail, .topbar, .table-wrap, .ctab-panel {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  filter: none;
}

/* —— Top bar 52px —— */
.topbar {
  height: var(--topbar-h);
  min-height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  overflow: hidden;
  position: relative;
}
.topbar-live-summary {
  position: absolute;
  left: 50%;
  top: 0;
  height: 100%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  max-width: 560px;
  min-width: 0;
  color: #8E929B;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
}
.tls-k { color: #6E727B; margin-right: 4px; font-weight: 500; }
.tls-v {
  color: #C8CCD4;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.tls-sep { color: #3A3E46; }
.topbar-spacer { flex: 1 1 auto; width: auto; overflow: hidden; }

.brand-block {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 0 0 auto;
  max-width: min(200px, 26vw);
}
.brand-mark, svg.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 0;
  display: block;
  flex: 0 0 28px;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  object-fit: contain;
  overflow: visible;
}
.brand-text {
  min-width: 0;
  display: flex;
  flex-direction: row;
  align-items: baseline;
}
.brand-title-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  white-space: nowrap;
}
.brand-name-zh {
  color: #FFFFFF;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1;
}
.brand-name-en {
  color: #A1A6B0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1;
}
.brand-title { color: #FFFFFF; font-weight: 700; font-size: 16px; }
.brand-sub { display: none !important; } /* removed from brand lockup (t463) */

.scope-block select,
.rail-scope-select select,
.filters select,
.filters input,
.rail input,
.stepper input {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 8px;
  outline: none;
}
.scope-block select:focus,
.rail-scope-select select:focus,
.filters select:focus,
.filters input:focus,
.rail input:focus {
  border-color: var(--blue);
}

.meta-block {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  flex-wrap: nowrap;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: thin;
}

.capsule {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  white-space: nowrap;
  font-size: 12px;
  flex: 0 0 auto;
}
.capsule.mode {
  color: var(--text);
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.35);
  font-weight: 600;
}
.capsule.bal {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.35);
}
.capsule.bal strong {
  color: #FFFFFF;
  margin: 0 6px;
  font-family: var(--mono);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.capsule .cur {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}
.capsule .cur[hidden] { display: none !important; }
.capsule.bal {
  max-width: min(360px, 42vw);
  overflow: hidden;
}
.capsule.alert {
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(239, 68, 68, 0.45);
  color: #FECACA;
  font-weight: 600;
}
.capsule.alert[hidden] { display: none !important; }

.lamp {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #64748B;
  display: inline-block;
  flex-shrink: 0;
}
.lamp.ok { background: var(--green); box-shadow: 0 0 6px rgba(16,185,129,0.55); }
.lamp.stale { background: var(--orange); }
.lamp.off { background: var(--red); }

.updated { color: var(--muted); font-size: 11px; white-space: nowrap; flex: 0 0 auto; }

.actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: 12px;
  flex: 0 0 auto;
  flex-shrink: 0;
}
.actions .btn {
  flex-shrink: 0;
  white-space: nowrap;
}

.btn {
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
  font-family: var(--font);
}
.btn.ghost {
  background: transparent;
  color: var(--muted);
  font-weight: 500;
}
.btn.ghost:hover { color: var(--text); border-color: #475569; }

.btn-start {
  background: #0ECB81;
  border-color: #0ECB81;
  color: #0B0E11;
  font-weight: 700;
  box-shadow: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-start:hover { background: #0BB872; border-color: #0BB872; color: #0B0E11; }
.btn-halt {
  background: rgba(246, 70, 93, 0.08);
  border: 1px solid rgba(246, 70, 93, 0.55);
  color: #F6465D;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: none;
}
.btn-halt:hover { background: rgba(246, 70, 93, 0.14); border-color: #F6465D; }
.btn-start:disabled,
.btn-halt:disabled {
  cursor: not-allowed;
  opacity: 1;
  pointer-events: none;
}
.btn-start:disabled {
  background: rgba(14, 203, 129, 0.35);
  border-color: rgba(14, 203, 129, 0.35);
  color: #0B0E11;
  box-shadow: none;
}
.btn-halt:disabled {
  background: rgba(246, 70, 93, 0.06);
  border-color: rgba(246, 70, 93, 0.28);
  color: rgba(246, 70, 93, 0.55);
}
.mode-switch {
  display: inline-flex;
  border: 1px solid rgba(14, 203, 129, 0.45);
  border-radius: 8px;
  overflow: hidden;
  background: #0b1210;
}
.mode-switch.is-live {
  border-color: #f6465d;
  box-shadow: 0 0 0 1px rgba(246, 70, 93, 0.55);
}
.mode-seg {
  border: 0;
  background: transparent;
  color: #8e929b;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 10px;
  cursor: pointer;
}
.mode-seg.is-on {
  background: rgba(14, 203, 129, 0.22);
  color: #0ecb81;
}
.mode-switch.is-live .mode-seg.is-on {
  background: rgba(246, 70, 93, 0.2);
  color: #f6465d;
}
.st-live-fail { color: #f6465d; font-weight: 700; }
.st-sim { color: #0ecb81; }
.btn-lock[hidden] { display: none !important; }
.btn-lock {
  display: inline-grid;
  place-items: center;
  min-width: 16px;
  height: 16px;
  border-radius: 4px;
  background: rgba(0,0,0,0.22);
  font-size: 10px;
  font-weight: 700;
}
.btn-hint { display: none; }
.btn-save {
  width: 100%;
  background: #1E2329;
  border: 1px solid #2B3139;
  color: #EAECEF;
  font-weight: 700;
  padding: 10px 14px;
}
.btn-save:hover { background: #2B3139; border-color: #3A424C; color: #FFFFFF; filter: none; }

.stale-banner, .err-banner {
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  background: rgba(245, 158, 11, 0.12);
  color: var(--orange-text);
}
.err-banner {
  background: rgba(239, 68, 68, 0.12);
  color: #FCA5A5;
}

/* —— Four-zone desk —— */
.desk-4zone {
  flex: 1;
  min-height: 0;
  width: 100%;
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr) var(--books-rail-w);
  gap: 0;
  background: var(--bg);
  overflow: hidden;
}

.rail {
  width: var(--rail-w);
  min-width: var(--rail-w);
  max-width: var(--rail-w);
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden; /* do not hide clip by scrolling sideways */
  padding: 0;
}

.rail-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: var(--rail-pad);
  padding-bottom: 20px;
  gap: 8px;
}

.rail-body > .rail-section {
  flex: 0 0 auto;
  margin-bottom: 0;
  padding-bottom: 8px;
}

.rail-body > .rules-panel--list-only {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-bottom: 0;
  padding-bottom: 0;
  margin-bottom: 0;
}

.rail-section {
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.rail-section:last-child { border-bottom: 0; margin-bottom: 0; padding-bottom: 0; }
.rail h2 {
  margin: 0 0 8px;
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--label-strong);
  font-weight: 600;
}

/* t445 Daily PnL meter card */
.overview-card, .pnl-meter {
  background: #181C23;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 10px;
  border-bottom: 0;
}
.pnl-meter h2 { margin-bottom: 8px; }

/* t454 compact account card (~35% shorter title stack) */
.pnl-meter--compact {
  padding: 6px 8px 8px;
  margin-bottom: 0;
}
.pnl-meter--compact .pnl-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 8px;
  margin-bottom: 6px;
  min-width: 0;
}
.pnl-meter--compact .pnl-scope {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.25;
  min-width: 0;
  flex: 1 1 auto;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.pnl-meter--compact .pnl-status-pill {
  padding: 2px 7px;
  font-size: 11px;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.pnl-meter--compact .pnl-compact-body {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 6px 8px;
  align-items: stretch;
  border-top: 1px solid rgba(30,41,59,0.9);
  padding-top: 6px;
}
.pnl-meter--compact .pnl-hero {
  border: 0;
  margin: 0;
  padding: 0;
}
.pnl-meter--compact .pnl-hero-label { font-size: 11px; margin-bottom: 2px; }
.pnl-meter--compact .pnl-hero-value { font-size: 18px; line-height: 1.15; }
.pnl-meter--compact .pnl-micro {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
}
.pnl-meter--compact .pnl-micro-cell {
  padding: 4px 6px;
}
.pnl-meter--compact .pnl-micro-label { font-size: 10px; }
.pnl-meter--compact .pnl-micro-value { font-size: 12px; }
@media (max-width: 1360px) {
  .pnl-meter--compact .pnl-compact-body { grid-template-columns: 1fr; }
}

.pnl-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 8px;
  margin-bottom: 8px;
}
.pnl-scope {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 4px;
  color: var(--label-strong);
  font-size: 13px;
  font-weight: 600;
  min-width: 0;
}
.pnl-scope strong {
  color: #FFFFFF;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.session-line .sep, .pnl-scope .sep { color: #64748B; font-weight: 500; }
.pnl-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid #2B3139;
  background: #12151A;
  color: #E2E8F0;
  font-size: 12px;
  font-weight: 600;
}
.pnl-status-pill strong {
  color: #FFFFFF;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.pnl-status-pill .pill-sep { color: #64748B; }
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #64748B;
  flex: 0 0 auto;
}
.status-dot.ok { background: #10B981; box-shadow: 0 0 0 3px rgba(16,185,129,0.18); }
.status-dot.stale { background: #F59E0B; }
.status-dot.off { background: #EF4444; }

.pnl-hero {
  text-align: left;
  padding: 6px 0 8px;
  border-top: 1px solid rgba(30,41,59,0.9);
  border-bottom: 1px solid rgba(30,41,59,0.9);
  margin-bottom: 8px;
}
.pnl-hero-label {
  color: var(--label);
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 4px;
}
.pnl-hero-value {
  font-family: var(--mono);
  font-size: 21px;
  line-height: 1.2;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #FFFFFF;
  word-break: break-word;
}
.pnl-hero-value.pos { color: #10B981; }
.pnl-hero-value.neg { color: #EF4444; }
.pnl-hero-value.zero { color: #FFFFFF; }
.pnl-hero-value.na { color: #CBD5E1; font-size: 18px; font-weight: 650; }

.pnl-micro {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.pnl-micro-cell {
  min-width: 0;
  background: #12151A;
  border: 1px solid #1E2329;
  border-radius: 8px;
  padding: 6px 8px;
}
.pnl-micro-label {
  color: var(--label);
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 2px;
}
.pnl-micro-value {
  color: #FFFFFF;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.pnl-micro-value.na { color: #94A3B8; font-family: var(--font); font-weight: 600; }

.nav-row, .account-facts > div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 0;
  color: var(--label);
  font-size: 13px;
  font-weight: 500;
}
.nav-row strong, .account-facts dd {
  color: #FFFFFF;
  margin: 0;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.account-facts { margin: 0; }
.account-facts dt { margin: 0; }

.hint-mini {
  color: var(--label);
  font-size: 12px;
  font-weight: 500;
  margin: 0 0 10px;
}

#config-form label {
  display: block;
  margin: 0 0 10px;
  color: var(--label);
  font-size: 13px;
  font-weight: 500;
}
#config-form input[type="text"] {
  width: 100%;
  margin-top: 4px;
}

.stepper-field { margin-bottom: 8px; }
.stepper-field > label {
  display: block;
  color: var(--label);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 4px;
}
.stepper {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 36px;
  gap: 8px;
  align-items: center;
  width: 100%;
}
.stepper.united {
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: #181C23;
}
.stepper.united:hover { border-color: #2B3139; }
.stepper.united:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.25);
}
.stepper .step {
  height: 32px;
  width: 36px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #181C23;
  color: var(--text);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0;
  flex-shrink: 0;
}
.stepper.united .step {
  height: 30px;
  width: 34px;
  border: 0;
  border-radius: 0;
  background: #181C23;
  color: #E2E8F0;
}
.stepper.united .step:hover { background: #1A1F27; color: #FFFFFF; }
.stepper.united .step:active { background: #1E2329; }
.stepper input {
  width: 100%;
  min-width: 0;
  text-align: right;
  font-family: var(--mono);
  color: var(--text);
}
.stepper.united input {
  height: 30px;
  border: 0;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
  text-align: center;
  font-weight: 700;
  color: #FFFFFF;
  font-variant-numeric: tabular-nums;
  outline: none;
}

.pools {
  border: 0;
  border-radius: 0;
  padding: 0;
  margin: 0 0 8px;
  min-inline-size: 0;
}
.pools legend {
  padding: 0;
  margin-bottom: 4px;
  color: var(--label);
  font-size: 13px;
  font-weight: 500;
}
.pool-segment-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: #181C23;
}
.pool-pill {
  display: block;
  margin: 0;
  cursor: pointer;
  min-width: 0;
}
.pool-pill + .pool-pill {
  border-left: 1px solid var(--border);
}
.pool-pill input { position: absolute; opacity: 0; pointer-events: none; }
.pool-pill span {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  box-sizing: border-box;
  padding: 7px 4px;
  border-radius: 0;
  border: 0;
  background: #1E2329;
  color: #CBD5E1;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
}
.pool-pill span::before {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: 3px;
  border: 1px solid #64748B;
  background: transparent;
  box-sizing: border-box;
  flex: 0 0 auto;
}
.pool-pill input:checked + span {
  background: var(--blue-solid);
  border-color: var(--blue-solid);
  color: #FFFFFF;
  font-weight: 700;
}
.pool-pill input:checked + span::before {
  content: "✓";
  display: inline-grid;
  place-items: center;
  border-color: rgba(255,255,255,0.7);
  background: rgba(255,255,255,0.15);
  font-size: 10px;
  line-height: 1;
  color: #FFFFFF;
}
.pool-pill input:focus-visible + span {
  outline: 2px solid var(--blue-text);
  outline-offset: -2px;
  position: relative;
  z-index: 1;
}

.limit-field {
  margin: 0 0 8px;
}
.limit-field > label {
  display: block;
  color: var(--label);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 4px;
}
.limit-field input {
  width: 100%;
  margin: 0;
}
.limit-presets {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  margin-top: 6px;
}
.limit-preset {
  border: 1px solid var(--border);
  background: #181C23;
  color: var(--label-strong);
  border-radius: 999px;
  padding: 4px 2px;
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  text-align: center;
  min-width: 0;
}
.limit-preset:hover {
  border-color: var(--blue);
  color: #FFFFFF;
  background: rgba(37, 99, 235, 0.15);
}
.limit-preset[aria-pressed="true"],
.limit-preset.active {
  background: var(--blue-solid);
  border-color: var(--blue-solid);
  color: #FFFFFF;
  font-weight: 700;
}
.limit-preset:focus-visible {
  outline: 2px solid var(--blue-text);
  outline-offset: 1px;
}

.risk-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 0 0 4px;
}
.risk-field {
  display: block;
  margin: 0 !important;
  color: var(--label);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
  min-width: 0;
}
.unit-input {
  position: relative;
  display: block;
  margin-top: 4px;
}
.risk-field input,
.unit-input input {
  width: 100%;
  min-width: 0;
  height: 34px;
  box-sizing: border-box;
  padding-right: 22px;
  margin-top: 0;
}
.unit-affix {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  color: #94A3B8;
  font-size: 12px;
  font-weight: 700;
  pointer-events: none;
}

/* Save toast — top-right, non-blocking */
.toast-host {
  position: fixed;
  top: 60px;
  right: 16px;
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(360px, calc(100vw - 32px));
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  background: #181C23;
  border: 1px solid #2B3139;
  color: #EAECEF;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 160ms ease, transform 160ms ease;
}
.toast.show {
  opacity: 1;
  transform: translateY(0);
}
.toast.ok { border-color: rgba(16, 185, 129, 0.55); color: #ECFDF5; }
.toast.err { border-color: rgba(239, 68, 68, 0.55); color: #FEE2E2; }

.feedback { min-height: 0; color: var(--green); font-size: 11px; margin: 0; }
.feedback.err { color: var(--red); }

/* Compact one-screen target (CSS height contract only — not pixel-verified) */
@media (min-height: 768px) and (min-width: 1280px) {
  .rail-body {
    /* Notebook one-screen target: sections stay visible; only rules-list scrolls */
    overflow: hidden;
  }
  .stepper.united .step,
  .stepper.united input { height: 28px; }
  .pool-pill span { padding: 6px 4px; }
  .overview-card { padding: 8px; }
}

/* —— Center workspace —— */
.workspace {
  min-width: 0;
  display: grid;
  grid-template-rows: 55% 45%;
  background: var(--bg);
  border-right: 1px solid var(--border);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  margin: 10px 10px 0;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.workbench {
  margin: 10px;
}

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px 8px;
  border-bottom: 1px solid var(--border);
}
.panel-head h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--label-strong);
}
.panel-sub {
  color: var(--label);
  font-size: 12px;
  font-weight: 500;
}

.table-wrap {
  overflow: auto;
  flex: 1;
  min-height: 0;
  background: var(--panel);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  color: var(--text);
}
.data-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #181C23;
  color: #CBD5E1;
  font-weight: 600;
  font-size: 13px;
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
.data-table thead th.num,
.data-table thead th.col-num,
.data-table td.num,
.data-table td.col-num {
  text-align: right !important;
}
.data-table thead th.col-left,
.data-table td.col-left {
  text-align: left !important;
}
.data-table thead th.col-status,
.data-table td.col-status {
  text-align: center !important;
}
.data-table td {
  padding: 7px 10px;
  border-bottom: 1px solid rgba(30, 41, 59, 0.85);
  background: var(--panel);
  color: #FFFFFF;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.data-table td.col-left {
  font-family: var(--font);
  font-weight: 500;
  color: var(--label-strong);
}
/* Keep direction/status business colors (do not force all text white) */
.data-table .status-chip,
.data-table .spread-badge,
.data-table .dir-back,
.data-table .dir-lay,
.data-table .tag-back,
.data-table .tag-lay {
  font-family: var(--font);
}
.data-table .dir-back, .data-table .tag-back { color: var(--blue-text); }
.data-table .dir-lay, .data-table .tag-lay { color: var(--orange-text); }

.data-table tbody tr:hover td {
  background: #1A1F27;
}
.data-table .empty,
.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 28px 12px;
  background: var(--panel) !important;
}

.matrix-scroll {
  max-height: 100%;
  align-content: flex-start;
}
.matrix-panel .table-wrap {
  display: block;
  overflow: auto;
}
.matrix-panel .data-table {
  width: 100%;
  height: auto !important; /* prevent row stretch when few rows */
  table-layout: fixed;
}
.matrix-panel .data-table thead th {
  height: 32px;
  max-height: 32px;
  box-sizing: border-box;
  padding-top: 0;
  padding-bottom: 0;
  vertical-align: middle;
  font-size: 13px;
  font-weight: 600;
  color: #CBD5E1;
}
.matrix-panel .data-table tbody tr {
  height: 40px;
}
.matrix-panel .data-table tbody td {
  height: 40px;
  max-height: 40px;
  box-sizing: border-box;
  padding-top: 0;
  padding-bottom: 0;
  vertical-align: middle;
  line-height: 1.2;
  overflow: hidden;
}
.matrix-panel .data-table tbody td .spread-badge,
.matrix-panel .data-table tbody td .status-chip {
  max-height: 24px;
}
.matrix-panel .data-table .empty {
  height: auto;
  max-height: none;
  padding: 28px 12px;
}
.quote-spread-hit td {
  /* quote-threshold visual only — not locked profit / not confirmed arb */
  background: rgba(14, 203, 129, 0.06) !important;
  box-shadow: none;
}
.quote-spread-hit td:first-child {
  box-shadow: inset 2px 0 0 #0ECB81;
}
.status-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 650;
  font-family: var(--font);
  white-space: nowrap;
}
.status-chip.watching {
  color: #EAECEF;
  background: rgba(132, 142, 156, 0.10);
  border: 1px solid rgba(132, 142, 156, 0.28);
}
.status-chip.hit {
  color: #0ECB81;
  background: rgba(14, 203, 129, 0.08);
  border: 1px solid rgba(14, 203, 129, 0.35);
}
.status-chip.insufficient,
.status-chip.pending {
  color: #F0B90B;
  background: rgba(240, 185, 11, 0.10);
  border: 1px solid rgba(240, 185, 11, 0.32);
}
.status-chip.stale {
  color: #F6465D;
  background: rgba(246, 70, 93, 0.10);
  border: 1px solid rgba(246, 70, 93, 0.35);
}
.spread-badge {
  display: inline-flex;
  min-width: 2.6em;
  justify-content: flex-end;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.spread-badge.muted {
  color: #EAECEF;
  background: rgba(148, 163, 184, 0.14);
  border: 1px solid rgba(148, 163, 184, 0.22);
}
.spread-badge.hit {
  color: #0ECB81;
  background: rgba(14, 203, 129, 0.08);
  border: 1px solid rgba(14, 203, 129, 0.35);
}
.spread-badge.empty {
  color: var(--muted);
  background: transparent;
  border: 0;
  font-weight: 500;
}

/* —— Demo style preview + workbench toolbar (t471) —— */
.workbench-toolbar{
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  margin-bottom:8px; flex-wrap:wrap;
}
.workbench-tools{
  margin-left:auto; display:inline-flex; align-items:center; gap:8px; min-width:0;
}
.demo-style-controls{
  display:inline-flex; align-items:center; gap:8px; margin-left:0;
}
.btn-history{
  height:26px; padding:0 12px; font-size:12px; font-weight:650;
  border-color:#2B3139; color:#EAECEF; white-space:nowrap;
}
.btn-history:hover{ border-color:#8E929B; color:#FFFFFF; }
.demo-style-controls[hidden],
.demo-banner[hidden],
.btn-demo-toggle[hidden]{
  display:none !important;
}
.demo-banner{
  display:inline-flex; align-items:center; gap:6px;
  padding:3px 10px; border-radius:999px;
  border:1px solid rgba(240,185,11,.35);
  background:rgba(240,185,11,.08);
  color:#F0B90B; font-size:11px; font-weight:600; letter-spacing:.02em;
  white-space:nowrap;
}
.demo-banner::before{ content:""; width:6px; height:6px; border-radius:50%; background:#F0B90B; box-shadow:0 0 6px rgba(240,185,11,.55); }
.btn-demo-toggle{
  height:26px; padding:0 10px; font-size:11px; font-weight:600;
  border-color:#3B4454; color:#EAECEF;
}
.btn-demo-toggle[aria-pressed="true"]{
  border-color:rgba(240,185,11,.45); color:#F0B90B;
}
.btn-demo-toggle:hover{ border-color:#00D170; color:#FFFFFF; }
.demo-row td{ background:rgba(240,185,11,.035); }
.demo-id{
  font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
  font-size:11px; color:#F0B90B; font-weight:600; letter-spacing:.02em;
}
.demo-tag{
  display:inline-flex; align-items:center; margin-left:4px;
  padding:1px 5px; border-radius:4px;
  background:rgba(240,185,11,.12); color:#F0B90B;
  font-size:10px; font-weight:700; letter-spacing:.04em;
}

.center-tabs {
  display: flex;
  gap: 4px;
  padding: 8px 10px 0;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}
.ctab {
  background: transparent;
  border: 0;
  color: var(--label);
  padding: 8px 12px;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
}
.ctab.active {
  color: var(--label-strong);
  font-weight: 600;
  border-bottom-color: var(--blue);
}
.ctab-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--panel);
}
.ctab-panel[hidden] { display: none !important; }
.history-modal-panel { width: min(1080px, calc(100vw - 32px)); }
.history-form { display: flex; flex-direction: column; min-height: 0; }
.history-filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px 10px;
  padding: 12px 14px 4px;
}
.history-filters label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  color: #8E929B;
  font-size: 11px;
  font-weight: 600;
}
.history-filters input,
.history-filters select {
  height: 30px;
  border-radius: 8px;
  border: 1px solid #2B3139;
  background: #0D0E10;
  color: #EAECEF;
  padding: 0 8px;
  font-size: 12px;
  color-scheme: dark;
}
.history-filter-actions {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
.history-filter-actions .btn { height: 30px; padding: 0 12px; }
.history-result-note {
  margin: 0;
  padding: 6px 14px 8px;
  color: #8E929B;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.history-table-wrap { max-height: min(420px, 46vh); border-top: 1px solid #1E2025; }
@media (max-width: 860px) {
  .history-filters { grid-template-columns: 1fr 1fr; }
}

.journal-list {
  list-style: none;
  margin: 0;
  padding: 8px 12px;
  overflow: auto;
  flex: 1;
}
.journal-list li {
  display: grid;
  grid-template-columns: 150px 88px 1fr;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(30,41,59,0.7);
  color: var(--text);
}
.journal-list .time { color: var(--muted); font-variant-numeric: tabular-nums; }
.journal-list .kind { color: var(--blue-text); }
.journal-list .empty { display: block; text-align: center; color: var(--muted); border: 0; }
.agg {
  margin: 0;
  padding: 6px 12px 10px;
  color: var(--muted);
  font-size: 11px;
  border-top: 1px solid var(--border);
}

/* —— Right books 376px ——
   Root cause (t437): grid 1fr ≡ minmax(auto,1fr), so blue content
   min-height inflated the first row and crushed orange. Force
   minmax(0,1fr)×2 + overflow scroll so both panes share 50/50. */
.desk-4zone > .books-rail,
.desk-4zone > .rail,
.desk-4zone > .workspace {
  min-height: 0;
  max-height: 100%;
}

.books-rail {
  --books-rail-w: 376px; /* t442: +16px for limit col + scrollbar */
  --book-font: "SF Pro Text", "PingFang HK", "Helvetica Neue", system-ui, sans-serif;
  --book-mono: "SF Mono", "Menlo", "Consolas", ui-monospace, monospace;
  --book-fs: 12px;
  --book-lh: 1.35;
  --book-head-h: 44px;
  --book-cell-pad-y: 4px;
  --book-cell-pad-x: 4px;
  width: var(--books-rail-w);
  min-width: 280px;
  max-width: 376px;
  background: var(--panel);
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}
.books-rail-head {
  padding: 10px 10px 8px;
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
}
.books-rail-title {
  font-family: var(--book-font);
  font-size: 13px;
  font-weight: 600;
  color: var(--label-strong);
  line-height: 1.3;
  margin-bottom: 8px;
}
.filters {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
}
.filters label {
  display: flex;
  flex-direction: column;
  gap: 3px;
  color: var(--label);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--book-font);
}
.filters input, .filters select { width: 100%; }

.dual-books.stacked {
  flex: 1 1 0;
  min-height: 0;
  display: grid;
  /* CRITICAL: minmax(0,1fr) not bare 1fr — bare 1fr keeps content min-size */
  grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
  overflow: hidden;
}
.book {
  min-height: 0;
  max-height: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}
.book:last-child { border-bottom: 0; }
.book-head {
  box-sizing: border-box;
  height: var(--book-head-h);
  min-height: var(--book-head-h);
  max-height: var(--book-head-h);
  padding: 4px 10px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 2px;
  font-family: var(--book-font);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: 0.01em;
  flex: 0 0 var(--book-head-h);
  overflow: hidden;
}
.book-head-main {
  font-size: 13px;
  font-weight: 700;
  color: inherit;
  white-space: nowrap;
}
.book-head-sub {
  font-size: 11px;
  font-weight: 600;
  color: #A3B1C2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.book-head.back {
  /* semantic: 蓝·赌 channel; skin signal green */
  color: var(--blue-text);
  background: linear-gradient(90deg, rgba(14,203,129,0.18), rgba(14,203,129,0.03));
  border-bottom: 1px solid rgba(14,203,129,0.28);
}
.book-head.lay {
  color: var(--orange-text);
  background: linear-gradient(90deg, rgba(240,185,11,0.18), rgba(240,185,11,0.03));
  border-bottom: 1px solid rgba(240,185,11,0.28);
}
.book-scroll {
  flex: 1 1 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--panel);
  scrollbar-gutter: stable;
  box-sizing: border-box;
  padding-right: 2px; /* breathing room past vertical scrollbar */
}

/* Unified blue/orange table typography + column geometry */
.books-rail .data-table {
  table-layout: fixed;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  font-family: var(--book-font);
  font-size: var(--book-fs);
  line-height: var(--book-lh);
  border-collapse: collapse;
}
.books-rail .data-table thead th,
.books-rail .data-table tbody td {
  font-family: var(--book-font);
  line-height: var(--book-lh);
  padding: var(--book-cell-pad-y) var(--book-cell-pad-x);
  vertical-align: middle;
  white-space: nowrap;
  box-sizing: border-box;
}
.books-rail .data-table thead th {
  font-weight: 600;
  font-size: 13px;
  color: #CBD5E1;
  height: 28px;
  box-sizing: border-box;
}
.books-rail .data-table tbody td {
  font-size: var(--book-fs);
  color: #FFFFFF;
  font-weight: 600;
}
/* Narrow race/horse; keep limit fully visible (no ellipsis) */
.books-rail .data-table th:nth-child(1),
.books-rail .data-table td:nth-child(1) {
  width: 24px;
  max-width: 26px;
  padding-left: 6px;
  padding-right: 2px;
  text-align: left;
  overflow: hidden;
  text-overflow: clip;
}
.books-rail .data-table th:nth-child(2),
.books-rail .data-table td:nth-child(2) {
  width: 24px;
  max-width: 26px;
  padding-left: 2px;
  padding-right: 2px;
  text-align: left;
  overflow: hidden;
  text-overflow: clip;
}
.books-rail .data-table th:nth-child(3),
.books-rail .data-table td:nth-child(3),
.books-rail .data-table th:nth-child(4),
.books-rail .data-table td:nth-child(4),
.books-rail .data-table th:nth-child(5),
.books-rail .data-table td:nth-child(5) {
  width: auto;
  text-align: right;
  font-family: var(--book-mono), var(--book-font);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  overflow: hidden;
  text-overflow: clip;
  padding-left: 4px;
  padding-right: 4px;
}
.books-rail .data-table th:nth-child(6),
.books-rail .data-table td:nth-child(6) {
  width: 78px;
  min-width: 76px;
  max-width: none;
  text-align: right;
  font-family: var(--book-mono), var(--book-font);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
  padding-left: 4px;
  padding-right: 10px; /* clear right edge / scrollbar */
}
.amt-bar {
  position: relative;
  /* bar must not change text metrics */
  font-family: var(--book-mono), var(--book-font);
  font-variant-numeric: tabular-nums;
}
.amt-bar::before {
  content: "";
  position: absolute;
  inset: 2px auto 2px 0;
  width: var(--bar, 0%);
  max-width: 100%;
  border-radius: 2px;
  pointer-events: none;
  z-index: 0;
}
.amt-bar > *,
.books-rail .data-table td.amt-bar {
  position: relative;
  z-index: 1;
  color: #EAECEF;
}
.back-book .amt-bar { color: #EAECEF; }
.lay-book .amt-bar { color: #EAECEF; }
.back-book .amt-bar::before { background: rgba(14, 203, 129, 0.10); opacity: 1; }
.lay-book .amt-bar::before { background: rgba(240, 185, 11, 0.10); opacity: 1; }
.books-rail .data-table td.num { color: #EAECEF; }
.books-rail .data-table td.num:nth-child(5) { color: var(--blue-text); font-weight: 700; } /* % col emphasis */
.lay-book .data-table td.num:nth-child(5) { color: var(--orange-text); }

/* Kill any leftover light surfaces */
input, select, textarea, table, th, td, .panel, .table-wrap, .ctab-panel, .empty-state {
  background-color: var(--panel);
  color: var(--text);
}
option { background: var(--panel); color: var(--text); }

/* Responsive: shrink right rail, avoid horizontal overflow */
@media (max-width: 1280px) {
  .desk-4zone {
    grid-template-columns: 260px minmax(0, 1fr) minmax(260px, 320px);
  }
  .rail { width: 260px; min-width: 260px; max-width: 260px; }
  .books-rail { width: auto; max-width: 336px; min-width: 260px; }
}
@media (max-width: 1100px) {
  .desk-4zone {
    grid-template-columns: 240px minmax(0, 1fr) minmax(240px, 316px);
  }
  .rail { width: 240px; min-width: 240px; max-width: 240px; }
  .books-rail { max-width: 316px; min-width: 240px; }
  .topbar {
    flex-wrap: nowrap;
    height: var(--topbar-h);
    min-height: var(--topbar-h);
    padding: 0 12px;
    gap: 8px;
  }
  .brand-block { max-width: min(200px, 32vw); }
  .brand-name-en { display: none; } /* keep 港脉 primary on narrow */
  .btn-hint { display: none; }
}

.trades-footer-note[hidden] { display: none !important; }
.trades-footer-note:empty { display: none !important; }

.field-hint {
  margin-left: 6px;
  color: #94A3B8;
  font-size: 12px;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
}


/* ---- t450/t454 multi-rule panel (list-only + modal editor) ---- */
.rules-panel { margin-bottom: 0; }
.rules-panel-head { display:flex; align-items:center; justify-content:space-between; gap:8px; margin-bottom:8px; flex:0 0 auto; }
.rules-panel-head h2 { margin:0; font-size:13px; font-weight:600; color:#E2E8F0; }
.btn-new-rule {
  height:28px; padding:0 10px; border-radius:8px; border:1px solid #2B3139;
  background:#1E2329; color:#EAECEF; font-size:12px; font-weight:600; cursor:pointer;
}
.btn-new-rule:hover { border-color:#3A424C; background:#2B3139; color:#fff; }

.global-cap-bar { border-bottom: 1px solid var(--border); }
.global-cap-row--inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 0;
  min-width: 0;
}
.global-cap-label-wrap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  flex: 1 1 auto;
}
.global-cap-row--inline label {
  display: inline;
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  color: #CBD5E1;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.global-cap-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}
.global-cap-controls .unit-input { width: 96px; }
.global-cap-controls .unit-input input { height: 30px; }
.btn-global-save {
  height: 30px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid #2B3139;
  background: #1E2329;
  color: #EAECEF;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.btn-global-save:hover { background: #2B3139; border-color: #3A424C; color: #fff; }
.btn-global-save:disabled { opacity: 0.55; cursor: not-allowed; }
.help-tip {
  width: 18px; height: 18px; border-radius: 50%;
  border: 1px solid #2B3139; background: #12151A; color: #CBD5E1;
  font-size: 11px; font-weight: 700; line-height: 1; cursor: help; position: relative;
}
.help-tip:hover, .help-tip:focus-visible { border-color: #0ECB81; color: #fff; outline: none; }
.help-tip-bubble {
  position: absolute;
  z-index: 40;
  left: 0;
  top: calc(100% + 6px);
  width: min(220px, 70vw);
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #2B3139;
  background: #181C23;
  color: #E2E8F0;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.4;
  box-shadow: 0 8px 24px rgba(0,0,0,.45);
}
.global-cap-label-wrap { position: relative; }
.help-tip-bubble[hidden] { display: none !important; }

.rules-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 2px;
  margin-bottom: 0;
  scroll-padding-bottom: 20px;
}
.rule-card {
  border:1px solid #1E2329;
  border-left: 2px solid transparent; /* reserve width so active indicator does not jump layout */
  border-radius:10px; background:#12151A; padding:8px 10px;
  display:grid; grid-template-columns: 1fr auto; gap:6px 8px; cursor: default;
  box-shadow: none;
}
.rule-card.active {
  border-color: #1E2329;
  border-left-color: #0ECB81;
  background: #1A1F27;
  box-shadow: none;
}
.rule-card .rule-name { font-size:13px; font-weight:700; color:#EAECEF; overflow-wrap:anywhere; }
.rule-card .rule-summary { grid-column:1 / -1; font-size:12px; color:#848E9C; line-height:1.35; }
.rule-card .rule-actions { display:flex; align-items:center; gap:6px; flex-wrap:wrap; justify-content:flex-end; }
.rule-switch {
  width:36px; height:20px; border-radius:999px; border:0; padding:2px; cursor:pointer;
  background:#2B3139; position:relative;
}
.rule-switch[aria-checked="true"] { background:#0ECB81; }
.rule-switch .knob {
  width:16px; height:16px; border-radius:50%; background:#EAECEF; display:block;
  transition: transform .15s ease;
}
.rule-switch[aria-checked="true"] .knob { transform: translateX(16px); }
.rule-edit, .rule-del {
  border:0; background:transparent; font-size:12px; font-weight:600; cursor:pointer; padding:2px 4px;
}
.rule-edit { color:#848E9C; }
.rule-edit:hover, .rule-edit:focus-visible { color:#EAECEF; }
.rule-del { color:#5E6673; }
.rule-del:hover, .rule-del:focus-visible { color:#F6465D; }
.rule-hit-tag {
  display:inline-flex; align-items:center; max-width:110px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
  padding:1px 6px; border-radius:999px; background:rgba(132,142,156,.12); color:#B7BDC6; border:1px solid rgba(132,142,156,.22); font-size:11px; font-weight:600;
}

/* Rule editor modal — backdrop may be translucent; no blur on text */
.rule-modal-backdrop {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(2, 6, 23, 0.62);
  /* intentionally no backdrop-filter / blur */
}
.rule-modal {
  position: fixed; inset: 0; z-index: 90;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  pointer-events: none;
}
.rule-modal:not([hidden]) { pointer-events: auto; }
.rule-modal[hidden], .rule-modal-backdrop[hidden] { display: none !important; }
.rule-modal-panel {
  width: min(720px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  overflow: auto;
  border-radius: 14px;
  border: 1px solid #1E2329;
  background: #12151A;
  box-shadow: 0 24px 64px rgba(0,0,0,.55);
  display: flex;
  flex-direction: column;
  pointer-events: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
.rule-modal-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 12px 14px 8px; flex: 0 0 auto;
  border-bottom: 1px solid #1E2329;
}
.rule-modal-head h2 { margin: 0; font-size: 15px; font-weight: 700; color: #EAECEF; }
.rule-modal-close {
  width: 32px; height: 32px; border-radius: 8px; border: 1px solid #2B3139;
  background: #181C23; color: #E2E8F0; font-size: 18px; line-height: 1; cursor: pointer;
}
.rule-modal-form { display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto; }
.rule-modal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
  padding: 12px 14px;
  flex: 1 1 auto;
}
.rule-modal-col { min-width: 0; }
.rule-modal-foot {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 10px 14px 14px;
  border-top: 1px solid #1E2329;
  flex: 0 0 auto;
  position: sticky; bottom: 0;
  background: #12151A;
}
.rule-modal-foot .btn-save {
  background: #1E2329; border: 1px solid #2B3139; color: #EAECEF; font-weight: 700;
}
.rule-modal-foot .btn-save:hover { background: #2B3139; border-color: #3A424C; color: #fff; }
body.rule-modal-open { overflow: hidden; }
@media (max-width: 720px) {
  .rule-modal-grid { grid-template-columns: 1fr; }
}
@media (min-height: 768px) and (min-width: 1280px) {
  /* CSS one-screen target for 1366x768 / 1440x900 notebooks — not pixel-verified */
  .rules-list { max-height: none; }
}



/* t457 focus-visible carbon — keep keyboard contrast */
.btn:focus-visible,
.btn-new-rule:focus-visible,
.btn-global-save:focus-visible,
.rule-edit:focus-visible,
.rule-del:focus-visible,
.rule-switch:focus-visible,
input:focus-visible,
button:focus-visible {
  outline: 2px solid #0ECB81;
  outline-offset: 2px;
}

/* Input / hover graphite surfaces */
.rail input,
.rule-modal input,
.unit-input input,
.stepper.united,
.stepper.united input {
  background: #181C23;
  border-color: #1E2329;
  color: #EAECEF;
}
.rail input:focus,
.rule-modal input:focus,
.unit-input input:focus,
.stepper.united:focus-within {
  border-color: #2B3139;
  box-shadow: 0 0 0 1px rgba(14, 203, 129, 0.25);
}


/* t458 matrix hit-rule column + contrast polish */
.matrix-panel .data-table th.col-num {
  white-space: nowrap;
}
.matrix-panel .data-table th.col-rule,
.matrix-panel .data-table td.col-rule {
  text-align: left;
  max-width: 110px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.matrix-panel .data-table td.col-left {
  white-space: nowrap;
}
.rule-card .rule-summary,
.rule-edit, .rule-del,
.pnl-micro-value.na,
.pnl-hero-value.na,
#acct-status,
#acct-closed-pnl.na,
#acct-open-exposure.na {
  color: #A3B1C2 !important;
  font-size: 12px;
  font-weight: 500;
}
.rule-card .rule-summary { font-size: 12px; line-height: 1.35; }
.rule-edit { color: #38BDF8 !important; font-weight: 700; }
.rule-edit:hover, .rule-edit:focus-visible { color: #7DD3FC !important; }
.rule-del { color: #FB7185 !important; font-weight: 700; }
.rule-del:hover, .rule-del:focus-visible { color: #FDA4AF !important; }
.btn-halt {
  background: #F6465D !important;
  border: 1px solid #F6465D !important;
  color: #FFFFFF !important;
  font-weight: 700 !important;
  box-shadow: none !important;
}
.btn-halt:hover { background: #E03E54 !important; border-color: #E03E54 !important; color: #fff !important; }
.btn-halt:disabled {
  background: rgba(246, 70, 93, 0.45) !important;
  border-color: rgba(246, 70, 93, 0.45) !important;
  color: #FFFFFF !important;
}
.btn-new-rule, .btn-global-save, .btn-save, .rule-modal-foot .btn-save {
  background: #1E242E !important;
  border: 1px solid #3B4454 !important;
  color: #FFFFFF !important;
  font-weight: 700 !important;
}
.btn-new-rule:hover, .btn-global-save:hover, .btn-save:hover, .rule-modal-foot .btn-save:hover {
  border-color: #0ECB81 !important;
  background: #242B36 !important;
  color: #FFFFFF !important;
}


/* ============================================================
   t459 OKX-inspired pure-black visual polish (CSS only)
   Keeps layout / matrix 40px / books 376 / modal / DRY_RUN semantics.
   HK-Pulse brand retained — no third-party logos/marks.
   ============================================================ */

/* Surfaces */
.desk-body,
html, body { background: #000000; color: #FFFFFF; }
.topbar,
.panel,
.rail,
.books-rail,
.ctab-panel,
.book,
.rule-modal-panel,
.rule-modal-backdrop {
  background: #0D0E10;
}
.rule-modal-backdrop {
  background: rgba(0, 0, 0, 0.72);
}
.topbar,
.panel,
.rail,
.books-rail,
.book,
.rule-card,
.rule-modal-panel,
.pnl-meter,
.unit-input,
.stepper.united {
  border-color: #1E2025 !important;
}
.topbar { border-bottom: 1px solid #1E2025; }

/* Table: no heavy horizontal rules; faint row separators only */
.data-table thead th {
  border-bottom: 1px solid #1E2025;
  background: #0D0E10;
  color: #8E929B !important;
  font-size: 12px !important;
  font-weight: 500 !important;
}
.matrix-panel .data-table thead th {
  font-size: 12px !important;
  font-weight: 500 !important;
  color: #8E929B !important;
}
.data-table td {
  border-bottom: 1px solid #16181D;
  border-top: 0;
  color: #FFFFFF;
  font-size: 13.5px;
  font-weight: 600;
  font-family: var(--mono);
}
.data-table td.col-left,
.data-table td.col-rule,
.data-table td.col-status {
  font-family: var(--font);
  font-weight: 500;
}
.data-table tbody tr:hover td {
  background: #121317;
}

/* Card / panel titles — 15px / 600 / white */
.panel-head h2,
.books-rail-title,
.rules-panel-head h2,
.rail h2:not(.sr-only),
.rule-modal-head h2 {
  color: #FFFFFF !important;
  font-size: 15px !important;
  font-weight: 600 !important;
  letter-spacing: 0.01em;
}
.panel-head .sub,
.books-rail-head .sub,
.brand-sub {
  color: #8E929B !important;
  font-size: 12px !important;
  font-weight: 500;
}

/* Top capsules: strip redundant borders; keep lock / alert semantics */
.capsule {
  background: transparent;
  border: 0;
  padding: 4px 8px;
  color: #FFFFFF;
  font-weight: 500;
}
.capsule.mode {
  background: transparent;
  border: 0;
  color: #FFFFFF;
  font-weight: 600;
}
.capsule.bal {
  background: transparent;
  border: 0;
}
.capsule.bal strong {
  color: #FFFFFF;
  font-size: 13.5px;
  font-weight: 700;
}
.capsule.alert {
  background: transparent;
  border: 0;
  color: #FF4D6A;
  font-weight: 700;
}
.lamp.ok { background: #00D170; box-shadow: 0 0 6px rgba(0, 209, 112, 0.45); }
.lamp.stale { background: #F0B90B; }
.lamp.off { background: #FF4D6A; }

/* Status / spread: text signal colors — no border capsules */
.status-chip,
.spread-badge {
  display: inline;
  padding: 0 !important;
  margin: 0;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  min-width: 0;
  font-size: 12px;
  font-family: var(--font);
  white-space: nowrap;
}
.status-chip.watching {
  color: #8E929B !important;
  font-weight: 500;
  background: transparent !important;
  border: 0 !important;
}
.status-chip.hit {
  color: #00D170 !important;
  font-weight: 700;
  background: transparent !important;
  border: 0 !important;
}
.status-chip.insufficient,
.status-chip.pending {
  color: #5E626B !important;
  font-weight: 500;
  background: transparent !important;
  border: 0 !important;
}
/* Stale / auth failure stay high-contrast (not muted gray) */
.status-chip.stale {
  color: #FF4D6A !important;
  font-weight: 700;
  background: transparent !important;
  border: 0 !important;
}
.spread-badge {
  font-family: var(--mono);
  font-size: 13.5px;
  font-weight: 700;
  color: #FFFFFF;
}
.spread-badge.muted {
  color: #FFFFFF !important;
  background: transparent !important;
  border: 0 !important;
}
.spread-badge.hit {
  color: #00D170 !important;
  background: transparent !important;
  border: 0 !important;
}
.spread-badge.empty {
  color: #5E626B !important;
  background: transparent !important;
  border: 0 !important;
  font-weight: 500;
}
.quote-spread-hit td {
  background: rgba(0, 209, 112, 0.05) !important;
}
.quote-spread-hit td:first-child {
  box-shadow: inset 2px 0 0 #00D170;
}
.rule-hit-tag {
  display: inline;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #A1A6B0;
  font-size: 12px;
  font-weight: 500;
  background: transparent;
  border: 0;
  padding: 0;
}

/* Matrix row contract unchanged */
.matrix-panel .data-table tbody tr,
.matrix-panel .data-table tbody td {
  height: 40px;
  max-height: 40px;
}
.matrix-panel .data-table tbody td .spread-badge,
.matrix-panel .data-table tbody td .status-chip {
  max-height: none;
  line-height: 1.2;
}

/* Bottom tabs — OKX selected pill (white/light-gray, black text) */
.center-tabs {
  background: #0D0E10;
  border-bottom: 1px solid #1E2025;
  gap: 6px;
  padding: 8px 10px;
}
.ctab {
  background: transparent;
  border: 0;
  border-bottom: 0 !important;
  border-radius: 999px;
  color: #8E929B;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
}
.ctab:hover {
  color: #FFFFFF;
  background: rgba(255, 255, 255, 0.04);
}
.ctab.active,
.ctab[aria-selected="true"] {
  background: #F5F5F5 !important;
  color: #0D0E10 !important;
  font-weight: 600;
  border-bottom-color: transparent !important;
}
.ctab:focus-visible {
  outline: 2px solid #00D170;
  outline-offset: 2px;
}

/* Right book filters: focus/open look like light pill; native options stay readable */
.filters label {
  color: #8E929B;
  font-size: 12px;
  font-weight: 500;
}
.filters select,
.filters input {
  background: #121317;
  color: #FFFFFF;
  border: 1px solid #1E2025;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
}
.filters select:hover,
.filters input:hover {
  border-color: #2A2D33;
}
.filters select:focus,
.filters input:focus {
  background: #F5F5F5;
  color: #0D0E10;
  border-color: #F5F5F5;
  box-shadow: none;
}
/* Never force white-on-white dropdown options */
.filters select option,
.scope-block select option {
  background: #0D0E10;
  color: #FFFFFF;
}

/* Primary actions */
.btn-start {
  background: #00D170 !important;
  border: 1px solid #00D170 !important;
  color: #000000 !important;
  font-weight: 700 !important;
  box-shadow: none !important;
}
.btn-start:hover {
  background: #00B861 !important;
  border-color: #00B861 !important;
  color: #000000 !important;
}
.btn-start:disabled {
  background: rgba(0, 209, 112, 0.35) !important;
  border-color: rgba(0, 209, 112, 0.35) !important;
  color: #000000 !important;
  opacity: 1;
}
.btn-halt {
  background: #FF4D6A !important;
  border: 1px solid #FF4D6A !important;
  color: #FFFFFF !important;
  font-weight: 700 !important;
  box-shadow: none !important;
}
.btn-halt:hover {
  background: #E64560 !important;
  border-color: #E64560 !important;
  color: #FFFFFF !important;
}
.btn-halt:disabled {
  background: rgba(255, 77, 106, 0.45) !important;
  border-color: rgba(255, 77, 106, 0.45) !important;
  color: #FFFFFF !important;
  opacity: 1;
}

/* Left rule card desc + keep edit/delete contrast */
.rule-card .rule-summary {
  color: #A1A6B0 !important;
  font-size: 12px !important;
  font-weight: 500;
}
.rule-edit { color: #38BDF8 !important; }
.rule-del { color: #FB7185 !important; }
.pnl-micro-value.na,
.pnl-hero-value.na,
#acct-status,
#acct-closed-pnl.na,
#acct-open-exposure.na {
  color: #A1A6B0 !important;
}

/* Books rail width / heads unchanged */
.books-rail { width: var(--books-rail-w); min-width: var(--books-rail-w); }
.book-head-main { color: #FFFFFF; font-weight: 600; }
.book-head-sub { color: #8E929B; font-size: 11px; font-weight: 500; }

/* Brand mark: SVG asset (no OKX/Binance marks) */
.brand-mark { background: transparent; }
.brand-title, .brand-name-zh { color: #FFFFFF; }

/* Core numeric emphasis (signal colors still win for dirs / hit / stale) */
#acct-balance,
.pnl-hero-value:not(.na),
.data-table td.num,
.data-table td.col-num {
  color: #FFFFFF;
  font-size: 13.5px;
  font-weight: 700;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}
.data-table .dir-back, .data-table .tag-back, .data-table td.dir-eat { color: #00D170 !important; font-weight: 700; }
.data-table .dir-lay, .data-table .tag-lay, .data-table td.dir-hedge { color: #F0B90B !important; font-weight: 700; }
.data-table td.st-confirmed { color: #00D170 !important; font-weight: 700; }

/* Focus rings stay visible */
.btn:focus-visible,
.ctab:focus-visible,
.rule-edit:focus-visible,
.rule-del:focus-visible,
.filters select:focus-visible {
  outline: 2px solid #00D170;
  outline-offset: 2px;
}


/* ============================================================
   t460 display cleanup: drop verbose desk copy; amplify amounts
   ============================================================ */
.capsule.mode[hidden],
#mode-badge[hidden] {
  display: none !important;
}

/* Book heads keep a restrained silver direction subtitle on one line */
:root { --book-head-h: 36px; }
.book-head {
  height: var(--book-head-h);
  min-height: var(--book-head-h);
  max-height: var(--book-head-h);
  flex-basis: var(--book-head-h);
  gap: 0;
  padding: 0 10px;
}
.book-head-main {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
}
.book-head-sub {
  display: inline !important;
  height: auto;
  margin: 0 0 0 4px;
  padding: 0;
  color: #8E929B !important;
  font-size: 11px !important;
  font-weight: 500 !important;
  letter-spacing: 0.01em;
}

/* Credit amounts — owned by left account overview (t465); see .acct-credit-block */

/* Left PnL hero / micro amounts a touch clearer (sign colors preserved) */
.pnl-meter--compact .pnl-hero-value {
  font-size: 20px !important;
  font-weight: 800;
}
.pnl-micro-value:not(.na) {
  color: #FFFFFF;
  font-size: 13px;
  font-weight: 700;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

/* t461: non-positive quote spread — muted / dark-red, never green */
.spread-badge.neg {
  color: #FF4D6A !important;
  background: transparent !important;
  border: 0 !important;
  font-weight: 700;
}


/* t462 brand lockup — pulse mark + 港脉 / HK-Pulse hierarchy */
.brand-block:focus-within .brand-mark {
  box-shadow: 0 0 0 2px rgba(0, 209, 112, 0.35);
}
@media (max-width: 1100px) {
  .brand-name-en { display: none; }
}

svg.brand-mark {
  width: 30px;
  height: 30px;
  display: block;
  flex: 0 0 30px;
  overflow: visible;
}

/* t463: no session line under brand; freestanding pulse mark */
.brand-block .brand-sub,
#scope-select-label.brand-sub { display: none !important; height: 0; margin: 0; padding: 0; }



/* t464: meeting-select lives in account overview, not topbar */
.rail-scope-select {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  flex: 1 1 auto;
  max-width: 100%;
}
.rail-scope-select select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: 26px;
  padding: 2px 6px;
  font-size: 12px;
  font-weight: 600;
  color: #FFFFFF;
  background: #121317;
  border: 1px solid #1E2025;
  border-radius: 6px;
  font-variant-numeric: tabular-nums;
}
.rail-scope-select select:disabled {
  opacity: 1;
  color: #FFFFFF;
  -webkit-text-fill-color: #FFFFFF;
}
.pnl-meter--compact .pnl-scope.session-line {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1 1 auto;
  min-width: 0;
}
.topbar .scope-block { display: none; }


/* t465: account overview owns credit + meeting + updated time; topbar brand/actions only */
.topbar-spacer {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
}
.rail-conn.capsule.conn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border: 1px solid #1E2025;
  border-radius: 999px;
  background: #121317;
  color: #A1A6B0;
  font-size: 11px;
  font-weight: 600;
  flex: 0 0 auto;
  max-width: 46%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rail-conn .lamp { width: 7px; height: 7px; }
.pnl-meter--compact .pnl-scope.session-line {
  margin: 4px 0 6px;
}
.acct-credit-block {
  margin: 0 0 6px;
  padding: 6px 8px;
  border: 1px solid #1E2025;
  border-radius: 8px;
  background: #121317;
}
.acct-credit-label {
  color: #8E929B;
  font-size: 11px;
  font-weight: 500;
  margin-bottom: 2px;
}
.acct-credit-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
}
.acct-credit-block #acct-balance {
  color: #FFFFFF !important;
  font-family: var(--mono) !important;
  font-size: 20px !important;
  font-weight: 800 !important;
  letter-spacing: 0.01em;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 12px rgba(255, 255, 255, 0.08);
}
.acct-credit-block #acct-currency.cur {
  color: #A1A6B0;
  font-size: 12px;
  font-weight: 600;
}
.acct-alert {
  display: none;
  margin: 0 0 6px;
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px solid rgba(255, 77, 106, 0.45);
  background: rgba(255, 77, 106, 0.10);
  color: #FF8FA3;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.3;
}
.acct-alert:not([hidden]) { display: block; }
.acct-updated-row {
  margin-top: 6px;
  padding-top: 5px;
  border-top: 1px solid #16181D;
}
.acct-updated-row #updated-at,
#updated-at.updated {
  color: #8E929B;
  font-size: 11px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}
.pnl-meter--compact .pnl-hero-value {
  font-size: 16px !important;
  font-weight: 700;
}
.pnl-meter--compact .pnl-compact-body {
  margin-top: 2px;
}


/* t466: flat left-rail account + rules global-cap + icon actions */
.pnl-meter--flat {
  padding: 8px 10px 8px;
  margin-bottom: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
}
.acct-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  padding-bottom: 8px;
  border-bottom: 1px solid #1A1D24;
}
.acct-identity {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: #FFFFFF;
  font-size: 12px;
  font-weight: 600;
  flex: 1 1 auto;
}
.acct-identity .pill-sep { color: #5E626B; }
.acct-identity .rail-conn {
  margin-left: 4px;
  padding: 0;
  border: 0;
  background: transparent;
  max-width: none;
}
.acct-top-row .rail-scope-select {
  flex: 0 1 48%;
  max-width: 58%;
  min-width: 0;
}
.acct-top-row .rail-scope-select select {
  height: 26px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.acct-pnl-hero {
  padding: 10px 0 8px;
  border-bottom: 1px solid #1A1D24;
}
.acct-pnl-hero .pnl-hero-label {
  font-size: 11px;
  color: #8E929B;
  margin-bottom: 4px;
  font-weight: 500;
}
.pnl-meter--flat #acct-pl.pnl-hero-value,
.acct-pnl-hero #acct-pl {
  font-family: var(--mono) !important;
  font-size: 22px !important;
  font-weight: 800 !important;
  line-height: 1.15;
  letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums;
  color: #FFFFFF;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.acct-pnl-hero #acct-pl.pos { color: #00D170 !important; }
.acct-pnl-hero #acct-pl.neg { color: #FF4D6A !important; }
.acct-pnl-hero #acct-pl.zero { color: #FFFFFF !important; }
.acct-pnl-hero #acct-pl.na { color: #A1A6B0 !important; font-size: 18px !important; font-weight: 700 !important; }
.acct-metrics-row { /* legacy alias; t469 uses .acct-metrics */ display: block; }
.acct-metric {
  min-width: 0;
  padding: 0 8px;
  border-right: 1px solid #1A1D24;
}
.acct-metric:first-child { padding-left: 0; }
.acct-metric:last-child { padding-right: 0; border-right: 0; }
.acct-metric-label {
  color: #8E929B;
  font-size: 10px;
  font-weight: 500;
  margin-bottom: 3px;
  white-space: nowrap;
}
.acct-metric-value-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 3px 4px;
  min-width: 0;
}
.acct-metric-value {
  color: #FFFFFF;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
}
.acct-metric-value.na { color: #A1A6B0; }
.acct-updated-row {
  margin-top: 0;
  padding-top: 6px;
  border-top: 0;
}
.acct-alert { margin: 8px 0 0; }
/* t468: do NOT stack metrics to 1 col at 1360 — that made 3 full rows on notebooks */

/* global cap inside rules panel */
.rules-global-cap-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: nowrap;
  margin: 0 0 8px;
  padding: 0 0 8px;
  border-bottom: 1px solid #1A1D24;
  min-width: 0;
}
.rules-global-cap-row .global-cap-label-wrap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: 0 1 auto;
  min-width: 0;
  white-space: nowrap;
}
.rules-global-cap-row .global-cap-label-wrap label {
  color: #A1A6B0;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  line-height: 1;
  margin: 0;
}
.rules-global-cap-row .global-cap-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}
.rules-global-cap-row .unit-input {
  width: 88px;
  display: inline-flex;
  align-items: center;
}
.rules-global-cap-row .unit-input input {
  height: 28px;
  width: 100%;
}
.rules-global-cap-row .btn-global-save {
  height: 28px;
  padding: 0 10px;
  white-space: nowrap;
}

/* rule cards: structured summary + icon buttons */
.rule-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 10px;
}
.rule-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}
.rule-card .rule-name {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 13px;
  font-weight: 700;
  color: #FFFFFF;
  overflow-wrap: anywhere;
}
.rule-card .rule-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
}
.rule-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #8E929B;
  cursor: pointer;
}
.rule-icon-btn .rule-ico {
  pointer-events: none; /* clicks hit button; closest() still works */
  display: block;
}
.rule-icon-btn.rule-edit:hover,
.rule-icon-btn.rule-edit:focus-visible {
  color: #00D170;
  background: rgba(0, 209, 112, 0.08);
  outline: none;
}
.rule-icon-btn.rule-del:hover,
.rule-icon-btn.rule-del:focus-visible {
  color: #FF4D6A;
  background: rgba(255, 77, 106, 0.08);
  outline: none;
}
.rule-summary-struct {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  min-width: 0;
}
.sum-pools {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
}
.sum-pool {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 4px;
  background: #16181D;
  color: #EAECEF;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.sum-item {
  color: #A1A6B0;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.sum-eat { color: #EAECEF; }
.sum-sell { color: #EAECEF; }
.sum-limit {
  color: #8E929B;
  font-family: var(--mono);
}
/* legacy text edit/del hidden if any */
.rule-edit:not(.rule-icon-btn),
.rule-del:not(.rule-icon-btn) { display: none !important; }


/* t468: account card top-row + compact metrics only (rules/global untouched) */
.pnl-meter--flat .acct-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  flex-wrap: nowrap;
}
.pnl-meter--flat .acct-identity {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1 1 auto;
  max-width: calc(100% - 7.5rem);
  overflow: hidden;
}
.pnl-meter--flat .acct-identity-text {
  display: inline-block;
  min-width: 0;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 12px;
  font-weight: 600;
  color: #FFFFFF;
  line-height: 1.2;
}
.pnl-meter--flat .acct-identity-text .pill-sep { color: #5E626B; font-weight: 500; }
.pnl-meter--flat .acct-identity .status-dot {
  flex: 0 0 auto;
}
/* text-like meeting trigger: closed shows current value only; native popup on click */
.pnl-meter--flat .acct-meeting-trigger {
  flex: 0 0 auto;
  max-width: 46%;
  min-width: 0;
}
.pnl-meter--flat .acct-meeting-trigger select#meeting-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  display: block;
  width: auto;
  max-width: 100%;
  min-width: 0;
  height: 22px;
  max-height: 22px;
  margin: 0;
  padding: 0 14px 0 0;
  border: 0;
  border-radius: 0;
  background-color: transparent;
  background-image: linear-gradient(45deg, transparent 50%, #8E929B 50%), linear-gradient(135deg, #8E929B 50%, transparent 50%);
  background-position: calc(100% - 6px) 8px, calc(100% - 1px) 8px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  color: #A1A6B0;
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 22px;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  cursor: pointer;
  box-shadow: none;
}
.pnl-meter--flat .acct-meeting-trigger select#meeting-select:focus {
  outline: none;
  color: #FFFFFF;
  border: 0;
  box-shadow: none;
}
.pnl-meter--flat .acct-meeting-trigger select#meeting-select:disabled {
  cursor: default;
  opacity: 1;
  color: #A1A6B0;
  -webkit-text-fill-color: #A1A6B0;
}
/* meeting-select size clamped via HTML size=1 + max-height */

.pnl-meter--flat .acct-pnl-hero #acct-pl {
  font-size: 22px !important;
}
/* t468 3-col metrics superseded by t469 credit-full + pair */


/* t469: credit balance full-width single line; closed/open as 2-col pair */
.pnl-meter--flat .acct-metrics {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px 0;
  border-bottom: 1px solid #1A1D24;
  min-width: 0;
}
.pnl-meter--flat .acct-credit-full {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  width: 100%;
}
.pnl-meter--flat .acct-credit-full .acct-metric-label {
  flex: 0 0 auto;
  font-size: 10px;
  margin: 0;
  white-space: nowrap;
  color: #8E929B;
}
.pnl-meter--flat .acct-credit-amount-row {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  min-width: 0;
  flex: 1 1 auto;
  justify-content: flex-end;
  overflow: hidden;
}
.pnl-meter--flat .acct-metrics #acct-balance {
  color: #FFFFFF !important;
  font-family: var(--mono) !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  line-height: 1.2 !important;
  font-variant-numeric: tabular-nums;
  white-space: nowrap !important;
  overflow: hidden;
  text-overflow: clip; /* show full when fits; never break digits mid-amount */
  word-break: normal !important;
  overflow-wrap: normal !important;
  text-shadow: none !important;
}
.pnl-meter--flat .acct-metrics #acct-currency.cur {
  flex: 0 0 auto;
  color: #8E929B;
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}
.pnl-meter--flat .acct-metrics-pair {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 0 8px;
  min-width: 0;
}
.pnl-meter--flat .acct-metrics-pair .acct-metric {
  min-width: 0;
  padding: 0 8px 0 0 !important;
  border-right: 1px solid #1A1D24;
  border-bottom: 0 !important;
}
.pnl-meter--flat .acct-metrics-pair .acct-metric:last-child {
  padding-right: 0 !important;
  border-right: 0;
}
.pnl-meter--flat .acct-metrics-pair .acct-metric-label {
  font-size: 10px;
  margin-bottom: 2px;
  white-space: nowrap;
}
.pnl-meter--flat .acct-metrics-pair .acct-metric-value {
  font-size: 13px !important;
  font-weight: 700 !important;
  line-height: 1.2 !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis; /* secondary metrics may ellipsis; credit must not */
  word-break: normal;
  overflow-wrap: normal;
}
