:root {
  --tv-bg: #ffffff;
  --tv-subtle: #f8f9fd;
  --tv-hover: #f0f3fa;
  --tv-selected: #e8eefc;
  --tv-border: #e0e3eb;
  --tv-border-strong: #c9cdd5;
  --tv-text: #131722;
  --tv-muted: #787b86;
  --tv-faint: #b2b5be;
  --tv-blue: #2962ff;
  --tv-blue-dark: #1e53e5;
  --tv-up: #f23645;
  --tv-down: #089981;
  --tv-orange: #f59e0b;
  --tv-shadow: 0 4px 16px rgba(19, 23, 34, .12);
  --topbar-height: 44px;
  --rail-width: 48px;
  font-family: -apple-system, BlinkMacSystemFont, "Trebuchet MS", "PingFang SC",
    "Microsoft YaHei", Arial, sans-serif;
  color: var(--tv-text);
  background: var(--tv-bg);
}

* { box-sizing: border-box; }
html, body { width: 100%; min-width: 0; height: 100%; margin: 0; }
body { overflow: hidden; font-size: 13px; }
button, input, select { font: inherit; color: inherit; }
button, a, summary { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }
.positive, .up { color: var(--tv-up) !important; }
.negative, .down { color: var(--tv-down) !important; }
.status-spacer, .topbar-spacer, .command-spacer { flex: 1; }

.terminal-shell { width: 100%; height: 100%; overflow: hidden; background: #fff; }
.terminal-topbar {
  position: relative; z-index: 40; height: var(--topbar-height);
  display: flex; align-items: center; gap: 4px; padding: 0 8px;
  border-bottom: 1px solid var(--tv-border); background: #fff;
}
.terminal-brand {
  width: 110px; height: 34px; display: inline-grid; place-items: center;
  padding: 0 8px; border-radius: 5px;
}
.terminal-brand:hover { background: var(--tv-hover); }
.terminal-brand-logo { grid-area: 1 / 1; width: 94px; height: 22px; object-fit: contain; }
.terminal-brand-logo-light { display: none; }
html[data-theme="dark"] .terminal-brand-logo-dark { display: none; }
html[data-theme="dark"] .terminal-brand-logo-light { display: block; }
.workspace-tabs { height: 100%; display: flex; align-items: center; gap: 1px; margin-left: 8px; }
.workspace-tabs a {
  position: relative; height: 100%; display: inline-flex; align-items: center; gap: 6px;
  padding: 0 12px; color: var(--tv-muted); font-size: 13px; font-weight: 600;
}
.workspace-tabs a:hover { color: var(--tv-text); background: var(--tv-hover); }
.workspace-tabs a.active { color: var(--tv-text); }
.workspace-tabs a.active::after {
  content: ""; position: absolute; right: 10px; bottom: -1px; left: 10px;
  height: 2px; background: var(--tv-blue);
}
.topbar-divider, .command-separator, .view-separator, .toolbar-separator {
  width: 1px; height: 22px; margin: 0 6px; background: var(--tv-border);
}
.topbar-tools { position: relative; display: flex; align-items: center; gap: 2px; }
.icon-button {
  min-width: 32px; height: 32px; display: inline-grid; place-items: center;
  padding: 0; border: 0; border-radius: 5px; color: #434651; background: transparent;
  font-size: 17px;
}
.icon-button:hover, .icon-button.active { color: var(--tv-text); background: var(--tv-hover); }
.icon-button:focus { outline: none; }
.icon-button:focus-visible { box-shadow: inset 0 0 0 2px var(--tv-blue); }
.icon-button:disabled { opacity: .4; cursor: default; }
.market-clock { display: flex; align-items: center; gap: 7px; margin-right: 4px; color: var(--tv-muted); font-size: 12px; }
.status-dot { width: 7px; height: 7px; display: inline-block; border-radius: 50%; background: var(--tv-up); }
.account-menu { position: relative; }
.account-menu summary {
  height: 34px; display: flex; align-items: center; gap: 7px; padding: 0 7px;
  list-style: none; border-radius: 5px; cursor: pointer; font-size: 12px;
}
.account-menu summary::-webkit-details-marker { display: none; }
.account-menu summary:hover { background: var(--tv-hover); }
.account-avatar {
  width: 24px; height: 24px; display: inline-grid; place-items: center;
  border-radius: 50%; color: #fff; background: #5b6680; font-weight: 700;
}
.account-popover {
  position: absolute; top: 38px; right: 0; width: 160px; padding: 5px;
  border: 1px solid var(--tv-border); border-radius: 6px; background: #fff; box-shadow: var(--tv-shadow);
}
.account-popover a, .account-popover button {
  width: 100%; height: 34px; display: flex; align-items: center; gap: 9px; padding: 0 9px;
  border: 0; border-radius: 4px; background: transparent; text-align: left; font-size: 12px;
}
.account-popover a:hover, .account-popover button:hover { background: var(--tv-hover); }
.global-settings-popover {
  position: absolute; z-index: 120; top: 38px; left: 0; width: 348px;
  max-height: calc(100vh - 52px); overflow-x: hidden; overflow-y: auto;
  border: 1px solid var(--tv-border); border-radius: 10px;
  background: var(--tv-bg); box-shadow: var(--tv-shadow);
}
.global-settings-popover > section {
  display: grid; gap: 10px; margin: 0 13px; padding: 14px 0;
  border-bottom: 1px solid var(--tv-border);
}
.global-settings-popover > section > strong {
  color: var(--tv-faint); font-size: 11px; font-weight: 500;
}
.global-settings-popover input[type="radio"] {
  width: 14px; height: 14px; margin: 0; accent-color: var(--tv-blue);
}
.global-settings-popover label > span {
  display: inline-flex; align-items: center; gap: 7px; font-size: 12px;
}
.settings-segmented {
  display: grid; grid-template-columns: 1fr 1fr; gap: 2px;
  padding: 3px; border-radius: 7px; background: var(--tv-subtle);
  box-shadow: inset 0 0 0 1px rgb(120 123 134 / 8%);
}
.settings-segmented label { position: relative; min-width: 0; width: 100%; }
.settings-segmented input { position: absolute; opacity: 0; pointer-events: none; }
.global-settings-popover .settings-segmented label > span {
  width: 100%;
  height: 28px; display: flex; align-items: center; justify-content: center;
  border-radius: 5px; color: var(--tv-muted); font-size: 12px; cursor: pointer;
}
.settings-segmented input:checked + span {
  color: var(--tv-text); background: var(--tv-bg); font-weight: 500;
  box-shadow: 0 1px 3px rgba(19, 23, 34, .12);
}
.chart-theme-grid {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px;
}
.chart-theme-grid label { min-width: 0; display: grid; gap: 7px; }
.chart-theme-grid label > span { color: var(--tv-text); font-size: 12px; }
.chart-theme-grid select {
  width: 100%; height: 30px; min-width: 0; padding: 0 28px 0 9px;
  border: 1px solid var(--tv-border); border-radius: 5px;
  color: var(--tv-text); background: var(--tv-bg); font-size: 11px;
}
.chart-palette-editor { margin-top: 2px; border-top: 1px solid var(--tv-border); }
.chart-palette-editor > summary {
  height: 36px; display: flex; align-items: center; cursor: pointer;
  color: var(--tv-faint); font-size: 11px; list-style: none;
}
.chart-palette-editor > summary::-webkit-details-marker { display: none; }
.chart-palette-editor > summary:focus { outline: none; }
.chart-palette-editor > summary:focus-visible {
  border-radius: 4px; box-shadow: inset 0 0 0 2px var(--tv-blue);
}
.chart-palette-editor > summary::after {
  content: "›"; margin-left: auto; font-size: 15px; transform: rotate(90deg);
}
.chart-palette-editor[open] > summary::after { transform: rotate(-90deg); }
.chart-palette-editor > div {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding-bottom: 2px;
}
.chart-palette-editor fieldset {
  min-width: 0; display: grid; gap: 7px; margin: 0; padding: 7px;
  border: 1px solid var(--tv-border); border-radius: 6px;
}
.chart-palette-editor legend { padding: 0 3px; color: var(--tv-faint); font-size: 10px; }
.palette-surface-colors { display: grid; gap: 3px; }
.palette-surface-colors label {
  height: 25px; display: flex; align-items: center; justify-content: space-between;
  color: var(--tv-muted); font-size: 9px;
}
.palette-kline-title, .palette-direction-row {
  display: grid; grid-template-columns: 34px repeat(3, 1fr); gap: 3px; align-items: center;
}
.palette-kline-title {
  padding-top: 5px; border-top: 1px solid var(--tv-border);
  color: var(--tv-faint); font-size: 8px; text-align: center;
}
.palette-kline-title span:first-child { text-align: left; }
.palette-direction-row > span:first-child { color: var(--tv-muted); font-size: 9px; }
.palette-direction-row.is-up > span:first-child { color: var(--tv-up); }
.palette-direction-row.is-down > span:first-child { color: var(--tv-down); }
.tv-color-control { display: flex; justify-content: center; }
.tv-color-trigger {
  width: 31px; height: 22px; display: inline-flex; align-items: center; justify-content: center;
  gap: 2px; padding: 2px; border: 1px solid var(--tv-border); border-radius: 4px;
  color: var(--tv-faint); background: var(--tv-bg); cursor: pointer;
}
.tv-color-trigger:hover, .tv-color-trigger.active {
  border-color: var(--tv-blue); color: var(--tv-blue); background: var(--tv-hover);
}
.tv-color-trigger > i {
  width: 17px; height: 14px; border: 1px solid rgba(19, 23, 34, .12); border-radius: 2px;
}
.tv-color-trigger > span { font-size: 8px; }
.color-scheme-settings { border-bottom: 0 !important; }
.color-scheme-options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.color-scheme-options label {
  min-width: 0; height: 34px; display: flex; align-items: center; justify-content: center;
  gap: 8px; border-radius: 5px; cursor: pointer;
}
.color-scheme-options label:hover { background: var(--tv-hover); }
.color-scheme-options label > span { display: inline-flex; gap: 6px; font-size: 11px; }
.color-scheme-options b, .color-scheme-options em {
  display: inline-flex; align-items: center; gap: 1px; font-style: normal; font-weight: 500;
}
.color-scheme-options b { color: #f23645; }
.color-scheme-options em { color: #089981; }
.color-scheme-options i { font-size: 10px; }
.baseline-color-editor {
  min-height: 34px; display: grid; grid-template-columns: minmax(70px, 1fr) auto auto 26px;
  gap: 8px; align-items: center; margin-top: 5px; padding-top: 8px;
  border-top: 1px solid var(--tv-border);
}
.baseline-color-editor > span { color: var(--tv-muted); font-size: 10px; }
.baseline-color-editor > label {
  display: inline-flex; align-items: center; gap: 4px; color: var(--tv-faint);
  font-size: 9px;
}
.baseline-color-editor > button {
  width: 26px; height: 26px; display: grid; place-items: center; padding: 0;
  border: 0; border-radius: 4px; color: var(--tv-faint); background: transparent;
  cursor: pointer;
}
.baseline-color-editor > button:hover { color: var(--tv-text); background: var(--tv-hover); }
.baseline-color-editor .tv-color-trigger { width: 31px; }
.tv-color-picker {
  --picker-solid: #131722; --picker-hue: hsl(228 100% 50%);
  position: fixed; z-index: 2147483645; width: 246px; padding: 8px;
  border: 1px solid var(--tv-border); border-radius: 6px;
  color: var(--tv-text); background: var(--tv-bg); box-shadow: var(--tv-shadow);
}
.tv-color-palette { display: grid; grid-template-columns: repeat(10, 18px); gap: 5px; }
.tv-color-cell {
  width: 18px; height: 18px; padding: 0; border: 0;
  border-radius: 2px; background: var(--picker-color); cursor: pointer;
}
.tv-color-cell:hover { box-shadow: 0 0 0 2px var(--tv-blue); }
.tv-color-recent {
  min-height: 34px; display: flex; align-items: center; gap: 5px;
  margin-top: 9px; padding-top: 8px; border-top: 1px solid var(--tv-border);
}
.tv-color-recent > div { min-width: 18px; display: flex; gap: 5px; align-items: center; }
.tv-color-recent .tv-color-cell { box-shadow: inset 0 0 0 1px rgb(120 123 134 / 15%); }
.tv-color-add {
  width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center;
  padding: 0; border: 0; border-radius: 3px; color: var(--tv-text);
  background: transparent; cursor: pointer;
}
.tv-color-add:hover { background: var(--tv-hover); }
.tv-color-add i { font-size: 15px; }
.tv-color-opacity { display: grid; gap: 5px; margin-top: 2px; }
.tv-color-opacity > span { color: var(--tv-faint); font-size: 10px; }
.tv-color-opacity-row { display: grid; grid-template-columns: minmax(0, 1fr) 44px; gap: 7px; align-items: center; }
.tv-color-opacity input {
  width: 100%; height: 12px; margin: 0; appearance: none; border: 1px solid var(--tv-border);
  border-radius: 7px; cursor: pointer; background-color: #fff;
  background-image:
    linear-gradient(to right, transparent, var(--picker-solid)),
    conic-gradient(#b2b5be 25%, #fff 0 50%, #b2b5be 0 75%, #fff 0);
  background-size: 100% 100%, 8px 8px;
}
.tv-color-opacity input::-webkit-slider-thumb {
  width: 11px; height: 11px; appearance: none; border: 2px solid var(--tv-text);
  border-radius: 50%; background: var(--tv-bg); box-shadow: 0 0 0 1px var(--tv-bg);
}
.tv-color-opacity output {
  height: 27px; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--tv-border); border-radius: 4px; font-size: 10px;
}
.tv-color-picker-advanced { display: none; }
.tv-color-picker.advanced-mode .tv-color-picker-main { display: none; }
.tv-color-picker.advanced-mode .tv-color-picker-advanced { display: grid; gap: 8px; }
.tv-color-advanced-head {
  display: grid; grid-template-columns: 28px minmax(0, 1fr) 44px; gap: 7px; align-items: center;
}
.tv-color-advanced-head > i {
  width: 26px; height: 26px; border: 1px solid var(--tv-border); border-radius: 4px;
  background: var(--picker-solid);
}
.tv-color-advanced-head input {
  width: 100%; height: 27px; padding: 0 7px; border: 1px solid var(--tv-blue);
  border-radius: 4px; color: var(--tv-text); background: var(--tv-bg); font-size: 11px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; text-transform: uppercase;
}
.tv-color-advanced-head input.invalid { border-color: var(--tv-down); }
.tv-color-advanced-head button {
  height: 27px; padding: 0; border: 0; border-radius: 4px;
  color: #fff; background: var(--tv-text); font-size: 10px; cursor: pointer;
}
.tv-color-advanced-body { display: grid; grid-template-columns: minmax(0, 1fr) 18px; gap: 8px; }
.tv-color-sv, .tv-color-hue { position: relative; height: 184px; cursor: crosshair; touch-action: none; }
.tv-color-sv {
  border-radius: 2px;
  background: linear-gradient(to bottom, transparent, #000), linear-gradient(to right, #fff, transparent), var(--picker-hue);
}
.tv-color-hue {
  border-radius: 2px;
  background: linear-gradient(to bottom, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00);
}
.tv-color-sv-knob, .tv-color-hue-knob { position: absolute; pointer-events: none; background: transparent; }
.tv-color-sv-knob {
  width: 11px; height: 11px; border: 2px solid #131722; border-radius: 50%;
  box-shadow: 0 0 0 1px #fff; transform: translate(-50%, -50%);
}
.tv-color-hue-knob {
  left: -3px; width: 24px; height: 7px; border: 2px solid #131722; border-radius: 2px;
  box-shadow: 0 0 0 1px #fff; transform: translateY(-50%);
}
.global-settings-popover > small {
  min-height: 30px; display: flex; align-items: center; padding: 0 13px;
  border-top: 1px solid var(--tv-border); color: var(--tv-faint); font-size: 9px;
}

.terminal-workspace { height: calc(100% - var(--topbar-height)); display: flex; min-width: 0; }
.terminal-rail {
  flex: 0 0 var(--rail-width); width: var(--rail-width); height: 100%;
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 0;
  border-right: 1px solid var(--tv-border); background: #fff;
}
.terminal-rail a, .terminal-rail button {
  width: 36px; height: 36px; display: grid; place-items: center;
  border: 0; border-radius: 5px; color: #434651; background: transparent; font-size: 19px;
}
.terminal-rail a:hover, .terminal-rail button:hover, .terminal-rail a.active {
  color: var(--tv-blue); background: var(--tv-hover);
}
.terminal-rail a.active { box-shadow: inset 2px 0 var(--tv-blue); }
.rail-separator { width: 28px; height: 1px; margin: 3px 0; background: var(--tv-border); }
.rail-spacer { flex: 1; }
.terminal-main { position: relative; flex: 1; min-width: 0; height: 100%; overflow: hidden; background: #fff; }
.toast-message { position: absolute; z-index: 100; top: 12px; left: 50%; transform: translateX(-50%); padding: 8px 12px; border: 1px solid var(--tv-border); border-radius: 5px; background: #fff; box-shadow: var(--tv-shadow); }
.workspace-save-status {
  position: fixed; z-index: 1200; top: 52px; left: 50%;
  transform: translate(-50%, -4px); padding: 5px 9px;
  border: 1px solid var(--tv-border); border-radius: 5px;
  color: var(--tv-muted); background: var(--tv-bg); box-shadow: var(--tv-shadow);
  font-size: 11px; line-height: 16px; opacity: 0; pointer-events: none;
  transition: opacity .12s ease, transform .12s ease;
}
.workspace-save-status.visible { opacity: 1; transform: translate(-50%, 0); }

.workspace-frame-page .terminal-workspace { height: 100%; }
.persistent-workspaces,
.persistent-workspace-panel,
.persistent-workspace-frame {
  width: 100%;
  height: 100%;
}
.persistent-workspaces {
  position: relative;
  overflow: hidden;
  background: var(--tv-bg);
}
.persistent-workspace-panel {
  position: absolute;
  z-index: 0;
  inset: 0;
  visibility: hidden;
  pointer-events: none;
}
.persistent-workspace-panel.active {
  z-index: 1;
  visibility: visible;
  pointer-events: auto;
}
.persistent-workspace-frame {
  display: block;
  border: 0;
  background: var(--tv-bg);
}

.screen-app, .market-app { width: 100%; height: 100%; display: flex; flex-direction: column; min-width: 0; }
.screen-commandbar {
  flex: 0 0 42px; height: 42px; display: flex; align-items: center; gap: 4px;
  padding: 0 8px; border-bottom: 1px solid var(--tv-border); background: #fff;
}
.screen-commandbar-screener {
  flex-basis: 38px; height: 38px; gap: 6px;
}
.screener-context {
  min-width: 0; display: flex; align-items: baseline; gap: 7px; padding: 0 6px;
  white-space: nowrap;
}
.screener-context strong { font-size: 13px; font-weight: 600; }
.screener-context span { color: var(--tv-muted); font-size: 10px; }
.screen-commandbar-screener .command-state { margin-left: 2px; }
.screen-commandbar-screener .watchlist-primary-button,
.screen-commandbar-screener .tv-button,
.screen-commandbar-screener select { height: 28px; }
.command-title { display: flex; align-items: center; gap: 7px; padding: 0 6px; }
.command-title > i { font-size: 16px; }
.command-title > span { color: var(--tv-faint); }
.command-button {
  height: 30px; display: inline-flex; align-items: center; gap: 6px; padding: 0 9px;
  border: 0; border-radius: 5px; background: transparent; font-size: 12px;
}
.command-button:hover { background: var(--tv-hover); }
.command-button:disabled { opacity: .45; cursor: not-allowed; }
.command-button:disabled:hover { background: transparent; }
.command-state { display: inline-flex; align-items: center; gap: 7px; margin-left: 8px; color: var(--tv-muted); font-size: 11px; }
.command-state.stale .status-dot { background: var(--tv-orange); }

.screener-split {
  --drawer-width: min(520px, 39vw);
  flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(520px, 1fr) 5px var(--drawer-width);
  transition: grid-template-columns .2s ease;
}
.screener-split.drawer-collapsed { grid-template-columns: minmax(0, 1fr) 0 0; }
.screener-split.drawer-expanded { --drawer-width: min(680px, 54vw); }
.split-resizer {
  position: relative; z-index: 17; min-width: 5px; cursor: col-resize; touch-action: none; background: #fff;
  border-left: 1px solid var(--tv-border); border-right: 1px solid transparent;
}
.split-resizer::before {
  content: ""; position: absolute; inset: 0 -3px;
}
.split-resizer::after {
  content: ""; position: absolute; top: 50%; left: 50%; width: 2px; height: 38px;
  border-radius: 2px; background: transparent; transform: translate(-50%, -50%);
}
.split-resizer:hover::after, .split-resizer.dragging::after { background: var(--tv-blue); }
.drawer-collapsed .split-resizer { visibility: hidden; }
body.resizing-columns { cursor: col-resize; user-select: none; }
body.resizing-columns::after {
  content: ""; position: fixed; z-index: 2147483646; inset: 0;
  cursor: col-resize;
}
body.resizing-columns iframe { pointer-events: none !important; }
.screener-main { position: relative; min-width: 0; min-height: 0; display: flex; flex-direction: column; background: #fff; }
.watchlist-primary-button {
  flex: 0 0 auto; height: 32px; display: inline-flex; align-items: center; gap: 7px; margin-left: auto; padding: 0 10px;
  border: 1px solid var(--tv-border); border-radius: 5px; color: var(--tv-text); background: #fff;
  font-size: 11px; font-weight: 600; white-space: nowrap;
}
.watchlist-primary-button:hover { border-color: var(--tv-border-strong); background: var(--tv-hover); }
.watchlist-primary-button i { color: var(--tv-blue); font-size: 15px; }
.watchlist-primary-button b {
  min-width: 18px; height: 18px; display: inline-grid; place-items: center; padding: 0 5px;
  border-radius: 9px; color: var(--tv-blue); background: #e9efff; font-size: 9px;
}
.strategy-picker { display: flex; align-items: center; gap: 5px; }
select, input {
  height: 30px; padding: 0 9px; border: 1px solid var(--tv-border);
  border-radius: 5px; outline: 0; background: #fff; font-size: 12px;
}
select:focus, input:focus { border-color: var(--tv-blue); box-shadow: 0 0 0 1px var(--tv-blue); }
.strategy-picker select { min-width: 145px; }
.tv-button {
  height: 30px; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 0 11px; border: 1px solid var(--tv-border); border-radius: 5px;
  background: #fff; font-size: 12px; font-weight: 600;
}
.tv-button:hover { background: var(--tv-hover); }
.tv-button.primary { color: #fff; border-color: var(--tv-blue); background: var(--tv-blue); }
.tv-button.primary:hover { background: var(--tv-blue-dark); }
.tv-button.ghost { color: var(--tv-blue); border-color: transparent; background: transparent; }

.filter-ribbon {
  flex: 0 0 auto; display: flex; align-items: center; gap: 5px; padding: 8px 10px;
  border-bottom: 1px solid var(--tv-border); overflow-x: auto; scrollbar-width: none;
}
.filter-ribbon::-webkit-scrollbar { display: none; }
.filter-chip {
  flex: 0 0 auto; height: 31px; display: inline-flex; align-items: center; gap: 6px; padding: 0 10px;
  border: 1px solid var(--tv-border); border-radius: 5px; color: #434651; background: #fff; font-size: 12px;
}
.filter-chip:hover { border-color: var(--tv-border-strong); background: var(--tv-hover); }
.filter-chip.primary { color: var(--tv-text); font-weight: 600; }
.filter-chip.icon-only { width: 31px; justify-content: center; padding: 0; }
.cn-dot { width: 20px; height: 20px; display: inline-grid; place-items: center; border-radius: 50%; color: #fff; background: var(--tv-down); font-size: 8px; font-weight: 800; }

.filter-editor {
  position: absolute; z-index: 25; top: 49px; right: 9px; left: 9px; max-height: min(560px, calc(100% - 72px));
  padding: 14px; overflow: auto; border: 1px solid var(--tv-border);
  border-radius: 7px; background: #fff; box-shadow: var(--tv-shadow);
}
.watchlist-panel {
  position: absolute; z-index: 27; top: 51px; left: 10px; width: min(390px, calc(100% - 20px));
  max-height: min(570px, calc(100% - 74px)); display: flex; flex-direction: column;
  overflow: hidden; border: 1px solid var(--tv-border); border-radius: 7px;
  background: #fff; box-shadow: var(--tv-shadow);
}
.watchlist-panel > header { min-height: 46px; display: flex; align-items: center; padding: 7px 7px 7px 12px; border-bottom: 1px solid var(--tv-border); }
.watchlist-panel > header div { display: grid; gap: 2px; margin-right: auto; }
.watchlist-panel > header span { color: var(--tv-muted); font-size: 9px; }
.watchlist-create { display: flex; gap: 5px; padding: 8px; border-bottom: 1px solid var(--tv-border); }
.watchlist-create input { flex: 1; min-width: 0; }
.watchlist-tabs { display: flex; gap: 2px; padding: 6px 8px; overflow-x: auto; border-bottom: 1px solid var(--tv-border); }
.watchlist-tabs button {
  flex: 0 0 auto; height: 28px; padding: 0 8px; border: 0; border-radius: 4px;
  color: var(--tv-muted); background: transparent; font-size: 10px;
}
.watchlist-tabs button:hover, .watchlist-tabs button.active { color: var(--tv-text); background: var(--tv-hover); }
.watchlist-tabs span { margin-left: 5px; color: var(--tv-faint); }
.watchlist-items { min-height: 130px; overflow: auto; }
.watchlist-item {
  width: 100%; min-height: 44px; display: grid; grid-template-columns: minmax(0, 1fr) 68px 64px;
  align-items: center; gap: 6px; padding: 5px 10px; border: 0; border-bottom: 1px solid #f0f2f5;
  background: #fff; text-align: left;
}
.watchlist-item:hover { background: var(--tv-hover); }
.watchlist-item > span { min-width: 0; display: flex; align-items: baseline; gap: 7px; }
.watchlist-item b { font-size: 10px; font-weight: 500; }
.watchlist-item small { overflow: hidden; color: var(--tv-muted); text-overflow: ellipsis; white-space: nowrap; }
.watchlist-item strong, .watchlist-item em { text-align: right; font-size: 10px; font-style: normal; font-weight: 500; }
.watchlist-empty { min-height: 145px; display: grid; place-content: center; justify-items: center; gap: 4px; color: var(--tv-muted); }
.watchlist-empty i { font-size: 24px; }
.watchlist-empty small { color: var(--tv-faint); }
.watchlist-panel > .inline-message { padding: 0 10px; }
.filter-editor-header { display: flex; align-items: center; margin-bottom: 12px; }
.filter-editor-header > div { display: flex; align-items: baseline; gap: 9px; }
.filter-editor-header span { color: var(--tv-muted); font-size: 11px; }
.filter-editor-header .icon-button { margin-left: auto; }
.strategy-name-row { max-width: 360px; margin-bottom: 10px; }
.strategy-name-row label { display: block; color: var(--tv-muted); font-size: 11px; }
.strategy-name-row input { width: 100%; margin-top: 4px; }
.rule-tree { display: grid; gap: 7px; }
.rule-group { padding: 9px; border: 1px solid var(--tv-border); border-radius: 5px; background: var(--tv-subtle); }
.group-toolbar { display: flex; align-items: center; gap: 5px; margin-bottom: 8px; }
.group-toolbar strong { margin-right: auto; font-size: 11px; }
.group-toolbar select { width: auto; }
.mini-button {
  height: 28px; padding: 0 8px; border: 1px solid var(--tv-border); border-radius: 4px;
  color: #434651; background: #fff; font-size: 11px;
}
.mini-button:hover { background: var(--tv-hover); }
.mini-button.danger { color: var(--tv-down); }
.group-children { display: grid; gap: 6px; }
.rule-condition {
  display: grid; grid-template-columns: minmax(190px, 1fr) 105px minmax(190px, 1fr) 28px;
  gap: 6px; align-items: start; padding: 7px; border: 1px solid var(--tv-border);
  border-radius: 4px; background: #fff;
}
.operand { display: grid; grid-template-columns: 90px 1fr; gap: 5px; }
.operand .param-row { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 5px; }
.operand .param-row label { display: flex; align-items: center; gap: 4px; color: var(--tv-muted); font-size: 10px; }
.operand .param-row input, .operand .param-row select { width: 80px; }
.remove-rule { width: 28px; height: 28px; border: 0; border-radius: 4px; color: var(--tv-down); background: transparent; font-size: 18px; }
.remove-rule:hover { background: #fff0f1; }
.inline-message { min-height: 18px; margin-top: 7px; color: var(--tv-muted); font-size: 11px; }
.inline-message.error { color: var(--tv-down); }
.inline-message.success { color: var(--tv-up); }
.filter-editor-actions { display: flex; justify-content: flex-end; gap: 6px; margin-top: 8px; }

.view-tabs {
  flex: 0 0 40px; display: flex; align-items: center; gap: 2px; padding: 0 9px;
  border-bottom: 1px solid var(--tv-border); overflow-x: auto; background: #fff;
}
.view-tabs > button {
  position: relative; height: 32px; padding: 0 10px; border: 0; border-radius: 4px;
  color: #434651; background: transparent; font-size: 12px; white-space: nowrap;
}
.view-tabs > button:hover, .view-tabs > button.active { color: var(--tv-text); background: var(--tv-hover); }
.view-tabs > button.active:not(.table-view-toggle) { font-weight: 600; }
.view-tabs > button.active:not(.table-view-toggle)::after {
  content: ""; position: absolute; right: 8px; bottom: -4px; left: 8px; height: 2px; background: var(--tv-blue);
}
.view-tabs > .table-view-toggle { width: 30px; padding: 0; font-size: 16px; }
.result-summary { margin-left: auto; padding-right: 4px; color: var(--tv-muted); font-size: 11px; white-space: nowrap; }
.screener-table-wrap { flex: 1; min-height: 0; overflow: auto; scrollbar-color: #c7cbd3 transparent; }
.screener-table { width: max-content; min-width: 100%; table-layout: fixed; border-collapse: separate; border-spacing: 0; white-space: nowrap; font-size: 11px; }
.screener-table th {
  position: sticky; z-index: 3; top: 0; height: 37px; padding: 0 12px; overflow: hidden;
  border-bottom: 1px solid var(--tv-border); color: var(--tv-muted); background: #fff;
  text-align: right; text-overflow: ellipsis; font-weight: 500;
}
.screener-table th.symbol-column { left: 0; z-index: 4; text-align: left; }
.screener-table th.draggable-column { cursor: grab; user-select: none; }
.screener-table th.dragging { opacity: .45; }
.column-resizer {
  position: absolute; z-index: 5; top: 0; right: -2px; width: 7px; height: 100%;
  cursor: col-resize;
}
.column-resizer::after { content: ""; position: absolute; top: 8px; right: 3px; width: 1px; height: 20px; background: transparent; }
.column-resizer:hover::after { background: var(--tv-blue); }
.screener-table td { height: 38px; padding: 0 12px; overflow: hidden; border-bottom: 1px solid #f0f2f5; text-align: right; text-overflow: ellipsis; }
.screener-table tr { cursor: pointer; }
.screener-table tbody tr:hover td { background: var(--tv-hover); }
.screener-table tbody tr.selected td { background: var(--tv-selected); }
.screener-table td.symbol-cell {
  position: sticky; z-index: 2; left: 0; display: flex; align-items: center;
  gap: 7px; background: #fff; text-align: left;
}
.watchlist-star {
  flex: 0 0 20px; width: 20px; height: 26px; display: grid; place-items: center; padding: 0;
  border: 0; color: #b2b5be; background: transparent; font-size: 15px;
}
.watchlist-star:hover, .watchlist-star.active { color: var(--tv-blue); }
.symbol-code { flex: 0 0 53px; font-size: 11px; font-weight: 400; }
.symbol-name { min-width: 0; overflow: hidden; color: var(--tv-muted); text-overflow: ellipsis; }
.watchlist-membership-popover {
  position: fixed; z-index: 120; width: 230px; overflow: hidden; border: 1px solid var(--tv-border);
  border-radius: 6px; background: #fff; box-shadow: var(--tv-shadow);
}
.watchlist-membership-popover header { display: grid; gap: 2px; padding: 9px 11px; border-bottom: 1px solid var(--tv-border); }
.watchlist-membership-popover header span { color: var(--tv-muted); font-size: 9px; }
.watchlist-membership-popover label { min-height: 34px; display: flex; align-items: center; gap: 8px; padding: 0 10px; }
.watchlist-membership-popover label:hover { background: var(--tv-hover); }
.watchlist-membership-popover label input { width: 15px; height: 15px; margin: 0; }
.watchlist-membership-popover label span { flex: 1; }
.watchlist-membership-popover label small { color: var(--tv-muted); }
.table-empty { flex: 1; display: grid; place-content: center; justify-items: center; gap: 8px; color: var(--tv-muted); }
.table-empty i { font-size: 28px; }
.screener-statusbar, .market-statusbar {
  flex: 0 0 28px; height: 28px; display: flex; align-items: center; gap: 14px; padding: 0 10px;
  border-top: 1px solid var(--tv-border); color: var(--tv-muted); background: #fff; font-size: 10px;
}
.screener-statusbar span, .screener-statusbar a, .market-statusbar span { display: inline-flex; align-items: center; gap: 5px; }
.screener-statusbar a:hover { color: var(--tv-blue); }

.chart-drawer {
  position: relative; min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: hidden;
  background: #fff;
}
.drawer-collapsed .chart-drawer { visibility: hidden; }
.drawer-floating-actions {
  position: absolute; z-index: 35; top: 45px; right: 6px; display: flex;
  align-items: center; gap: 2px; padding: 2px; border-radius: 5px;
  background: color-mix(in srgb, var(--tv-bg) 88%, transparent);
  box-shadow: 0 1px 5px rgba(19, 23, 34, .12);
}
.drawer-floating-actions .icon-button { width: 28px; height: 28px; }
.chart-drawer > .advanced-chart-status { top: 0; }
.drawer-header > div { min-width: 0; display: flex; align-items: center; gap: 6px; margin-right: auto; }
.symbol-search-shell { position: relative; flex: 1; }
.symbol-search-shell > i { flex: 0 0 auto; color: var(--tv-muted); font-size: 14px; }
.symbol-search-shell input {
  width: 90px; height: 29px; padding: 0 3px; border-color: transparent;
  border-radius: 4px; font-size: 13px; font-weight: 500;
}
.symbol-search-shell input:hover { background: var(--tv-hover); }
.drawer-header strong { overflow: hidden; color: var(--tv-muted); font-size: 11px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.symbol-search-results {
  position: absolute; z-index: 60; top: 34px; left: 0; width: min(330px, 78vw); max-height: 330px;
  overflow: auto; border: 1px solid var(--tv-border); border-radius: 6px; background: #fff; box-shadow: var(--tv-shadow);
}
.symbol-search-results button {
  width: 100%; height: 42px; display: flex; align-items: center; gap: 8px; padding: 0 10px;
  border: 0; border-bottom: 1px solid #f0f2f5; background: #fff; text-align: left;
}
.symbol-search-results button:hover { background: var(--tv-hover); }
.symbol-search-results button span { min-width: 0; display: flex; align-items: baseline; gap: 7px; }
.symbol-search-results button b { font-size: 11px; font-weight: 500; }
.symbol-search-results button small { overflow: hidden; color: var(--tv-muted); text-overflow: ellipsis; white-space: nowrap; }
.symbol-search-results button em { margin-left: auto; font-size: 10px; font-style: normal; }
.search-empty { padding: 18px; color: var(--tv-muted); text-align: center; }
.drawer-toolbar {
  position: relative;
  flex: 0 0 39px; display: flex; align-items: center; gap: 4px; padding: 0 7px;
  border-bottom: 1px solid var(--tv-border);
}
.drawer-toolbar select { width: auto; max-width: 92px; border-color: transparent; }
.drawer-toolbar select:hover { background: var(--tv-hover); }
.period-control { display: flex; align-items: center; gap: 4px; color: var(--tv-muted); font-size: 10px; }
.period-control input { width: 48px; }
.chart-popover {
  position: absolute; z-index: 50; top: 35px; left: 60px; width: 285px; padding: 8px;
  border: 1px solid var(--tv-border); border-radius: 6px; background: #fff; box-shadow: var(--tv-shadow);
}
.chart-popover > header { display: grid; gap: 2px; padding: 3px 3px 8px; border-bottom: 1px solid var(--tv-border); }
.chart-popover > header span { color: var(--tv-muted); font-size: 9px; }
.chart-popover > label { min-height: 32px; display: flex; align-items: center; gap: 8px; padding: 0 3px; font-size: 11px; }
.chart-popover > label input[type="checkbox"] { width: 15px; height: 15px; margin: 0; }
.custom-indicator { display: grid; grid-template-columns: 1fr 65px 54px; gap: 5px; padding: 8px 3px 4px; border-top: 1px solid var(--tv-border); }
.custom-indicator select, .custom-indicator input { width: 100%; }
.indicator-custom-list { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px 3px 2px; }
.indicator-custom-list button {
  height: 24px; display: inline-flex; align-items: center; gap: 4px; padding: 0 6px;
  border: 0; border-radius: 4px; color: var(--tv-blue); background: var(--tv-selected); font-size: 9px;
}
.chart-settings { left: auto; right: 35px; width: 220px; }
.chart-settings > label { display: grid; grid-template-columns: 1fr 34px; }
.chart-settings input[type="color"] { width: 30px; height: 22px; padding: 1px; border-radius: 4px; }
.indicator-legend {
  flex: 0 0 auto; min-height: 24px; display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px;
  padding: 3px 9px; color: var(--tv-muted); font-size: 9px;
}
.indicator-legend:empty { display: none; }
.indicator-legend span { display: inline-flex; align-items: center; gap: 4px; }
.indicator-legend i { width: 9px; height: 2px; background: var(--indicator-color); }
.drawer-quote { flex: 0 0 30px; display: flex; align-items: center; gap: 8px; padding: 0 9px; color: var(--tv-muted); font-size: 10px; }
#drawer-ohlc { color: var(--tv-up); }
#drawer-chart-message { margin-left: auto; }
.drawer-chart { flex: 1; min-height: 220px; }
.drawer-vp {
  flex: 0 0 32px; display: flex; align-items: center; gap: 11px; padding: 0 9px;
  border-top: 1px solid var(--tv-border); color: var(--tv-muted); font-size: 10px;
}
.drawer-vp strong { color: var(--tv-text); }
.drawer-rangebar {
  flex: 0 0 32px; display: flex; align-items: center; gap: 2px; padding: 0 7px;
  border-top: 1px solid var(--tv-border);
}
.drawer-rangebar button { height: 25px; padding: 0 7px; border: 0; border-radius: 4px; color: var(--tv-muted); background: transparent; font-size: 10px; }
.drawer-rangebar button:hover, .drawer-rangebar button.active { color: var(--tv-text); background: var(--tv-hover); }

.market-layout { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr); }
.market-canvas { min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: auto; background: #fff; }
.market-chart-toolbar,
.breadth-toolbar {
  position: relative; flex: 0 0 38px; min-height: 38px; display: flex; align-items: center;
  gap: 12px; padding: 4px 10px 4px 14px;
}
.market-header-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.market-period { color: var(--tv-faint); font-size: 9px; white-space: nowrap; }
.range-selector { display: flex; gap: 2px; }
.range-selector button {
  height: 28px; padding: 0 9px; border: 0; border-radius: 4px; color: var(--tv-muted); background: transparent; font-size: 10px;
}
.range-selector button:hover, .range-selector button.active { color: var(--tv-text); background: var(--tv-hover); }
.market-select-shell { position: relative; }
.market-select-button {
  height: 30px; display: inline-flex; align-items: center; gap: 6px; padding: 0 9px;
  border: 1px solid var(--tv-border); border-radius: 5px; color: #434651; background: #fff; font-size: 11px;
}
.market-select-button:hover, .market-select-button[aria-expanded="true"] { border-color: var(--tv-border-strong); background: var(--tv-hover); }
.market-select-button > i:first-child { color: var(--tv-blue); font-size: 15px; }
.market-select-button b {
  min-width: 18px; height: 18px; display: inline-grid; place-items: center; padding: 0 5px;
  border-radius: 9px; color: var(--tv-blue); background: #e9efff; font-size: 9px;
}
.market-select-popover {
  position: absolute; z-index: 45; top: calc(100% + 6px); right: 0; width: 340px;
  overflow: hidden; border: 1px solid var(--tv-border); border-radius: 7px; background: #fff; box-shadow: var(--tv-shadow);
}
.market-select-popover.viewport-pinned { position: fixed; top: 56px; right: 28px; bottom: auto; }
.market-select-popover > header { min-height: 52px; display: flex; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--tv-border); }
.market-select-popover > header > div { display: grid; gap: 3px; }
.market-select-popover > header strong { font-size: 12px; }
.market-select-popover > header span, .market-select-popover > footer { color: var(--tv-muted); font-size: 9px; }
.market-select-popover > footer { min-height: 31px; display: flex; align-items: center; padding: 0 12px; border-top: 1px solid var(--tv-border); background: var(--tv-subtle); }
.market-appearance-popover { width: 320px; }
.market-appearance-scroll { max-height: 420px; overflow: auto; padding: 6px 0; }
.market-appearance-scroll section { padding: 5px 11px 8px; }
.market-appearance-scroll section + section { border-top: 1px solid var(--tv-border); }
.market-appearance-scroll h4 {
  margin: 0 0 4px; color: var(--tv-faint); font-size: 9px; font-weight: 500;
}
.market-color-row {
  min-height: 31px; display: grid; grid-template-columns: minmax(0, 1fr) 34px;
  align-items: center; gap: 10px; color: var(--tv-text); font-size: 10px;
}
.market-color-row > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.market-signal-method {
  margin: 0 11px 6px; padding: 8px; border-radius: 4px;
  color: var(--tv-muted); background: var(--tv-subtle); font-size: 9px; line-height: 1.5;
}
.market-select-popover > footer.market-appearance-footer { justify-content: space-between; gap: 10px; }
.market-appearance-footer button {
  height: 24px; padding: 0 7px; border: 0; border-radius: 4px;
  color: var(--tv-blue); background: transparent; font-size: 9px; cursor: pointer;
}
.market-appearance-footer button:hover { background: var(--tv-hover); }
.market-appearance-footer span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.market-select-options { max-height: 330px; overflow: auto; padding: 4px 0; }
.market-select-options label {
  min-height: 44px; display: grid; grid-template-columns: 18px 9px minmax(0, 1fr) 58px;
  align-items: center; gap: 8px; padding: 4px 11px;
}
.market-select-options label:hover { background: var(--tv-hover); }
.market-select-options label.disabled { opacity: .45; }
.market-select-options input { width: 15px; height: 15px; margin: 0; accent-color: var(--tv-blue); }
.market-select-options label > i { width: 8px; height: 3px; border-radius: 2px; background: var(--option-color); }
.market-select-options label > span { min-width: 0; display: grid; gap: 2px; }
.market-select-options strong { overflow: hidden; font-size: 10px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.market-select-options small { color: var(--tv-muted); font-size: 8px; }
.market-select-options em { text-align: right; color: var(--tv-muted); font-size: 9px; font-style: normal; }
.market-legend { min-width: 0; display: flex; align-items: center; gap: 18px; color: var(--tv-muted); font-size: 10px; }
.market-legend span { display: inline-flex; align-items: center; gap: 6px; }
.market-legend i { width: 8px; height: 3px; border-radius: 2px; background: var(--legend-color); }
.market-legend strong { color: var(--tv-text); }
.market-legend .legend-note { display: none; }
.market-index-chart { position: relative; flex: 0 0 42vh; min-height: 300px; border-bottom: 1px solid var(--tv-border); }
.breadth-toolbar { border-bottom: 1px solid var(--tv-border); }
.breadth-toolbar > .market-select-shell { margin-left: auto; }
.breadth-select-popover { top: auto; bottom: calc(100% + 6px); width: 310px; }
.breadth-grid { display: grid; grid-template-columns: 1fr; border-bottom: 1px solid var(--tv-border); }
.breadth-panel { min-width: 0; }
.breadth-panel + .breadth-panel { border-left: 0; }
.breadth-legend { min-width: 0; display: flex; align-items: center; gap: 13px; }
.breadth-legend span { display: inline-flex; align-items: center; gap: 5px; color: var(--tv-muted); font-size: 9px; }
.breadth-legend i { width: 8px; height: 3px; border-radius: 2px; background: var(--legend-color); }
.breadth-legend b { color: var(--tv-text); font-size: 10px; }
.breadth-chart { position: relative; height: 285px; }
.concentration-toolbar {
  flex: 0 0 38px; min-height: 38px; display: flex; align-items: center;
  padding: 0 14px; border-bottom: 1px solid var(--tv-border);
}
.concentration-legend { display: flex; align-items: center; gap: 6px; color: var(--tv-muted); font-size: 10px; }
.concentration-legend > i { width: 8px; height: 3px; border-radius: 2px; background: var(--concentration-color, #7e57c2); }
.concentration-legend strong { color: var(--tv-text); }
.concentration-legend small { margin-left: 4px; color: var(--tv-faint); font-size: 9px; }
.concentration-chart { position: relative; flex: 0 0 245px; min-height: 245px; border-bottom: 1px solid var(--tv-border); }
.market-signal-overlay {
  position: absolute; z-index: 3; inset: 0 64px 26px 0;
  overflow: hidden; pointer-events: none;
}
.market-signal-overlay > i {
  position: absolute; top: 0; bottom: 0; min-width: 1px; pointer-events: none;
}
.market-statusbar { flex: 0 0 30px; }

/* Dedicated charting workspace */
.charting-workspace {
  width: 100%; height: 100%; min-width: 0; display: flex; flex-direction: column;
  overflow: hidden; background: #fff;
}
.charting-grid {
  --watchlist-width: 350px;
  --info-width: 300px;
  flex: 1; min-height: 0; display: grid;
  grid-template-columns: var(--watchlist-width) 5px minmax(340px, 1fr) 5px var(--info-width);
  background: #fff; transition: grid-template-columns .18s ease;
}
.charting-grid.info-collapsed {
  grid-template-columns: var(--watchlist-width) 5px minmax(340px, 1fr) 0 0;
}
.charting-grid.watchlist-collapsed {
  grid-template-columns: 0 0 minmax(340px, 1fr) 5px var(--info-width);
}
.charting-grid.watchlist-collapsed.info-collapsed {
  grid-template-columns: 0 0 minmax(340px, 1fr) 0 0;
}
.workspace-resizer {
  position: relative; z-index: 18; min-width: 5px; cursor: col-resize;
  border-left: 1px solid var(--tv-border); background: #fff;
}
.workspace-resizer::after {
  content: ""; position: absolute; top: 50%; left: 50%; width: 2px; height: 40px;
  border-radius: 2px; background: transparent; transform: translate(-50%, -50%);
}
.workspace-resizer:hover::after, .workspace-resizer.dragging::after { background: var(--tv-blue); }
.info-collapsed #info-resizer, .info-collapsed .instrument-info,
.watchlist-collapsed #watchlist-resizer, .watchlist-collapsed .native-watchlist {
  visibility: hidden;
}

.native-watchlist {
  position: relative; min-width: 0; min-height: 0; display: flex; flex-direction: column;
  overflow: hidden; background: #fff;
}
.native-watchlist-header {
  position: relative; flex: 0 0 42px; display: flex; align-items: center; gap: 2px;
  padding: 0 6px 0 10px; border-bottom: 1px solid var(--tv-border);
}
.watchlist-title-button {
  min-width: 0; height: 32px; display: flex; align-items: center; gap: 6px;
  padding: 0 4px; border: 0; border-radius: 4px; background: transparent;
}
.watchlist-title-button:hover { background: var(--tv-hover); }
.watchlist-title-button strong {
  max-width: 150px; overflow: hidden; font-size: 14px; font-weight: 600;
  text-overflow: ellipsis; white-space: nowrap;
}
.watchlist-title-button > i { color: var(--tv-muted); font-size: 11px; }
.header-spacer, .footer-spacer, .charting-symbol-spacer, .rangebar-spacer { flex: 1; }
.native-watchlist-header > .icon-button { min-width: 32px; width: 32px; font-size: 19px; }
.native-watchlist-menu, .native-add-symbol {
  position: absolute; z-index: 75; top: 42px; right: 6px; left: 6px;
  overflow: hidden; border: 1px solid var(--tv-border); border-radius: 7px;
  background: #fff; box-shadow: var(--tv-shadow);
}
.native-watchlist-menu > header {
  min-height: 48px; display: grid; align-content: center; gap: 2px;
  padding: 7px 10px; border-bottom: 1px solid var(--tv-border);
}
#native-watchlist-options { max-height: 250px; overflow: auto; padding: 4px; }
#native-watchlist-options button {
  width: 100%; height: 35px; display: flex; align-items: center; gap: 8px;
  padding: 0 7px; border: 0; border-radius: 4px; background: transparent; text-align: left;
}
#native-watchlist-options button:hover, #native-watchlist-options button.active { background: var(--tv-hover); }
#native-watchlist-options button i { width: 18px; color: var(--tv-blue); text-align: center; }
#native-watchlist-options button span { flex: 1; }
#native-watchlist-options button small { color: var(--tv-muted); }
.watchlist-add-separator {
  width: calc(100% - 8px); height: 32px; display: flex; align-items: center; gap: 8px;
  margin: 0 4px 4px; padding: 0 8px; border: 0; border-radius: 4px;
  color: var(--tv-text); background: transparent; text-align: left;
}
.watchlist-add-separator:hover { background: var(--tv-hover); }
.watchlist-add-separator i { width: 18px; color: var(--tv-blue); text-align: center; }
#native-watchlist-create-form {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 5px;
  padding: 8px; border-top: 1px solid var(--tv-border);
}
#native-watchlist-create-form input { min-width: 0; }
.native-watchlist-menu .inline-message { padding: 0 8px 6px; }
.native-add-symbol { padding: 6px; }
.native-add-symbol > div:first-child {
  display: flex; align-items: center; gap: 5px; padding: 0 6px;
  border: 1px solid var(--tv-blue); border-radius: 5px;
}
.native-add-symbol > div:first-child i { color: var(--tv-muted); }
.native-add-symbol input { flex: 1; min-width: 0; padding: 0; border: 0; box-shadow: none; }
#native-symbol-results { max-height: 330px; overflow: auto; }
#native-symbol-results > button {
  width: 100%; min-height: 42px; display: flex; align-items: center; gap: 7px;
  padding: 5px 7px; border: 0; border-bottom: 1px solid #f0f2f5;
  background: #fff; text-align: left;
}
#native-symbol-results > button:hover { background: var(--tv-hover); }
#native-symbol-results > button > span { min-width: 0; display: grid; gap: 2px; }
#native-symbol-results b { font-size: 11px; font-weight: 500; }
#native-symbol-results small { overflow: hidden; color: var(--tv-muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
#native-symbol-results em { margin-left: auto; font-size: 10px; font-style: normal; }
.native-watchlist-columns {
  flex: 0 0 34px; display: grid; grid-template-columns: var(--watchlist-grid-template, 58px 92px);
  min-width: var(--watchlist-content-width, 100%);
  align-items: stretch; gap: 4px; padding: 0 8px; border-bottom: 1px solid var(--tv-border);
  overflow: hidden; color: var(--tv-muted); font-size: 11px; user-select: none;
}
.watchlist-column-header {
  position: relative; min-width: 0; display: flex; align-items: center; gap: 3px;
  padding: 0 5px 0 0; overflow: visible; border: 0; background: transparent;
  color: var(--tv-muted); font-size: 11px; text-align: left; white-space: nowrap;
}
.watchlist-column-header.numeric { justify-content: flex-end; text-align: right; }
.watchlist-column-header > span {
  min-width: 0; overflow: hidden; text-overflow: ellipsis;
}
.watchlist-column-header > i { flex: 0 0 auto; color: var(--tv-blue); font-size: 9px; }
.watchlist-column-header[data-draggable-column] { cursor: grab; touch-action: none; }
.watchlist-column-header.dragging { opacity: .45; }
.watchlist-column-header.drag-over { box-shadow: inset 2px 0 var(--tv-blue); }
.watchlist-column-resize {
  position: absolute; z-index: 2; top: 5px; right: -4px; bottom: 5px;
  width: 7px; border-radius: 2px; cursor: col-resize;
}
.watchlist-column-resize:hover { background: var(--tv-blue); opacity: .65; }
.watchlist-column-menu {
  position: absolute; z-index: 90; top: var(--watchlist-menu-y, 76px); left: var(--watchlist-menu-x, 12px);
  width: 214px; overflow: hidden; border: 1px solid var(--tv-border); border-radius: 6px;
  background: #fff; box-shadow: var(--tv-shadow);
}
.watchlist-column-menu > header {
  height: 38px; display: flex; align-items: center; padding: 0 10px;
  border-bottom: 1px solid var(--tv-border);
}
.watchlist-column-menu > header strong { font-size: 12px; font-weight: 600; }
.watchlist-column-menu > header span { margin-left: auto; color: var(--tv-muted); font-size: 10px; }
#watchlist-column-options { max-height: 310px; overflow: auto; padding: 4px; }
#watchlist-column-options label {
  height: 31px; display: flex; align-items: center; gap: 8px; padding: 0 7px;
  border-radius: 4px; color: var(--tv-text); font-size: 12px; cursor: pointer;
}
#watchlist-column-options label:hover { background: var(--tv-hover); }
#watchlist-column-options input { width: 14px; height: 14px; margin: 0; accent-color: var(--tv-blue); }
.watchlist-column-menu > footer { padding: 4px; border-top: 1px solid var(--tv-border); }
.watchlist-column-menu > footer button {
  width: 100%; height: 30px; border: 0; border-radius: 4px; background: transparent;
  color: var(--tv-text); font-size: 12px; text-align: left;
}
.watchlist-column-menu > footer button:hover { background: var(--tv-hover); }
.watchlist-row-menu {
  position: fixed; z-index: 150; width: 230px; padding: 4px;
  border: 1px solid var(--tv-border); border-radius: 7px;
  background: var(--tv-bg); box-shadow: var(--tv-shadow);
}
.watchlist-row-menu > button,
.context-submenu-shell > button,
.context-submenu > button {
  width: 100%; min-height: 32px; display: flex; align-items: center; gap: 8px;
  padding: 0 8px; border: 0; border-radius: 4px; background: transparent;
  color: var(--tv-text); text-align: left; white-space: nowrap;
}
.watchlist-row-menu button:hover { background: var(--tv-hover); }
.watchlist-row-menu button > i:first-child { width: 17px; color: var(--tv-muted); text-align: center; }
.watchlist-row-menu button > span { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.watchlist-row-menu button.danger { color: var(--tv-down); }
.watchlist-row-menu hr {
  height: 1px; margin: 4px -4px; border: 0; background: var(--tv-border);
}
.context-submenu-shell { position: relative; }
.context-submenu {
  position: absolute; z-index: 2; top: -4px; left: calc(100% + 4px); width: 190px;
  display: none; max-height: 270px; overflow: auto; padding: 4px;
  border: 1px solid var(--tv-border); border-radius: 7px;
  background: var(--tv-bg); box-shadow: var(--tv-shadow);
}
.context-submenu-shell:hover > .context-submenu,
.context-submenu-shell:focus-within > .context-submenu { display: block; }
.context-menu-empty {
  min-height: 32px; display: flex; align-items: center; padding: 0 8px;
  color: var(--tv-faint); font-size: 10px;
}
.overlay-scroll-shell {
  position: relative; min-width: 0; min-height: 0; overflow: hidden;
}
.native-watchlist-scroll-shell,
.instrument-info-scroll-shell { flex: 1 1 auto; }
.overlay-scroll-surface {
  width: 100%; height: 100%; min-width: 0; min-height: 0; overflow: auto;
  overscroll-behavior: contain; scrollbar-width: none;
}
.overlay-scroll-surface::-webkit-scrollbar { display: none; width: 0; height: 0; }
.overlay-scroll-track {
  position: absolute; z-index: 12; opacity: 0; pointer-events: none;
  transition: opacity .12s ease;
}
.overlay-scroll-track.vertical { top: 3px; right: 2px; bottom: 3px; width: 4px; }
.overlay-scroll-track.horizontal { right: 3px; bottom: 2px; left: 3px; height: 4px; }
.overlay-scroll-track.is-scrollable .overlay-scroll-thumb { pointer-events: auto; }
.overlay-scroll-shell:hover .overlay-scroll-track.is-scrollable,
.overlay-scroll-shell.scrolling .overlay-scroll-track.is-scrollable,
.overlay-scroll-track.dragging { opacity: .52; }
.overlay-scroll-track:hover,
.overlay-scroll-track.dragging { opacity: .82 !important; }
.overlay-scroll-thumb {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  border-radius: 999px; background: var(--tv-muted); cursor: default;
  touch-action: none; will-change: transform;
}
.overlay-scroll-track.vertical .overlay-scroll-thumb { cursor: ns-resize; }
.overlay-scroll-track.horizontal .overlay-scroll-thumb { cursor: ew-resize; }
.native-watchlist-rows { flex: none; }
.native-watchlist-row {
  position: relative; width: 100%; min-width: var(--watchlist-content-width, 100%); min-height: 38px; display: grid;
  grid-template-columns: var(--watchlist-grid-template, 58px 92px);
  align-items: center; gap: 4px; padding: 0 8px; border: 0;
  border-bottom: 1px solid var(--tv-subtle); background: var(--tv-bg); text-align: left;
}
.native-watchlist-row:hover { background: var(--tv-hover); }
.native-watchlist-row.selected {
  z-index: 1; background: var(--tv-selected); box-shadow: inset 2px 0 var(--tv-blue);
}
.watchlist-code {
  min-width: 0; overflow: hidden; color: var(--tv-muted); font-size: 11px;
  text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums;
}
.watchlist-security { min-width: 0; display: flex; align-items: center; gap: 5px; }
.watchlist-security strong {
  min-width: 0; overflow: hidden; font-size: 13px; font-weight: 400; text-overflow: ellipsis; white-space: nowrap;
}
.watchlist-security em { color: var(--tv-orange); font-size: 9px; font-style: normal; font-weight: 600; }
.watchlist-security > i {
  flex: 0 0 7px; width: 7px; height: 7px; border-radius: 50%; background: #9da1aa;
}
.watchlist-value {
  min-width: 0; overflow: hidden; text-align: right; font-size: 12px;
  text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums;
}
.watchlist-separator-row {
  width: 100%; min-width: var(--watchlist-content-width, 100%);
  border-bottom: 1px solid var(--tv-border); background: var(--tv-subtle);
  cursor: grab; touch-action: none;
}
.watchlist-separator-row.dragging { opacity: .65; cursor: grabbing; }
.native-watchlist-row.separator-drop-before,
.watchlist-separator-row.separator-drop-before { box-shadow: inset 0 2px var(--tv-blue); }
.native-watchlist-row.separator-drop-after,
.watchlist-separator-row.separator-drop-after { box-shadow: inset 0 -2px var(--tv-blue); }
.watchlist-separator-row > button {
  position: sticky; left: 0; width: min(100%, 350px); min-height: 30px;
  display: flex; align-items: center; gap: 6px; padding: 0 9px;
  border: 0; background: transparent; color: var(--tv-text); text-align: left;
}
.watchlist-separator-row > button:hover { background: var(--tv-hover); }
.watchlist-separator-row i { color: var(--tv-muted); font-size: 10px; }
.watchlist-separator-row .separator-drag-handle {
  margin-left: -4px; color: var(--tv-faint); font-size: 12px;
}
.watchlist-separator-row strong {
  min-width: 0; overflow: hidden; font-size: 11px; font-weight: 600;
  text-overflow: ellipsis; white-space: nowrap;
}
.watchlist-separator-row small { color: var(--tv-faint); font-size: 9px; }
.native-watchlist-empty {
  min-height: 180px; display: grid; place-content: center; justify-items: center; gap: 5px;
  padding: 20px; color: var(--tv-muted); text-align: center;
}
.native-watchlist-empty i { font-size: 25px; }
.native-watchlist-empty strong { color: var(--tv-text); font-size: 12px; }
.native-watchlist-empty span { color: var(--tv-faint); font-size: 9px; }
.native-watchlist-footer {
  display: none;
}
.native-watchlist-footer .icon-button { min-width: 28px; width: 28px; height: 28px; }

.charting-canvas {
  --related-panel-height: 220px;
  position: relative; min-width: 0; min-height: 0; display: flex; flex-direction: column;
  overflow: hidden; background: #fff;
}
.panel-restore-button {
  position: absolute; z-index: 10; right: auto; bottom: 36px; min-height: 30px;
  display: none; align-items: center; gap: 5px; padding: 0 8px;
  border: 1px solid var(--tv-border); border-radius: 5px;
  color: var(--tv-muted); background: var(--tv-bg); box-shadow: var(--tv-shadow);
  font-size: 10px;
}
.panel-restore-button:hover { color: var(--tv-text); background: var(--tv-hover); }
.panel-restore-button.restore-watchlist {
  left: 6px; top: 718px; bottom: auto;
  width: 40px; min-width: 40px; min-height: 44px;
  height: clamp(44px, calc(100% - 836px), 420px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 6px 0 0; border: 0; border-radius: 8px;
  color: color-mix(in srgb, var(--tv-muted) 34%, transparent);
  background: transparent; box-shadow: none; font-size: 14px;
  transition: color .14s ease, background-color .14s ease;
}
.panel-restore-button.restore-watchlist > i {
  width: 24px; height: 24px; display: grid; place-items: center;
}
.panel-restore-button.restore-watchlist > span { display: none; }
.panel-restore-button.restore-watchlist:hover {
  color: var(--tv-muted);
  background: color-mix(in srgb, var(--tv-hover) 74%, transparent);
}
.panel-restore-button.restore-watchlist:focus { outline: none; }
.panel-restore-button.restore-watchlist:focus-visible {
  color: var(--tv-muted);
  background: color-mix(in srgb, var(--tv-hover) 74%, transparent);
  box-shadow: none;
}
.panel-restore-button.restore-info span { display: none; }
.panel-restore-button.restore-info {
  right: 6px; top: 320px; bottom: auto;
  width: 40px; min-width: 40px; min-height: 44px;
  height: clamp(44px, calc(100% - 750px), 680px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 6px 0 0; border: 0; border-radius: 8px;
  color: color-mix(in srgb, var(--tv-muted) 34%, transparent);
  background: transparent; box-shadow: none; font-size: 14px;
  transition: color .14s ease, background-color .14s ease;
}
.panel-restore-button.restore-info i {
  width: 24px; height: 24px; display: grid; place-items: center;
  font-size: 14px; line-height: 1;
}
.panel-restore-button.restore-info:focus { outline: none; }
.panel-restore-button.restore-info:focus-visible {
  outline: none; color: var(--tv-muted);
  background: color-mix(in srgb, var(--tv-hover) 74%, transparent);
}
.panel-restore-button.restore-info:hover {
  color: var(--tv-muted);
  background: color-mix(in srgb, var(--tv-hover) 74%, transparent);
}
.charting-canvas.related-open .panel-restore-button.restore-info {
  bottom: auto;
  height: clamp(44px, calc(100% - var(--related-panel-height) - 755px), 680px);
}
.charting-canvas.related-open .panel-restore-button.restore-watchlist {
  bottom: auto;
  height: clamp(44px, calc(100% - var(--related-panel-height) - 841px), 420px);
}
@media (max-height: 1050px) {
  .panel-restore-button.restore-watchlist {
    top: auto; bottom: 29px; height: 44px;
    align-items: center; justify-content: center; padding-top: 0;
  }
  .charting-canvas.related-open .panel-restore-button.restore-watchlist {
    bottom: calc(var(--related-panel-height) + 34px);
    height: 44px;
  }
  .panel-restore-button.restore-info {
    top: auto; bottom: 29px; height: 44px;
    align-items: center; justify-content: center; padding-top: 0;
  }
  .charting-canvas.related-open .panel-restore-button.restore-info {
    bottom: calc(var(--related-panel-height) + 34px);
    height: 44px;
  }
}
.advanced-chart-host {
  position: relative; width: 100%; height: 100%; min-width: 0; min-height: 0;
  flex: 1 1 auto; overflow: hidden; background: #fff;
}
.advanced-chart-host > iframe {
  display: block; width: 100% !important; height: 100% !important; border: 0;
}
.advanced-chart-status {
  position: absolute; z-index: 4; inset: 0 0 29px; display: grid; place-items: center;
  color: var(--tv-muted); background: #fff; font-size: 12px;
}
.charting-canvas.related-open .advanced-chart-status {
  bottom: calc(var(--related-panel-height) + 34px);
}
.advanced-chart-status.error { color: var(--tv-down); }
.advanced-chart-status.hidden { display: none; }
.advanced-chart-status.data-empty {
  inset: 46px auto auto 50%; width: max-content; max-width: calc(100% - 120px);
  min-height: 30px; padding: 0 11px; display: flex; align-items: center;
  border: 1px solid var(--tv-border); border-radius: 6px;
  color: var(--tv-muted); background: color-mix(in srgb, var(--tv-bg) 94%, transparent);
  box-shadow: 0 2px 8px rgb(0 0 0 / 10%); pointer-events: none;
  transform: translateX(-50%);
}
.charting-canvas.related-open .advanced-chart-status.data-empty { bottom: auto; }
.chart-history-status {
  position: absolute; z-index: 8; top: 50%; left: 88px;
  display: flex; align-items: center; gap: 7px;
  min-height: 30px; padding: 0 10px;
  border: 1px solid var(--tv-border); border-radius: 6px;
  color: var(--tv-text); background: color-mix(in srgb, var(--tv-bg) 94%, transparent);
  box-shadow: 0 2px 8px rgb(0 0 0 / 10%);
  font-size: 12px; pointer-events: none;
  transform: translateY(-50%);
}
.chart-history-status.hidden { display: none; }
.chart-history-spinner {
  width: 13px; height: 13px; flex: 0 0 13px;
  border: 2px solid var(--tv-border); border-top-color: var(--tv-blue);
  border-radius: 50%; animation: chart-history-spin .8s linear infinite;
}
@keyframes chart-history-spin {
  to { transform: rotate(360deg); }
}
.related-panel-resizer {
  position: relative; z-index: 7; flex: 0 0 0; cursor: row-resize;
  border-top: 0 solid var(--tv-border); background: #fff;
}
.charting-canvas.related-open .related-panel-resizer {
  flex-basis: 5px; border-top-width: 1px;
}
.related-panel-resizer::after {
  content: ""; position: absolute; top: 50%; left: 50%; width: 44px; height: 2px;
  border-radius: 2px; background: transparent; transform: translate(-50%, -50%);
}
.related-panel-resizer:hover::after,
.related-panel-resizer.dragging::after { background: var(--tv-blue); }
.related-panel {
  flex: 0 0 0; min-height: 0; display: flex; flex-direction: column;
  overflow: hidden; visibility: hidden; background: #fff;
}
.charting-canvas.related-open .related-panel {
  flex-basis: var(--related-panel-height); visibility: visible;
}
.related-panel-header {
  flex: 0 0 37px; display: flex; align-items: center; gap: 8px; padding: 0 6px;
  border-bottom: 1px solid var(--tv-border);
}
.related-tabs { height: 100%; display: flex; align-items: stretch; }
.related-tabs button {
  position: relative; min-width: 52px; border: 0; background: transparent;
  color: var(--tv-muted); font-size: 12px;
}
.related-tabs button:hover { color: var(--tv-text); background: var(--tv-hover); }
.related-tabs button.active { color: var(--tv-text); font-weight: 600; }
.related-tabs button.active::after {
  content: ""; position: absolute; right: 8px; bottom: 0; left: 8px;
  height: 2px; background: var(--tv-blue);
}
#related-group-select {
  width: auto; max-width: 180px; height: 28px; padding: 0 26px 0 7px;
  border-color: var(--tv-border); font-size: 11px;
}
.related-source {
  min-width: 0; margin-left: auto; overflow: hidden; color: var(--tv-muted);
  font-size: 10px; text-overflow: ellipsis; white-space: nowrap;
}
.related-panel-header > .icon-button { min-width: 28px; width: 28px; height: 28px; }
.related-table {
  min-height: 0; display: block; flex: 1; overflow: auto;
  overscroll-behavior: contain;
}
.related-table-head, .related-table-row {
  width: 100%; min-width: 680px; box-sizing: border-box; display: grid;
  grid-template-columns: minmax(180px, 2fr) repeat(4, minmax(90px, 1fr));
  align-items: center; gap: 10px; padding: 0 12px;
}
.related-table-head {
  position: sticky; z-index: 2; top: 0; height: 28px;
  border-bottom: 1px solid var(--tv-border); background: var(--tv-bg);
  color: var(--tv-muted); font-size: 10px;
}
.related-table-head span:not(:first-child),
.related-table-row span:not(:first-child) { text-align: right; }
.related-table-body { min-height: calc(100% - 28px); overflow: visible; }
.related-table-row {
  width: 100%; min-height: 32px; border: 0; border-bottom: 1px solid #f0f3fa;
  background: #fff; font-size: 11px; text-align: left;
}
.related-table-row:hover { background: var(--tv-hover); }
.related-table-row.selected { background: var(--tv-selected); }
.related-security {
  min-width: 0; display: flex; align-items: center; gap: 7px;
}
.related-security i { color: var(--tv-blue); font-size: 14px; }
.related-security strong {
  min-width: 0; overflow: hidden; font-size: 11px; font-weight: 500;
  text-overflow: ellipsis; white-space: nowrap;
}
.related-security small { color: var(--tv-muted); font-size: 9px; }
.related-empty {
  height: 100%; min-height: 86px; display: grid; place-content: center; gap: 5px;
  padding: 16px; color: var(--tv-muted); text-align: center;
}
.related-empty strong { color: var(--tv-text); font-size: 12px; font-weight: 500; }
.related-empty span { max-width: 420px; font-size: 10px; line-height: 1.5; }
.chart-bottom-bar {
  flex: 0 0 29px; display: flex; align-items: center; gap: 8px; padding: 0 6px;
  border-top: 1px solid var(--tv-border); background: #fff;
}
.chart-bottom-bar button {
  position: relative; height: 28px; display: flex; align-items: center; gap: 5px; padding: 0 8px;
  border: 0; border-radius: 0; background: transparent; color: var(--tv-muted); font-size: 11px;
}
.chart-bottom-bar button:hover,
.charting-canvas.related-open .chart-bottom-bar button { color: var(--tv-text); background: var(--tv-hover); }
.charting-canvas.related-open .chart-bottom-bar button::before {
  content: ""; position: absolute; top: -1px; right: 5px; left: 5px;
  height: 2px; background: var(--tv-blue);
}
.chart-bottom-bar button i { color: var(--tv-muted); font-size: 12px; }
.chart-bottom-bar > span {
  min-width: 0; overflow: hidden; color: var(--tv-faint); font-size: 9px;
  text-overflow: ellipsis; white-space: nowrap;
}
.charting-symbolbar {
  flex: 0 0 43px; display: flex; align-items: center; gap: 7px;
  padding: 0 8px; border-bottom: 1px solid var(--tv-border);
}
.charting-symbol-search { flex: 0 0 115px; display: flex; align-items: center; }
.charting-symbol-search input { width: 92px; font-size: 13px; font-weight: 500; }
.charting-symbolbar > strong {
  max-width: 220px; overflow: hidden; font-size: 12px; font-weight: 500;
  text-overflow: ellipsis; white-space: nowrap;
}
.symbol-market-badge {
  height: 20px; display: inline-flex; align-items: center; padding: 0 6px;
  border-radius: 3px; color: var(--tv-muted); background: var(--tv-hover); font-size: 8px;
}
.charting-symbolbar #charting-favorite-button.active { color: var(--tv-blue); background: var(--tv-selected); }
.charting-toolbar {
  position: relative; flex: 0 0 40px; display: flex; align-items: center; gap: 3px;
  padding: 0 7px; border-bottom: 1px solid var(--tv-border);
}
.charting-toolbar select { width: auto; border-color: transparent; }
.charting-toolbar select:hover { background: var(--tv-hover); }
.charting-toolbar .chart-popover { top: 36px; left: 54px; }
.charting-toolbar .chart-settings { right: 7px; left: auto; }
.charting-instrument-head {
  flex: 0 0 45px; display: flex; align-items: center; gap: 10px; padding: 0 10px;
}
.charting-instrument-title { min-width: 0; display: flex; align-items: center; gap: 8px; }
.instrument-mark {
  flex: 0 0 28px; width: 28px; height: 28px; display: grid; place-items: center;
  border-radius: 50%; color: var(--tv-blue); background: var(--tv-hover); font-size: 15px;
}
.charting-instrument-title > div { min-width: 0; display: grid; gap: 2px; }
.charting-instrument-title strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.charting-instrument-title span { color: var(--tv-muted); font-size: 8px; }
.charting-ohlc {
  margin-left: auto; overflow: hidden; color: var(--tv-muted); font-size: 9px;
  text-overflow: ellipsis; white-space: nowrap;
}
.charting-chart { flex: 1; min-height: 280px; }
.charting-rangebar #charting-chart-message { color: var(--tv-faint); font-size: 9px; }

.instrument-info {
  min-width: 0; min-height: 0; display: flex; flex-direction: column;
  overflow: hidden; background: #fff;
}
.instrument-info > header {
  flex: 0 0 auto; display: grid; align-content: start; gap: 7px;
  padding: 11px 9px 10px 12px; border-bottom: 1px solid var(--tv-border);
}
.instrument-identity-row {
  min-width: 0; display: flex; align-items: center; min-height: 31px;
}
.instrument-info-symbol {
  min-width: 0; display: flex; align-items: baseline; gap: 7px;
  overflow: hidden; white-space: nowrap;
}
.instrument-info-symbol strong {
  flex: 0 0 auto; color: var(--tv-text); font-size: 15px; font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.instrument-info-symbol span {
  min-width: 0; overflow: hidden; color: var(--tv-text); font-size: 16px;
  font-weight: 600; text-overflow: ellipsis;
}
.instrument-info-actions {
  margin-left: auto; display: flex; align-items: center; gap: 1px;
}
.instrument-info-actions .icon-button { width: 32px; height: 32px; }
.info-favorite-button.active { color: var(--tv-down); }
.instrument-price-line {
  min-width: 0; display: flex; align-items: baseline; gap: 8px;
}
.instrument-price-line > strong {
  flex: 0 0 auto; font-size: 31px; font-weight: 600; line-height: 1;
  letter-spacing: -.4px; font-variant-numeric: tabular-nums;
}
.instrument-price-line > span {
  min-width: 0; overflow: hidden; font-size: 13px; font-weight: 600;
  text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums;
}
.instrument-info-topbar > small { color: var(--tv-muted); font-size: 11px; }
.instrument-market-chips { display: flex; align-items: center; gap: 5px; min-height: 18px; }
.instrument-market-chips span {
  height: 18px; display: inline-flex; align-items: center; padding: 0 5px;
  border-radius: 3px; color: var(--tv-muted); background: var(--tv-hover);
  font-size: 9px; line-height: 18px;
}
.instrument-info-tabs {
  flex: 0 0 40px; display: flex; gap: 2px; padding: 2px 7px 0;
  border-bottom: 1px solid var(--tv-border);
}
.instrument-info-tabs button {
  position: relative; flex: 1; border: 0; background: transparent; color: var(--tv-muted); font-size: 12px;
}
.instrument-info-tabs button:hover { color: var(--tv-text); background: var(--tv-hover); }
.instrument-info-tabs button.active { color: var(--tv-text); font-weight: 600; }
.instrument-info-tabs button.active::after {
  content: ""; position: absolute; right: 8px; bottom: -1px; left: 8px;
  height: 2px; background: var(--tv-blue);
}
.instrument-info-scroll { flex: none; }
.info-section { padding: 14px 12px; border-bottom: 1px solid var(--tv-border); }
.info-section h2 {
  margin: 0 0 9px; color: var(--tv-text); font-size: 13px; font-weight: 600;
}
.info-section.info-overview { padding-top: 8px; padding-bottom: 6px; }
.info-stats {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; margin: 0;
}
.info-stats > div, .info-list > div {
  min-width: 0; min-height: 31px; display: flex; align-items: center;
  border-bottom: 1px solid #f0f2f5;
}
.info-stats dt, .info-list dt { color: var(--tv-muted); font-size: 12px; }
.info-stats dd, .info-list dd {
  min-width: 0; margin-left: auto; overflow: hidden; font-size: 12px;
  text-align: right; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums;
}
.info-overview .info-stats > div { min-height: 28px; border-bottom: 0; }
.info-stats-primary dd { font-weight: 500; }
.info-more-stats { margin-top: 2px; border-top: 1px solid var(--tv-border); }
.info-more-stats > summary {
  min-height: 27px; display: flex; align-items: center; justify-content: center;
  gap: 4px; list-style: none; color: var(--tv-faint); cursor: pointer;
  font-size: 10px; user-select: none;
}
.info-more-stats > summary::-webkit-details-marker { display: none; }
.info-more-stats > summary:hover { color: var(--tv-text); }
.info-more-stats > summary i { font-size: 10px; transition: transform .15s ease; }
.info-more-stats[open] > summary i { transform: rotate(180deg); }
.info-more-stats[open] > .info-stats { padding-bottom: 4px; }
.info-list { margin: 0; }
.data-source-placeholder {
  display: flex; align-items: flex-start; gap: 9px; padding: 3px 0;
  border: 0; background: transparent;
}
.data-source-placeholder > i { color: var(--tv-muted); font-size: 18px; }
.data-source-placeholder > div { display: grid; gap: 3px; }
.data-source-placeholder strong { font-size: 12px; font-weight: 600; }
.data-source-placeholder span { color: var(--tv-muted); font-size: 11px; line-height: 1.5; }
.anomaly-list { display: grid; gap: 10px; }
.financial-list { display: grid; gap: 10px; }
.financial-chart-head {
  display: flex; align-items: center; justify-content: space-between;
}
.financial-chart-head strong { font-size: 12px; font-weight: 600; }
.financial-chart-head span { color: var(--tv-faint); font-size: 10px; }
.financial-chart-wrap { position: relative; width: 100%; }
.financial-profit-chart,
.money-flow-structure,
.shareholder-chart svg {
  display: block; width: 100%; height: auto; overflow: visible;
}
.financial-profit-chart line,
.money-flow-structure line,
.shareholder-chart .holder-grid {
  stroke: var(--tv-border); stroke-width: 1;
}
.financial-profit-chart text,
.money-flow-structure text,
.shareholder-chart text {
  fill: var(--tv-muted); font-size: 9px;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
}
.financial-profit-chart .profit-grid line {
  stroke: color-mix(in srgb, var(--tv-border) 72%, transparent);
}
.financial-profit-chart .profit-zero {
  stroke: var(--tv-muted); stroke-width: 1;
}
.financial-profit-chart .profit-up { fill: var(--tv-up); }
.financial-profit-chart .profit-down { fill: var(--tv-down); }
.financial-profit-chart [data-profit-bar] {
  cursor: default; outline: none; transition: opacity .12s ease;
}
.financial-profit-chart [data-profit-bar]:hover,
.financial-profit-chart [data-profit-bar]:focus { opacity: .72; }
.financial-profit-tooltip {
  position: absolute; z-index: 3; min-width: 112px; display: grid; gap: 3px;
  padding: 7px 8px; border: 1px solid var(--tv-border); border-radius: 5px;
  color: var(--tv-text); background: color-mix(in srgb, var(--tv-bg) 97%, transparent);
  box-shadow: 0 3px 12px rgb(0 0 0 / 16%); pointer-events: none;
  font-variant-numeric: tabular-nums;
}
.financial-profit-tooltip strong { font-size: 11px; font-weight: 600; }
.financial-profit-tooltip span { color: var(--tv-muted); font-size: 10px; }
.financial-profit-tooltip span.positive { color: var(--tv-up); }
.financial-profit-tooltip span.negative { color: var(--tv-down); }
.financial-profit-tooltip.hidden { display: none; }
.financial-event-list { display: grid; gap: 0; margin-top: 14px; }
.financial-subhead {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 30px; border-bottom: 1px solid var(--tv-border);
}
.financial-subhead strong { font-size: 11px; font-weight: 600; }
.financial-subhead span { color: var(--tv-faint); font-size: 9px; }
.financial-event {
  display: grid; gap: 4px; padding: 8px 0; border-top: 1px solid var(--tv-border);
}
.financial-subhead + .financial-event { border-top: 0; }
.financial-event header {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.financial-event strong { font-size: 10px; font-weight: 600; }
.financial-event span { color: var(--tv-faint); font-size: 9px; }
.financial-event p {
  margin: 0; color: var(--tv-muted); font-size: 10px; line-height: 1.45;
}
.financial-period-picker {
  display: flex; gap: 3px; overflow-x: auto; padding-bottom: 2px;
  scrollbar-width: none;
}
.financial-period-picker::-webkit-scrollbar { display: none; }
.financial-period-picker button {
  flex: 0 0 auto; min-width: 42px; height: 26px; padding: 0 8px;
  border: 0; border-radius: 5px; background: transparent;
  color: var(--tv-muted); font-size: 10px; font-variant-numeric: tabular-nums;
}
.financial-period-picker button:hover { background: var(--tv-hover); color: var(--tv-text); }
.financial-period-picker button.active {
  background: var(--tv-selected); color: var(--tv-text); font-weight: 600;
}
.financial-summary {
  overflow: hidden; border: 1px solid var(--tv-border); border-radius: 6px;
  background: var(--tv-bg);
}
.financial-summary > summary {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 34px; padding: 0 8px 0 9px; list-style: none;
  cursor: pointer; user-select: none;
}
.financial-summary > summary::-webkit-details-marker { display: none; }
.financial-summary > summary:hover { background: var(--tv-hover); }
.financial-summary > summary strong { font-size: 11px; font-weight: 600; }
.financial-summary > summary span {
  margin-left: auto; color: var(--tv-muted); font-size: 10px;
}
.financial-summary > summary i {
  margin-left: 5px; color: var(--tv-faint); font-size: 10px;
  transition: transform .15s ease;
}
.financial-summary[open] > summary {
  border-bottom: 1px solid var(--tv-border);
}
.financial-summary[open] > summary i { transform: rotate(180deg); }
.financial-metric-grid {
  display: grid; grid-template-columns: 1fr 1fr; padding: 0 9px;
}
.financial-metric-grid > div {
  min-width: 0; display: grid; gap: 4px; padding: 9px 0;
  border-bottom: 1px solid var(--tv-border);
}
.financial-metric-grid > div:nth-child(odd) {
  padding-right: 9px; border-right: 1px solid var(--tv-border);
}
.financial-metric-grid > div:nth-child(even) { padding-left: 9px; }
.financial-metric-grid > div:nth-last-child(-n + 2) { border-bottom: 0; }
.financial-metric-grid span { color: var(--tv-muted); font-size: 10px; }
.financial-metric-grid strong {
  overflow: hidden; font-size: 13px; font-weight: 500;
  text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums;
}
.money-flow-list { display: grid; gap: 8px; }
.money-flow-summary {
  display: grid; grid-template-columns: auto 1fr; align-items: baseline;
  gap: 3px 8px;
}
.money-flow-summary > span { color: var(--tv-muted); font-size: 12px; }
.money-flow-summary > strong {
  text-align: right; font-size: 18px; font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.money-flow-summary > time {
  grid-column: 1 / -1; color: var(--tv-faint); font-size: 10px;
}
.money-flow-structure .flow-up-bar { fill: var(--tv-up); }
.money-flow-structure .flow-down-bar { fill: var(--tv-down); }
.money-flow-structure .flow-up-text { fill: var(--tv-up); font-size: 10px; }
.money-flow-structure .flow-down-text { fill: var(--tv-down); font-size: 10px; }
.money-flow-day {
  overflow: hidden; border: 1px solid var(--tv-border); border-radius: 5px;
}
.money-flow-day > header {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 32px; padding: 0 9px; border-bottom: 1px solid var(--tv-border);
}
.money-flow-day > header strong { font-size: 11px; }
.money-flow-day > header span { color: var(--tv-faint); font-size: 9px; }
.money-flow-day dl { margin: 0; padding: 3px 9px 6px; }
.money-flow-day dl > div,
.money-flow-history > div {
  min-height: 27px; display: flex; align-items: center;
  border-bottom: 1px solid var(--tv-border);
}
.money-flow-day dl > div:last-child,
.money-flow-history > div:last-child { border-bottom: 0; }
.money-flow-day dt,
.money-flow-history time { color: var(--tv-muted); font-size: 10px; }
.money-flow-day dd,
.money-flow-history span {
  margin-left: auto; font-size: 10px; font-variant-numeric: tabular-nums;
}
.money-flow-history { padding: 0 9px; }
.anomaly-item small { margin-left: auto; color: var(--tv-faint); font-size: 9px; }
.anomaly-item {
  display: grid; gap: 5px; padding-bottom: 10px; border-bottom: 1px solid var(--tv-border);
}
.anomaly-item:last-child { padding-bottom: 0; border-bottom: 0; }
.anomaly-item > div { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.anomaly-item strong { margin-right: 3px; font-size: 11px; font-weight: 600; }
.anomaly-item span {
  padding: 1px 5px; border-radius: 3px; background: var(--tv-hover);
  color: var(--tv-muted); font-size: 9px;
}
.anomaly-item p {
  margin: 0; color: var(--tv-text); font-size: 10px; line-height: 1.55;
  white-space: pre-wrap;
}
.anomaly-feature { display: grid; gap: 8px; }
.anomaly-feature > header {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 5px;
}
.anomaly-feature > header strong {
  color: var(--tv-orange); font-size: 13px; font-weight: 600;
}
.anomaly-feature > header span { color: var(--tv-muted); font-size: 10px; }
.anomaly-feature p {
  margin: 0; color: var(--tv-orange); font-size: 12px; line-height: 1.7;
  white-space: pre-wrap;
}
.anomaly-feature > div { display: flex; flex-wrap: wrap; gap: 6px; }
.anomaly-feature > div span { color: var(--tv-orange); font-size: 10px; }
.shareholder-section-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.shareholder-section-head h2 { margin: 0; }
.shareholder-section-head strong {
  font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.shareholder-chart rect { fill: #43464d; }
.shareholder-chart polyline {
  fill: none; stroke: #00a6d6; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
}
.shareholder-chart p {
  margin: 5px 0 0; color: var(--tv-faint); font-size: 10px;
}
html[data-theme="dark"] .shareholder-chart rect { fill: #c5c7cc; }

/* Existing standalone chart and data status routes */
.page-header { display: flex; align-items: center; min-height: 64px; padding: 10px 14px; border-bottom: 1px solid var(--tv-border); }
.page-header > div { margin-right: auto; }
.page-header h1 { margin: 0; font-size: 18px; }
.page-header p { margin: 3px 0 0; color: var(--tv-muted); font-size: 10px; }
.eyebrow { display: none; }
.muted { color: var(--tv-muted); }
.secondary-button, .primary-button {
  min-height: 30px; display: inline-flex; align-items: center; justify-content: center; padding: 0 10px;
  border: 1px solid var(--tv-border); border-radius: 5px; background: #fff; font-size: 11px;
}
.primary-button { color: #fff; border-color: var(--tv-blue); background: var(--tv-blue); }
.chart-toolbar { display: flex; align-items: end; gap: 7px; padding: 8px 12px; border-bottom: 1px solid var(--tv-border); }
.chart-toolbar label { color: var(--tv-muted); font-size: 9px; }
.chart-toolbar label input, .chart-toolbar label select { display: block; margin-top: 3px; }
.chart-layout { min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 230px; }
.chart-panel, .vp-panel { min-width: 0; border-right: 1px solid var(--tv-border); }
.chart { height: calc(100vh - 185px); }
.legacy-advanced-shell {
  position: relative; height: calc(100vh - 115px); min-height: 420px;
  overflow: hidden; border-top: 1px solid var(--tv-border); background: #fff;
}
.vp-panel { padding: 12px; overflow: auto; }
.panel-head { display: flex; align-items: center; min-height: 36px; }
.panel-head h2 { margin: 0; font-size: 13px; }
.vp-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.vp-summary div { padding: 7px; border: 1px solid var(--tv-border); border-radius: 4px; }
.vp-summary span, .vp-summary strong { display: block; font-size: 9px; }
.vp-summary strong { margin-top: 3px; font-size: 11px; }
.method-note { color: var(--tv-muted); font-size: 9px; line-height: 1.4; }
.vp-levels { max-height: 420px; overflow: auto; }
.vp-row { display: grid; grid-template-columns: 58px 1fr; align-items: center; gap: 5px; min-height: 17px; font-size: 8px; }
.vp-bar { height: 8px; background: #90a4d4; }
.vp-row.poc .vp-bar { background: var(--tv-down); }
.vp-row.value-area:not(.poc) .vp-bar { background: var(--tv-blue); }
.conservation { color: var(--tv-up); font-size: 9px; }
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); border-bottom: 1px solid var(--tv-border); }
.metric-card { min-height: 88px; padding: 14px; border-right: 1px solid var(--tv-border); }
.metric-card span, .metric-card small { display: block; color: var(--tv-muted); font-size: 9px; }
.metric-card strong { display: block; margin: 8px 0 4px; font-size: 21px; }
.panel { background: #fff; }
.table-wrap { max-width: 100%; overflow: auto; }
.table-wrap table { width: 100%; border-collapse: collapse; white-space: nowrap; font-size: 10px; }
.table-wrap th, .table-wrap td { height: 34px; padding: 0 10px; border-bottom: 1px solid var(--tv-border); text-align: left; }
.table-wrap th { color: var(--tv-muted); font-weight: 500; }

/* Login */
.login-body {
  min-height: 100%;
  min-height: 100dvh;
  overflow: auto;
  color: #e6e7e9;
  background: #000;
  font-family: Arial, "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
}
.login-shell {
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 24px 48px;
}
.login-form {
  width: min(440px, 100%);
  display: grid;
}
.login-field {
  display: grid;
  gap: 6px;
}
.login-field + .login-field {
  margin-top: 16px;
}
.login-field > label {
  color: #d4d5d8;
  font-size: 11px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: .025em;
}
.login-control {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid #737880;
  border-radius: 0;
  outline: 0;
  color: #e6e7e9;
  background: transparent;
  box-shadow: none;
  font-size: 13px;
  line-height: 44px;
  caret-color: #5b83ff;
  transition: border-color .16s ease, background-color .16s ease, box-shadow .16s ease;
}
.login-control:hover { border-color: #a1a5ab; }
.login-control:focus {
  border-color: #2962ff;
  background: rgba(41, 98, 255, .035);
  box-shadow: 0 0 0 1px rgba(41, 98, 255, .34);
}
.login-control:-webkit-autofill,
.login-control:-webkit-autofill:hover,
.login-control:-webkit-autofill:focus {
  -webkit-text-fill-color: #e6e7e9;
  box-shadow: 0 0 0 1000px #000 inset, 0 0 0 1px rgba(41, 98, 255, .34);
  caret-color: #5b83ff;
}
.login-remember {
  position: relative;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-self: start;
  gap: 10px;
  margin-top: 8px;
  color: #8e9299;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  user-select: none;
}
.login-remember-input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}
.login-checkbox {
  position: relative;
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  border: 1px solid #4b4f55;
  border-radius: 4px;
  background: #000;
  transition: border-color .14s ease, background-color .14s ease, box-shadow .14s ease;
}
.login-remember:hover .login-checkbox { border-color: #858a92; }
.login-remember-input:focus-visible + .login-checkbox {
  border-color: #2962ff;
  box-shadow: 0 0 0 2px rgba(41, 98, 255, .22);
}
.login-remember-input:checked + .login-checkbox {
  border-color: #2962ff;
  background: #2962ff;
}
.login-remember-input:checked + .login-checkbox::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 5px;
  width: 4px;
  height: 7px;
  border: solid #fff;
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
}
.login-submit {
  width: 100%;
  height: 44px;
  margin-top: 10px;
  padding: 0 14px;
  border: 1px solid #777c83;
  border-radius: 0;
  outline: 0;
  color: #e6e7e9;
  background: transparent;
  font-size: 14px;
  font-weight: 400;
  letter-spacing: .09em;
  box-shadow: none;
  transition: border-color .14s ease, background-color .14s ease, box-shadow .14s ease, transform .08s ease;
}
.login-submit:hover {
  border-color: #2962ff;
  color: #fff;
  background: rgba(41, 98, 255, .08);
  box-shadow: inset 0 0 0 1px rgba(41, 98, 255, .25);
}
.login-submit:focus-visible {
  border-color: #2962ff;
  box-shadow: 0 0 0 2px #000, 0 0 0 4px rgba(66, 116, 255, .82);
}
.login-submit:active {
  border-color: #2962ff;
  background: #2962ff;
  transform: translateY(1px);
}
.login-form--invalid {
  animation: login-denied .24s ease-out;
}
.login-form--invalid .login-control {
  border-color: #9d3d4b;
}
.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;
}
@keyframes login-denied {
  0%, 100% { transform: translateX(0); }
  30% { transform: translateX(-4px); }
  70% { transform: translateX(4px); }
}
@media (prefers-reduced-motion: reduce) {
  .login-form--invalid { animation: none; }
  .login-control, .login-checkbox, .login-submit { transition: none; }
}

@media (max-width: 1050px) {
  .screener-split { grid-template-columns: minmax(460px, 1fr) 5px minmax(360px, var(--drawer-width)); }
  .chart-drawer { position: relative; z-index: 15; }
  .rule-condition { grid-template-columns: 1fr 95px 1fr 28px; }
  .market-layout { grid-template-columns: 200px minmax(0, 1fr); }
  .market-header-actions { gap: 4px; }
  .charting-grid {
    --watchlist-width: 320px;
    --info-width: 270px;
    grid-template-columns: var(--watchlist-width) 5px minmax(320px, 1fr) 5px var(--info-width);
  }
  .charting-grid.info-collapsed { grid-template-columns: var(--watchlist-width) 5px minmax(320px, 1fr) 0 0; }
  .charting-grid.watchlist-collapsed { grid-template-columns: 0 0 minmax(320px, 1fr) 5px var(--info-width); }
  .charting-grid.watchlist-collapsed.info-collapsed { grid-template-columns: 0 0 minmax(320px, 1fr) 0 0; }
  .charting-symbolbar > strong { max-width: 120px; }
}
@media (max-width: 760px) {
  :root { --rail-width: 40px; }
  .workspace-tabs a { padding: 0 8px; }
  .workspace-tabs a span { display: none; }
  .topbar-tools, .market-clock { display: none; }
  .screener-split { position: relative; display: block; }
  .screener-main { width: 100%; height: 100%; }
  .chart-drawer {
    position: absolute; z-index: 30; top: 0; right: 0; bottom: 0; width: min(92vw, 520px);
    box-shadow: -8px 0 24px rgba(19, 23, 34, .14);
  }
  .drawer-collapsed .chart-drawer { display: none; }
  .split-resizer { display: none; }
  .strategy-picker { flex-wrap: wrap; }
  .filter-editor { top: 119px; }
  .rule-condition { grid-template-columns: 1fr; }
  .remove-rule { justify-self: end; }
  .market-layout { display: flex; flex-direction: column; overflow: auto; }
  .market-canvas { overflow: visible; }
  .market-chart-toolbar { min-height: 76px; align-items: flex-start; flex-wrap: wrap; gap: 5px; padding-top: 7px; }
  .market-header-actions { align-self: stretch; flex-wrap: wrap; justify-content: flex-end; }
  .market-select-popover, .breadth-select-popover, .market-select-popover.viewport-pinned { position: fixed; top: 110px; right: 12px; bottom: auto; left: 52px; width: auto; }
  .market-index-chart { height: 340px; flex-basis: 340px; }
  .breadth-toolbar { min-height: 50px; flex-wrap: wrap; }
  .breadth-legend { flex-wrap: wrap; }
  .breadth-grid { grid-template-columns: 1fr; }
  .breadth-panel + .breadth-panel { border-top: 1px solid var(--tv-border); border-left: 0; }
  .chart-layout { grid-template-columns: 1fr; }
  .vp-panel { display: none; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .charting-grid, .charting-grid.info-collapsed,
  .charting-grid.watchlist-collapsed,
  .charting-grid.watchlist-collapsed.info-collapsed {
    position: relative; display: grid; grid-template-columns: minmax(0, 1fr);
  }
  .native-watchlist {
    position: absolute; z-index: 32; top: 0; bottom: 0; left: 0; width: min(86vw, 340px);
    box-shadow: 8px 0 24px rgba(19, 23, 34, .14);
  }
  .charting-canvas { grid-column: 1; }
  .charting-grid .workspace-resizer { display: none; }
  .instrument-info {
    position: absolute; z-index: 33; top: 0; right: 0; bottom: 0; width: min(86vw, 320px);
    box-shadow: -8px 0 24px rgba(19, 23, 34, .14);
  }
  .charting-grid.info-collapsed .instrument-info { display: none; }
  .charting-grid.watchlist-collapsed .native-watchlist { display: none; }
  .charting-symbolbar > strong, .symbol-market-badge { display: none; }
  .charting-ohlc { display: none; }
}

html[data-theme="dark"] {
  color-scheme: dark;
  --tv-bg: #0f0f0f;
  --tv-subtle: #171717;
  --tv-hover: #242424;
  --tv-selected: #292929;
  --tv-border: #2b2b2b;
  --tv-border-strong: #444444;
  --tv-text: #d6d6d6;
  --tv-muted: #a1a1a1;
  --tv-faint: #707070;
  --tv-shadow: 0 5px 18px rgba(0, 0, 0, .38);
  background: var(--tv-bg);
}
html[data-theme="dark"] body,
html[data-theme="dark"] .terminal-shell,
html[data-theme="dark"] .terminal-topbar,
html[data-theme="dark"] .terminal-rail,
html[data-theme="dark"] .terminal-main,
html[data-theme="dark"] .screen-commandbar,
html[data-theme="dark"] .screener-main,
html[data-theme="dark"] .screener-table,
html[data-theme="dark"] .screener-table thead,
html[data-theme="dark"] .screener-row,
html[data-theme="dark"] .chart-drawer,
html[data-theme="dark"] .market-app,
html[data-theme="dark"] .market-canvas,
html[data-theme="dark"] .charting-workspace,
html[data-theme="dark"] .charting-grid,
html[data-theme="dark"] .workspace-resizer,
html[data-theme="dark"] .native-watchlist,
html[data-theme="dark"] .native-watchlist-row,
html[data-theme="dark"] .charting-canvas,
html[data-theme="dark"] .advanced-chart-host,
html[data-theme="dark"] .advanced-chart-status,
html[data-theme="dark"] .related-panel-resizer,
html[data-theme="dark"] .related-panel,
html[data-theme="dark"] .related-table-row,
html[data-theme="dark"] .chart-bottom-bar,
html[data-theme="dark"] .instrument-info,
html[data-theme="dark"] .account-popover,
html[data-theme="dark"] .native-watchlist-menu,
html[data-theme="dark"] .native-add-symbol,
html[data-theme="dark"] #native-symbol-results > button,
html[data-theme="dark"] .watchlist-column-menu,
html[data-theme="dark"] .panel,
html[data-theme="dark"] .login-card,
html[data-theme="dark"] .legacy-advanced-shell,
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] .secondary-button,
html[data-theme="dark"] .watchlist-primary-button {
  color: var(--tv-text);
  background-color: var(--tv-bg);
  border-color: var(--tv-border);
}
html[data-theme="dark"] .split-resizer,
html[data-theme="dark"] .filter-editor,
html[data-theme="dark"] .chart-popover,
html[data-theme="dark"] .market-select-popover,
html[data-theme="dark"] .breadth-select-popover {
  background: var(--tv-bg);
  border-color: var(--tv-border);
}
html[data-theme="dark"] .filter-ribbon,
html[data-theme="dark"] .filter-chip,
html[data-theme="dark"] .view-tabs,
html[data-theme="dark"] .screener-table th,
html[data-theme="dark"] .screener-table td.symbol-cell,
html[data-theme="dark"] .rule-condition,
html[data-theme="dark"] .rule-group,
html[data-theme="dark"] .mini-button,
html[data-theme="dark"] .tv-button,
html[data-theme="dark"] .watchlist-panel,
html[data-theme="dark"] .watchlist-item,
html[data-theme="dark"] .watchlist-membership-popover,
html[data-theme="dark"] .screener-statusbar,
html[data-theme="dark"] .market-statusbar,
html[data-theme="dark"] .drawer-header,
html[data-theme="dark"] .drawer-toolbar,
html[data-theme="dark"] .drawer-rangebar,
html[data-theme="dark"] .chart-settings,
html[data-theme="dark"] .chart-search-results,
html[data-theme="dark"] .market-select-button,
html[data-theme="dark"] .global-settings-popover {
  color: var(--tv-text);
  background-color: var(--tv-bg);
  border-color: var(--tv-border);
}
html[data-theme="dark"] .screener-table td,
html[data-theme="dark"] .watchlist-item,
html[data-theme="dark"] #native-symbol-results > button {
  border-bottom-color: var(--tv-border);
}
html[data-theme="dark"] .filter-chip,
html[data-theme="dark"] .view-tabs > button,
html[data-theme="dark"] .mini-button,
html[data-theme="dark"] .market-select-button {
  color: var(--tv-muted);
}
html[data-theme="dark"] .advanced-chart-host,
html[data-theme="dark"] .advanced-chart-status,
html[data-theme="dark"] .charting-canvas,
html[data-theme="dark"] .charting-grid,
html[data-theme="dark"] .charting-workspace {
  background: #0f0f0f;
}
html[data-theme="dark"] .native-watchlist-row,
html[data-theme="dark"] .related-table-row,
html[data-theme="dark"] .info-stats > div,
html[data-theme="dark"] .info-list > div,
html[data-theme="dark"] #native-symbol-results > button {
  border-color: var(--tv-border);
}
html[data-theme="dark"] .login-body { background: #0f1118; }
html[data-theme="dark"] .icon-button { color: var(--tv-muted); }
html[data-theme="dark"] .primary-button { color: #fff; }

.separator-rename-form {
  display: grid; gap: 7px; padding: 7px;
}
.separator-rename-form label { color: var(--tv-muted); font-size: 10px; }
.separator-rename-form input { width: 100%; }
.separator-rename-form > div { display: flex; justify-content: flex-end; gap: 5px; }
.separator-rename-form button {
  min-width: 54px; height: 28px; border: 0; border-radius: 4px;
  background: transparent; color: var(--tv-text);
}
.separator-rename-form button:hover { background: var(--tv-hover); }
.separator-rename-form button.primary { color: #fff; background: var(--tv-blue); }

@media (min-width: 761px) {
  .market-canvas {
    display: grid;
    grid-template-rows:
      38px minmax(0, 1.8fr)
      34px minmax(0, 1fr)
      32px minmax(0, .82fr)
      28px;
    overflow: hidden;
  }
  .market-index-chart,
  .breadth-chart,
  .concentration-chart {
    width: 100%; height: 100%; min-height: 0; flex: none;
  }
  .breadth-grid,
  .breadth-panel { min-height: 0; }
  .breadth-toolbar { min-height: 34px; height: 34px; }
  .concentration-toolbar { min-height: 32px; height: 32px; }
  .market-statusbar { min-height: 28px; height: 28px; }
}

/* Staff-only operations dashboard */
.ops-app {
  --ops-ok: #089981;
  --ops-warning: #f59e0b;
  --ops-bad: #f23645;
  width: 100%; height: 100%; display: flex; flex-direction: column;
  min-width: 0; color: var(--tv-text); background: var(--tv-bg);
}
.ops-commandbar {
  flex: 0 0 42px; height: 42px; background: var(--tv-bg);
}
.ops-health-state .status-dot { background: var(--ops-ok); }
.ops-health-state[data-health="warning"] .status-dot { background: var(--ops-warning); }
.ops-health-state[data-health="critical"] .status-dot { background: var(--ops-bad); }
.ops-period-switcher {
  height: 28px; display: inline-flex; align-items: center; gap: 1px;
  padding: 2px; border: 1px solid var(--tv-border); border-radius: 4px;
  background: var(--tv-subtle);
}
.ops-period-switcher a {
  height: 22px; min-width: 33px; display: inline-flex; align-items: center;
  justify-content: center; padding: 0 7px; border-radius: 3px;
  color: var(--tv-muted); font-size: 10px;
}
.ops-period-switcher a:hover { color: var(--tv-text); }
.ops-period-switcher a.active {
  color: var(--tv-text); background: var(--tv-bg); box-shadow: 0 1px 2px rgba(19, 23, 34, .09);
}
.ops-commandbar .loading i { animation: ops-spin .8s linear infinite; }
@keyframes ops-spin { to { transform: rotate(360deg); } }
.ops-workspace {
  flex: 1; min-height: 0; display: flex; flex-direction: column;
  overflow: hidden; background: var(--tv-bg);
}
.ops-kpi-grid {
  flex: 0 0 76px; height: 76px; display: grid;
  grid-template-columns: repeat(6, minmax(115px, 1fr));
  border-bottom: 1px solid var(--tv-border);
}
.ops-kpi {
  position: relative; min-width: 0; display: flex; flex-direction: column;
  justify-content: center; padding: 8px 12px; overflow: hidden;
  border-right: 1px solid var(--tv-border); background: var(--tv-bg);
}
.ops-kpi:last-child { border-right: 0; }
.ops-kpi::before {
  content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 2px;
  background: transparent;
}
.ops-app[data-health="healthy"] .ops-kpi.primary::before { background: var(--ops-ok); }
.ops-app[data-health="warning"] .ops-kpi.primary::before { background: var(--ops-warning); }
.ops-app[data-health="critical"] .ops-kpi.primary::before { background: var(--ops-bad); }
.ops-kpi > span { color: var(--tv-muted); font-size: 9px; line-height: 1; }
.ops-kpi > strong {
  min-width: 0; margin-top: 6px; overflow: hidden; font-size: 18px; line-height: 1;
  font-variant-numeric: tabular-nums; text-overflow: ellipsis; white-space: nowrap;
}
.ops-kpi > strong.compact { font-size: 15px; }
.ops-kpi > strong em {
  margin-left: 3px; color: var(--tv-muted); font-size: 9px; font-style: normal; font-weight: 500;
}
.ops-kpi > small {
  margin-top: 6px; overflow: hidden; color: var(--tv-faint); font-size: 8px;
  text-overflow: ellipsis; white-space: nowrap;
}
.ops-kpi > small b { color: var(--tv-muted); font-weight: 600; }
.ops-content-grid {
  flex: 1; min-height: 0; display: grid;
  grid-template-columns: minmax(0, 1fr) 324px;
}
.ops-main-column,
.ops-side-column {
  min-width: 0; min-height: 0; display: flex; flex-direction: column;
}
.ops-side-column {
  border-left: 1px solid var(--tv-border);
  overflow-y: auto;
  scrollbar-width: thin;
}
.ops-panel {
  min-width: 0; min-height: 0; overflow: hidden; background: var(--tv-bg);
}
.ops-panel > header {
  flex: 0 0 38px; height: 38px; display: flex; align-items: center;
  gap: 8px; padding: 0 10px;
  border-bottom: 1px solid var(--tv-border);
}
.ops-panel > header > div:first-child {
  min-width: 0; display: flex; align-items: center; gap: 6px;
}
.ops-panel > header > div:first-child > i { color: var(--tv-muted); font-size: 15px; }
.ops-panel > header strong { font-size: 11px; font-weight: 600; white-space: nowrap; }
.ops-panel > header span { color: var(--tv-faint); font-size: 8px; white-space: nowrap; }
.ops-panel > header > a {
  margin-left: auto; color: var(--tv-muted); font-size: 9px; white-space: nowrap;
}
.ops-panel > header > a:hover { color: var(--tv-blue); }
.ops-legend {
  margin-left: auto; display: flex !important; flex-direction: row !important;
  align-items: center; gap: 5px !important; color: var(--tv-faint); font-size: 8px;
}
.ops-legend i { width: 7px; height: 7px; border-radius: 1px; background: var(--tv-blue); }
.ops-legend i:nth-of-type(2) { width: 6px; height: 6px; border-radius: 50%; background: var(--tv-orange); }
.ops-activity-panel {
  flex: 0 0 210px; border-bottom: 1px solid var(--tv-border);
}
.ops-activity-chart {
  height: calc(100% - 38px); display: flex; align-items: stretch; gap: 3px;
  padding: 14px 14px 22px; overflow-x: auto;
  background-image:
    linear-gradient(to bottom,
      transparent calc(25% - .5px), var(--tv-border) 25%, transparent calc(25% + .5px),
      transparent calc(50% - .5px), var(--tv-border) 50%, transparent calc(50% + .5px),
      transparent calc(75% - .5px), var(--tv-border) 75%, transparent calc(75% + .5px));
}
.ops-activity-day {
  position: relative; flex: 1 0 8px; min-width: 8px; height: 100%;
  display: flex; align-items: flex-end; justify-content: center;
}
.ops-activity-bar {
  width: min(24px, 58%); min-height: 2px; border-radius: 1px 1px 0 0;
  background: color-mix(in srgb, var(--tv-blue) 72%, transparent);
}
.ops-activity-day > i {
  position: absolute; z-index: 2; left: 50%; width: 6px; height: 6px;
  border: 1px solid var(--tv-bg); border-radius: 50%; background: var(--tv-orange);
  transform: translate(-50%, 50%);
}
.ops-activity-day > small {
  position: absolute; top: calc(100% + 5px); left: 50%; color: var(--tv-faint);
  font-size: 8px; white-space: nowrap; transform: translateX(-50%);
}
.ops-system-panel {
  flex: 0 0 206px; border-bottom: 1px solid var(--tv-border);
}
.ops-system-list { margin: 0; padding: 0 10px; }
.ops-system-list > div {
  height: 28px; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  border-bottom: 1px solid var(--tv-border); font-size: 9px;
}
.ops-system-list > div:last-child { border-bottom: 0; }
.ops-system-list dt { color: var(--tv-muted); }
.ops-system-list dd {
  min-width: 0; margin: 0; overflow: hidden; text-align: right; text-overflow: ellipsis; white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.ops-system-list dd i, .ops-presence i {
  width: 6px; height: 6px; display: inline-block; margin-right: 5px;
  border-radius: 50%; background: var(--tv-faint);
}
.ops-system-list dd.ok i, .ops-presence.online i { background: var(--ops-ok); }
.ops-system-list dd.bad i { background: var(--ops-bad); }
.ops-job-panel { flex: 1; display: flex; flex-direction: column; }
.ops-job-summary {
  flex: 0 0 42px; height: 42px; display: grid;
  grid-template-columns: repeat(3, 1fr); align-items: center;
  border-bottom: 1px solid var(--tv-border);
}
.ops-job-summary span {
  height: 100%; display: flex; align-items: baseline; justify-content: center;
  gap: 4px; padding-top: 13px; border-right: 1px solid var(--tv-border);
  color: var(--tv-faint); font-size: 8px;
}
.ops-job-summary span:last-child { border-right: 0; }
.ops-job-summary b { color: var(--tv-text); font-size: 13px; font-weight: 600; }
.ops-job-list { flex: 1; min-height: 0; overflow: auto; }
.ops-job-list > div {
  min-height: 36px; display: grid; grid-template-columns: 8px minmax(0, 1fr) auto;
  align-items: center; gap: 7px; padding: 4px 10px;
  border-bottom: 1px solid var(--tv-border);
}
.ops-job-list > div > span { min-width: 0; display: flex; flex-direction: column; }
.ops-job-list strong { overflow: hidden; font-size: 10px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.ops-job-list small { margin-top: 2px; color: var(--tv-faint); font-size: 8px; }
.ops-job-list b { color: var(--tv-muted); font-size: 8px; font-weight: 500; }
.ops-status-icon { width: 6px; height: 6px; border-radius: 50%; background: var(--tv-faint); }
.ops-status-icon.succeeded { background: var(--ops-ok); }
.ops-status-icon.running { background: var(--tv-blue); box-shadow: 0 0 0 2px color-mix(in srgb, var(--tv-blue) 18%, transparent); }
.ops-status-icon.partial { background: var(--ops-warning); }
.ops-status-icon.failed { background: var(--ops-bad); }
.ops-empty { margin: 0; padding: 18px; color: var(--tv-faint); text-align: center; font-size: 10px; }
.ops-users-panel {
  flex: 1; min-height: 0; display: flex; flex-direction: column;
}
.ops-upload-panel {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
}
.ops-upload-form {
  flex: 1;
  min-height: 0;
  padding: 10px;
  display: grid;
  gap: 8px;
  align-content: start;
}
.ops-upload-form label {
  display: grid;
  gap: 4px;
  color: var(--tv-muted);
  font-size: 9px;
}
.ops-upload-form label > span {
  color: var(--tv-faint);
}
.ops-upload-form section {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--tv-border);
  display: grid;
  gap: 8px;
}
.ops-upload-form section > header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  color: var(--tv-faint);
  font-size: 9px;
}
.ops-upload-form input[type="date"],
.ops-upload-form input[type="file"] {
  width: 100%;
  height: 30px;
  border-radius: 5px;
  padding: 6px;
  border: 1px solid var(--tv-border);
  background: var(--tv-bg);
  color: var(--tv-text);
  font-size: 10px;
}
.ops-upload-form input[type="file"]::file-selector-button {
  margin-right: 8px;
  padding: 3px 7px;
  border: 1px solid var(--tv-border);
  border-radius: 4px;
  background: var(--tv-subtle);
  color: var(--tv-text);
}
.ops-upload-checkbox {
  display: flex !important;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 6px;
}
.ops-upload-checkbox span {
  color: var(--tv-faint);
}
.ops-upload-checkbox input { width: 12px; height: 12px; }
.ops-upload-actions {
  display: flex;
  gap: 8px;
}
.ops-upload-actions .command-button {
  height: 30px;
  min-width: 88px;
  border: 1px solid var(--tv-border);
}
.ops-upload-hint {
  margin: 0;
  color: var(--tv-faint);
  font-size: 8px;
  line-height: 1.45;
}
.ops-upload-result {
  min-height: 36px;
  padding: 8px;
  border: 1px dashed var(--tv-border);
  border-radius: 4px;
  color: var(--tv-muted);
  font-size: 9px;
  line-height: 1.5;
  background: var(--tv-subtle);
}
.ops-upload-result--error {
  border-color: var(--ops-bad);
  color: color-mix(in srgb, var(--ops-bad) 85%, var(--tv-text));
}
.ops-upload-result--ok {
  border-color: var(--ops-ok);
  color: color-mix(in srgb, var(--ops-ok) 85%, var(--tv-text));
}
.ops-search {
  width: 190px; height: 28px; display: flex; align-items: center;
  gap: 6px; margin-left: auto; padding: 0 8px;
  border: 1px solid transparent; border-radius: 4px; color: var(--tv-muted);
  background: var(--tv-subtle);
}
.ops-search:focus-within { border-color: var(--tv-blue); }
.ops-search input {
  width: 100%; height: 24px; padding: 0; border: 0; box-shadow: none !important;
  background: transparent; font-size: 10px;
}
.ops-manage-link {
  height: 28px; display: inline-flex; align-items: center; gap: 5px;
  padding: 0 7px; border: 0; border-radius: 4px;
  color: var(--tv-text) !important;
}
.ops-manage-link:hover { background: var(--tv-hover); }
.ops-table-wrap { flex: 1; min-height: 0; overflow: auto; }
.ops-users-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 10px; }
.ops-users-table th {
  position: sticky; z-index: 2; top: 0; height: 28px; padding: 0 8px;
  border-bottom: 1px solid var(--tv-border); color: var(--tv-muted); background: var(--tv-bg);
  text-align: right; font-weight: 500; white-space: nowrap;
}
.ops-users-table th:first-child { width: 140px; text-align: left; }
.ops-users-table th:nth-child(2) { width: 64px; text-align: left; }
.ops-users-table th:nth-child(3) { width: 102px; text-align: left; }
.ops-users-table th:last-child { width: 112px; text-align: left; }
.ops-users-table td {
  height: 36px; padding: 0 8px; overflow: hidden; border-bottom: 1px solid var(--tv-border);
  text-align: right; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums;
}
.ops-users-table td:first-child, .ops-users-table td:nth-child(2), .ops-users-table td:nth-child(3), .ops-users-table td:last-child { text-align: left; }
.ops-users-table tr:hover td { background: var(--tv-hover); }
.ops-user { display: flex; align-items: center; gap: 6px; }
.ops-user > i {
  flex: 0 0 20px; width: 20px; height: 20px; display: grid; place-items: center;
  border-radius: 50%; color: #fff; background: #5b6680;
  font-size: 8px; font-style: normal; font-weight: 700;
}
.ops-user > span { min-width: 0; display: flex; align-items: baseline; gap: 5px; }
.ops-user strong { overflow: hidden; font-size: 10px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.ops-user small { color: var(--tv-faint); font-size: 8px; white-space: nowrap; }
.ops-presence { display: inline-flex; align-items: center; color: var(--tv-muted); }
.ops-presence.recent i { background: var(--ops-warning); }
.ops-presence.offline i { background: var(--tv-faint); }
html[data-theme="dark"] .ops-app,
html[data-theme="dark"] .ops-commandbar,
html[data-theme="dark"] .ops-workspace,
html[data-theme="dark"] .ops-kpi,
html[data-theme="dark"] .ops-panel,
html[data-theme="dark"] .ops-users-table th {
  color: var(--tv-text); background: var(--tv-bg);
}
html[data-theme="dark"] .ops-search { background: var(--tv-subtle); }
html[data-theme="dark"] .ops-search input { background: transparent; }

@media (max-width: 1000px) {
  .ops-kpi-grid {
    flex-basis: 116px; height: 116px; grid-template-columns: repeat(3, minmax(125px, 1fr));
  }
  .ops-kpi:nth-child(-n+3) { border-bottom: 1px solid var(--tv-border); }
  .ops-content-grid { grid-template-columns: minmax(0, 1fr) 280px; }
  .ops-activity-panel { flex-basis: 180px; }
  .ops-system-panel { flex-basis: 206px; }
}

@media (max-width: 760px) {
  .ops-workspace { overflow: auto; }
  .ops-kpi-grid {
    flex: 0 0 auto; height: auto; grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .ops-kpi { min-height: 70px; border-bottom: 1px solid var(--tv-border); }
  .ops-content-grid { flex: 0 0 auto; display: block; }
  .ops-main-column, .ops-side-column { display: block; }
  .ops-side-column { border-top: 1px solid var(--tv-border); border-left: 0; }
  .ops-activity-panel { height: 190px; }
  .ops-users-panel { height: 310px; }
  .ops-system-panel { height: 206px; }
  .ops-job-panel { height: 300px; }
}
