:root {
  color-scheme: light;
  --canvas: #f0f3fa;
  --surface: #ffffff;
  --surface-solid: #ffffff;
  --surface-muted: #f8f9fd;
  --surface-hover: #f0f3fa;
  --surface-active: #e3effd;
  --popup-surface: #ffffff;
  --dialog-backdrop: rgba(8, 12, 20, 0.52);
  --border: #e0e3eb;
  --border-strong: #b2b5be;
  --text: #131722;
  --text-muted: #434651;
  --text-soft: #6a6d78;
  --accent: #2962ff;
  --accent-soft: #e3effd;
  --control-primary: #2962ff;
  --control-primary-hover: #1e53e5;
  --control-primary-active: #1848cc;
  --control-primary-text: #ffffff;
  --up: #f23645;
  --down: #089981;
  --up-text: #d32f3f;
  --down-text: #00796b;
  --warning: #a35c00;
  --warning-soft: #fff3e0;
  --danger: #d32f3f;
  --danger-soft: #ffebec;
  --success: #00796b;
  --focus-ring: rgba(41, 98, 255, 0.32);
  --shadow: none;
  --shadow-soft: none;
  --shadow-popup: 0 8px 24px rgba(19, 23, 34, 0.16), 0 2px 8px rgba(19, 23, 34, 0.08);
  --radius-lg: 6px;
  --radius-md: 6px;
  --radius-sm: 4px;
  --chart-grid: #e0e3eb;
  --chart-crosshair: #787b86;
  --chart-axis: #6a6d78;
  --ema: #2962ff;
  --pa-trend: #2962ff;
  --pa-trend-fill: rgba(41, 98, 255, 0.08);
  --pa-trend-terminal: rgba(41, 98, 255, 0.035);
  --pa-breakout: #a35c00;
  --pa-breakout-fill: rgba(255, 152, 0, 0.09);
  --pa-breakout-terminal: rgba(255, 152, 0, 0.04);
  --pa-range: #9c27b0;
  --pa-range-fill: rgba(156, 39, 176, 0.08);
  --pa-range-terminal: rgba(156, 39, 176, 0.035);
  --pa-mtr: #00796b;
  --pa-mtr-fill: rgba(0, 137, 123, 0.08);
  --pa-mtr-terminal: rgba(0, 137, 123, 0.035);
  --pa-label-text: #ffffff;
  --level-support: rgba(8, 153, 129, 0.82);
  --level-support-fill: rgba(8, 153, 129, 0.10);
  --level-resistance: rgba(242, 54, 69, 0.82);
  --level-resistance-fill: rgba(242, 54, 69, 0.10);
  --level-midpoint: rgba(156, 39, 176, 0.72);
  --level-reference: rgba(41, 98, 255, 0.72);
  --level-execution: rgba(212, 123, 0, 0.88);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  /* 深色终端：更深的底色拉开图表与面板层次，文字对比度按盘中长时间盯盘调校。 */
  --canvas: #0b0e14;
  --surface: #131722;
  --surface-solid: #131722;
  --surface-muted: #181c27;
  --surface-hover: #242938;
  --surface-active: rgba(41, 98, 255, 0.22);
  --popup-surface: #1b2030;
  --dialog-backdrop: rgba(3, 6, 12, 0.68);
  --border: #262b38;
  --border-strong: #3b4152;
  --text: #d8dbe3;
  --text-muted: #b2b5be;
  --text-soft: #8a8e9a;
  --accent: #5b8cff;
  --accent-soft: rgba(41, 98, 255, 0.18);
  --control-primary: #2962ff;
  --control-primary-hover: #1e53e5;
  --control-primary-active: #1848cc;
  --control-primary-text: #ffffff;
  --up: #f7525f;
  --down: #22ab94;
  --up-text: #f7525f;
  --down-text: #22ab94;
  --warning: #ffb74d;
  --warning-soft: rgba(255, 152, 0, 0.14);
  --danger: #f7525f;
  --danger-soft: rgba(242, 54, 69, 0.15);
  --success: #22ab94;
  --focus-ring: rgba(91, 140, 255, 0.4);
  --shadow: none;
  --shadow-soft: none;
  --shadow-popup: 0 8px 28px rgba(0, 0, 0, 0.46), 0 2px 8px rgba(0, 0, 0, 0.32);
  --chart-grid: #242832;
  --chart-crosshair: #787b86;
  --chart-axis: #b2b5be;
  --ema: #5b8cff;
  --pa-trend: #5b8cff;
  --pa-trend-fill: rgba(91, 140, 255, 0.10);
  --pa-trend-terminal: rgba(91, 140, 255, 0.045);
  --pa-breakout: #ffb74d;
  --pa-breakout-fill: rgba(255, 183, 77, 0.10);
  --pa-breakout-terminal: rgba(255, 183, 77, 0.045);
  --pa-range: #bb86fc;
  --pa-range-fill: rgba(187, 134, 252, 0.10);
  --pa-range-terminal: rgba(187, 134, 252, 0.045);
  --pa-mtr: #26c6da;
  --pa-mtr-fill: rgba(38, 198, 218, 0.10);
  --pa-mtr-terminal: rgba(38, 198, 218, 0.045);
  --pa-label-text: #131722;
  --level-support: rgba(34, 171, 148, 0.82);
  --level-support-fill: rgba(34, 171, 148, 0.10);
  --level-resistance: rgba(247, 82, 95, 0.82);
  --level-resistance-fill: rgba(247, 82, 95, 0.10);
  --level-midpoint: rgba(187, 134, 252, 0.76);
  --level-reference: rgba(91, 140, 255, 0.76);
  --level-execution: rgba(255, 183, 77, 0.90);
}
* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
html {
  min-width: 320px;
  background: var(--canvas);
  scrollbar-color: var(--border-strong) transparent;
  scrollbar-width: thin;
}
*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
*::-webkit-scrollbar-track {
  background: transparent;
}
*::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: 999px;
  background: var(--border-strong);
  background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover {
  background: var(--text-soft);
  background-clip: padding-box;
}
body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background: var(--canvas);
  color: var(--text);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}
button,
select {
  font: inherit;
}
button,
select,
input,
summary,
a {
  -webkit-tap-highlight-color: transparent;
}
button:focus-visible,
select:focus-visible,
input:focus-visible,
summary:focus-visible,
a:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}
.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 60px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-solid);
  box-shadow: none;
}
.brand {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  color: inherit;
  text-decoration: none;
  padding-right: 8px;
}
.brand-mark {
  display: block;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  object-fit: contain;
}
.brand strong,
.brand small {
  display: block;
}
.brand strong {
  letter-spacing: -0.01em;
}
.brand small {
  color: var(--text-muted);
  font-size: 12px;
}
.page-nav {
  display: flex;
  align-self: stretch;
  align-items: center;
  gap: 2px;
}
.page-nav-link {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 18px;
  text-decoration: none;
  white-space: nowrap;
}
.page-nav-link:hover {
  background: var(--surface-hover);
  color: var(--text);
}
.page-nav-link[aria-current="page"] {
  border-color: color-mix(in srgb, var(--accent) 20%, transparent);
  background: var(--accent-soft);
  color: var(--accent);
}
.status-pill {
  display: inline-flex;
  margin-left: 0;
  min-height: 30px;
  align-items: center;
  gap: 8px;
  padding: 5px 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}
.theme-switcher {
  position: relative;
  z-index: 40;
  margin-left: auto;
  color: var(--text-muted);
}
.theme-switcher > summary {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  gap: 7px;
  padding: 5px 9px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  list-style: none;
  user-select: none;
}
.theme-switcher > summary::-webkit-details-marker {
  display: none;
}
.theme-switcher > summary:hover,
.theme-switcher[open] > summary {
  border-color: var(--border);
  background: var(--surface-hover);
  color: var(--text);
}
.theme-switcher > summary svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.6;
}
.theme-current {
  white-space: nowrap;
}
.theme-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  display: grid;
  width: 148px;
  gap: 2px;
  padding: 5px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--popup-surface);
  box-shadow: var(--shadow-popup);
}
.theme-switcher:not([open]) > .theme-menu {
  display: none;
}
.theme-menu button {
  min-height: 32px;
  padding: 5px 9px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  text-align: left;
  cursor: pointer;
}
.theme-menu button:hover {
  background: var(--surface-hover);
  color: var(--text);
}
.theme-menu button.is-active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 750;
}
.theme-menu button.is-active::after {
  float: right;
  content: "✓";
}
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-soft);
  box-shadow: none;
}
.status-connected {
  color: var(--success);
}
.status-connected .status-dot {
  background: var(--success);
  box-shadow: none;
}
.status-loading .status-dot {
  background: var(--accent);
  box-shadow: none;
  animation: status-pulse 1.6s ease-in-out infinite;
}
.status-error {
  color: var(--danger);
}
.status-error .status-dot {
  background: var(--danger);
  box-shadow: none;
}
@keyframes status-pulse {
  50% {
    opacity: 0.38;
  }
}
.app-shell {
  width: min(100% - 32px, 1800px);
  margin: clamp(14px, 2vw, 24px) auto 24px;
}
body.market-page {
  display: grid;
  grid-template-rows: 60px minmax(0, 1fr);
  width: 100%;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}
.market-page > .app-header {
  position: relative;
  height: 60px;
  min-height: 60px;
}
.market-page .app-shell {
  display: flex;
  width: 100%;
  height: 100%;
  min-height: 0;
  flex-direction: column;
  margin: 0;
  padding: 12px;
  overflow: hidden;
}
.market-overview,
.chart-card,
.message-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}
.market-overview,
.chart-card {
  margin-bottom: 12px;
}
.market-overview {
  padding: clamp(16px, 2vw, 22px);
}
.chart-toolbar,
.contract-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
h1,
h2,
p {
  margin-top: 0;
}
h1,
h2 {
  margin-bottom: 0;
  letter-spacing: -0.02em;
  line-height: 1.18;
}
h1 {
  font-size: clamp(21px, 2.1vw, 27px);
}
h2 {
  font-size: clamp(18px, 1.8vw, 22px);
}
.contract-meta {
  margin-bottom: 0;
  color: var(--text-muted);
  font-size: 12px;
}
.selector-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
.field {
  display: grid;
  gap: 5px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}
.custom-select {
  position: relative;
  min-width: 0;
}
.custom-select.is-open {
  z-index: 30;
}
.custom-select-trigger {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 18px;
  width: 100%;
  min-height: 42px;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 0 10px 0 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-solid);
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
  line-height: 1.25;
  text-align: left;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 140ms ease, background-color 140ms ease,
  box-shadow 140ms ease;
}
.custom-select-trigger:hover:not(:disabled) {
  border-color: var(--border-strong);
  background: var(--surface-hover);
}
.custom-select-trigger:active:not(:disabled) {
  background: var(--surface-active);
}
.custom-select.is-open .custom-select-trigger {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent);
}
.custom-select-trigger:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}
.custom-select-value {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.custom-select-chevron {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
  transition: transform 140ms ease;
}
.custom-select.is-open .custom-select-chevron {
  transform: rotate(180deg);
}
.custom-select-listbox {
  position: absolute;
  z-index: 40;
  inset: calc(100% + 4px) 0 auto;
  width: 100%;
  max-height: min(280px, 45dvh);
  margin: 0;
  padding: 4px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--popup-surface);
  box-shadow: var(--shadow-popup);
}
.custom-select-option {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 16px;
  min-height: 36px;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 3px;
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
}
.custom-select-option.is-active {
  background: var(--surface-hover);
}
.custom-select-option[aria-selected="true"] {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 750;
}
.custom-select-option[aria-selected="true"].is-active {
  background: color-mix(in srgb, var(--accent) 18%, var(--surface-solid));
}
.custom-select-option[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.46;
}
.custom-select-option-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.custom-select-check {
  color: var(--accent);
  font-size: 14px;
  line-height: 1;
  opacity: 0;
  text-align: center;
}
.custom-select-option[aria-selected="true"] .custom-select-check {
  opacity: 1;
}
.button {
  min-height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-solid);
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
  transition: border-color 140ms ease, background-color 140ms ease, color 140ms ease;
}
.button:hover:not(:disabled) {
  border-color: var(--border-strong);
  background: var(--surface-hover);
}
.button:active:not(:disabled) {
  border-color: var(--border-strong);
  background: var(--surface-active);
}
.button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}
.button {
  padding: 6px 13px;
}
.button-secondary {
  background: transparent;
}
.message-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
  padding: 12px 14px;
}
.message-panel p {
  margin: 4px 0 0;
  color: var(--text-muted);
}
.message-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
}
.message-actions a.button {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}
.message-warning {
  border-color: color-mix(in srgb, var(--warning) 35%, var(--border));
  background: var(--warning-soft);
}
.message-fatal {
  border-color: color-mix(in srgb, var(--danger) 38%, var(--border));
  background: var(--danger-soft);
}
.contract-hero {
  align-items: center;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.contract-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.main-badge {
  padding: 2px 6px;
  border: 1px solid color-mix(in srgb, var(--accent) 36%, transparent);
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}
.contract-meta {
  margin-top: 5px;
}
.overview-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}
.price-block {
  display: grid;
  justify-items: end;
  min-width: 168px;
}
.metric-label {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}
.hero-price {
  margin-top: 2px;
  font-size: clamp(29px, 3.6vw, 40px);
  line-height: 1.08;
  letter-spacing: -0.045em;
}
.price-change {
  min-height: 23px;
  margin-top: 4px;
  font-size: 14px;
  font-weight: 800;
}
.trend-up {
  color: var(--up-text) !important;
}
.trend-down {
  color: var(--down-text) !important;
}
.trend-flat {
  color: var(--text-muted) !important;
}
.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin-top: 16px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--border);
}
.metric-card {
  min-width: 0;
  padding: 11px 12px;
  border: 0;
  border-radius: 0;
  background: var(--surface-muted);
}
.metric-card strong,
.metric-card small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.metric-card strong {
  margin-top: 3px;
  font-size: 16px;
}
.metric-card small {
  margin-top: 2px;
  color: var(--text-soft);
  font-size: 12px;
}
.metric-divider {
  color: var(--text-soft);
  font-weight: 400;
}
.chart-card {
  container-name: chart-card;
  container-type: inline-size;
  overflow: hidden;
}
/* All native dialogs share one shell; individual dialogs only size their content. */
.app-dialog {
  --dialog-padding: 20px;
  width: min(480px, calc(100dvw - 48px));
  max-width: none;
  max-height: calc(100dvh - 48px);
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--popup-surface);
  box-shadow: var(--shadow-popup);
  color: var(--text);
}
.app-dialog[open] {
  display: flex;
  flex-direction: column;
}
.app-dialog::backdrop {
  background: var(--dialog-backdrop);
}
.dialog-header {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px var(--dialog-padding);
  border-bottom: 1px solid var(--border);
}
.dialog-heading {
  min-width: 0;
}
.dialog-header h2 {
  margin: 0;
  font-size: 17px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.dialog-description {
  margin: 4px 0 0;
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.6;
}
.dialog-close {
  display: grid;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  place-items: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
}
.dialog-close:hover {
  border-color: var(--border);
  background: var(--surface-hover);
  color: var(--text);
}
.dialog-close:active {
  background: var(--surface-active);
}
.dialog-close svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.8;
}
.dialog-body {
  display: grid;
  flex: 1 1 auto;
  min-height: 0;
  gap: 16px;
  padding: var(--dialog-padding);
  overflow: auto;
  overscroll-behavior: contain;
  font-size: 13px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.dialog-footer {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px var(--dialog-padding);
  border-top: 1px solid var(--border);
  background: var(--surface-muted);
}
.dialog-header form,
.dialog-footer form {
  margin: 0;
}
.dialog-footer .button {
  min-height: 38px;
  justify-content: center;
}
.action-log-dialog {
  width: min(1040px, calc(100dvw - 48px));
  height: min(80dvh, 760px);
}
.action-list-toolbar {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 20px;
  padding: 12px var(--dialog-padding);
  border-bottom: 1px solid var(--border);
  background: var(--surface-muted);
}
.action-list-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  color: var(--text-soft);
  font-size: 12px;
}
.action-list-stats span {
  display: flex;
  align-items: center;
  gap: 8px;
}
.action-list-stats strong {
  color: var(--text);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.action-list-sort {
  color: var(--text-soft);
  font-size: 11px;
}
.action-list-body {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  overflow: hidden;
}
.action-list-columns,
.action-list-row {
  display: grid;
  grid-template-columns: minmax(220px, 2fr) minmax(70px, 0.55fr) minmax(82px, 0.65fr) minmax(54px, 0.4fr) minmax(102px, 0.72fr);
  align-items: center;
  gap: 14px;
}
.action-list-columns {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 8px var(--dialog-padding);
  border-bottom: 1px solid var(--border);
  background: var(--popup-surface);
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 600;
}
.action-list {
  min-height: 0;
  max-height: none;
  flex: 1;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  list-style: none;
}
.action-list:empty {
  display: none;
}
.action-list:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 36%, transparent);
  outline-offset: -3px;
}
.action-list-item + .action-list-item {
  border-top: 1px solid var(--border);
}
.action-list-row {
  position: relative;
  width: 100%;
  min-height: 62px;
  padding: 11px var(--dialog-padding);
  border: 0;
  background: var(--popup-surface);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: background-color 140ms ease, border-color 140ms ease;
}
.action-list-row:hover {
  background: var(--surface-hover);
}
.action-list-row.is-selected {
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent);
}
.action-list-row[data-family="trend_pullback"] {
  --action-family: var(--pa-trend);
}
.action-list-row[data-family="breakout"] {
  --action-family: var(--pa-breakout);
}
.action-list-row[data-family="range_reversal"] {
  --action-family: var(--pa-range);
}
.action-list-row[data-family="major_trend_reversal"] {
  --action-family: var(--pa-mtr);
}
.action-list-identity {
  display: grid;
  min-width: 0;
}
.action-list-identity strong,
.action-list-identity small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.action-list-identity strong {
  font-size: 13px;
}
.action-list-identity small {
  margin-top: 2px;
  color: var(--text-soft);
  font-size: 11px;
}
.action-list-identity .action-list-family-meta {
  width: fit-content;
  padding: 2px 5px;
  background: color-mix(in srgb, var(--action-family) 13%, var(--surface-solid));
  color: var(--action-family);
}
.action-list-mobile-meta {
  display: none;
}
.action-list-direction,
.action-list-state,
.action-list-known {
  color: var(--text-muted);
  font-size: 12px;
}
.action-list-direction {
  font-weight: 800;
}
.direction-bullish {
  color: var(--up-text);
}
.direction-bearish {
  color: var(--down-text);
}
.direction-bidirectional {
  color: var(--warning);
}
.action-list-state {
  justify-self: start;
  padding: 2px 6px;
  border: 1px solid var(--border);
  background: var(--surface-muted);
  font-size: 11px;
  font-weight: 750;
  white-space: nowrap;
}
.action-list-row[data-state="SIGNAL_READY"] .action-list-state {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  color: var(--accent);
}
.action-list-row[data-state="TRIGGERED"] .action-list-state {
  border-color: color-mix(in srgb, var(--warning) 45%, var(--border));
  color: var(--warning);
}
.action-list-row[data-state="CONFIRMED"] .action-list-state {
  border-color: color-mix(in srgb, var(--success) 45%, var(--border));
  color: var(--success);
}
.action-list-row[data-state="INVALIDATED"],
.action-list-row[data-state="EXPIRED"],
.action-list-row[data-state="NOT_TRIGGERED"],
.action-list-row[data-state="FAILED"] {
  opacity: 0.68;
}
.action-list-quality {
  display: flex;
  align-items: baseline;
  gap: 3px;
  font-family: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-variant-numeric: tabular-nums;
}
.action-list-quality strong {
  font-size: 15px;
}
.action-list-quality small {
  color: var(--text-soft);
  font-size: 11px;
}
.action-list-known {
  font-family: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.action-list-empty {
  display: grid;
  min-height: 0;
  flex: 1;
  place-content: center;
  margin: 0;
  padding: 34px 18px;
  color: var(--text-soft);
  text-align: center;
}
.action-list-footer {
  justify-content: space-between;
  color: var(--text-soft);
  font-size: 12px;
}
.chart-toolbar {
  align-items: center;
  min-height: 40px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-muted);
}
.chart-title-block {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
}
.chart-title-block .chart-style-icon {
  width: 26px;
  height: 26px;
}
.chart-toolbar h2 {
  font-size: 16px;
}
.analysis-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  min-height: 44px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-solid);
}
.analysis-toolbar-label {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  gap: 6px;
  padding-right: 11px;
  border-right: 1px solid var(--border);
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 750;
  white-space: nowrap;
}
.analysis-toolbar-label svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.7;
}
.family-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.analysis-toggle,
.family-filter {
  min-height: 30px;
  padding: 4px 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-solid);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.analysis-toggle:hover,
.family-filter:hover,
.annotation-filter summary:hover {
  border-color: var(--border-strong);
  background: var(--surface-hover);
  color: var(--text);
}
.analysis-toggle.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}
.level-view-control {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  gap: 6px;
  padding-left: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-solid);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}
.level-view-control select {
  align-self: stretch;
  min-width: 92px;
  border: 0;
  border-left: 1px solid var(--border);
  background: var(--surface-solid);
  color: var(--text);
  padding: 3px 7px;
}
.family-trend {
  --family-color: var(--pa-trend);
}
.family-breakout {
  --family-color: var(--pa-breakout);
}
.family-range {
  --family-color: var(--pa-range);
}
.family-mtr {
  --family-color: var(--pa-mtr);
}
.family-filter {
  transition: background-color 160ms ease, border-color 160ms ease,
  color 160ms ease, opacity 160ms ease;
}
.family-filter.is-active {
  background: color-mix(in srgb, var(--family-color) 14%, var(--surface-solid));
  color: var(--family-color);
}
.family-filter.is-active:hover {
  border-color: color-mix(in srgb, var(--family-color) 32%, var(--border-strong));
  background: color-mix(in srgb, var(--family-color) 20%, var(--surface-solid));
  color: var(--family-color);
}
.family-filter:not(.is-active) {
  background: var(--surface-muted);
  color: var(--text-soft);
  opacity: 0.62;
}
.family-filter:not(.is-active):hover {
  background: var(--surface-solid);
  color: var(--text-muted);
  opacity: 0.86;
}
.annotation-filter {
  position: relative;
}
.annotation-filter summary {
  min-height: 30px;
  padding: 5px 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-solid);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}
.annotation-filter summary::-webkit-details-marker {
  display: none;
}
.annotation-filter summary::after {
  content: "▾";
  margin-left: 7px;
  color: var(--text-soft);
}
.annotation-filter[open] summary::after {
  content: "▴";
}
.annotation-filter-menu {
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  left: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(110px, 1fr));
  gap: 2px 12px;
  width: 260px;
  min-width: 0;
  max-width: calc(100vw - 20px);
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--popup-surface);
  box-shadow: var(--shadow-popup);
}
.annotation-filter-menu label {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  color: var(--text-muted);
  font-size: 12px;
  white-space: nowrap;
  cursor: pointer;
}
.annotation-filter-menu input {
  accent-color: var(--accent);
}
.direction-filter-menu {
  grid-template-columns: minmax(110px, 1fr);
}
.overlap-filter-menu {
  grid-template-columns: minmax(0, 1fr);
}
.overlap-filter-menu label {
  white-space: normal;
}
.annotation-filter-note {
  grid-column: 1 / -1;
  margin: 5px 0 0;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.45;
}
.action-log-open {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  gap: 7px;
  padding: 4px 6px 4px 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-solid);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}
.action-log-open:hover {
  border-color: var(--border-strong);
  background: var(--surface-hover);
  color: var(--text);
}
.action-log-open strong {
  min-width: 22px;
  padding: 1px 5px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent);
  font: 800 11px/1.5 ui-monospace, "SFMono-Regular", Consolas, monospace;
  text-align: center;
}
.annotation-count {
  color: var(--text-soft);
  font-size: 12px;
}
.analysis-layer-label {
  margin-left: auto;
  padding-right: 0;
  padding-left: 11px;
  border-right: 0;
  border-left: 1px solid var(--border);
}
.ohlc-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px 12px;
  margin: 0;
}
.ohlc-legend div {
  display: flex;
  gap: 5px;
}
.ohlc-legend dt {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}
.ohlc-legend dd {
  margin: 0;
  font-size: 12px;
  font-weight: 750;
}
.chart-stage {
  position: relative;
  min-width: 0;
  min-height: 420px;
  background: var(--surface-solid);
}
.chart-workspace {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  background: var(--surface-solid);
}
.chart {
  width: 100%;
  height: clamp(420px, 46vw, 580px);
}
.latest-price-label {
  --latest-price-label-color: var(--up);
  position: absolute;
  z-index: 18;
  right: 0;
  display: grid;
  min-width: 64px;
  overflow: hidden;
  border-radius: 3px 0 0 3px;
  box-shadow: 0 1px 3px color-mix(in srgb, var(--latest-price-label-color) 32%, transparent);
  color: var(--surface-solid);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  pointer-events: none;
  transition: opacity 80ms ease;
}
.latest-price-label[data-direction="down"] {
  --latest-price-label-color: var(--down);
}
.latest-price-label.is-crosshair-collision {
  opacity: 0;
}
.latest-price-label strong,
.latest-price-label span {
  display: block;
  min-width: 0;
  padding-inline: 4px;
  overflow: hidden;
  text-align: center;
  text-overflow: clip;
  white-space: nowrap;
}
.latest-price-label strong {
  min-height: 18px;
  padding-block: 3px 2px;
  background: var(--latest-price-label-color);
  font-size: 12px;
  font-weight: 800;
}
.latest-price-label span {
  min-height: 16px;
  padding-block: 2px 3px;
  border-top: 1px solid color-mix(in srgb, var(--surface-solid) 38%, transparent);
  background: color-mix(in srgb, var(--latest-price-label-color) 88%, #000000);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.02em;
}
.chart-loading {
  position: absolute;
  z-index: 24;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 7px;
  padding: 24px;
  background: color-mix(in srgb, var(--surface-solid) 90%, transparent);
  color: var(--text-muted);
  text-align: center;
}
.chart-loading small {
  max-width: 32rem;
}
.annotation-tooltip {
  position: absolute;
  z-index: 22;
  max-width: 260px;
  padding: 7px 9px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--surface-solid) 96%, transparent);
  box-shadow: var(--shadow);
  color: var(--text);
  font-size: 12px;
  line-height: 1.45;
  pointer-events: none;
}
.annotation-tooltip strong,
.annotation-tooltip span {
  display: block;
}
.annotation-tooltip span {
  color: var(--text-muted);
}
.annotation-detail {
  display: flex;
  flex-direction: column;
  container-name: annotation-detail-card;
  container-type: inline-size;
  min-width: 0;
  width: 100%;
  max-height: none;
  overflow: visible;
  padding: 14px;
  border: 1px solid var(--border-strong);
  border-width: 1px 0 0;
  border-radius: 0;
  background: var(--surface);
  box-shadow: none;
  scrollbar-width: none;
}
.annotation-detail::-webkit-scrollbar {
  display: none;
}
.annotation-detail:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 36%, transparent);
  outline-offset: -3px;
}
.annotation-detail-heading {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  min-width: 0;
  gap: 12px;
}
.annotation-detail-heading h3 {
  min-width: 0;
  margin: 4px 0 0;
  font-size: 16px;
  overflow-wrap: anywhere;
}
.annotation-detail-empty {
  display: grid;
  flex: 1;
  min-height: 190px;
  place-content: center;
  justify-items: center;
  gap: 8px;
  padding: 28px 18px;
  color: var(--text-muted);
  text-align: center;
}
.annotation-detail-empty-icon {
  width: 46px;
  height: 46px;
  margin-bottom: 4px;
  padding: 8px;
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--border));
  border-radius: 50%;
  background: var(--accent-soft);
  fill: var(--surface-solid);
  stroke: var(--accent);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}
.annotation-detail-empty strong {
  color: var(--text);
  font-size: 14px;
}
.annotation-detail-empty p {
  max-width: 260px;
  margin: 0;
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.65;
}
.annotation-detail-content {
  min-width: 0;
  max-width: 100%;
}
.annotation-family-badge {
  display: inline-flex;
  padding: 2px 6px;
  background: var(--surface-muted);
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
}
.annotation-family-badge[data-family="trend_pullback"] {
  background: color-mix(in srgb, var(--pa-trend) 14%, var(--surface-solid));
  color: var(--pa-trend);
}
.annotation-family-badge[data-family="breakout"] {
  background: color-mix(in srgb, var(--pa-breakout) 15%, var(--surface-solid));
  color: var(--pa-breakout);
}
.annotation-family-badge[data-family="range_reversal"] {
  background: color-mix(in srgb, var(--pa-range) 14%, var(--surface-solid));
  color: var(--pa-range);
}
.annotation-family-badge[data-family="major_trend_reversal"] {
  background: color-mix(in srgb, var(--pa-mtr) 14%, var(--surface-solid));
  color: var(--pa-mtr);
}
.annotation-quality-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 14px 0 10px;
  padding: 8px 10px;
  border: 1px solid color-mix(in srgb, var(--accent) 26%, var(--border));
  background: var(--accent-soft);
}
.annotation-quality-row strong {
  font-size: 22px;
}
.annotation-quality-row span {
  color: var(--text-soft);
  font-size: 12px;
}
.annotation-trade-cta {
  display: grid;
  gap: 5px;
  margin-top: 12px;
}
.annotation-trade-button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-color: var(--control-primary);
  background: var(--control-primary);
  color: var(--control-primary-text);
  text-decoration: none;
}
.annotation-trade-button:hover {
  border-color: var(--control-primary-hover);
  background: var(--control-primary-hover);
  color: var(--control-primary-text);
}
.annotation-trade-button:active {
  border-color: var(--control-primary-active);
  background: var(--control-primary-active);
}
.annotation-trade-button svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}
.annotation-trade-cta small {
  color: var(--text-soft);
  font-size: 11px;
  line-height: 1.45;
}
.annotation-detail-grid {
  display: grid;
  gap: 8px;
  margin: 0;
}
.annotation-detail-grid div {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  min-width: 0;
  gap: 8px;
}
.annotation-detail-grid dt {
  color: var(--text-soft);
  font-size: 12px;
}
.annotation-detail-grid dd {
  min-width: 0;
  margin: 0;
  color: var(--text-muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}
.annotation-detail-section {
  min-width: 0;
  max-width: 100%;
  margin-top: 13px;
  padding-top: 11px;
  border-top: 1px solid var(--border);
}
.annotation-detail-section h4 {
  margin: 0 0 7px;
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.annotation-level-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.annotation-level-heading h4 {
  margin-bottom: 0;
}
.annotation-level-basis {
  display: inline-flex;
  gap: 3px;
}
.annotation-level-basis button {
  min-height: 24px;
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  color: var(--text-soft);
  font-size: 11px;
  cursor: pointer;
}
.annotation-level-basis button.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}
.annotation-level-summary {
  margin: 7px 0;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}
.annotation-level-metrics {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
  max-width: 100%;
  gap: 4px 8px;
  margin: 0 0 7px;
  font-size: 11px;
}
.annotation-level-metrics div {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  min-width: 0;
  gap: 5px;
  border-bottom: 1px solid var(--border);
}
.annotation-level-metrics dt {
  min-width: 0;
  color: var(--text-soft);
  overflow-wrap: anywhere;
}
.annotation-level-metrics dd {
  min-width: 0;
  margin: 0;
  color: var(--text-muted);
  text-align: right;
  overflow-wrap: anywhere;
}
.annotation-level-list {
  display: grid;
  min-width: 0;
  max-width: 100%;
  gap: 5px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.annotation-level-list li {
  min-width: 0;
  max-width: 100%;
  padding: 6px;
  border: 1px solid var(--border);
  background: var(--surface-muted);
  color: var(--text-muted);
  font-size: 11px;
  overflow-wrap: anywhere;
}
.level-role-badge {
  display: inline-flex;
  margin-right: 5px;
  padding: 1px 4px;
  border-radius: var(--radius-sm);
  font-weight: 800;
}
.level-role-support {
  color: var(--success); background: color-mix(in srgb, var(--level-support) 12%, transparent);
}
.level-role-resistance {
  color: var(--danger); background: color-mix(in srgb, var(--level-resistance) 12%, transparent);
}
.level-role-midpoint {
  color: var(--pa-range); background: color-mix(in srgb, var(--level-midpoint) 12%, transparent);
}
.level-role-execution {
  color: var(--warning); background: color-mix(in srgb, var(--level-execution) 12%, transparent);
}
.annotation-score-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
}
.annotation-score-grid span {
  padding: 5px 6px;
  border: 1px solid var(--border);
  background: var(--surface-muted);
  color: var(--text-muted);
  font-size: 11px;
  text-align: center;
}
.annotation-reasons,
.annotation-transitions {
  min-width: 0;
  max-width: 100%;
  margin: 0;
  padding-left: 18px;
  color: var(--text-muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}
.annotation-evolution-summary {
  margin: 0 0 7px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}
.annotation-reasons li + li,
.annotation-transitions li + li {
  margin-top: 4px;
}
.annotation-reasons li,
.annotation-transitions li {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}
@container annotation-detail-card (min-width: 560px) {
  .annotation-level-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@container chart-card (min-width: 1000px) {
  .chart-workspace {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: stretch;
  }
  .annotation-detail {
    width: 340px;
    height: 100%;
    overflow: auto;
    border-width: 0 0 0 1px;
  }
  /* 空态收合为窄轨，把宽度让给图表；选中信号后再展开。 */
  .annotation-detail[data-state="empty"] {
    width: 46px;
    padding: 0;
    overflow: hidden;
    scrollbar-gutter: auto;
  }
  .annotation-detail[data-state="empty"] .annotation-detail-heading,
  .annotation-detail[data-state="empty"] .annotation-detail-empty {
    display: none;
  }
  .annotation-detail-heading {
    position: sticky;
    z-index: 1;
    top: -14px;
    margin: -14px -14px 0;
    padding: 14px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
  }
}
.spinner {
  width: 26px;
  height: 26px;
  margin-bottom: 3px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.noscript-message {
  position: fixed;
  inset: auto 16px 16px;
  z-index: 50;
  padding: 16px;
  border: 1px solid var(--danger);
  border-radius: var(--radius-md);
  background: var(--danger-soft);
  color: var(--danger);
  text-align: center;
}
.hero-price,
.price-change,
.metric-card strong,
.ohlc-legend dd {
  font-family: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-variant-numeric: tabular-nums lining-nums;
}
@media (min-width: 640px) {
  .selector-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .field-contract {
    grid-column: 1 / -1;
  }
  .metric-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (min-width: 1024px) {
  .selector-grid {
    grid-template-columns: minmax(120px, 0.8fr) minmax(130px, 0.9fr) minmax(210px, 1.3fr) minmax(120px, 0.65fr);
  }
  .field-contract {
    grid-column: auto;
  }
}
@media (min-width: 1200px) {
  .metric-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}
@media (max-width: 639px) {
  .app-header {
    min-height: 56px;
    padding-right: 10px;
    padding-left: 10px;
  }
  .brand {
    margin-right: 0;
    padding-right: 8px;
  }
  .brand small {
    display: none;
  }
  .status-pill span:last-child {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
  .status-pill {
    min-width: 30px;
    justify-content: center;
    padding: 5px;
  }
  .page-nav {
    gap: 0;
  }
  .page-nav-link {
    min-height: 32px;
    padding: 0 7px;
    font-size: 12px;
  }
  .app-shell {
    width: min(100% - 20px, 1440px);
  }
  .contract-hero,
.chart-toolbar,
.message-panel {
    align-items: stretch;
    flex-direction: column;
  }
  .message-actions {
    width: 100%;
    flex-wrap: wrap;
  }
  .message-actions .button {
    flex: 1 1 auto;
    justify-content: center;
  }
  .price-block {
    justify-items: start;
  }
  .overview-actions {
    width: 100%;
    justify-content: flex-start;
  }
  .ohlc-legend {
    justify-content: flex-start;
  }
  .analysis-toolbar {
    align-items: stretch;
  }
  .family-filters {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }
  .analysis-toggle,
  .family-filter {
    justify-content: center;
  }
  .annotation-filter-menu {
    position: fixed;
    inset: auto 10px 10px;
    width: auto;
    max-width: none;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: 55vh;
    overflow: auto;
  }
  .direction-filter-menu {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .overlap-filter-menu {
    grid-template-columns: minmax(0, 1fr);
  }
  .annotation-count {
    margin-left: 0;
    align-self: center;
  }
  .chart-stage {
    min-height: 390px;
  }
  .chart {
    height: 390px;
  }
  .annotation-detail-grid div {
    grid-template-columns: 96px minmax(0, 1fr);
  }
}
@media (min-width: 640px) and (max-width: 900px) {
  .annotation-filter-menu {
    position: fixed;
    inset: auto 10px 10px;
    width: auto;
    max-width: none;
    max-height: 55vh;
    overflow: auto;
  }
  .direction-filter-menu {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.live-workbench {
  position: relative;
  display: block;
}
.market-page-empty {
  display: grid;
  width: min(100%, 680px);
  min-height: min(520px, calc(100dvh - 100px));
  align-content: center;
  justify-items: center;
  gap: 12px;
  align-self: center;
  margin: auto;
  padding: 36px 24px;
  text-align: center;
}
.market-page-empty-icon {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: var(--surface-muted);
  color: var(--accent);
  font-size: 28px;
  font-weight: 400;
}
.market-page-empty h1,
.market-page-empty p {
  margin: 0;
}
.market-page-empty h1 {
  color: var(--text);
  font-size: clamp(22px, 3vw, 32px);
}
.market-page-empty p {
  max-width: 460px;
  color: var(--text-muted);
  line-height: 1.7;
}
.market-page-empty .button {
  margin-top: 5px;
  text-decoration: none;
}
.primary-workspace {
  min-width: 0;
}
.market-page .live-workbench {
  height: 100%;
  min-height: 0;
  flex: 1;
}
.market-page .primary-workspace {
  display: flex;
  height: 100%;
  min-height: 0;
  flex-direction: column;
  gap: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: auto;
}
.market-page .primary-workspace > * {
  margin-bottom: 0;
}
.market-page .terminal-market-strip {
  display: grid;
  grid-template-columns: minmax(292px, 0.82fr) minmax(0, 1.8fr);
  flex: 0 0 auto;
  margin: 0;
  padding: 0;
  overflow: visible;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: var(--surface-solid);
  box-shadow: none;
}
.market-page .terminal-market-strip .contract-hero {
  gap: 10px;
  min-width: 0;
  padding: 8px 12px;
  border: 0;
  border-right: 1px solid var(--border);
}
.contract-identity {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 9px;
}
.contract-identity > div {
  min-width: 0;
}
.chart-style-icon {
  display: grid;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  color: var(--accent);
}
.chart-style-icon svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}
.market-page .terminal-market-strip h1 {
  overflow: hidden;
  font-size: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.market-page .hero-price {
  font-size: 25px;
}
.market-page .price-change {
  min-height: 16px;
  margin-top: 0;
  font-size: 12px;
}
.market-page .terminal-market-strip .price-block {
  min-width: 112px;
}
.market-page .terminal-market-strip .metric-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  align-self: stretch;
  margin: 0;
  border: 0;
  border-radius: 0;
}
.market-page .terminal-market-strip .metric-card {
  display: grid;
  align-content: center;
  padding: 7px 8px;
}
.market-page .terminal-market-strip .metric-label {
  font-size: 11px;
  line-height: 1.25;
}
.market-page .terminal-market-strip .metric-card strong {
  margin-top: 1px;
  font-size: 13px;
  line-height: 1.25;
}
.market-page .terminal-market-strip .metric-card small {
  margin-top: 1px;
  font-size: 11px;
  line-height: 1.25;
}
.market-page .trading-terminal {
  display: flex;
  min-height: 520px;
  margin: 0;
  flex: 1 0 auto;
  flex-direction: column;
}
.market-page .chart-toolbar,
.market-page .analysis-toolbar {
  flex: 0 0 auto;
}
.market-page .chart-workspace {
  min-height: 390px;
  flex: 1 0 390px;
}
.market-page .chart-stage,
.market-page .chart {
  height: 100%;
  min-height: 390px;
}
@media (max-height: 900px), (max-width: 1199px) {
  .market-page .terminal-market-strip {
    grid-template-columns: minmax(0, 1fr);
  }
  .market-page .terminal-market-strip .contract-hero {
    gap: 8px;
    padding: 7px 10px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .market-page .terminal-market-strip h1 {
    font-size: 17px;
  }
  .market-page .hero-price {
    font-size: 23px;
  }
  .market-page .price-change {
    min-height: 15px;
    font-size: 11px;
  }
}
@media (max-height: 650px) {
  .market-page .terminal-market-strip .contract-hero {
    padding-block: 5px;
  }
  .market-page .hero-price {
    font-size: 21px;
  }
  .market-page .price-change {
    min-height: 14px;
    font-size: 11px;
  }
  .market-page .terminal-market-strip .metric-card {
    padding-block: 5px;
  }
}
@media (max-height: 650px) and (min-width: 901px) {
  .annotation-filter-menu {
    top: auto;
    bottom: calc(100% + 6px);
    max-height: 55vh;
    overflow: auto;
  }
}
@media (min-width: 960px) and (max-width: 1199px) {
  .market-page .metric-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}
@media (max-width: 639px) {
  .market-page .analysis-toolbar-label {
    display: none;
  }
  .market-page .terminal-market-strip .contract-hero {
    gap: 6px;
    padding: 6px 8px;
  }
  .market-page .terminal-market-strip .price-block {
    display: flex;
    width: 100%;
    min-width: 0;
    align-items: baseline;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 2px 8px;
  }
  .market-page .hero-price,
  .market-page .price-change {
    margin-top: 0;
  }
  .market-page .price-change {
    min-height: 0;
  }
  .market-page .terminal-market-strip .metric-card {
    padding: 3px 7px;
  }
  .market-page .terminal-market-strip .metric-label {
    font-size: 11px;
  }
  .market-page .terminal-market-strip .metric-card strong {
    font-size: 13px;
  }
}
@media (min-width: 360px) and (max-width: 639px) {
  .market-page .terminal-market-strip {
    padding: 0;
  }
  .market-page .terminal-market-strip .contract-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
  }
  .market-page .terminal-market-strip .contract-hero > div:first-child {
    min-width: 0;
  }
  .market-page .terminal-market-strip h1 {
    overflow: hidden;
    font-size: 16px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .market-page .contract-meta {
    overflow: hidden;
    margin-top: 2px;
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .market-page .overview-actions {
    width: auto;
    min-width: 0;
    justify-content: flex-end;
  }
  .market-page .terminal-market-strip .price-block {
    width: auto;
    max-width: 150px;
    justify-content: flex-end;
    gap: 1px 6px;
  }
  .market-page .terminal-market-strip .price-block .metric-label {
    font-size: 11px;
  }
  .market-page .hero-price {
    font-size: 20px;
  }
  .market-page .price-change {
    font-size: 11px;
  }
  .market-page .terminal-market-strip .metric-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin: 0;
  }
  .market-page .terminal-market-strip .metric-card {
    padding: 3px 5px;
  }
  .market-page .terminal-market-strip .metric-label {
    font-size: 11px;
  }
  .market-page .terminal-market-strip .metric-card strong {
    font-size: 12px;
  }
  .market-page .terminal-market-strip .metric-card small {
    font-size: 11px;
  }
  .market-page .terminal-market-strip .metric-card:nth-child(3) > strong {
    display: flex;
    flex-wrap: wrap;
    gap: 0 3px;
    overflow: visible;
    font-size: 11px;
    white-space: normal;
  }
  .market-page .chart-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: center;
    gap: 3px;
    padding: 6px 8px;
  }
  .market-page .chart-toolbar h2 {
    font-size: 15px;
  }
  .market-page .ohlc-legend {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    width: 100%;
    gap: 3px;
  }
  .market-page .ohlc-legend div {
    min-width: 0;
    gap: 2px;
  }
  .market-page .ohlc-legend dt,
  .market-page .ohlc-legend dd {
    min-width: 0;
    overflow: hidden;
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .market-page .analysis-toolbar {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    align-items: stretch;
    gap: 4px;
    min-height: 0;
    padding: 5px 8px;
  }
  .market-page .analysis-toggle {
    grid-column: span 2;
  }
  .market-page .family-filters {
    display: grid;
    grid-column: span 10;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 3px;
    width: auto;
  }
  .market-page #direction-filter,
  .market-page #overlap-filter {
    grid-column: span 2;
  }
  .market-page #stage-filter,
  .market-page .action-log-open {
    grid-column: span 3;
  }
  .market-page .level-view-control {
    grid-column: span 6;
    min-width: 0;
    padding-left: 6px;
    white-space: nowrap;
  }
  .market-page .level-view-control select {
    width: 100%;
    min-width: 0;
    padding: 3px 5px;
  }
  .market-page #execution-level-toggle {
    grid-column: span 2;
  }
  .market-page .annotation-count {
    display: flex;
    grid-column: span 4;
    align-items: center;
    justify-content: flex-end;
    margin-left: 0;
    font-size: 11px;
    white-space: nowrap;
  }
  .market-page .analysis-toggle,
  .market-page .family-filter,
  .market-page .annotation-filter summary,
  .market-page .action-log-open {
    min-width: 0;
    min-height: 26px;
    justify-content: center;
    padding: 3px;
    overflow: hidden;
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .market-page .annotation-filter summary::after {
    margin-left: 2px;
  }
  .market-page .action-log-open {
    gap: 3px;
  }
  .market-page .action-log-open strong {
    min-width: 17px;
    padding: 0 3px;
    font-size: 10px;
  }
}
.live-workbench .primary-workspace > :last-child {
  margin-bottom: 0;
}
.market-panel-toggle {
  position: fixed;
  z-index: 32;
  left: 12px;
  bottom: max(12px, env(safe-area-inset-bottom));
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  gap: 8px;
  padding: 8px 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-solid);
  box-shadow: 0 8px 24px rgba(17, 24, 39, 0.2);
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}
.market-panel-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.market-panel-toggle svg {
  width: 17px;
  height: 17px;
  fill: var(--surface-solid);
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.8;
}
.market-panel-toggle strong {
  min-width: 20px;
  padding: 1px 5px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent);
  font: 800 11px/1.5 ui-monospace, "SFMono-Regular", Consolas, monospace;
  text-align: center;
}
.market-panel-scrim {
  position: fixed;
  z-index: 48;
  inset: 0;
  border: 0;
  background: rgba(5, 10, 18, 0.5);
  cursor: default;
}
.market-page .market-panel-scrim {
  top: 60px;
}
.market-center {
  position: fixed;
  z-index: 49;
  right: 8px;
  bottom: 0;
  left: 8px;
  display: flex;
  height: min(72vh, 640px);
  min-width: 0;
  flex-direction: column;
  overflow: hidden;
  visibility: hidden;
  border: 1px solid var(--border-strong);
  border-bottom: 0;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  background: var(--surface);
  box-shadow: 0 -16px 36px rgba(5, 10, 18, 0.26);
  transform: translateY(calc(100% + 16px));
  transition: transform 180ms ease, visibility 0s linear 180ms;
}
.live-workbench.is-market-open .market-center {
  visibility: visible;
  transform: translateY(0);
  transition-delay: 0s;
}
.market-center-header {
  display: flex;
  min-height: 52px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-solid);
}
.market-center-header h2 {
  font-size: 16px;
}
.market-center-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}
.watchlist-reconnect {
  min-height: 34px;
  padding: 5px 9px;
  font-size: 12px;
}
.market-panel-close {
  display: inline-grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-solid);
  color: var(--text-muted);
  cursor: pointer;
}
.market-panel-close:hover {
  border-color: var(--border-strong);
  background: var(--surface-hover);
  color: var(--text);
}
.market-panel-close svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.8;
}
.market-pane {
  display: none;
  min-width: 0;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  overflow: hidden;
}
.watchlist-panel {
  display: flex;
}
.market-shared-tools {
  display: grid;
  flex: 0 0 auto;
  gap: 8px;
  padding: 8px 12px 9px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-solid);
}
.side-panel-count {
  padding: 3px 6px;
  border: 1px solid var(--border);
  background: var(--surface-solid);
  color: var(--text-muted);
  font: 750 12px/1.4 ui-monospace, "SFMono-Regular", Consolas, monospace;
  white-space: nowrap;
}
.side-panel-tools {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.side-search {
  position: relative;
  display: block;
}
.side-search svg {
  position: absolute;
  top: 50%;
  left: 9px;
  width: 15px;
  height: 15px;
  fill: none;
  stroke: var(--text-soft);
  stroke-width: 1.8;
  transform: translateY(-50%);
  pointer-events: none;
}
.side-search input {
  width: 100%;
  min-height: 34px;
  padding: 6px 9px 6px 31px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-solid);
  color: var(--text);
  font: inherit;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}
.side-search:hover input {
  border-color: var(--border-strong);
}
.side-search input:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent);
}
.watch-family-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}
.watch-family-controls label {
  display: grid;
  min-width: 0;
  gap: 3px;
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 750;
}
.watch-family-controls select {
  width: 100%;
  min-width: 0;
  min-height: 30px;
  padding: 3px 20px 3px 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-solid);
  color: var(--text);
  font-size: 11px;
}
.market-duration-filter {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
.market-duration-filter legend {
  margin-bottom: 4px;
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 750;
}
.market-duration-filter > div {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 3px;
}
.market-duration-filter > div > button {
  display: inline-flex;
  min-width: 0;
  min-height: 24px;
  align-items: center;
  justify-content: center;
  padding: 3px 2px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface-solid);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 10px;
  font-weight: 750;
  transition: border-color 140ms ease, background-color 140ms ease, color 140ms ease;
  white-space: nowrap;
}
.market-duration-filter > div > button:hover:not(.is-active) {
  border-color: var(--border-strong);
  background: var(--surface-hover);
  color: var(--text);
}
.market-duration-filter > div > button.is-active {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  background: var(--accent-soft);
  color: var(--accent);
}
.market-list {
  min-height: 0;
  max-height: none;
  flex: 1;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  list-style: none;
}
#watchlist-items.market-list {
  scrollbar-width: none;
}
#watchlist-items.market-list::-webkit-scrollbar {
  display: none;
}
.market-list:empty {
  display: none;
}
.market-list > li + li {
  border-top: 1px solid var(--border);
}
.market-contract {
  position: relative;
}
.market-contract-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 6px 9px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-solid);
}
.market-contract-identity,
.market-contract-price {
  min-width: 0;
}
.market-contract-identity :is(strong, small),
.market-contract-price :is(strong, small) {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.market-contract-identity strong {
  font-size: 12px;
}
.market-contract-identity-meta {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 6px;
}
.market-contract-identity-meta > small:first-child {
  min-width: 0;
  flex: 1;
}
.market-contract-identity small,
.market-contract-price small,
.market-contract-status {
  color: var(--text-soft);
  font-size: 11px;
}
.market-contract-price {
  text-align: right;
}
.market-contract-price strong {
  font: 800 13px/1.3 ui-monospace, "SFMono-Regular", Consolas, monospace;
}
.market-contract-identity .market-contract-status {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 3px;
  font-weight: 750;
}
.market-contract-status::before,
.market-interval-status::before {
  width: 5px;
  height: 5px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--text-soft);
  content: "";
}
.market-contract[data-status="READY"] .market-contract-status::before,
.market-interval-row[data-status="READY"] .market-interval-status::before {
  background: var(--success);
}
.market-contract:is([data-status="QUEUED"], [data-status="LOADING"], [data-status="BACKFILLING"]) .market-contract-status::before,
.market-interval-row:is([data-status="QUEUED"], [data-status="LOADING"], [data-status="BACKFILLING"]) .market-interval-status::before {
  background: var(--warning);
}
.market-contract:is([data-status="DEGRADED"], [data-status="INACTIVE"]) .market-contract-status,
.market-interval-row:is([data-status="FAILED"], [data-status="INACTIVE"]) .market-interval-status {
  color: var(--danger);
}
.market-contract:is([data-status="DEGRADED"], [data-status="INACTIVE"]) .market-contract-status::before,
.market-interval-row:is([data-status="FAILED"], [data-status="INACTIVE"]) .market-interval-status::before {
  background: var(--danger);
}
.watchlist-matrix-header {
  display: grid;
  grid-template-columns: 42px repeat(4, minmax(0, 1fr));
  flex: 0 0 auto;
  gap: 3px;
  padding: 4px 7px 4px 9px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-muted);
  color: var(--text-soft);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-align: center;
}
.watchlist-matrix-header > span:first-child {
  text-align: left;
}
.market-contract-intervals {
  margin: 0;
  padding: 0;
  list-style: none;
}
.market-contract-intervals > li + li {
  border-top: 1px solid var(--border);
}
.market-row {
  width: 100%;
  border: 0;
  background: var(--surface-solid);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: background-color 140ms ease;
}
.market-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 10px;
  min-height: 88px;
  padding: 9px 11px;
}
.market-interval-row {
  grid-template-columns: 42px repeat(4, minmax(0, 1fr));
  min-height: 40px;
  align-items: stretch;
  gap: 3px;
  padding: 4px 7px 4px 9px;
}
.market-interval-identity {
  display: grid;
  min-width: 0;
  align-content: center;
  justify-items: start;
  gap: 1px;
}
.market-interval-identity strong {
  font-size: 11px;
}
.market-interval-identity small {
  color: var(--text-soft);
  font-size: 10px;
}
.market-interval-status {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
}
.market-row:hover {
  background: var(--surface-muted);
}
.market-row:active {
  background: color-mix(in srgb, var(--accent) 10%, var(--surface-solid));
}
.market-row.is-current {
  background: var(--accent-soft);
}
.market-row.is-current .market-interval-identity > strong {
  color: var(--accent);
}
.market-family-grid {
  display: contents;
}
.market-family-chip {
  --family-color: var(--border-strong);
  display: flex;
  min-width: 0;
  min-height: 30px;
  align-items: center;
  justify-content: center;
  padding: 2px 1px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--family-color) 42%, var(--border));
  border-radius: 4px;
  background: color-mix(in srgb, var(--family-color) 7%, var(--surface-solid));
  text-align: center;
}
.market-family-chip[data-family="trend_pullback"] {
  --family-color: var(--pa-trend);
}
.market-family-chip[data-family="breakout"] {
  --family-color: var(--pa-breakout);
}
.market-family-chip[data-family="range_reversal"] {
  --family-color: var(--pa-range);
}
.market-family-chip[data-family="major_trend_reversal"] {
  --family-color: var(--pa-mtr);
}
.market-family-chip small,
.market-family-chip strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.market-family-chip small {
  display: none;
}
.market-family-chip strong {
  color: var(--text-muted);
  font: 800 11px/1.25 ui-monospace, "SFMono-Regular", Consolas, monospace;
}
.market-family-chip[data-direction="bullish"] strong {
  color: var(--up-text);
}
.market-family-chip[data-direction="bearish"] strong {
  color: var(--down-text);
}
.market-family-chip[data-direction="bidirectional"] strong {
  color: var(--text);
}
.market-family-chip.is-stale {
  border-style: dashed;
  opacity: 0.62;
}
.market-family-chip.is-loading strong {
  color: var(--warning);
}
.market-family-chip.is-empty {
  background: var(--surface-solid);
}
.side-panel-empty {
  display: grid;
  min-height: 0;
  flex: 1;
  place-content: center;
  margin: 0;
  padding: 28px 16px;
  color: var(--text-soft);
  font-size: 12px;
  text-align: center;
}
.side-panel-empty a {
  margin-top: 7px;
  color: var(--accent);
  font-weight: 750;
  text-underline-offset: 3px;
}
.watch-control {
  display: grid;
  gap: 5px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}
.watch-toggle {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 6px 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-solid);
  color: var(--text-muted);
  cursor: pointer;
  font-weight: 800;
  transition: border-color 140ms ease, background-color 140ms ease,
  color 140ms ease;
}
.watch-toggle:hover:not(:disabled) {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}
.watch-toggle:active:not(:disabled) {
  background: color-mix(in srgb, var(--accent) 18%, var(--surface-solid));
}
.watch-toggle svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linejoin: round;
  stroke-width: 1.8;
}
.watch-toggle[aria-pressed="true"] {
  border-color: color-mix(in srgb, var(--warning) 48%, var(--border));
  background: var(--warning-soft);
  color: var(--warning);
}
.watch-toggle[aria-pressed="true"] svg {
  fill: currentColor;
}
.watch-toggle:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}
.radar-live-indicator {
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 750;
  white-space: nowrap;
}
.radar-live-indicator.is-ready {
  color: var(--success);
}
.radar-live-indicator.is-warning {
  color: var(--warning);
}
.radar-live-indicator.is-error {
  color: var(--danger);
}
.market-contract-signals {
  border-top: 1px solid var(--border);
  background: var(--surface-solid);
}
.market-signals-toggle {
  display: flex;
  width: 100%;
  min-height: 30px;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border: 0;
  background: var(--surface-muted);
  color: var(--text-soft);
  cursor: pointer;
  font-size: 11px;
  font-weight: 750;
  text-align: left;
  transition: background-color 140ms ease, color 140ms ease;
}
.market-signals-toggle:hover {
  background: var(--surface-hover);
  color: var(--text);
}
.market-signals-toggle strong {
  min-width: 18px;
  padding: 0 4px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent);
  font: 800 11px/1.5 ui-monospace, "SFMono-Regular", Consolas, monospace;
  text-align: center;
}
.market-signals-toggle .signals-chevron {
  margin-left: auto;
  transition: transform 140ms ease;
}
.market-signals-toggle[aria-expanded="true"] .signals-chevron {
  transform: rotate(180deg);
}
.market-signals-list {
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--border);
  list-style: none;
}
.market-signals-list > li + li {
  border-top: 1px solid var(--border);
}
.market-signal-row {
  --family-color: var(--border-strong);
  display: grid;
  width: 100%;
  gap: 3px;
  padding: 6px 9px 6px 14px;
  border: 0;
  border-left: 2px solid var(--family-color);
  background: var(--surface-solid);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: background-color 140ms ease;
}
.market-signal-row:hover {
  background: var(--surface-muted);
}
.market-signal-row[data-family="trend_pullback"] {
  --family-color: var(--pa-trend);
}
.market-signal-row[data-family="breakout"] {
  --family-color: var(--pa-breakout);
}
.market-signal-row[data-family="range_reversal"] {
  --family-color: var(--pa-range);
}
.market-signal-row[data-family="major_trend_reversal"] {
  --family-color: var(--pa-mtr);
}
.market-signal-band {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--family-color);
  font-size: 11px;
  font-weight: 750;
}
.market-signal-band > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.market-signal-band strong {
  flex: 0 0 auto;
  font: 800 11px/1.3 ui-monospace, "SFMono-Regular", Consolas, monospace;
}
.market-signal-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--text-soft);
  font-size: 11px;
}
.market-signal-row.is-stale {
  opacity: 0.66;
}
@media (min-width: 768px) and (max-width: 1439px) {
  .market-panel-toggle {
    position: static;
    flex: 0 0 auto;
    box-shadow: none;
  }
  .market-center {
    top: 60px;
    left: 0;
    bottom: 0;
    right: auto;
    width: 320px;
    height: calc(100dvh - 60px);
    border-width: 0 1px 0 0;
    border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
    box-shadow: 16px 0 36px rgba(5, 10, 18, 0.22);
    transform: translateX(calc(-100% - 16px));
  }
  .live-workbench.is-market-open .market-center {
    transform: translateX(0);
  }
}
@media (min-width: 1440px) {
  .market-interval-row {
    min-height: 36px;
    padding-block: 3px;
  }
  .live-workbench {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr) 340px;
    grid-template-areas: "market primary detail";
    gap: 0;
    height: 100%;
    min-height: 0;
    align-items: stretch;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface-solid);
  }
  .market-panel-toggle,
  .market-panel-scrim,
  .market-panel-close {
    display: none;
  }
  .market-center {
    position: relative;
    top: auto;
    grid-area: market;
    right: auto;
    bottom: auto;
    left: auto;
    width: auto;
    height: 100%;
    min-height: 0;
    visibility: visible;
    border: 0;
    border-right: 1px solid var(--border);
    border-radius: 0;
    box-shadow: var(--shadow-soft);
    transform: none;
    transition: none;
  }
  .primary-workspace {
    grid-area: primary;
    height: 100%;
    min-height: 0;
  }
  .market-page .trading-terminal {
    border: 0;
    border-radius: 0;
  }
}
@media (min-width: 1440px) and (max-width: 1599px) {
  .market-page .analysis-toolbar {
    gap: 6px;
    padding-inline: 8px;
  }
  .market-page .analysis-toolbar-label {
    padding-right: 6px;
  }
  .market-page .analysis-toolbar-label span {
    display: none;
  }
  .market-page .family-filters {
    gap: 3px;
  }
  .market-page .analysis-toggle,
  .market-page .family-filter,
  .market-page .annotation-filter summary,
  .market-page .action-log-open {
    padding-inline: 6px;
    font-size: 12px;
  }
  .market-page .level-view-control {
    gap: 4px;
    padding-left: 6px;
    font-size: 11px;
  }
  .market-page .level-view-control select {
    min-width: 76px;
  }
  .market-page .annotation-count {
    font-size: 11px;
  }
}
@media (max-width: 460px) {
  .app-header .brand > span {
    display: none;
  }
}
@media (max-width: 767px) {
  body.market-page {
    grid-template-rows: 56px minmax(0, 1fr);
  }
  .market-page > .app-header {
    height: 56px;
    min-height: 56px;
  }
  .market-page .market-panel-scrim {
    top: 56px;
  }
  .market-panel-toggle {
    left: 10px;
    bottom: max(10px, env(safe-area-inset-bottom));
  }
  .market-center-header {
    min-height: 48px;
  }
  .market-interval-row {
    min-height: 44px;
  }
  .app-dialog {
    --dialog-padding: 16px;
    width: calc(100dvw - 24px);
    max-height: calc(100dvh - 24px);
  }
  .dialog-header {
    padding-block: 12px;
  }
  .dialog-header h2 {
    font-size: 16px;
  }
  .dialog-footer {
    padding-block: 12px;
  }
  .action-log-dialog .action-list-columns {
    display: none;
  }
  .action-log-dialog .action-list {
    max-height: none;
  }
  .action-log-dialog .action-list-row {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    gap: 3px 12px;
    min-height: 70px;
    padding-right: var(--dialog-padding);
    padding-left: var(--dialog-padding);
  }
  .action-log-dialog .action-list-identity {
    grid-row: 1 / 3;
  }
  .action-log-dialog .action-list-mobile-meta {
    display: block;
  }
  .action-log-dialog .action-list-direction,
  .action-log-dialog .action-list-known {
    display: none;
  }
  .action-log-dialog .action-list-state,
  .action-log-dialog .action-list-quality {
    grid-column: 2;
    justify-self: end;
  }
  .action-log-dialog .action-list-state {
    grid-row: 2;
  }
  .action-log-dialog .action-list-quality {
    grid-row: 1;
  }
}
@media (max-height: 720px) {
  .watch-control) {
    gap: 3px;
    font-size: 12px;
  }
}
/* Account center */
.history-range-presets button,
.order-filters button {
  border: 1px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-weight: 750;
  cursor: pointer;
}
.history-range-presets button:hover:not([aria-pressed="true"]),
.order-filters button:hover:not([aria-pressed="true"]) {
  background: var(--surface-hover);
  color: var(--text);
}
.history-range-presets button[aria-pressed="true"],
.order-filters button[aria-pressed="true"] {
  border-bottom-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  box-shadow: inset 0 -1px 0 var(--accent);
}
.account-view {
  width: 100%;
  margin: 0;
}
.account-view {
  display: grid;
  height: 100%;
  min-height: 100%;
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-solid);
  box-shadow: var(--shadow-soft);
}
#account-overview {
  grid-template-rows: auto minmax(440px, 1fr);
  min-height: 620px;
}
#account-history {
  grid-template-rows: auto auto minmax(440px, 1fr);
  min-height: 620px;
}
@keyframes located-flash {
  from {
    background: color-mix(in srgb, var(--accent) 30%, var(--surface-solid));
  }
}
.is-profit {
  color: var(--up-text);
}
.is-loss {
  color: var(--down-text);
}
.history-range-presets,
.order-filters {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 0;
  background: var(--surface-solid);
}
.history-range-presets button,
.order-filters button {
  min-height: 31px;
  padding: 4px 10px;
  font-size: 12px;
}
.history-range-presets button + button,
.order-filters button + button {
  border-left-color: var(--border);
}
.account-table-scroll {
  width: 100%;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
}
.account-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  font-size: 12px;
}
.account-table th,
.account-table td {
  padding: 7px 9px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}
.account-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-muted);
  color: var(--text-muted);
  font-size: 11px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.account-table tbody tr:hover {
  background: color-mix(in srgb, var(--accent-soft) 42%, transparent);
}
.account-table td {
  max-width: 240px;
  overflow-wrap: anywhere;
}
.account-table .number-cell {
  white-space: nowrap;
}
.account-table .direction-buy {
  color: var(--up-text);
}
.account-table .direction-sell {
  color: var(--down-text);
}
.table-empty {
  margin: 0;
  padding: 18px 12px;
  border-top: 1px solid var(--border);
  color: var(--text-soft);
  text-align: center;
}
.history-range-presets {
  flex-wrap: nowrap;
}
#history-range-status {
  margin-left: auto;
  color: var(--text-soft);
  font-size: 12px;
}
.account-chart-container {
  position: relative;
  width: 100%;
  min-height: 220px;
  flex: 1 1 auto;
  height: auto;
}
.chart-decimation-status {
  flex: 0 0 auto;
  margin: 0;
  padding: 6px 15px 8px;
  color: var(--text-soft);
  font-size: 11px;
}
#record-inspector-close {
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface-solid);
  color: var(--text-muted);
  font-size: 21px;
  cursor: pointer;
}
@media (max-width: 1199px) {
  #account-overview,
  #account-history {
    min-height: 780px;
  }
}
@media (max-width: 860px) {
  .theme-current {
    display: none;
  }
  .theme-switcher > summary {
    width: 32px;
    justify-content: center;
    padding-inline: 5px;
  }
  .app-header .brand > span {
    display: none;
  }
}
@media (max-width: 639px) {
  .account-view {
    height: auto;
    min-height: 0;
  }
  #account-overview,
  #account-history {
    min-height: 0;
  }
  .history-range-presets {
    align-self: stretch;
  }
  .history-range-presets button {
    flex: 1 1 auto;
  }
  #history-range-status {
    width: 100%;
    margin-left: 0;
  }
  .account-chart-container {
    height: 250px;
    min-height: 250px;
  }
}
@media (max-width: 380px) {
  .app-header {
    gap: 8px;
    padding-inline: 8px;
  }
  .page-nav {
    gap: 8px;
  }
  .brand-mark {
    width: 32px;
    height: 32px;
  }
}
/* Single live account manager */
.account-view {
  width: 100%;
  margin: 0;
}
.account-view {
  display: flex;
  height: 100%;
  min-height: 520px;
  flex-direction: column;
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-solid);
  box-shadow: var(--shadow-soft);
}
#account-overview,
#account-history {
  min-height: 620px;
}
@media (max-width: 639px) {
  .account-view {
    height: auto;
    min-height: 100%;
  }
  #account-overview,
  #account-history {
    min-height: 100%;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
