:root {
  color-scheme: dark;
  --toolbox-font: Arial, "Thomas", "Segoe UI", sans-serif;
  --bg: #0b1020;
  --panel: rgba(255, 255, 255, 0.06);
  --panel2: rgba(255, 255, 255, 0.04);
  --border: rgba(255, 255, 255, 0.12);
  --text: #e8edf8;
  --muted: rgba(232, 237, 248, 0.72);
  --text-soft: rgba(232, 237, 248, 0.92);
  --surface-text: rgba(255, 255, 255, 0.92);
  --surface: rgba(11, 16, 32, 0.96);
  --surface-strong: rgba(11, 16, 32, 0.92);
  --topbar-bg: rgba(11, 16, 32, 0.60);
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New";
  --sans: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans";
  --accent: #7c5cff;
  --accent2: #26d1ff;
  --danger: #ff4d6d;
  --ok: #2ee59d;
  --chart-bg: rgba(255, 255, 255, 0.04);
  --chart-area-bg: rgba(255, 255, 255, 0.04);
  --chart-axis-text: rgba(232, 237, 248, 0.88);
  --chart-time-text: rgba(232, 237, 248, 0.88);
  --chart-tag-bg: rgba(0, 0, 0, 0.22);
  --chart-grid: rgba(255, 255, 255, 0.14);
  --chart-card-bg: rgba(11, 16, 32, 0.88);
  --wt-radius: 3px;
  --wt-radius-sm: 2px;
  --wt-chart-scale-text: var(--chart-axis-text);
  --wt-chart-grid-faint: var(--chart-grid);
  --wt-chart-axis-border: var(--border);
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f7fc;
  --panel: rgba(0, 0, 0, 0.045);
  --panel2: rgba(0, 0, 0, 0.030);
  --border: rgba(0, 0, 0, 0.12);
  --text: #0b1020;
  --muted: rgba(11, 16, 32, 0.68);
  --text-soft: rgba(11, 16, 32, 0.92);
  --surface-text: rgba(11, 16, 32, 0.92);
  --surface: rgba(255, 255, 255, 0.98);
  --surface-strong: rgba(245, 247, 252, 0.95);
  --topbar-bg: rgba(245, 247, 252, 0.70);
  --accent: #5a4bff;
  --accent2: #0aa7d6;
  --danger: #c51e3a;
  --ok: #1a9a6a;
  --chart-bg: rgba(0, 0, 0, 0.028);
  --chart-area-bg: rgba(0, 0, 0, 0.028);
  --chart-axis-text: rgba(11, 16, 32, 0.88);
  --chart-time-text: rgba(11, 16, 32, 0.88);
  --chart-tag-bg: rgba(0, 0, 0, 0.08);
  --chart-grid: rgba(0, 0, 0, 0.16);
  --chart-card-bg: rgba(255, 255, 255, 0.94);
  --wt-chart-scale-text: var(--chart-axis-text);
  --wt-chart-grid-faint: var(--chart-grid);
  --wt-chart-axis-border: var(--border);
}

:root[data-theme="light"] .bg {
  background: var(--bg);
}


* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  font-size: 12px;
}

.bg {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(1200px 600px at 10% 10%, rgba(124, 92, 255, 0.20), transparent 60%),
    radial-gradient(900px 520px at 90% 20%, rgba(38, 209, 255, 0.16), transparent 55%),
    radial-gradient(900px 520px at 60% 100%, rgba(46, 229, 157, 0.10), transparent 55%);
  pointer-events: none;
  filter: saturate(110%);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(14px);
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.topbar-right { display: flex; align-items: center; gap: 12px; }
.sysline{
  font-size:12px;
  color:var(--muted);
  white-space:nowrap;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  user-select: none;
}
.theme-toggle input { display: none; }
.theme-toggle .track {
  width: 34px;
  height: 18px;
  border-radius: 999px;
  background: rgba(255,255,255,0.22);
  border: 1px solid rgba(255,255,255,0.16);
  position: relative;
}
:root[data-theme="light"] .theme-toggle .track {
  background: rgba(0,0,0,0.10);
  border: 1px solid rgba(0,0,0,0.14);
}
.theme-toggle .knob {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  position: absolute;
  top: 1px;
  left: 1px;
  background: linear-gradient(180deg, rgba(255,255,255,0.92), rgba(255,255,255,0.70));
  transition: transform 140ms ease;
}
:root[data-theme="light"] .theme-toggle .knob {
  background: linear-gradient(180deg, rgba(11,16,32,0.85), rgba(11,16,32,0.65));
}
:root[data-theme="light"] .logo {
  border-color: rgba(0,0,0,0.12);
  background: linear-gradient(135deg, rgba(90,75,255,0.18), rgba(10,167,214,0.12));
}
:root[data-theme="light"] #mwSymBarsControls select,
:root[data-theme="light"] #mwSymTicksControls select,
:root[data-theme="light"] .mw-of-row select { color-scheme: light; }
.theme-toggle input:checked + .track .knob { transform: translateX(16px); }

.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 40px;
  height: 40px;
  border-radius: var(--wt-radius);
  display: grid;
  place-items: center;
  font-weight: 800;
  letter-spacing: 0.5px;
  border: 1px solid rgba(255,255,255,0.16);
  background: linear-gradient(135deg, rgba(124, 92, 255, 0.35), rgba(38, 209, 255, 0.20));
}
.brand-title { font-weight: 750; letter-spacing: 0.2px; }
.brand-subtitle { font-size: 12px; color: var(--muted); margin-top: 2px; }

.menu-bar {
  display: flex;
  gap: 18px;
  align-items: center;
}
.menu-root { position: relative; }
.menu-btn {
  border: 0;
  background: transparent;
  padding: 4px 10px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-soft);
  cursor: pointer;
  white-space: normal;
  text-align: left;
  min-width: 0;
}
.menu-btn:hover { background: rgba(255,255,255,0.08); border-radius: var(--wt-radius-sm); }
.menu-dropdown {
  position: absolute;
  left: 0;
  top: 100%;
  margin-top: 4px;
  min-width: 220px;
  width: max-content;
  max-width: min(420px, 95vw);
  border-radius: var(--wt-radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: 0 10px 30px rgba(0,0,0,0.55);
  padding: 4px 0;
  display: none;
  z-index: 20;
}
.menu-root.open .menu-dropdown { display: block; }
.menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  padding: 6px 14px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-soft);
  border: 0;
  background: transparent;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  text-align: left;
}
.menu-item.active::after {
  content: "✓";
  margin-left: auto;
  opacity: 0.9;
}
.menu-item:hover { background: rgba(255,255,255,0.10); }
.menu-icon {
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.menu-icon svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: var(--text-soft);
  stroke-width: 1.6;
}
.menu-sep {
  margin: 4px 0;
  border-top: 1px solid rgba(255,255,255,0.12);
}

.statusbar { display: none; gap: 8px; align-items: center; }
@media (min-width: 860px) { .statusbar { display: flex; } }
.status-pill {
  font-family: var(--mono);
  font-size: 12px;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(0,0,0,0.14);
  color: var(--text-soft);
}
.status-pill.ok { border-color: rgba(46, 229, 157, 0.45); color: rgba(46, 229, 157, 0.95); }
.status-pill.bad { border-color: rgba(255, 77, 109, 0.55); color: rgba(255, 77, 109, 0.95); }

.container { width: min(1200px, calc(100vw - 32px)); margin: 18px auto 40px; position: relative; }
.container.wide { width: calc(100vw - 20px); max-width: none; margin: 12px 10px 30px; }

body.webterminal {
  --wtTopOffset: 84px;
  --wtBottomBarH: 44px;
  --wt-topbar-h: 42px;
  --wt-nav-row-h: 18px;
  --wt-nav-indent-0: 0px;
  --wt-nav-indent-1: 14px;
  --wt-nav-indent-2: 28px;
  --wt-nav-indent-3: 42px;
  /* Match /winterminal :root[data-theme="dark"] palette */
  --bg: #1a1d23;
  --text: #e4e6eb;
  --muted: rgba(228, 230, 235, 0.68);
  --text-soft: #e4e6eb;
  --surface-text: #e4e6eb;
  --border: #3d424d;
  --panel: #252830;
  --panel2: #2c3038;
  --surface: #1e2128;
  --surface-strong: #1e2128;
  --menu-popup-bg: #2a2e38;
  --menu-popup-border: #3d424d;
  --menu-hover: #3a4a62;
  --wt-grid-line: #3d424d;
  --wt-shadow-soft: rgba(0, 0, 0, 0.35);
  --accent: #4a9eff;
  --mono: Consolas, "Courier New", ui-monospace, monospace;
  --sans: "Segoe UI", Tahoma, Arial, sans-serif;
  --toolbox-font: Arial, "Thomas", "Segoe UI", sans-serif;
  --chart-bg: #000000;
  --chart-area-bg: #000000;
  --chart-axis-text: #f2f4f7;
  --chart-time-text: #f2f4f7;
  --chart-grid: rgba(255, 255, 255, 0.14);
  --chart-card-bg: rgba(24, 28, 36, 0.82);
  --chart-tag-bg: rgba(0, 0, 0, 0.22);
  --wt-chart-scale-text: #fafafa;
  --wt-chart-grid-faint: rgba(255, 255, 255, 0.14);
  --wt-chart-axis-border: rgba(255, 255, 255, 0.18);
  font-family: var(--sans);
  font-size: 11px;
  line-height: 1.35;
  color: var(--text);
  background: var(--bg);
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  padding-bottom: calc(var(--wtBottomBarH) + env(safe-area-inset-bottom, 0px));
  color-scheme: dark;
  display: flex;
  flex-direction: column;
}

body.webterminal > main.container.wide {
  flex: 1 1 auto;
  min-height: 0;
  margin: 8px 10px 0;
  display: flex;
  flex-direction: column;
}

:root[data-theme="light"] body.webterminal {
  /* Match /winterminal light :root */
  --bg: #eef2f6;
  --text: #1d2733;
  --muted: rgba(29, 39, 51, 0.65);
  --text-soft: #1d2733;
  --surface-text: #1d2733;
  --border: #cfd6de;
  --panel: #f4f6f9;
  --panel2: #e8edf3;
  --surface: #ffffff;
  --surface-strong: #ffffff;
  --menu-popup-bg: #f9fbfe;
  --menu-popup-border: #9eabba;
  --menu-hover: #d9e8fb;
  --wt-grid-line: #d6dde5;
  --wt-shadow-soft: rgba(23, 35, 47, 0.16);
  --accent: #1e8ad8;
  /* Chart area: keep same as dark theme (user preference) */
  --chart-bg: #000000;
  --chart-area-bg: #000000;
  --chart-axis-text: #f2f4f7;
  --chart-time-text: #f2f4f7;
  --chart-grid: rgba(255, 255, 255, 0.14);
  --chart-card-bg: rgba(24, 28, 36, 0.82);
  --wt-chart-scale-text: #fafafa;
  --wt-chart-grid-faint: rgba(255, 255, 255, 0.14);
  --wt-chart-axis-border: rgba(255, 255, 255, 0.18);
  --chart-tag-bg: rgba(0, 0, 0, 0.22);
  color-scheme: light;
}
:root[data-theme="light"] body.webterminal .trade-chart-wrap .chart-symbol-info {
  color: #f2f4f7;
  background: rgba(24, 28, 36, 0.82);
  border-color: rgba(255, 255, 255, 0.18);
}

/* —— WinTerminal-matched chrome (topbar, menus, tabs, tables, context menu, statusbar) —— */
body.webterminal .bg {
  display: none !important;
}

body.webterminal .topbar {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  background: var(--panel2);
  border-bottom: 1px solid var(--border);
  padding: 4px 10px;
  padding-top: max(4px, env(safe-area-inset-top, 0px));
  padding-left: max(10px, env(safe-area-inset-left, 0px));
  padding-right: max(10px, env(safe-area-inset-right, 0px));
  min-height: 32px;
  justify-content: flex-start;
  gap: 10px;
  flex-shrink: 0;
}
body.webterminal .wt-topbar-brand {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}
body.webterminal .wt-topbar-brand .logo {
  width: 34px;
  height: 34px;
  font-size: 10px;
}
body.webterminal .menu-bar {
  flex: 1 1 auto;
  min-width: 0;
}
body.webterminal .topbar-right {
  margin-left: auto;
  flex-shrink: 0;
}

/* Mobile-style slide-out menu (narrow screens) */
body.webterminal .wt-mobile-nav-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 34px;
  margin: 0 6px 0 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--wt-radius-sm);
  background: var(--panel);
  color: var(--text-soft);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}
body.webterminal .wt-mobile-nav-btn:active {
  background: var(--panel2);
}
body.webterminal .wt-mobile-nav-scrim {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  top: var(--wt-topbar-h);
  bottom: 0;
  z-index: 140;
  background: rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(2px);
}
body.webterminal.wt-mobile-nav-open .wt-mobile-nav-scrim {
  display: block;
}
body.webterminal .wt-topbar-title .brand-title {
  font-size: 11px;
  font-weight: 600;
}

:root[data-theme="light"] body.webterminal .topbar {
  background: linear-gradient(#fafbfd, #eef2f7);
}

body.webterminal .sysline {
  font-size: 11px;
  font-family: var(--sans);
  color: var(--muted);
}

body.webterminal .brand-title {
  font-size: 11px;
  font-weight: 600;
}

body.webterminal .logo {
  border-color: var(--border);
  background: var(--panel);
  font-size: 11px;
}

body.webterminal .theme-toggle {
  font-family: var(--sans);
  font-size: 11px;
  border-color: var(--border);
  background: var(--panel);
  border-radius: 2px;
}

/* Login overlay — uses body.webterminal theme tokens (dark / light via :root[data-theme]) */
body.webterminal .wt-auth {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 18px;
  background: rgba(10, 12, 16, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
:root[data-theme="light"] body.webterminal .wt-auth {
  background: rgba(238, 242, 246, 0.88);
}
body.webterminal .wt-auth-card {
  width: min(420px, calc(100vw - 36px));
  border-radius: var(--wt-radius, 2px);
  border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--panel2), var(--panel));
  box-shadow: 0 12px 40px var(--wt-shadow-soft, rgba(0, 0, 0, 0.35));
  padding: 16px;
  color: var(--text);
}
body.webterminal .wt-auth-title {
  font-weight: 800;
  letter-spacing: 0.2px;
  margin-bottom: 10px;
  font-size: 15px;
  font-family: var(--sans);
  color: var(--text);
}
body.webterminal .wt-auth-row {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
}
body.webterminal .wt-auth-label {
  font-size: 12px;
  color: var(--muted);
  font-family: var(--sans);
}
body.webterminal .wt-auth-input {
  width: 100%;
  border-radius: var(--wt-radius, 2px);
  border: 1px solid var(--border);
  background: var(--surface-strong, var(--panel));
  color: var(--text);
  padding: 10px 12px;
  font-family: var(--mono);
  font-size: 13px;
  outline: none;
  color-scheme: dark;
}
:root[data-theme="light"] body.webterminal .wt-auth-input {
  color-scheme: light;
}
body.webterminal .wt-auth-input:focus {
  border-color: var(--accent, #26d1ff);
  box-shadow: 0 0 0 2px rgba(74, 158, 255, 0.22);
}
:root[data-theme="light"] body.webterminal .wt-auth-input:focus {
  box-shadow: 0 0 0 2px rgba(30, 138, 216, 0.22);
}
body.webterminal .wt-auth-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
  margin-top: 10px;
}
body.webterminal .wt-auth-submit:disabled {
  opacity: 0.72;
  cursor: not-allowed;
}
body.webterminal .wt-auth-dismiss.btn.secondary {
  border-color: var(--border);
  background: var(--panel2);
  color: var(--text-soft);
}

body.webterminal .menu-btn {
  font-family: inherit;
  font-size: 11px;
  line-height: 16px;
  padding: 2px 7px;
  margin: 1px 0;
  color: var(--text);
  border: 1px solid transparent;
  border-radius: 0;
}

body.webterminal .menu-btn:hover,
body.webterminal .menu-root.open .menu-btn {
  border-color: color-mix(in srgb, var(--accent) 42%, #bfc8d2);
  background: color-mix(in srgb, var(--accent) 16%, #f6f8fb);
  color: var(--text);
}

/* Dark theme: same hover chip as light (fixed accent/text so it matches :root[data-theme="light"] body.webterminal) */
:root[data-theme="dark"] body.webterminal .menu-btn:hover,
:root[data-theme="dark"] body.webterminal .menu-root.open .menu-btn {
  border-color: color-mix(in srgb, #1e8ad8 42%, #bfc8d2);
  background: color-mix(in srgb, #1e8ad8 16%, #f6f8fb);
  color: #1d2733;
}

body.webterminal .menu-dropdown {
  margin-top: 2px;
  border-radius: 0;
  border: 1px solid var(--menu-popup-border);
  background: var(--menu-popup-bg);
  box-shadow: 0 3px 10px var(--wt-shadow-soft);
  padding: 3px 0;
  backdrop-filter: none;
}

body.webterminal .menu-item {
  font-family: inherit;
  font-size: 11px;
  line-height: 16px;
  padding: 4px 10px 4px 8px;
  color: var(--text);
  border-radius: 0;
}

body.webterminal .menu-item:hover {
  background: color-mix(in srgb, var(--accent) 18%, var(--menu-popup-bg));
}
:root[data-theme="dark"] body.webterminal .menu-item:hover {
  background: color-mix(in srgb, var(--accent) 24%, var(--menu-popup-bg));
}

body.webterminal .menu-icon svg {
  stroke: var(--text);
}

body.webterminal .menu-sep {
  margin: 3px 0;
  border: none;
  height: 1px;
  background: #ccd7e3;
}

:root[data-theme="dark"] body.webterminal .menu-sep {
  background: var(--border);
}

/* View menu: WinTerminal-style checkmarks */
body.webterminal .menu-item--toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}
body.webterminal .menu-item--toggle .menu-check {
  flex: 0 0 14px;
  width: 14px;
  text-align: center;
  font-size: 11px;
  line-height: 1;
  font-weight: 600;
}
body.webterminal .menu-item--toggle .menu-item-txt {
  flex: 1 1 auto;
  text-align: left;
}

/* Insert: nested flyouts (same interaction model as /winterminal) */
body.webterminal .menu-dropdown.menu-dropdown--insert {
  overflow: visible;
  min-width: 220px;
}
body.webterminal .menu-submenu-wrap {
  position: relative;
  width: 100%;
}
body.webterminal .menu-item--submenu-title {
  justify-content: space-between;
}
body.webterminal .menu-flyout-chevron {
  margin-left: auto;
  padding-left: 10px;
  font-size: 10px;
  opacity: 0.65;
}
body.webterminal .menu-flyout {
  display: none;
  position: absolute;
  left: calc(100% - 1px);
  top: -3px;
  min-width: 220px;
  max-width: min(380px, 72vw);
  max-height: min(72vh, 540px);
  overflow-x: hidden;
  overflow-y: auto;
  z-index: 60;
  margin: 0;
  padding: 3px 0;
  border: 1px solid var(--menu-popup-border);
  background: var(--menu-popup-bg);
  box-shadow: 4px 8px 18px var(--wt-shadow-soft);
}
body.webterminal .menu-submenu-wrap:hover > .menu-flyout {
  display: block;
}
body.webterminal .menu-flyout .menu-submenu-wrap:hover > .menu-flyout {
  display: block;
}
body.webterminal .menu-item--leaf {
  padding-left: 12px;
}

body.webterminal .panel {
  border-radius: 0;
  border-color: var(--border);
  background: var(--panel);
  background-image: none;
}

body.webterminal .bottom-statusbar {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  background: var(--panel);
  border-top: 1px solid var(--border);
  font-size: 11px;
  font-family: var(--sans);
  color: var(--text);
  padding: 5px 10px;
}

body.webterminal .wt-mobile-tabbar {
  display: none;
}

body.webterminal.wt-hide-statusbar {
  --wtBottomBarH: 0px;
}
body.webterminal.wt-hide-statusbar .bottom-statusbar {
  display: none !important;
}
body.webterminal.wt-hide-toolbox .wt-toolbox-band {
  display: none !important;
}
body.webterminal.wt-hide-toolbox .wt-row-resizer--bands {
  display: none !important;
}
/* Chart + indicators grow into the former toolbox rows (left columns only); trade dock stays in column 3. */
body.webterminal.wt-hide-toolbox .wt-chart-indicators-band {
  min-height: 0;
  grid-row: 1 / 4;
}
body.webterminal.wt-hide-toolbox .wt-work-columns {
  /* Row 1 gets remaining height; row 3 only as tall as trade dock (right column) — not full width. */
  grid-template-rows: minmax(0, 1fr) 0 minmax(0, auto) !important;
}
body.webterminal.wt-hide-toolbox .wt-grid-mw-bottom {
  grid-column: 3;
  grid-row: 3;
  min-height: 0;
}

/* When toolbox is hidden, show the same account summary (Balance / Equity / …) under the chart; chart flexes above it. */
body.webterminal #wtAccountFooterChart.wt-account-footer--under-chart {
  display: none;
  flex: 0 0 auto;
  border-top: 1px solid var(--border);
  background: var(--panel);
  padding: 6px 10px;
  box-sizing: border-box;
}
body.webterminal.wt-hide-toolbox #wtAccountFooterChart.wt-account-footer--under-chart {
  display: block;
}
body.webterminal.wt-hide-toolbox #wtAccountFooterChart .wt-af-grid {
  gap: 8px 16px;
  font-size: 10px;
}

/* Toolbox + MW hidden, trade dock open: main column full width; grow chart (indicators stay short). */
body.webterminal.wt-hide-toolbox.wt-hide-market-watch:not(.wt-trade-dock-hidden) .wt-chart-indicators-band {
  align-items: stretch;
}
body.webterminal.wt-hide-toolbox.wt-hide-market-watch:not(.wt-trade-dock-hidden) .wt-chart-indicators-band .wt-grid-indicators {
  align-self: start;
  flex: 0 0 auto;
  max-height: min(42vh, 480px);
  overflow-x: hidden;
  overflow-y: auto;
}
body.webterminal.wt-hide-toolbox.wt-hide-market-watch:not(.wt-trade-dock-hidden) .wt-chart-indicators-band .wt-grid-chart {
  flex: 1 1 0;
  min-height: 0;
}
body.webterminal.wt-hide-toolbox .wt-grid-toolbox {
  display: none !important;
}
body.webterminal.wt-hide-market-watch .wt-grid-mw-top,
body.webterminal.wt-hide-market-watch .wt-grid-mw-bottom {
  display: none !important;
}
body.webterminal.wt-hide-market-watch .wt-mw-col-resizer {
  display: none !important;
}
body.webterminal.wt-hide-market-watch .wt-work-columns {
  grid-template-columns: minmax(0, 1fr) var(--wt-indicator-strip);
}
body.webterminal.wt-hide-market-watch .wt-chart-indicators-band {
  grid-column: 1 / -1;
  grid-row: 1;
}
/* Toolbox hidden + no MW: chart uses full width and vertical space through row 3 (no toolbox band). */
body.webterminal.wt-hide-toolbox.wt-hide-market-watch .wt-chart-indicators-band {
  grid-row: 1 / 4;
}
body.webterminal.wt-hide-market-watch .wt-row-resizer--bands {
  grid-column: 1 / -1;
  grid-row: 2;
}
body.webterminal.wt-hide-market-watch .wt-toolbox-band {
  grid-column: 1 / -1;
  grid-row: 3;
}

/* Dark theme: MT5 + stream status match sys line green (same as status.js okColor) */
:root:not([data-theme="light"]) body.webterminal .bottom-statusbar .bottom-statusbar-mid,
:root:not([data-theme="light"]) body.webterminal .bottom-statusbar #streamStatusBottom {
  color: rgba(46, 229, 157, 0.95);
}

body.webterminal .mw-context-menu {
  border-radius: 0;
  border: 1px solid var(--menu-popup-border);
  background: var(--menu-popup-bg);
  box-shadow: 0 3px 10px var(--wt-shadow-soft);
  padding: 3px 0;
  backdrop-filter: none;
}

body.webterminal .mw-context-item {
  font-family: inherit;
  font-size: 10px;
  font-weight: 400;
  line-height: 14px;
  padding: 4px 10px 4px 8px;
  color: var(--text);
  border-radius: 0;
}

body.webterminal .mw-context-item:hover {
  background: var(--menu-hover);
}

body.webterminal .toast {
  font-family: var(--sans);
  font-size: 11px;
  border-color: var(--menu-popup-border);
  background: var(--menu-popup-bg);
  color: var(--text);
  box-shadow: 0 3px 10px var(--wt-shadow-soft);
}

body.webterminal .chart-toast {
  font-family: var(--sans);
  font-size: 11px;
  border-color: var(--menu-popup-border);
  background: var(--menu-popup-bg);
  color: var(--text);
  box-shadow: 0 3px 10px var(--wt-shadow-soft);
  backdrop-filter: none;
}

body.webterminal .mw-add-field .mw-add-input {
  font-family: var(--toolbox-font);
  font-size: 12px;
}

body.webterminal .mw-pane.active,
body.webterminal #mwSymbolsPane.active {
  background: var(--surface);
}

body.webterminal .mw-card {
  border-color: var(--border);
  background: var(--surface);
  border-radius: 0;
}
body.webterminal .mw-card-top {
  border-bottom-color: var(--border);
  background: var(--panel2);
  font-size: 10px;
}

body.webterminal .wt-account-footer {
  border-top: 1px solid var(--border);
  background: var(--panel);
  font-size: 11px;
  font-family: var(--sans);
  color: var(--text);
}
body.webterminal .wt-af-grid {
  font-size: 11px;
  color: var(--text);
}

body.webterminal .webterminal-order-modal-card {
  border-radius: 0;
  box-shadow: 0 8px 24px var(--wt-shadow-soft);
}
body.webterminal .webterminal-order-modal-head {
  background: linear-gradient(to bottom, var(--panel2), var(--panel));
  padding: 5px 10px;
}
body.webterminal .webterminal-order-modal-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
}
body.webterminal .webterminal-order-modal-close {
  border-radius: 1px;
  font-size: 11px;
  width: 22px;
  height: 20px;
}
body.webterminal .webterminal-order-modal-body {
  font-size: 11px;
}

.panel {
  border: 1px solid var(--border);
  border-radius: var(--wt-radius);
  background: linear-gradient(180deg, var(--panel), var(--panel2));
  padding: 16px;
}

.panel-title { font-weight: 700; letter-spacing: 0.2px; margin-bottom: 12px; }

.grid2 { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 900px) {
  .grid2 { grid-template-columns: 1fr 1fr; }
}

.kv {
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: var(--wt-radius);
  background: rgba(0,0,0,0.10);
  padding: 12px 12px;
}
.k { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.v { font-weight: 650; letter-spacing: 0.1px; }
.mono { font-family: var(--mono); font-weight: 600; }

.tabs { margin-top: 18px; }
.tablist {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--wt-radius);
  background: linear-gradient(180deg, var(--panel), var(--panel2));
}
.tab {
  cursor: pointer;
  user-select: none;
  padding: 10px 12px;
  border-radius: var(--wt-radius);
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.06);
  color: var(--text);
  font-weight: 650;
  letter-spacing: 0.15px;
}
.tab.active {
  border-color: rgba(124, 92, 255, 0.55);
  background: linear-gradient(135deg, rgba(124, 92, 255, 0.22), rgba(38, 209, 255, 0.14));
}

.tabpanes { margin-top: 12px; }
.pane { display: none; }
.pane.active { display: block; }

.gridCards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 980px) {
  .gridCards { grid-template-columns: 1fr 1fr; }
}

.fetchGrid { display: grid; gap: 12px; }
.fetchRow {
  border: 1px solid var(--border);
  border-radius: var(--wt-radius);
  background: linear-gradient(180deg, var(--panel), rgba(255,255,255,0.03));
  padding: 12px 14px;
}
.fetchName { font-weight: 800; letter-spacing: 0.2px; margin-bottom: 10px; }
.fetchActions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 10px; }
.fetchOut {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.45;
  border-radius: var(--wt-radius);
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(0,0,0,0.14);
  padding: 10px;
  max-height: 320px;
  overflow: auto;
}

.card {
  border: 1px solid var(--border);
  border-radius: var(--wt-radius);
  background: linear-gradient(180deg, var(--panel), rgba(255,255,255,0.03));
  overflow: hidden;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.10);
}
.card-title { font-weight: 750; letter-spacing: 0.2px; }
.pill {
  font-family: var(--mono);
  font-size: 12px;
  padding: 6px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.14);
  color: var(--text-soft);
  background: rgba(0,0,0,0.14);
}

.card-body { padding: 12px 14px; }
.card-actions {
  padding: 0 14px 12px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.field { display: block; margin-bottom: 10px; }
.field-label { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.field-input, .field-textarea {
  width: 100%;
  border-radius: var(--wt-radius);
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(0,0,0,0.18);
  color: var(--text);
  padding: 10px 10px;
  outline: none;
}
.field-input:focus, .field-textarea:focus {
  border-color: rgba(124, 92, 255, 0.6);
  box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.15);
}
.field-textarea { min-height: 140px; font-family: var(--mono); font-size: 12.5px; line-height: 1.5; }

.btn {
  cursor: pointer;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.06);
  color: var(--text);
  padding: 10px 12px;
  border-radius: var(--wt-radius);
  font-weight: 700;
  letter-spacing: 0.15px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn.secondary { background: rgba(255,255,255,0.04); }
.btn.run { background: linear-gradient(135deg, rgba(124, 92, 255, 0.28), rgba(38, 209, 255, 0.14)); }
.btn:hover { filter: brightness(1.04); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.response {
  border-top: 1px solid rgba(255,255,255,0.10);
  padding: 12px 14px;
}
.response-title { font-weight: 750; margin-bottom: 8px; }
.response-meta { font-family: var(--mono); font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.response-body {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.45;
  border-radius: var(--wt-radius);
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(0,0,0,0.14);
  padding: 10px;
  max-height: 420px;
  overflow: auto;
}

.toast {
  position: fixed;
  top: 72px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  width: min(980px, calc(100vw - 32px));
  border-radius: var(--wt-radius);
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(14px);
  padding: 12px 14px;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.4;
  color: var(--text-soft);
}
.toast.ok { border-color: rgba(46, 229, 157, 0.55); }
.toast.bad { border-color: rgba(255, 77, 109, 0.65); }

.chart-toast {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 12;
  padding: 8px 10px;
  border-radius: var(--wt-radius);
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(0,0,0,0.48);
  backdrop-filter: blur(12px);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.3;
  color: var(--text-soft);
  max-width: min(360px, calc(100% - 20px));
  pointer-events: none;
}
.chart-toast.ok { border-color: rgba(46, 229, 157, 0.55); }
.chart-toast.bad { border-color: rgba(255, 77, 109, 0.65); }

.chart-tooltip {
  position: absolute;
  z-index: 13;
  padding: 8px 10px;
  border-radius: var(--wt-radius);
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(12px);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.3;
  color: var(--text-soft);
  max-width: min(420px, calc(100% - 20px));
  pointer-events: none;
}
.chart-tooltip .tt-row { opacity: 0.9; margin-bottom: 6px; }
.chart-tooltip .tt-grid { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; }

.positions-table-wrap {
  overflow: auto;
  border-radius: var(--wt-radius);
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.10);
}
.positions-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 920px;
}
.positions-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  text-align: left;
  font-weight: 800;
  letter-spacing: 0.2px;
  padding: 4px 8px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
  background: var(--surface-strong);
  font-size: 12px;
}
.positions-table thead th.num-right { text-align: right; }
.positions-table thead th.num-center { text-align: center; }
.positions-table tbody td {
  padding: 4px 8px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 400;
}
.positions-table tbody tr:hover td {
  background: rgba(255,255,255,0.04);
}
.positions-table tbody tr.row-new td {
  background: rgba(46, 229, 157, 0.12);
  border-bottom-color: rgba(46, 229, 157, 0.22);
}

.profit-plus { color: rgba(46, 229, 157, 0.95); }
.profit-minus { color: rgba(255, 77, 109, 0.95); }

.positions-table tbody tr.row-closed-new td {
  background: rgba(255, 208, 77, 0.10);
  border-bottom-color: rgba(255, 208, 77, 0.22);
}

body.webterminal .positions-table-wrap {
  border: 1px solid var(--wt-grid-line);
  border-radius: 0;
  background: var(--surface);
  backdrop-filter: none;
}
body.webterminal .positions-table thead th {
  background: linear-gradient(180deg, #3a3f4a, #2f343e);
  border-bottom: 1px solid var(--wt-grid-line);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: normal;
  color: var(--text);
}
:root[data-theme="light"] body.webterminal .positions-table thead th {
  background: linear-gradient(180deg, #f0f2f5, #e4e8ed);
}
body.webterminal .positions-table tbody td {
  font-family: var(--toolbox-font);
  font-size: 11px;
  font-weight: 400;
  color: var(--text);
  border-bottom: 1px solid var(--wt-grid-line);
}
body.webterminal .positions-table tbody tr:nth-child(odd) td {
  background: var(--surface);
}
body.webterminal .positions-table tbody tr:nth-child(even) td {
  background: rgba(0, 0, 0, 0.14);
}
:root[data-theme="light"] body.webterminal .positions-table tbody tr:nth-child(odd) td {
  background: #ffffff;
}
:root[data-theme="light"] body.webterminal .positions-table tbody tr:nth-child(even) td {
  background: #f5f6f8;
}
body.webterminal .positions-table tbody tr:hover td {
  background: var(--menu-hover) !important;
}

/* Trade + History: symbol column buy/sell icons (same assets/logic as winterminal). */
body.webterminal .wt-tb-pos-table .wt-tb-l,
body.webterminal .wt-tb-hist-table .wt-tb-l {
  text-align: left;
}

body.webterminal .wt-tb-pos-table .wt-tb-row-side-ico,
body.webterminal .wt-tb-hist-table .wt-tb-row-side-ico {
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 5px;
  vertical-align: -3px;
  flex-shrink: 0;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  box-sizing: border-box;
  border: none;
}

body.webterminal .wt-tb-pos-table .wt-tb-row-side-ico.wt-tb-ico-buy,
body.webterminal .wt-tb-hist-table .wt-tb-row-side-ico.wt-tb-ico-buy {
  background-image: url("assets/icons/buy-icon.png");
}

body.webterminal .wt-tb-pos-table .wt-tb-row-side-ico.wt-tb-ico-sell,
body.webterminal .wt-tb-hist-table .wt-tb-row-side-ico.wt-tb-ico-sell {
  background-image: url("assets/icons/sell-icon.png");
}

.layout {
  display: grid;
  grid-template-columns: 480px 1fr;
  gap: 12px;
  align-items: start;
}

body.webterminal .wt-layout-stack {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

body.webterminal .wt-work-columns {
  /* Indicator list column: wider strip → chart (flex 1) shrinks within the band. */
  --wt-indicator-strip: clamp(120px, 12vw, 220px);
  --wt-row-resizer-hit: 3px;
  /* Row 1: chart+indicators | MW; row 2: full-width band resizer; row 3: toolbox | trade dock. grid-template-rows overridden inline when a split is saved. */
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--wt-indicator-strip) clamp(132px, var(--wt-mw-aside-pref, 256px), 395px);
  grid-template-rows: minmax(0, 1.52fr) var(--wt-row-resizer-hit) minmax(100px, 1.12fr);
  column-gap: 8px;
  row-gap: 3px;
  align-items: stretch;
  align-content: stretch;
}

body.webterminal .wt-row-resizer {
  display: none;
  z-index: 25;
  margin: 0;
  min-height: var(--wt-row-resizer-hit);
  cursor: row-resize;
  touch-action: none;
  user-select: none;
  background: transparent;
  border-radius: 2px;
}
body.webterminal .wt-row-resizer:hover,
body.webterminal .wt-row-resizer.wt-row-resizer--active {
  background: color-mix(in srgb, var(--accent) 35%, transparent);
}
@media (min-width: 1101px) {
  body.webterminal:not(.wt-hide-toolbox) .wt-row-resizer--bands {
    display: block;
  }
}

body.webterminal .wt-mw-col-resizer {
  display: none;
  position: absolute;
  top: 0;
  width: 8px;
  margin-left: -4px;
  z-index: 30;
  cursor: col-resize;
  touch-action: none;
  user-select: none;
  background: transparent;
  border-radius: 2px;
}
body.webterminal .wt-mw-col-resizer:hover,
body.webterminal .wt-mw-col-resizer.wt-mw-col-resizer--active {
  background: color-mix(in srgb, var(--accent) 35%, transparent);
}
@media (min-width: 1101px) {
  body.webterminal:not(.wt-hide-market-watch) .wt-mw-col-resizer {
    display: block;
  }
}

body.webterminal .wt-chart-indicators-band {
  grid-column: 1 / 3;
  grid-row: 1;
  min-width: 0;
  min-height: 0;
  align-self: stretch;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 8px;
  box-sizing: border-box;
}

body.webterminal .wt-grid-mw-top {
  grid-column: 3;
  grid-row: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

body.webterminal .wt-row-resizer--bands {
  grid-column: 1 / -1;
  grid-row: 2;
}

body.webterminal .wt-toolbox-band.wt-grid-toolbox {
  grid-column: 1 / 3;
  grid-row: 3;
}

body.webterminal .wt-grid-mw-bottom {
  grid-column: 3;
  grid-row: 3;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

body.webterminal .wt-chart-indicators-band .wt-grid-chart {
  flex: 1 1 0;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-self: stretch;
}
/* Match chart column min height to #wtMarketWatchCard (updated from layout sync). */
body.webterminal .wt-chart-indicators-band .wt-grid-chart .layout-main.wt-grid-chart {
  min-height: var(--wt-mw-card-height, auto);
}

body.webterminal .wt-grid-toolbox {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

@media (min-width: 1101px) {
  body.webterminal.wt-trade-dock-hidden .wt-grid-mw-bottom {
    display: none !important;
  }
  body.webterminal.wt-trade-dock-hidden .wt-toolbox-band.wt-grid-toolbox {
    grid-column: 1 / -1;
    grid-row: 3;
  }
}

body.webterminal .wt-chart-indicators-band .wt-grid-indicators {
  flex: 0 0 var(--wt-indicator-strip);
  width: var(--wt-indicator-strip);
  min-width: 0;
  min-height: 0;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 4px 4px 6px;
  box-sizing: border-box;
  border: 1px solid var(--border);
  border-radius: 0;
}

body.webterminal .wt-toolbox-band {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 0;
  min-height: 0;
  flex: 1 1 0;
  width: 100%;
}
body.webterminal .wt-toolbox-band .wt-toolbox-panel {
  flex: 1 1 0;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-right: none;
}

@media (max-width: 1100px) {
  /* Stack as column: chart → trade dock → market watch → toolbox (trade always under chart). */

  /*
   * Mobile/tablet: avoid horizontal page scroll. Base .positions-table uses min-width: 920px;
   * card layouts hide columns — table must shrink to viewport. Flex children also need min-width: 0
   * so overflow stays inside scroll areas instead of expanding the page.
   */
  body.webterminal .wt-layout-stack,
  body.webterminal .wt-work-columns,
  body.webterminal .wt-chart-indicators-band,
  body.webterminal .wt-grid-mw-top,
  body.webterminal .wt-grid-mw-bottom,
  body.webterminal .wt-toolbox-band.wt-grid-toolbox,
  body.webterminal .wt-toolbox-panel,
  body.webterminal #wtToolboxPanel,
  body.webterminal .wt-book,
  body.webterminal .wt-pane,
  body.webterminal #wtPaneTrade,
  body.webterminal #wtPaneHistory,
  body.webterminal #wtPaneCalendar,
  body.webterminal #wtPaneExperts,
  body.webterminal .positions-table-wrap,
  body.webterminal .wt-cal-scroll,
  body.webterminal .wtc-cal-scroll,
  body.webterminal .wt-toolbox-grid-wrap {
    min-width: 0;
    max-width: 100%;
  }
  body.webterminal .positions-table {
    min-width: 0 !important;
    width: 100%;
    max-width: 100%;
  }
  body.webterminal .wt-cal-table {
    min-width: 0;
    width: 100%;
  }
  body.webterminal .wt-cal-col-time {
    min-width: 0;
  }
  body.webterminal #wtPaneExperts .wt-webt-experts-root {
    min-width: 0;
    max-width: 100%;
  }
  body.webterminal #wtPaneTrade .m-tr-kv .v,
  body.webterminal #wtPaneTrade .m-tr-item .t1,
  body.webterminal #wtPaneTrade .m-tr-item .t2 {
    overflow-wrap: anywhere;
  }
  body.webterminal #wtPaneHistory .m-h-item .t1,
  body.webterminal #wtPaneHistory .m-h-item .t2 {
    overflow-wrap: anywhere;
  }

  body.webterminal .wt-work-columns {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
    grid-template-columns: unset;
    grid-template-rows: unset;
    grid-auto-rows: unset;
  }
  body.webterminal .wt-chart-indicators-band,
  body.webterminal .wt-grid-mw-top,
  body.webterminal .wt-row-resizer--bands,
  body.webterminal .wt-toolbox-band.wt-grid-toolbox,
  body.webterminal .wt-grid-mw-bottom {
    grid-column: unset;
    grid-row: unset;
  }
  body.webterminal .wt-row-resizer,
  body.webterminal .wt-mw-col-resizer {
    display: none !important;
  }

  body.webterminal .wt-chart-indicators-band {
    order: 1;
    flex: 0 1 auto;
    min-height: 0;
    max-height: min(32dvh, 260px);
    flex-direction: column;
  }
  body.webterminal .wt-chart-indicators-band .wt-grid-chart {
    flex: 0 1 auto;
    min-height: 100px;
    max-height: min(28dvh, 220px);
  }
  body.webterminal .wt-chart-indicators-band .wt-grid-indicators {
    flex: 0 1 auto;
    width: 100%;
    max-width: none;
    max-height: min(200px, 26dvh);
    border-left: none;
    border-right: none;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
  }

  body.webterminal .wt-grid-mw-bottom {
    order: 2;
    flex: 1 1 auto;
    min-height: min(36dvh, 320px);
    max-height: none;
    overflow: visible;
    border-left: none;
    border-top: 1px solid var(--border);
    -webkit-overflow-scrolling: touch;
  }

  body.webterminal .wt-grid-mw-top {
    order: 3;
    flex: 0 1 auto;
    max-height: min(30dvh, 280px);
    overflow: auto;
    border-left: none;
    border-top: 1px solid var(--border);
    -webkit-overflow-scrolling: touch;
  }

  body.webterminal .wt-toolbox-band.wt-grid-toolbox {
    order: 4;
    flex: 1 1 22dvh;
    min-height: 140px;
    max-height: min(36dvh, 360px);
    overflow: hidden;
    -webkit-overflow-scrolling: touch;
  }

  body.webterminal .wt-chart-split {
    flex-direction: column;
  }
  body.webterminal.wt-hide-toolbox .wt-chart-indicators-band {
    flex: 1 1 50dvh;
    min-height: 260px;
  }
  body.webterminal.wt-hide-toolbox .wt-toolbox-band.wt-grid-toolbox {
    display: none !important;
  }

  body.webterminal .trade-chart {
    height: auto;
    min-height: 100px;
    max-height: min(28dvh, 220px);
  }

  body.webterminal .positions-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  body.webterminal .mw-tabs.wt-tabs,
  body.webterminal #wtMarketWatchCard .mw-tabs {
    flex-wrap: wrap;
    gap: 4px;
  }
  body.webterminal .mw-tab {
    flex: 1 1 auto;
    min-width: 72px;
    padding: 8px 10px;
    font-size: 12px;
  }

  body.webterminal > main.container.wide {
    margin: 6px 0 0;
    width: 100%;
    max-width: 100%;
    padding-left: 6px;
    padding-right: 6px;
    box-sizing: border-box;
  }

  body.webterminal .trade-chart-wrap {
    margin-bottom: 6px;
    padding: 6px;
  }

  /* Bottom tab bar: switch Market Watch vs toolbox (Trade / History / Calendar / Experts). */
  body.webterminal .wt-layout-stack {
    flex: 1 1 auto;
    min-height: 0;
  }
  body.webterminal .wt-work-columns {
    flex: 1 1 auto;
    min-height: 0;
  }

  body.webterminal .wt-mobile-tabbar {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 2px;
    position: fixed;
    left: 0;
    right: 0;
    bottom: calc(38px + env(safe-area-inset-bottom, 0px));
    z-index: 49;
    padding: 6px 4px 6px;
    border-top: 1px solid var(--border);
    background: color-mix(in srgb, var(--surface-strong) 88%, transparent);
    backdrop-filter: blur(12px);
    -webkit-tap-highlight-color: transparent;
  }
  :root[data-theme="light"] body.webterminal .wt-mobile-tabbar {
    background: color-mix(in srgb, #f5f7fc 90%, transparent);
  }
  body.webterminal.wt-hide-statusbar .wt-mobile-tabbar {
    bottom: env(safe-area-inset-bottom, 0px);
    padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px));
  }
  body.webterminal .wt-mtab {
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--text-soft);
    font-size: 8px;
    font-weight: 650;
    line-height: 1.15;
    padding: 4px 2px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    cursor: pointer;
    min-width: 0;
  }
  body.webterminal .wt-mtab:active {
    background: var(--panel2);
  }
  body.webterminal .wt-mtab.active {
    color: var(--accent);
  }
  body.webterminal .wt-mtab-ico {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
  }
  body.webterminal .wt-mtab[data-wt-mtab="experts"] .wt-mtab-ico {
    stroke: none;
    fill: currentColor;
  }
  body.webterminal .wt-mtab[data-wt-mtab="calendar"] .wt-mtab-ico rect {
    fill: none;
  }
  body.webterminal > main.container.wide {
    padding-bottom: calc(52px + 38px + env(safe-area-inset-bottom, 0px));
  }
  body.webterminal.wt-hide-statusbar > main.container.wide {
    padding-bottom: calc(52px + env(safe-area-inset-bottom, 0px));
  }

  body.webterminal .wt-book .mw-tabs.wt-tabs {
    display: none !important;
  }

  /* Market: only Market Watch, all space below top + bottom bars. */
  body.webterminal.wt-mtab-market .wt-chart-indicators-band,
  body.webterminal.wt-mtab-market .wt-grid-mw-bottom,
  body.webterminal.wt-mtab-market .wt-toolbox-band.wt-grid-toolbox {
    display: none !important;
  }
  body.webterminal.wt-mtab-market .wt-grid-mw-top {
    order: 1 !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: hidden !important;
  }
  body.webterminal.wt-mtab-market #wtMarketWatchCard {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    display: flex !important;
    flex-direction: column !important;
  }
  body.webterminal.wt-mtab-market #wtMarketWatchCard .mw-pane.active {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  /* Watch: chart + order dock only; chart dominates, trade strip compact. */
  body.webterminal.wt-mtab-watch .wt-grid-mw-top,
  body.webterminal.wt-mtab-watch .wt-toolbox-band.wt-grid-toolbox {
    display: none !important;
  }
  body.webterminal.wt-mtab-watch .wt-chart-indicators-band {
    order: 1 !important;
    flex: 0 1 auto !important;
    min-height: 0 !important;
    max-height: min(34dvh, 280px) !important;
    flex-direction: column !important;
  }
  body.webterminal.wt-mtab-watch .wt-chart-indicators-band .wt-grid-chart {
    flex: 0 1 auto !important;
    min-height: 0 !important;
    max-height: min(30dvh, 240px) !important;
  }
  body.webterminal.wt-mtab-watch .wt-chart-indicators-band .wt-grid-indicators {
    flex: 0 0 min(96px, 14dvh) !important;
    width: 100% !important;
    max-height: min(120px, 16dvh) !important;
    min-height: 0 !important;
  }
  body.webterminal.wt-mtab-watch .trade-chart-wrap {
    flex: 0 1 auto !important;
    min-height: 0 !important;
  }
  body.webterminal.wt-mtab-watch .trade-chart {
    flex: 0 1 auto !important;
    min-height: 100px !important;
    height: auto !important;
    max-height: min(26dvh, 200px) !important;
  }
  body.webterminal.wt-mtab-watch .wt-grid-mw-bottom {
    order: 2 !important;
    flex: 1 1 auto !important;
    max-height: none !important;
    min-height: min(38dvh, 380px) !important;
    overflow: visible !important;
    -webkit-overflow-scrolling: touch;
  }

  /* Trade: positions / orders toolbox only (mobile-style list), full space. */
  body.webterminal.wt-mtab-trade .wt-chart-indicators-band,
  body.webterminal.wt-mtab-trade .wt-grid-mw-bottom {
    display: none !important;
  }
  body.webterminal.wt-mtab-trade .wt-grid-mw-top {
    display: none !important;
  }
  body.webterminal.wt-mtab-trade .wt-toolbox-band.wt-grid-toolbox {
    order: 1 !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: hidden !important;
  }
  body.webterminal.wt-mtab-trade #wtToolboxPanel .wt-book {
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    min-height: 0;
  }
  body.webterminal.wt-mtab-trade #wtPaneTrade .positions-table-wrap {
    overflow: visible;
    flex: 1 1 auto;
    min-height: 0;
  }

  body.webterminal.wt-mtab-history .wt-chart-indicators-band,
  body.webterminal.wt-mtab-calendar .wt-chart-indicators-band,
  body.webterminal.wt-mtab-experts .wt-chart-indicators-band,
  body.webterminal.wt-mtab-history .wt-grid-mw-top,
  body.webterminal.wt-mtab-calendar .wt-grid-mw-top,
  body.webterminal.wt-mtab-experts .wt-grid-mw-top,
  body.webterminal.wt-mtab-history .wt-grid-mw-bottom,
  body.webterminal.wt-mtab-calendar .wt-grid-mw-bottom,
  body.webterminal.wt-mtab-experts .wt-grid-mw-bottom {
    display: none !important;
  }
  body.webterminal.wt-mtab-history .wt-toolbox-band.wt-grid-toolbox,
  body.webterminal.wt-mtab-calendar .wt-toolbox-band.wt-grid-toolbox,
  body.webterminal.wt-mtab-experts .wt-toolbox-band.wt-grid-toolbox {
    order: 1 !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: hidden !important;
  }

  /* Toolbox Trade / History: /mobile mTrade + mHistory-style cards (≤1100px). */
  body.webterminal #wtPaneTrade .positions-table-wrap,
  body.webterminal #wtPaneHistory .positions-table-wrap {
    overflow-x: visible;
  }

  body.webterminal #positionsTable {
    display: flex;
    flex-direction: column;
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
  }
  body.webterminal #positionsTable thead {
    display: none;
  }
  body.webterminal #positionsTable tbody {
    display: block;
    width: 100%;
  }
  body.webterminal #positionsTable tbody#positionsMetaSummaryBody {
    order: 1;
  }
  body.webterminal #positionsTable tbody#positionsBody {
    order: 2;
  }
  body.webterminal #positionsTable tbody#positionsMetaPendingBody {
    order: 3;
  }

  body.webterminal #closedPositionsTable {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
  }
  body.webterminal #closedPositionsTable thead {
    display: none;
  }
  body.webterminal #closedPositionsTable tbody {
    display: block;
  }

  /* —— mTrade-like (scoped to trade pane) —— */
  body.webterminal #wtPaneTrade .m-tr-summary {
    padding: 16px 14px 8px 14px;
    border-bottom: 1px solid var(--border);
    box-sizing: border-box;
  }
  body.webterminal #wtPaneTrade .m-tr-kv {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: baseline;
    gap: 10px;
    padding: 6px 0;
    font-size: 14px;
  }
  body.webterminal #wtPaneTrade .m-tr-kv .k {
    font-weight: 760;
    color: var(--text);
  }
  body.webterminal #wtPaneTrade .m-tr-kv .dots {
    border-bottom: 1px dotted rgba(255, 255, 255, 0.22);
    transform: translateY(-2px);
  }
  :root[data-theme="light"] body.webterminal #wtPaneTrade .m-tr-kv .dots {
    border-bottom: 1px dotted rgba(0, 0, 0, 0.22);
  }
  body.webterminal #wtPaneTrade .m-tr-kv .v {
    font-weight: 760;
    font-variant-numeric: tabular-nums;
  }
  body.webterminal #wtPaneTrade .m-tr-kv .v.pos {
    color: var(--accent2);
  }
  body.webterminal #wtPaneTrade .m-tr-kv .v.neg {
    color: var(--danger);
  }

  body.webterminal #wtPaneTrade .m-tr-item {
    padding: 6px 14px;
    border-top: 1px solid var(--border);
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    box-sizing: border-box;
  }
  body.webterminal #wtPaneTrade .m-tr-item .t1 {
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0.2px;
  }
  body.webterminal #wtPaneTrade .m-tr-item .t1 .tag {
    font-weight: 400;
  }
  body.webterminal #wtPaneTrade .m-tr-item .t1 .pos {
    color: var(--accent2);
  }
  body.webterminal #wtPaneTrade .m-tr-item .t1 .neg {
    color: var(--danger);
  }
  body.webterminal #wtPaneTrade .m-tr-item .t2 {
    color: var(--text-soft);
    margin-top: 2px;
    font-size: 12px;
  }
  body.webterminal #wtPaneTrade .m-tr-item .r {
    font-size: 14px;
    font-weight: 780;
    color: var(--accent2);
    font-variant-numeric: tabular-nums;
  }
  body.webterminal #wtPaneTrade .m-tr-item .r.neg {
    color: var(--danger);
  }
  body.webterminal #wtPaneTrade .m-tr-item .r.muted {
    color: var(--text-soft);
    font-weight: 650;
  }

  body.webterminal #wtPaneTrade .wt-mtr-rstack {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
  }
  body.webterminal #wtPaneTrade .wt-mtr-rstack .mw-pos-x {
    min-width: 36px;
    min-height: 32px;
  }

  body.webterminal #positionsTable tbody tr.wt-trade-meta-summary {
    display: block;
    border: 0;
    padding: 0;
    background: var(--panel2);
  }
  body.webterminal #positionsTable tbody tr.wt-trade-meta-summary td.wt-mtr-sum-td {
    display: block;
    border: 0;
    padding: 0;
    width: 100% !important;
    background: transparent !important;
  }
  body.webterminal #positionsTable tbody tr.wt-trade-meta-summary td.wt-mtr-sum-td .wt-mtr-sum-wide {
    display: none !important;
  }
  body.webterminal #positionsTable tbody tr.wt-trade-meta-summary td.wt-mtr-sum-td .wt-mtr-sum-narrow {
    display: block !important;
  }

  body.webterminal #positionsTable tbody#positionsBody tr[data-key],
  body.webterminal #positionsTable tbody#positionsMetaPendingBody tr.wt-trade-meta-pending {
    display: block;
    border: 0;
    padding: 0;
    background: transparent;
  }
  body.webterminal #positionsTable tbody#positionsBody tr[data-key] > td.wt-mtr-d-cell,
  body.webterminal #positionsTable tbody#positionsMetaPendingBody tr.wt-trade-meta-pending > td.wt-mtr-d-cell {
    display: none !important;
  }
  body.webterminal #positionsTable tbody#positionsBody tr[data-key] > td.wt-mtr-first > span.wt-mtr-d-cell,
  body.webterminal #positionsTable tbody#positionsMetaPendingBody tr.wt-trade-meta-pending > td.wt-mtr-first > span.wt-mtr-d-cell {
    display: none !important;
  }
  body.webterminal #positionsTable tbody#positionsBody tr[data-key] > td.wt-mtr-first,
  body.webterminal #positionsTable tbody#positionsMetaPendingBody tr.wt-trade-meta-pending > td.wt-mtr-first {
    display: block;
    width: 100%;
    border: 0;
    padding: 0;
    background: var(--surface-strong) !important;
  }
  body.webterminal #positionsTable tbody#positionsBody tr[data-key] > td.wt-mtr-first .wt-mtr-m,
  body.webterminal #positionsTable tbody#positionsMetaPendingBody tr.wt-trade-meta-pending > td.wt-mtr-first .wt-mtr-m {
    display: grid;
  }
  body.webterminal #positionsTable tbody#positionsMetaPendingBody tr.wt-trade-meta-pending-stripe > td.wt-mtr-first {
    filter: brightness(0.97);
  }

  /* —— mHistory-like (scoped to history pane) —— */
  body.webterminal #wtPaneHistory .m-h-item {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    box-sizing: border-box;
  }
  body.webterminal #wtPaneHistory .m-h-item .t1 {
    font-weight: 750;
    font-size: 14px;
    line-height: 1.1;
  }
  body.webterminal #wtPaneHistory .m-h-item .t1 .side.buy {
    color: var(--accent2);
    font-weight: 750;
  }
  body.webterminal #wtPaneHistory .m-h-item .t1 .side.sell {
    color: var(--danger);
    font-weight: 750;
  }
  body.webterminal #wtPaneHistory .m-h-item .t1 .vol.buy {
    color: var(--accent2);
  }
  body.webterminal #wtPaneHistory .m-h-item .t1 .vol.sell {
    color: var(--danger);
  }
  body.webterminal #wtPaneHistory .m-h-item .t2 {
    color: var(--text-soft);
    margin-top: 2px;
    font-size: 14px;
    font-variant-numeric: tabular-nums;
  }
  body.webterminal #wtPaneHistory .m-h-item .r {
    text-align: right;
  }
  body.webterminal #wtPaneHistory .m-h-item .tm {
    color: var(--text-soft);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
  }
  body.webterminal #wtPaneHistory .m-h-item .p {
    margin-top: 2px;
    font-weight: 750;
    font-size: 14px;
    font-variant-numeric: tabular-nums;
  }
  body.webterminal #wtPaneHistory .m-h-item .p.pos {
    color: var(--accent2);
  }
  body.webterminal #wtPaneHistory .m-h-item .p.neg {
    color: var(--danger);
  }

  body.webterminal #closedPositionsTable tr.wt-hist-row {
    display: block;
    border: 0;
    padding: 0;
    background: transparent;
  }
  body.webterminal #closedPositionsTable tr.wt-hist-row > td.wt-mhist-d-cell {
    display: none !important;
  }
  body.webterminal #closedPositionsTable tr.wt-hist-row > td.wt-mhist-first {
    display: block;
    width: 100%;
    border: 0;
    padding: 0;
    background: var(--surface-strong) !important;
  }
  body.webterminal #closedPositionsTable tr.wt-hist-row > td.wt-mhist-first .wt-mhist-m {
    display: grid;
  }
  body.webterminal #closedPositionsTable tr.wt-hist-row > td.wt-mhist-first .wt-mhist-wide-cell {
    display: none !important;
  }

  body.webterminal #closedPositionsTable tbody tr:not(.wt-hist-row) td {
    display: block;
    padding: 16px;
    text-align: center;
    color: var(--text-soft);
  }

  body.webterminal #wtPaneCalendar .wt-cal-table {
    font-size: 11px;
  }
  body.webterminal #wtPaneCalendar .wt-cal-table th,
  body.webterminal #wtPaneCalendar .wt-cal-table td {
    padding: 6px 4px;
  }
  body.webterminal #wtPaneCalendar .wt-cal-col-period,
  body.webterminal #wtPaneCalendar .wt-cal-table thead th:nth-child(5),
  body.webterminal #wtPaneCalendar .wt-cal-table tbody td:nth-child(5) {
    display: none;
  }
}

@media (min-width: 1101px) {
  body.webterminal #positionsTable {
    display: table !important;
  }
  body.webterminal #positionsTable thead {
    display: table-header-group !important;
  }
  body.webterminal #positionsTable tbody {
    display: table-row-group !important;
  }
  body.webterminal #positionsTable tbody#positionsMetaSummaryBody,
  body.webterminal #positionsTable tbody#positionsBody,
  body.webterminal #positionsTable tbody#positionsMetaPendingBody {
    order: unset;
  }
  body.webterminal #positionsTable tbody tr {
    display: table-row !important;
  }
  body.webterminal #positionsTable tbody tr > td {
    display: table-cell !important;
  }
  body.webterminal #positionsTable tbody#positionsBody tr[data-key] > td.wt-mtr-first > span.wt-mtr-d-cell,
  body.webterminal #positionsTable tbody#positionsMetaPendingBody tr.wt-trade-meta-pending > td.wt-mtr-first > span.wt-mtr-d-cell {
    display: inline !important;
  }
  body.webterminal #positionsTable tbody#positionsBody tr[data-key] > td.wt-mtr-first .wt-mtr-m,
  body.webterminal #positionsTable tbody#positionsMetaPendingBody tr.wt-trade-meta-pending > td.wt-mtr-first .wt-mtr-m {
    display: none !important;
  }
  body.webterminal #positionsTable tbody#positionsMetaPendingBody tr.wt-trade-meta-pending-stripe > td.wt-mtr-first {
    filter: none;
  }

  body.webterminal #positionsTable tbody tr.wt-trade-meta-summary td.wt-mtr-sum-td .wt-mtr-sum-narrow {
    display: none !important;
  }
  body.webterminal #positionsTable tbody tr.wt-trade-meta-summary td.wt-mtr-sum-td .wt-mtr-sum-wide {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 6px 12px;
    width: 100%;
    box-sizing: border-box;
  }
  body.webterminal #positionsTable tbody tr.wt-trade-meta-summary td.wt-mtr-sum-td .wt-mtr-sum-wide-main {
    flex: 1 1 auto;
    min-width: 0;
    line-height: 1.35;
    text-align: left;
  }
  body.webterminal #positionsTable tbody tr.wt-trade-meta-summary td.wt-mtr-sum-td .wt-mtr-sum-wide-pl {
    flex: 0 0 auto;
    white-space: nowrap;
    text-align: right;
  }
  body.webterminal .positions-table tbody#positionsMetaSummaryBody tr.wt-trade-meta-summary td.wt-mtr-sum-td {
    border-top: 1px solid var(--wt-grid-line);
    padding: 10px 10px 8px;
    background: color-mix(in srgb, var(--accent) 14%, var(--panel));
    font-size: 11px;
    color: var(--text);
    vertical-align: middle;
    text-align: left;
  }
  body.webterminal .positions-table tbody#positionsMetaSummaryBody tr.wt-trade-meta-summary td.wt-mtr-sum-td .wt-mtr-sum-wide-main strong {
    font-weight: 600;
    color: var(--text);
    margin-right: 4px;
  }
  body.webterminal .positions-table tbody#positionsMetaSummaryBody tr.wt-trade-meta-summary td.wt-mtr-sum-td .wt-trade-meta-sep {
    opacity: 0.4;
    padding: 0 8px;
    user-select: none;
  }
  :root[data-theme="light"] body.webterminal .positions-table tbody#positionsMetaSummaryBody tr.wt-trade-meta-summary td.wt-mtr-sum-td {
    background: linear-gradient(180deg, #d8dee6, #c5ccd6);
    border-top-color: rgba(0, 0, 0, 0.22);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
  }

  body.webterminal #closedPositionsTable {
    display: table !important;
  }
  body.webterminal #closedPositionsTable thead {
    display: table-header-group !important;
  }
  body.webterminal #closedPositionsTable tbody {
    display: table-row-group !important;
  }
  body.webterminal #closedPositionsTable tr.wt-hist-row {
    display: table-row !important;
    background: transparent !important;
  }
  body.webterminal #closedPositionsTable tr.wt-hist-row > td {
    display: table-cell !important;
  }
  body.webterminal #closedPositionsTable tr.wt-hist-row > td.wt-mhist-first .wt-mhist-m {
    display: none !important;
  }
  body.webterminal #closedPositionsTable tr.wt-hist-row > td.wt-mhist-first .wt-mhist-wide-cell {
    display: block !important;
  }
}

@media (max-width: 900px) {
  body.webterminal .wt-mobile-nav-btn {
    display: inline-flex;
  }
  body.webterminal .menu-bar {
    position: fixed;
    top: var(--wt-topbar-h);
    left: 0;
    bottom: 0;
    width: min(320px, 88vw);
    max-width: 100%;
    z-index: 160;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 10px 0 calc(12px + env(safe-area-inset-bottom, 0px));
    margin: 0;
    background: var(--surface-strong);
    border-right: 1px solid var(--border);
    box-shadow: 8px 0 24px var(--wt-shadow-soft, rgba(0, 0, 0, 0.2));
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    transform: translateX(-102%);
    transition: transform 180ms ease;
  }
  body.webterminal.wt-mobile-nav-open .menu-bar {
    transform: translateX(0);
  }
  body.webterminal .menu-root {
    width: 100%;
    border-bottom: 1px solid var(--border);
  }
  body.webterminal .menu-btn {
    width: 100%;
    padding: 12px 14px;
    font-size: 14px;
    text-align: left;
  }
  body.webterminal .menu-item {
    white-space: normal;
    padding: 10px 14px;
    font-size: 13px;
  }
  body.webterminal .menu-dropdown {
    position: static;
    width: 100%;
    max-width: none;
    margin: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    max-height: min(60vh, 400px);
    overflow-y: auto;
  }
  body.webterminal .menu-root:not(.open) .menu-dropdown {
    display: none;
  }
  body.webterminal .menu-root.open .menu-dropdown {
    display: block;
  }
}

@media (min-width: 901px) {
  body.webterminal .wt-mobile-nav-scrim {
    display: none !important;
  }
  body.webterminal.wt-mobile-nav-open .menu-bar {
    transform: none;
  }
}

.layout-aside {
  position: sticky;
  top: var(--wtTopOffset, 84px);
  height: calc(100vh - var(--wtTopOffset, 84px) - var(--wtBottomBarH, 44px) - 16px);
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 0;
}

body.webterminal .layout-aside {
  gap: 8px;
  position: relative;
  top: auto;
  height: 100%;
  max-height: none;
}
body.webterminal .layout-aside .panel {
  padding: 8px 10px;
}
#wtMarketWatchCard .panel-title {
  display: none;
}
.layout-aside .panel {
  position: static;
  height: auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.layout-aside .panel:first-child { flex: 1 1 auto; }

body.webterminal .layout-aside--mw {
  gap: 8px;
  min-width: 0;
}
body.webterminal .layout-aside--mw #wtMarketWatchCard {
  flex: 1 1 0;
  min-height: 0;
  min-width: 0;
  width: 100%;
  align-items: stretch;
  padding: 2px 4px 1px;
  box-sizing: border-box;
}
body.webterminal .layout-aside--mw.wt-grid-mw-bottom #wtTradeDockCard.wt-trade-dock-panel {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: none;
  margin: 0;
  border-radius: 0;
  border-top: 1px solid var(--border);
  border-left: none;
  border-right: none;
  padding: 0 0 8px;
  box-sizing: border-box;
}
body.webterminal .wt-indicator-list-panel.wt-indicator-dock.wt-indicator-list--hidden {
  display: none !important;
}
body.webterminal .wt-indicator-list-head {
  flex: 0 0 auto;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  width: 100%;
  box-sizing: border-box;
  padding: 2px 2px 6px 0;
  margin: 0 0 2px 0;
  border-bottom: 1px solid var(--wt-grid-line, var(--border));
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 10px;
  color: var(--text);
  opacity: 0.9;
}
body.webterminal .wt-indicator-list-head-title {
  flex: 1 1 auto;
  min-width: 0;
  line-height: 1.25;
}
body.webterminal .wt-indicator-list-nav {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}
body.webterminal .wt-indicator-list-tree-wrap {
  flex: 1 1 0;
  min-height: 0;
  min-width: 0;
  width: 100%;
  align-self: stretch;
  box-sizing: border-box;
  border: 1px solid var(--border);
  overflow-x: hidden;
  overflow-y: auto;
}
body.webterminal .wt-chart-split {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
}
body.webterminal .wt-chart-split > .wt-chart-main:only-child {
  flex: 1 1 0;
  min-width: 0;
  width: 100%;
  max-width: 100%;
}
body.webterminal .wt-trade-dock-panel .wt-trade-dock-head,
body.webterminal .wt-trade-dock-panel .wt-order-form-dock,
body.webterminal .wt-trade-dock-panel label,
body.webterminal .wt-trade-dock-panel input,
body.webterminal .wt-trade-dock-panel select,
body.webterminal .wt-trade-dock-panel button,
body.webterminal .wt-trade-dock-panel .mw-of-inline-suffix {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 11px;
}
body.webterminal .wt-trade-dock--hidden {
  display: none !important;
}
body.webterminal .wt-trade-dock-head {
  flex: 0 0 auto;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text);
  opacity: 0.85;
  box-sizing: border-box;
  width: 100%;
  padding: 0 0 2px 10px;
  margin: 0;
  margin-bottom: 4px;
  min-height: 0;
  line-height: 1;
  border-bottom: 1px solid var(--wt-grid-line, var(--border));
}
body.webterminal .wt-trade-dock-title {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 10px;
  line-height: 1;
}
body.webterminal .wt-trade-dock-close,
body.webterminal .wt-indicator-list-close {
  flex: 0 0 auto;
  appearance: none;
  border: 1px solid var(--border);
  background: var(--panel2, rgba(255, 255, 255, 0.06));
  color: var(--text);
  font-size: 12px;
  line-height: 1;
  width: 18px;
  height: 18px;
  padding: 0;
  cursor: pointer;
  border-radius: var(--wt-radius-sm, 2px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
body.webterminal .wt-trade-dock-close:hover,
body.webterminal .wt-indicator-list-close:hover {
  background: var(--menu-hover, rgba(255, 255, 255, 0.1));
}
body.webterminal .wt-order-form-dock {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  overflow-x: hidden;
  padding: 0 10px 0 10px;
  background: var(--panel);
  border-radius: 0;
  box-sizing: border-box;
}
body.webterminal .wt-order-form-dock .mw-order-form {
  min-width: 0;
  background: transparent;
  box-shadow: none;
}
body.webterminal .wt-order-form-dock .mw-order-form label {
  font-weight: 400;
}
body.webterminal .wt-order-form-dock .mw-of-row:has(#mwOrderComment) {
  display: none !important;
}
/* Fixed label column so every control column lines up (same left edge as Fill policy row). */
body.webterminal .wt-order-form-dock .mw-of-row:not(.mw-of-4) {
  gap: 6px;
  grid-template-columns: 52px minmax(0, 1fr);
}
body.webterminal .wt-order-form-dock .mw-of-4 {
  gap: 6px;
  grid-template-columns: 52px minmax(0, 1fr) 52px minmax(0, 1fr);
}
body.webterminal .wt-order-form-dock .mw-of-row > label,
body.webterminal .wt-order-form-dock .mw-of-4 > label {
  justify-self: end;
  align-self: center;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}
body.webterminal .wt-order-form-dock .mw-of-inline {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}
body.webterminal .wt-order-form-dock .mw-of-inline #mwOrderVolume {
  flex: 0 0 80px;
  width: 80px;
  max-width: 80px;
  min-width: 0;
}
body.webterminal .wt-order-form-dock .mw-of-inline .mw-of-inline-suffix {
  flex: 0 1 auto;
  min-width: 0;
  text-align: left;
}
body.webterminal .wt-order-form-dock #mwOrderVolume,
body.webterminal .wt-order-form-dock #mwOrderPrice {
  width: 80px;
  max-width: 80px;
  min-width: 0;
  box-sizing: border-box;
}
body.webterminal .wt-order-form-dock .mw-of-row input,
body.webterminal .wt-order-form-dock .mw-of-row select,
body.webterminal .wt-order-form-dock .mw-of-4 input,
body.webterminal .wt-order-form-dock .mw-of-4 select {
  padding: 5px 8px;
  font-size: 11px;
  font-family: Arial, Helvetica, sans-serif;
}
/* Match symbol dropdown field (`.wt-order-symbol-display`) */
body.webterminal #wtOrderFormDock input#mwOrderVolume,
body.webterminal #wtOrderFormDock input#mwOrderPrice,
body.webterminal #wtOrderFormDock input#mwOrderStopLimitPrice,
body.webterminal #wtOrderFormDock input#mwOrderSL,
body.webterminal #wtOrderFormDock input#mwOrderTP,
body.webterminal #wtOrderFormDock input#mwOrderExpDate,
body.webterminal .mw-order-form input#mwOrderExpDate {
  background: var(--surface, rgba(0, 0, 0, 0.14));
  color: var(--text);
}
body.webterminal .wt-order-form-dock .mw-order-actions {
  gap: 8px;
}
body.webterminal .wt-order-form-dock .mw-order-sell,
body.webterminal .wt-order-form-dock .mw-order-buy {
  min-height: 50px;
  padding: 10px 8px;
  font-size: 11px;
  font-family: Arial, Helvetica, sans-serif;
  gap: 3px;
}
body.webterminal .wt-order-form-dock .mw-order-btn-label {
  font-weight: 800;
  font-size: 14px;
  font-family: Thomas;
}
body.webterminal .wt-order-form-dock .mw-order-btn-quote {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.15;
}
body.webterminal .wt-order-form-dock #mwOrderAsk {
  font-family: Arial;
}
body.webterminal .wt-order-form-dock .mw-order-place,
body.webterminal .wt-order-form-dock .mw-order-close {
  font-size: 11px;
  font-family: Arial, Helvetica, sans-serif;
  padding: 8px 10px;
}
body.webterminal .wt-order-form-dock .mw-order-place.mw-place-buy-side {
  background: linear-gradient(180deg, rgba(110, 150, 255, 0.65), rgba(110, 150, 255, 0.22));
}
body.webterminal .wt-order-form-dock .mw-order-place.mw-place-sell-side {
  background: linear-gradient(180deg, rgba(255, 96, 120, 0.65), rgba(255, 96, 120, 0.22));
}

body.webterminal #wtOrderFormDock.mw-order-sym-popup-open {
  overflow: visible;
}
body.webterminal .mw-modal-body.mw-order-sym-popup-open,
body.webterminal .mw-order-form.mw-order-sym-popup-open {
  overflow: visible;
}

body.webterminal .wt-order-symbol-wrap {
  position: relative;
  display: flex;
  width: 100%;
  min-width: 0;
  align-items: stretch;
}
body.webterminal .wt-order-symbol-wrap .wt-order-symbol-display {
  flex: 1;
  min-width: 0;
  cursor: pointer;
  border-radius: var(--wt-radius-sm, 2px) 0 0 var(--wt-radius-sm, 2px);
  border-right: 0;
}
body.webterminal .wt-order-symbol-btn {
  width: 22px;
  flex-shrink: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 0 var(--wt-radius-sm, 2px) var(--wt-radius-sm, 2px) 0;
  border-left: 0;
  background: var(--surface, rgba(0, 0, 0, 0.14));
  color: var(--text);
  cursor: pointer;
  font-size: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
body.webterminal .wt-order-symbol-btn::after {
  content: "";
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
}
body.webterminal .wt-order-symbol-btn:disabled,
body.webterminal .wt-order-symbol-display:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
body.webterminal .wt-order-symbol-popup {
  display: none;
  position: absolute;
  left: 0;
  top: 100%;
  margin-top: 2px;
  min-width: 100%;
  width: min(320px, 100vw - 24px);
  max-height: 280px;
  overflow: auto;
  z-index: 320;
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
  padding: 4px 0;
}
body.webterminal .wt-order-symbol-popup.wt-order-symbol-popup-open {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
body.webterminal .wt-order-symbol-search-wrap {
  flex-shrink: 0;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
}
body.webterminal .wt-order-symbol-search-wrap input {
  width: 100%;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: var(--wt-radius-sm, 2px);
  font: inherit;
  box-sizing: border-box;
  background: var(--surface, rgba(0, 0, 0, 0.14));
  color: var(--text);
}
body.webterminal .wt-order-symbol-tree-wrap {
  overflow: auto;
  flex: 1;
  min-height: 0;
}
body.webterminal .wt-order-symbol-tree {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 11px;
}
body.webterminal .wt-order-symbol-tree ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
body.webterminal .wt-order-symbol-tree li {
  margin: 0;
  position: relative;
}
body.webterminal .wt-order-symbol-tree .wt-order-sym-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  cursor: pointer;
  color: var(--text);
  min-height: 22px;
  box-sizing: border-box;
  font-weight: normal;
  position: relative;
  border-left: 1px dotted color-mix(in srgb, var(--border) 85%, transparent);
  margin-left: 4px;
}
body.webterminal .wt-order-symbol-tree .wt-order-sym-row::before {
  content: "";
  position: absolute;
  left: calc(var(--depth, 0) * 16px);
  top: 50%;
  width: 16px;
  height: 0;
  border-top: 1px dotted color-mix(in srgb, var(--border) 85%, transparent);
  pointer-events: none;
}
body.webterminal .wt-order-symbol-tree .wt-order-sym-row:hover,
body.webterminal .wt-order-symbol-tree .wt-order-sym-row.wt-order-sym-selected {
  background: color-mix(in srgb, var(--accent) 22%, var(--panel));
}
body.webterminal .wt-order-symbol-tree .wt-order-sym-caret {
  width: 14px;
  flex-shrink: 0;
  text-align: center;
  color: color-mix(in srgb, var(--text) 72%, transparent);
  font-size: 10px;
}
body.webterminal .wt-order-symbol-tree .wt-order-sym-caret.empty {
  visibility: hidden;
}
body.webterminal .wt-order-symbol-tree .wt-order-sym-ico {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}
body.webterminal .wt-order-symbol-tree .wt-order-sym-ico-folder {
  background-image: url("./assets/icons/Symbols/symbol-folder.png");
}
body.webterminal .wt-order-symbol-tree .wt-order-sym-ico-symbol {
  background-image: url("./assets/icons/Symbols/symbol-leaf.png");
}
body.webterminal .wt-order-symbol-tree .wt-order-sym-label {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
body.webterminal .mw-of-row .wt-order-symbol-display,
body.webterminal .mw-of-4 .wt-order-symbol-display {
  width: 100%;
  padding: 5px 8px;
  border-radius: var(--wt-radius-sm, 2px) 0 0 var(--wt-radius-sm, 2px);
  border: 1px solid var(--border);
  background: var(--surface, rgba(0, 0, 0, 0.14));
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 11px;
  outline: none;
  box-sizing: border-box;
}
body.webterminal .mw-modal .mw-of-row .wt-order-symbol-display,
body.webterminal .mw-modal .mw-of-4 .wt-order-symbol-display {
  padding: 8px 10px;
  font-size: 12px;
  font-family: var(--mono);
}

body.webterminal .wt-chart-main {
  flex: 1 1 0;
  min-width: 0;
  min-height: 0;
  width: 100%;
  max-width: 100%;
  display: flex;
  flex-direction: column;
}
body.webterminal .wt-chart-panel {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  margin-bottom: 0;
}
body.webterminal .wt-indicator-dock .wt-nav-tree-row.wt-ind-row--has-toggle .wt-ind-tick {
  margin-left: auto;
  min-width: 14px;
  flex-shrink: 0;
  text-align: center;
  font-size: 11px;
  line-height: var(--wt-nav-row-h);
  opacity: 0.88;
}
body.webterminal .wt-indicator-dock .wt-nav-tree-row.wt-ind-row--has-toggle.wt-ind-row--active .wt-ind-tick::before {
  content: "\2713";
}

.layout-aside .panel-title { flex: 0 0 auto; }
.mw-pane { flex: 1 1 auto; min-height: 0; overflow: auto; }
.mw-tabs { flex: 0 0 auto; }

body.webterminal .layout-main {
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: none;
  padding-left: 4px;
  padding-right: 4px;
  align-self: stretch;
}
body.webterminal .layout-main.wt-grid-chart {
  min-height: 0;
  width: 100%;
  box-sizing: border-box;
}
body.webterminal .layout-main.wt-grid-chart .wt-chart-panel {
  flex: 1 1 0;
  min-height: 0;
}
body.webterminal .wt-grid-toolbox.wt-toolbox-band {
  min-height: 0;
  border-top: 1px solid var(--border);
  padding-top: 2px;
}

.layout-aside .panel:first-child { padding-bottom: 8px; }
.mw-pane { padding-bottom: 10px; }
.mw-tabs { margin-top: 6px; }

body.webterminal .layout-aside--mw #wtMarketWatchCard .mw-pane {
  padding-bottom: 1px;
  padding-top: 0;
  margin-top: 0;
}
body.webterminal #wtMarketWatchCard .mw-tabs {
  margin-top: 0;
  padding-bottom: 0;
  font-size: 12px;
}
/* Webterminal Market Watch card: 10px table/details/ticks; tabs 12px; add input 12px */
body.webterminal #wtMarketWatchCard {
  font-size: 10px;
}
body.webterminal #wtMarketWatchCard .marketwatch-table thead th,
body.webterminal #wtMarketWatchCard .marketwatch-table tbody td {
  font-size: 10px;
}
body.webterminal #marketWatchTable thead th:nth-child(n + 3):nth-child(-n + 7),
body.webterminal #marketWatchTable tbody td:nth-child(n + 3):nth-child(-n + 7) {
  font-size: 10px;
}
body.webterminal #wtMarketWatchCard .mw-tab {
  font-size: 12px;
  padding-top: 4px;
  padding-bottom: 3px;
}
body.webterminal #wtMarketWatchCard .mw-details-table th,
body.webterminal #wtMarketWatchCard .mw-details-table td {
  font-size: 10px;
}
body.webterminal #wtMarketWatchCard .mw-chart-meta {
  font-size: 10px;
}

.marketwatch-table {
  min-width: 0;
}
/*
 * Market Watch: use auto table layout so Symbol + Bid/Ask/etc. get sensible widths from
 * content and grow with the aside. Fixed + width:1% on quote cols was forcing columns to
 * shrink inside the narrow grid aside; min-width:0 + overflow-x:hidden hid the problem.
 */
body.webterminal #marketWatchTable.positions-table {
  table-layout: auto;
  width: 100%;
  min-width: min-content;
  max-width: none;
}
body.webterminal .marketwatch-table th,
body.webterminal .marketwatch-table td {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.webterminal #marketWatchTable th:nth-child(1),
body.webterminal #marketWatchTable td:nth-child(1) {
  width: 22px;
  min-width: 22px;
  max-width: 22px;
}
body.webterminal #marketWatchTable th:nth-child(2),
body.webterminal #marketWatchTable td:nth-child(2) {
  width: auto;
  min-width: 2.95rem;
  max-width: 4.85rem;
}
body.webterminal #marketWatchTable .mw-symbol {
  white-space: nowrap;
  word-break: normal;
  overflow: hidden;
  text-overflow: ellipsis;
}
body.webterminal #marketWatchTable th:nth-child(n + 3),
body.webterminal #marketWatchTable td:nth-child(n + 3) {
  width: auto;
  min-width: 4.25rem;
}
/* Bid / Ask / High / Low: tighter than generic quote min (Spread keeps rules below) */
body.webterminal #marketWatchTable th:nth-child(3),
body.webterminal #marketWatchTable td:nth-child(3),
body.webterminal #marketWatchTable th:nth-child(4),
body.webterminal #marketWatchTable td:nth-child(4),
body.webterminal #marketWatchTable th:nth-child(6),
body.webterminal #marketWatchTable td:nth-child(6),
body.webterminal #marketWatchTable th:nth-child(7),
body.webterminal #marketWatchTable td:nth-child(7) {
  min-width: 3.1rem;
  max-width: 3.85rem;
  width: 1%;
}
body.webterminal #marketWatchTable th:nth-child(5),
body.webterminal #marketWatchTable td:nth-child(5) {
  min-width: 2.35rem;
  max-width: 3.35rem;
  width: 1%;
}

body.webterminal #mwSymbolsPane {
  overflow: hidden;
  min-width: 0;
}
body.webterminal #mwSymbolsPane.active {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-width: 0;
}
body.webterminal #mwSymbolsPane .positions-table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  align-self: stretch;
  box-sizing: border-box;
  overflow-x: auto;
  overflow-y: auto;
  margin: 0;
  padding: 0;
}
body.webterminal #mwSymbolsPane.active {
  padding-left: 0;
  padding-right: 0;
}
body.webterminal #wtMarketWatchCard #marketWatchTable thead th,
body.webterminal #wtMarketWatchCard #marketWatchTable tbody td {
  padding: 2px 4px;
}

/* Market Watch: quote column size (see #wtMarketWatchCard 10px overrides) */
body.webterminal #marketWatchTable thead th:nth-child(n + 3):nth-child(-n + 7),
body.webterminal #marketWatchTable tbody td:nth-child(n + 3):nth-child(-n + 7) {
  font-size: 10px;
}

body.webterminal #mwTicksPane.active {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
body.webterminal #mwTicksPane .mw-chart {
  flex: 1 1 auto;
  min-height: 120px;
  height: auto;
  width: 100%;
}

.marketwatch-table thead th {
  background: var(--surface-strong);
}
body.webterminal #marketWatchTable thead th { text-align: left; }
body.webterminal #marketWatchTable thead th:nth-child(1) { text-align: center; }
body.webterminal #marketWatchTable thead th:nth-child(2) { text-align: left; }
body.webterminal #marketWatchTable thead th:nth-child(3),
body.webterminal #marketWatchTable thead th:nth-child(4),
body.webterminal #marketWatchTable thead th:nth-child(5),
body.webterminal #marketWatchTable thead th:nth-child(6),
body.webterminal #marketWatchTable thead th:nth-child(7) { text-align: right; }
body.webterminal #marketWatchTable tbody td:nth-child(1) { text-align: center; }
body.webterminal #marketWatchTable tbody td:nth-child(2) { text-align: left; }
body.webterminal #marketWatchTable tbody td:nth-child(3),
body.webterminal #marketWatchTable tbody td:nth-child(4),
body.webterminal #marketWatchTable tbody td:nth-child(5),
body.webterminal #marketWatchTable tbody td:nth-child(6),
body.webterminal #marketWatchTable tbody td:nth-child(7) { text-align: right; }

body.webterminal #positionsTable tbody td:last-child {
  width: 1%;
  padding-left: 6px;
  padding-right: 6px;
  text-align: right;
}

.marketwatch-table tbody td {
  padding: 4px 8px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 400;
}
body.webterminal .marketwatch-table thead th {
  background: linear-gradient(180deg, #3a3f4a, #2f343e);
  border-bottom: 1px solid var(--wt-grid-line);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: normal;
  color: var(--text);
}
:root[data-theme="light"] body.webterminal .marketwatch-table thead th {
  background: linear-gradient(180deg, #f0f2f5, #e4e8ed);
}
body.webterminal .marketwatch-table tbody td {
  font-family: var(--toolbox-font);
  font-size: 11px;
  color: var(--text);
  border-bottom: 1px solid var(--wt-grid-line);
  background: var(--surface);
}
/* Symbols list: no per-cell borders (incl. when Grid is on) */
body.webterminal #marketWatchTable thead th,
body.webterminal #marketWatchTable tbody td {
  border: none !important;
}
body.webterminal .marketwatch-table tbody tr:nth-child(odd) td {
  background: var(--surface);
}
body.webterminal .marketwatch-table tbody tr:nth-child(even) td {
  background: rgba(0, 0, 0, 0.14);
}
:root[data-theme="light"] body.webterminal .marketwatch-table tbody tr:nth-child(odd) td {
  background: #ffffff;
}
:root[data-theme="light"] body.webterminal .marketwatch-table tbody tr:nth-child(even) td {
  background: #f5f6f8;
}
body.webterminal .marketwatch-table tbody tr:hover td {
  background: var(--menu-hover) !important;
}

/* One separator between last quote row and add-symbol row (avoid double border) */
.mw-dir {
  width: 18px;
  text-align: center;
  padding-right: 0;
  padding-left: 8px;
}

.mw-bid { color: rgba(255, 96, 120, 0.95); }
.mw-ask { color: rgba(255, 96, 120, 0.95); }
.mw-high { color: rgba(110, 150, 255, 0.95); }
.mw-low { color: rgba(110, 150, 255, 0.95); }
.mw-symbol { font-family: var(--mono); }
.mw-up { color: rgba(46, 229, 157, 0.95); }
.mw-down { color: rgba(255, 96, 120, 0.95); }

/* Match /winterminal bid/ask + tick direction colors */
body.webterminal .mw-bid,
body.webterminal .mw-ask,
body.webterminal .mw-hi,
body.webterminal .mw-lo,
body.webterminal .mw-high,
body.webterminal .mw-low {
  color: #64b5f6 !important;
}
:root[data-theme="light"] body.webterminal .mw-bid,
:root[data-theme="light"] body.webterminal .mw-ask,
:root[data-theme="light"] body.webterminal .mw-hi,
:root[data-theme="light"] body.webterminal .mw-lo,
:root[data-theme="light"] body.webterminal .mw-high,
:root[data-theme="light"] body.webterminal .mw-low {
  color: #1565c0 !important;
}
body.webterminal .mw-up,
body.webterminal .mw-dir.mw-up {
  color: #6bcf7a !important;
}
body.webterminal .mw-down,
body.webterminal .mw-dir.mw-down {
  color: #ff8a80 !important;
}
:root[data-theme="light"] body.webterminal .mw-up,
:root[data-theme="light"] body.webterminal .mw-dir.mw-up {
  color: #0a6b18 !important;
}
:root[data-theme="light"] body.webterminal .mw-down,
:root[data-theme="light"] body.webterminal .mw-dir.mw-down {
  color: #b00000 !important;
}
body.webterminal .mw-row-up td {
  background: rgba(107, 207, 122, 0.12) !important;
}
body.webterminal .mw-row-down td {
  background: rgba(255, 138, 128, 0.1) !important;
}
:root[data-theme="light"] body.webterminal .mw-row-up td {
  background: rgba(10, 107, 24, 0.08) !important;
}
:root[data-theme="light"] body.webterminal .mw-row-down td {
  background: rgba(176, 0, 0, 0.06) !important;
}

.mw-row-up td { background: rgba(46, 229, 157, 0.06); }
.mw-row-down td { background: rgba(255, 96, 120, 0.06); }

/* WinTerminal-aligned Market Watch tick icon + bid/ask cells (theme via body.webterminal) */
.mw-mw-th-ic {
  width: 24px;
  min-width: 24px;
}
.mw-mw-ic {
  width: 24px;
  text-align: center;
  vertical-align: middle;
  padding: 1px 2px;
}
.mw-mw-tick-ico {
  display: block;
  margin: 0 auto;
  width: 10px;
  height: 10px;
  object-fit: contain;
  vertical-align: middle;
  border: 0 !important;
  outline: none;
  box-shadow: none;
  background: transparent;
}
@keyframes mw-mw-tick-ico-pulse {
  0% { opacity: 1; transform: scale(1); }
  40% { opacity: 0.42; transform: scale(1.2); }
  100% { opacity: 1; transform: scale(1); }
}
.mw-mw-tick-ico.mw-mw-tick-ico-flash {
  animation: mw-mw-tick-ico-pulse 0.26s ease-out;
}
.mw-mw-tick-ico.mw-mw-tick-ico-idle {
  opacity: 0.5;
}
body.webterminal #marketWatchTable tbody tr.mw-row-noquote:not(.mw-row-up):not(.mw-row-down) td {
  background: rgba(140, 140, 150, 0.09);
}
:root[data-theme="light"] body.webterminal #marketWatchTable tbody tr.mw-row-noquote:not(.mw-row-up):not(.mw-row-down) td {
  background: rgba(200, 200, 210, 0.12);
}
body.webterminal #marketWatchTable tbody td.mw-mw-cell-up {
  color: #1565c0 !important;
}
body.webterminal #marketWatchTable tbody td.mw-mw-cell-down {
  color: #c62828 !important;
}
:root[data-theme="dark"] body.webterminal #marketWatchTable tbody td.mw-mw-cell-up {
  color: #64b5f6 !important;
}
:root[data-theme="dark"] body.webterminal #marketWatchTable tbody td.mw-mw-cell-down {
  color: #ff8a80 !important;
}
body.webterminal #marketWatchTable tbody td.mw-mw-bid-cell:not(.mw-mw-cell-up):not(.mw-mw-cell-down),
body.webterminal #marketWatchTable tbody td.mw-mw-ask-cell:not(.mw-mw-cell-up):not(.mw-mw-cell-down),
body.webterminal #marketWatchTable tbody td.mw-mw-hi-cell:not(.mw-mw-cell-up):not(.mw-mw-cell-down),
body.webterminal #marketWatchTable tbody td.mw-mw-lo-cell:not(.mw-mw-cell-up):not(.mw-mw-cell-down) {
  color: #1565c0 !important;
}
:root[data-theme="dark"] body.webterminal #marketWatchTable tbody td.mw-mw-bid-cell:not(.mw-mw-cell-up):not(.mw-mw-cell-down),
:root[data-theme="dark"] body.webterminal #marketWatchTable tbody td.mw-mw-ask-cell:not(.mw-mw-cell-up):not(.mw-mw-cell-down),
:root[data-theme="dark"] body.webterminal #marketWatchTable tbody td.mw-mw-hi-cell:not(.mw-mw-cell-up):not(.mw-mw-cell-down),
:root[data-theme="dark"] body.webterminal #marketWatchTable tbody td.mw-mw-lo-cell:not(.mw-mw-cell-up):not(.mw-mw-cell-down) {
  color: #64b5f6 !important;
}
body.webterminal #marketWatchTable tbody tr[data-mw-sym-bg="1"] td {
  background: var(--mw-sym-bg) !important;
}
body.webterminal #marketWatchTable tbody tr[data-mw-sym-bg="1"].mw-row-up td {
  background: linear-gradient(rgba(10, 107, 24, 0.12), rgba(10, 107, 24, 0.12)), var(--mw-sym-bg) !important;
}
body.webterminal #marketWatchTable tbody tr[data-mw-sym-bg="1"].mw-row-down td {
  background: linear-gradient(rgba(176, 0, 0, 0.1), rgba(176, 0, 0, 0.1)), var(--mw-sym-bg) !important;
}
:root[data-theme="dark"] body.webterminal #marketWatchTable tbody tr[data-mw-sym-bg="1"].mw-row-up td {
  background: linear-gradient(rgba(107, 207, 122, 0.16), rgba(107, 207, 122, 0.16)), var(--mw-sym-bg) !important;
}
:root[data-theme="dark"] body.webterminal #marketWatchTable tbody tr[data-mw-sym-bg="1"].mw-row-down td {
  background: linear-gradient(rgba(255, 138, 128, 0.14), rgba(255, 138, 128, 0.14)), var(--mw-sym-bg) !important;
}
body.webterminal #marketWatchTable tbody tr.mw-mw-sel td {
  box-shadow: inset 0 0 0 1px rgba(26, 108, 186, 0.55);
}
body.webterminal .positions-table.wt-mw-table.wt-mw-gridlines:not(#marketWatchTable) th,
body.webterminal .positions-table.wt-mw-table.wt-mw-gridlines:not(#marketWatchTable) td {
  border: 1px solid var(--wt-grid-line) !important;
}
#marketWatchTable[data-mw-cols~="hid_spread"] thead th:nth-child(5),
#marketWatchTable[data-mw-cols~="hid_spread"] tbody tr:not(.mw-add-row) td:nth-child(5) {
  display: none !important;
}
#marketWatchTable[data-mw-cols~="hid_high"] thead th:nth-child(6),
#marketWatchTable[data-mw-cols~="hid_high"] tbody tr:not(.mw-add-row) td:nth-child(6) {
  display: none !important;
}
#marketWatchTable[data-mw-cols~="hid_low"] thead th:nth-child(7),
#marketWatchTable[data-mw-cols~="hid_low"] tbody tr:not(.mw-add-row) td:nth-child(7) {
  display: none !important;
}

body.webterminal #marketWatchTable tbody tr.mw-add-row td.mw-mw-add-cell {
  overflow: visible;
  vertical-align: middle;
}

.mw-mw-add-input-wrap {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  align-items: stretch;
}

.mw-mw-add-suggest {
  position: fixed;
  box-sizing: border-box;
  max-height: min(280px, calc(100vh - 24px));
  overflow: auto;
  z-index: 10060;
  padding: 4px 0;
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
}

.mw-mw-add-suggest .wt-order-symbol-tree-wrap {
  max-height: none;
}

.mw-mw-add-plus {
  display: inline-block;
  cursor: pointer;
  user-select: none;
  font-weight: 900;
  line-height: 1;
  font-size: 14px;
}

.mw-mw-add-plus:hover {
  color: var(--accent, #1a6cba);
}

body.webterminal .mw-mw-add-suggest .wt-order-symbol-tree {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 11px;
}
body.webterminal .mw-mw-add-suggest .wt-order-symbol-tree .wt-order-sym-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  cursor: pointer;
  color: var(--text);
  min-height: 22px;
  box-sizing: border-box;
  font-weight: normal;
}
body.webterminal .mw-mw-add-suggest .wt-order-symbol-tree .wt-order-sym-row:hover,
body.webterminal .mw-mw-add-suggest .wt-order-symbol-tree .wt-order-sym-row.wt-order-sym-selected {
  background: color-mix(in srgb, var(--accent) 22%, var(--panel));
}
body.webterminal .mw-mw-add-suggest .wt-order-symbol-tree .wt-order-sym-caret {
  width: 14px;
  flex-shrink: 0;
  text-align: center;
  color: color-mix(in srgb, var(--text) 72%, transparent);
  font-size: 10px;
}
body.webterminal .mw-mw-add-suggest .wt-order-symbol-tree .wt-order-sym-caret.empty {
  visibility: hidden;
}
body.webterminal .mw-mw-add-suggest .wt-order-symbol-tree .wt-order-sym-ico {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}
body.webterminal .mw-mw-add-suggest .wt-order-symbol-tree .wt-order-sym-ico-symbol {
  background-image: url("./assets/icons/Symbols/symbol-leaf.png");
}
body.webterminal .mw-mw-add-suggest .wt-order-symbol-tree .wt-order-sym-label {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Market Watch context menu (WinTerminal layout, WebTerminal theme tokens) */
body.webterminal .wt-mw-ctx {
  position: fixed;
  z-index: 12000;
  min-width: 220px;
  max-width: 320px;
  padding: 4px 0;
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--wt-radius-sm);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
  font: 11px/1.35 var(--toolbox-font, var(--mono));
  color: var(--text);
}
body.webterminal .wt-mw-ctx-sep {
  height: 1px;
  margin: 4px 6px;
  background: var(--border);
  border: 0;
  padding: 0;
}
body.webterminal .wt-mw-ctx-item {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 8px;
  margin: 0;
  padding: 4px 10px 4px 8px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
body.webterminal .wt-mw-ctx-item:hover:not(:disabled) {
  background: var(--menu-hover);
}
body.webterminal .wt-mw-ctx-item:disabled,
body.webterminal .wt-mw-ctx-item.wt-mw-ctx-item--disabled {
  opacity: 0.45;
  cursor: default;
  pointer-events: none;
}
body.webterminal .wt-mw-ctx-ico {
  flex: 0 0 20px;
  width: 20px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
body.webterminal .wt-mw-ctx-ico svg {
  display: block;
  width: 16px;
  height: 16px;
}
body.webterminal .wt-mw-ctx-lab {
  flex: 1 1 auto;
  min-width: 0;
}
body.webterminal .wt-mw-ctx-shortcut {
  flex: 0 0 auto;
  margin-left: 8px;
  opacity: 0.72;
  font-size: 10px;
}
body.webterminal .wt-mw-ctx-item.wt-mw-ctx-item--has-submenu::after {
  content: "›";
  flex: 0 0 auto;
  margin-left: 4px;
  opacity: 0.6;
  font-size: 14px;
  line-height: 1;
}
body.webterminal .wt-mw-ctx-item .wt-mw-ctx-ck {
  flex: 0 0 18px;
  width: 18px;
  text-align: center;
  font-size: 11px;
  opacity: 0.85;
}
body.webterminal .wt-mw-ctx-flyout {
  position: fixed;
  z-index: 12001;
  min-width: 160px;
  padding: 4px 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--wt-radius-sm);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  font: 11px var(--toolbox-font, var(--mono));
}
body.webterminal .wt-mw-ctx-flyout:not(.wt-mw-ctx-flyout--open) {
  display: none !important;
}
body.webterminal .wt-mw-ctx-flyout.wt-mw-ctx-flyout--open {
  display: block;
}
body.webterminal .wt-mw-ctx-flyout.wt-mw-ctx-flyout-cols.wt-mw-ctx-flyout--open {
  display: grid;
}
body.webterminal .wt-mw-ctx-flyout button {
  display: block;
  width: 100%;
  padding: 4px 12px;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
body.webterminal .wt-mw-ctx-flyout button:hover:not(:disabled) {
  background: var(--menu-hover);
}
body.webterminal .wt-mw-ctx-flyout-cols {
  min-width: 320px;
  max-width: min(96vw, 480px);
  padding: 8px 10px;
  display: grid;
  grid-template-columns: repeat(2, minmax(140px, 1fr));
  gap: 2px 8px;
}
body.webterminal .wt-mw-ctx-flyout.wt-mw-ctx-flyout-cols button {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 6px;
  white-space: nowrap;
}
body.webterminal .wt-mw-col-ck {
  flex: 0 0 12px;
  width: 12px;
  text-align: center;
}
body.webterminal .wt-mw-col-item-unsupported {
  opacity: 0.6;
}

/* Chart context menu (WinTerminal parity, #wtWebChartTabCtxMenu) */
body.webterminal .wt-chart-tab-ctx-flyout.wt-mw-ctx-flyout button {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  text-align: left;
}
body.webterminal .wt-chart-tab-ctx-flyout .wt-chart-tab-ctx-fly-lab {
  flex: 1 1 auto;
  min-width: 0;
}
body.webterminal .wt-chart-tab-ctx-menu {
  min-width: 242px;
  max-width: 296px;
  padding: 3px 0 4px;
  overflow: visible;
  max-height: none;
}
body.webterminal .wt-chart-tab-ctx-menu .wt-mw-ctx-item {
  padding: 3px 10px 3px 8px;
  line-height: 1.35;
  font-size: 11px;
  gap: 6px;
}
body.webterminal .wt-chart-tab-ctx-menu .wt-mw-ctx-sep {
  margin: 3px 6px;
}
body.webterminal .wt-chart-tab-ctx-menu .wt-mw-ctx-ico {
  flex: 0 0 17px;
  width: 17px;
  height: 15px;
}
body.webterminal .wt-chart-tab-ctx-menu .wt-mw-ctx-ico svg {
  width: 14px;
  height: 14px;
}
body.webterminal .wt-chart-tab-ctx-menu .wt-mw-ctx-shortcut {
  font-size: 10px;
  margin-left: 6px;
  opacity: 0.68;
}

.mw-context-menu {
  position: fixed;
  z-index: 200;
  min-width: 180px;
  border: 1px solid var(--border);
  border-radius: var(--wt-radius);
  background: var(--surface);
  box-shadow: 0 12px 30px rgba(0,0,0,0.35);
  padding: 6px;
  backdrop-filter: blur(10px);
}
.mw-context-item {
  width: 100%;
  display: block;
  cursor: pointer;
  user-select: none;
  padding: 9px 10px;
  border: 0;
  border-radius: var(--wt-radius-sm);
  background: transparent;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-soft);
  text-align: left;
}
.mw-mi-icon {
  display: inline-flex;
  width: 18px;
  margin-right: 8px;
  justify-content: center;
  opacity: 0.9;
}
.mw-mi-svg {
  width: 16px;
  height: 16px;
  stroke: var(--text-soft);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}
.mw-mi-text { display: inline-flex; }

.mw-pos-x {
  cursor: pointer;
  width: 26px;
  height: 22px;
  border-radius: var(--wt-radius-sm);
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.04);
  color: var(--surface-text);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1;
}
.mw-pos-x:hover { background: rgba(255,77,109,0.14); border-color: rgba(255,77,109,0.22); }

.mw-modal {
  position: fixed;
  inset: 0;
  z-index: 250;
}
.mw-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.55);
}
.mw-modal-card {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(980px, calc(100vw - 40px));
  max-height: calc(100vh - 40px);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--wt-radius);
  background: var(--surface);
  box-shadow: 0 20px 60px rgba(0,0,0,0.45);
  display: flex;
  flex-direction: column;
}
.mw-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  cursor: move;
}
.mw-modal-title {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 900;
  color: var(--text-soft);
}
.mw-modal-close {
  cursor: pointer;
  width: 30px;
  height: 30px;
  border-radius: var(--wt-radius-sm);
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text-soft);
  font-size: 18px;
  line-height: 1;
}
.mw-modal-body { padding: 12px; overflow: auto; color: var(--text); }
.mw-sym-card {
  width: min(1100px, calc(100vw - 40px));
  background: var(--surface);
  border-color: var(--border);
  resize: both;
  min-width: 760px;
  min-height: 560px;
  max-width: calc(100vw - 40px);
  max-height: calc(100vh - 40px);
}
.mw-sym-top { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.mw-sym-tabs { display: flex; gap: 8px; align-items: center; }
.mw-sym-tab {
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text-soft);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 800;
  padding: 7px 10px;
  border-radius: var(--wt-radius-sm);
}
.mw-sym-tab.active { background: rgba(124,92,255,0.22); border-color: var(--accent); }
.mw-sym-tab:disabled { opacity: 0.45; cursor: not-allowed; }

.mw-sym-controls { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.mw-sym-search { flex: 1 1 280px; }
.mw-sym-search-input {
  width: 320px;
  max-width: 70vw;
  padding: 8px 10px;
  border-radius: var(--wt-radius-sm);
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text-soft);
  font-family: var(--mono);
  font-size: 12px;
  outline: none;
}
.mw-sym-exp { display: inline-flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 12px; color: var(--text-soft); user-select: none; }

#mwSymBarsControls select,
#mwSymBarsControls input[type="datetime-local"],
#mwSymTicksControls select,
#mwSymTicksControls input[type="datetime-local"] {
  padding: 8px 10px;
  border-radius: var(--wt-radius-sm);
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text-soft);
  font-family: var(--mono);
  font-size: 12px;
  outline: none;
}
#mwSymBarsControls select,
#mwSymTicksControls select { color-scheme: dark; }
#mwSymBarsControls select option,
#mwSymTicksControls select option {
  background: var(--surface);
  color: var(--text-soft);
}

.mw-sym-grid { display: grid; grid-template-columns: 280px 1fr; gap: 12px; }
@media (max-width: 900px) { .mw-sym-grid { grid-template-columns: 1fr; } }
.mw-sym-left { border: 1px solid var(--border); border-radius: var(--wt-radius); background: var(--panel); overflow: hidden; }
.mw-sym-tree { max-height: 360px; overflow: auto; padding: 8px; }
.mw-sym-card .mw-modal-body { overflow: hidden; display: flex; flex-direction: column; min-height: 0; }
.mw-sym-grid { flex: 1 1 auto; min-height: 0; }
.mw-sym-left, .mw-sym-right { min-height: 0; }
.mw-sym-list-wrap { height: 100%; max-height: 100%; overflow: auto; }
.mw-sym-card .positions-table { min-width: 0; }
.mw-sym-node {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 0;
  background: transparent;
  color: var(--text-soft);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 800;
  padding: 7px 10px;
  border-radius: var(--wt-radius-sm);
  cursor: pointer;
  user-select: none;
}
.mw-sym-node:hover { background: rgba(255,255,255,0.06); }
.mw-sym-node.active { background: rgba(124,92,255,0.18); }
.mw-sym-caret { width: 14px; text-align: center; opacity: 0.8; }
.mw-sym-folder { width: 16px; text-align: center; opacity: 0.9; }
.mw-sym-node-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.mw-sym-table { table-layout: fixed; min-width: 0; }
.mw-sym-table th:nth-child(1),
.mw-sym-table td:nth-child(1) { width: 26%; }
.mw-sym-table th:nth-child(3),
.mw-sym-table td:nth-child(3) { width: 70px; }
.mw-sym-table tbody tr { cursor: pointer; }
.mw-sym-table tbody tr:hover td { background: rgba(255,255,255,0.04); }
.mw-sym-table tbody tr.active td { background: rgba(124,92,255,0.12); }
.mw-sym-table tbody tr.mw-sym-inwatch td { background: rgba(46, 229, 157, 0.08); }
.mw-sym-table tbody tr.mw-sym-inwatch.active td { background: rgba(124,92,255,0.16); }
.mw-sym-details { margin-top: 10px; max-height: 190px; overflow: auto; }
.mw-sym-details-table td { white-space: nowrap; }
.mw-sym-title-row td { background: rgba(255,255,255,0.04); border-bottom: 1px solid rgba(255,255,255,0.10); }
.mw-sym-title { font-weight: 900; }

.mw-bars-table { table-layout: fixed; min-width: 0; }
.mw-bars-table th:nth-child(1),
.mw-bars-table td:nth-child(1) { width: 155px; }
.mw-bars-table th:nth-child(6),
.mw-bars-table td:nth-child(6) { width: 110px; }
.mw-bars-table th:nth-child(7),
.mw-bars-table td:nth-child(7) { width: 90px; }
.mw-bars-table th:nth-child(8),
.mw-bars-table td:nth-child(8) { width: 80px; }

.mw-ticks-table { table-layout: fixed; min-width: 0; }
.mw-ticks-table th:nth-child(1),
.mw-ticks-table td:nth-child(1) { width: 190px; }

.mw-order-form-slot {
  min-width: 0;
  min-height: 0;
}

.mw-order-grid {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 14px;
  align-items: start;
}
@media (max-width: 900px) {
  .mw-order-grid { grid-template-columns: 1fr; }
}
.mw-order-chart {
  border: 1px solid var(--border);
  border-radius: var(--wt-radius);
  background: var(--chart-bg);
  padding: 10px;
}
.mw-order-canvas { width: 100%; height: 300px; display: block; }
.mw-order-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-radius: var(--wt-radius);
  background: rgba(255,255,255,0.03);
  padding: 8px;
}
.mw-of-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 10px;
  align-items: center;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-soft);
}
.mw-of-row label { opacity: 0.8; font-weight: 800; }
.mw-of-row input, .mw-of-row select {
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--wt-radius-sm);
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(0,0,0,0.14);
  color: var(--surface-text);
  font-family: var(--mono);
  font-size: 12px;
  outline: none;
}
.mw-of-row select { color-scheme: dark; }
.mw-of-row select option {
  background: var(--surface);
  color: var(--surface-text);
}
.mw-order-num { text-align: right; }
.mw-of-row input:focus, .mw-of-row select:focus { border-color: rgba(110,150,255,0.55); }
.mw-of-inline {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 10px;
  align-items: center;
}
.mw-of-inline-suffix {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mw-of-4 { grid-template-columns: 120px 1fr 120px 1fr; }
.mw-of-login { display: grid; }

.mw-order-price {
  margin-top: 6px;
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: 10px;
  font-family: var(--mono);
  font-weight: 900;
}
.mw-order-price .mw-order-bid { font-size: 34px; color: rgba(110,150,255,0.98); }
.mw-order-price .mw-order-ask { font-size: 34px; color: rgba(255,96,120,0.98); }
.mw-order-spread { font-size: 30px; opacity: 0.65; }

.mw-order-side {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  min-width: 0;
}

.mw-order-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 6px;
  align-items: start;
}
.mw-order-btn-label {
  display: block;
  line-height: 1.15;
}
.mw-order-btn-quote {
  display: block;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  line-height: 1.2;
  margin: 0;
}
.mw-order-sell .mw-order-btn-quote {
  color: rgba(255, 255, 255, 0.96);
}
.mw-order-buy .mw-order-btn-quote {
  color: rgba(255, 255, 255, 0.96);
}
.mw-order-sell, .mw-order-buy {
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 48px;
  padding: 10px 12px;
  border-radius: var(--wt-radius);
  border: 1px solid rgba(255,255,255,0.14);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 900;
  color: var(--surface-text);
}
.mw-order-sell { background: linear-gradient(180deg, rgba(255,96,120,0.65), rgba(255,96,120,0.22)); }
.mw-order-buy { background: linear-gradient(180deg, rgba(110,150,255,0.65), rgba(110,150,255,0.22)); }

.mw-order-place-wrap { margin-top: 10px; }
.mw-order-place {
  cursor: pointer;
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--wt-radius);
  border: 1px solid rgba(255,255,255,0.14);
  background: linear-gradient(180deg, rgba(110,150,255,0.55), rgba(110,150,255,0.18));
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 900;
  color: var(--surface-text);
}
.mw-order-place.mw-place-buy-side {
  background: linear-gradient(180deg, rgba(110,150,255,0.65), rgba(110,150,255,0.22));
}
.mw-order-place.mw-place-sell-side {
  background: linear-gradient(180deg, rgba(255,96,120,0.65), rgba(255,96,120,0.22));
}

.mw-order-close-wrap { margin-top: 10px; }
.mw-order-close {
  cursor: pointer;
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--wt-radius);
  border: 1px solid rgba(255,255,255,0.14);
  background: linear-gradient(180deg, rgba(255, 208, 77, 0.40), rgba(255, 208, 77, 0.14));
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 900;
  color: var(--surface-text);
}
.mw-order-close.mw-modify.buy { background: linear-gradient(180deg, rgba(110,150,255,0.65), rgba(110,150,255,0.22)); }
.mw-order-close.mw-modify.sell { background: linear-gradient(180deg, rgba(255,96,120,0.65), rgba(255,96,120,0.22)); }
.mw-order-close:disabled,
.mw-order-place:disabled,
.mw-order-buy:disabled,
.mw-order-sell:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.mw-dir.mw-up { color: rgba(46, 229, 157, 0.95); }
.mw-dir.mw-down { color: rgba(255, 96, 120, 0.95); }
.mw-context-item:hover {
  background: rgba(255,255,255,0.08);
}

.mw-add-row td {
  background: rgba(255,255,255,0.04);
}
.mw-add-row:hover td {
  background: rgba(255,255,255,0.07);
}
.mw-add-icon {
  color: rgba(46, 229, 157, 0.95);
  font-weight: 900;
}
.mw-add-cell {
  color: var(--text-soft);
  font-family: var(--mono);
  font-weight: 700;
}
.mw-add-composite {
  padding: 6px 10px;
  vertical-align: middle;
}
.mw-add-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.mw-add-inner--hint .mw-add-hint {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--text-soft);
  font-family: var(--mono);
  font-weight: 700;
}
.mw-add-inline-count {
  flex: 0 0 auto;
  text-align: right;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.mw-add-field {
  display: flex;
  align-items: center;
  flex: 1 1 auto;
  min-width: 0;
  gap: 8px;
  padding: 0 10px 0 10px;
  border-radius: var(--wt-radius-sm);
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(0,0,0,0.18);
}
:root[data-theme="light"] .mw-add-field {
  border-color: var(--border);
  background: var(--surface);
}
.mw-add-edit { padding: 6px 10px; }
.mw-add-input {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
  padding: 7px 0;
  border-radius: 0;
  border: 0;
  background: transparent;
  color: var(--surface-text);
  font-family: var(--mono);
  font-size: 12px;
  outline: none;
  box-shadow: none;
}
.mw-add-field .mw-add-input:focus {
  box-shadow: none;
}
.mw-add-field:focus-within {
  border-color: rgba(110,150,255,0.55);
}
.mw-add-input:focus { border-color: rgba(110,150,255,0.55); }
body.webterminal .mw-add-field {
  border-color: var(--border);
  background: var(--surface);
}
body.webterminal .mw-add-field:focus-within {
  border-color: rgba(110,150,255,0.55);
}
body.webterminal .mw-add-input {
  background: transparent;
  color: var(--text);
}

.mw-tabs {
  margin-top: 0;
  display: flex;
  gap: 0;
  align-items: stretch;
  border-top: 0;
  padding-top: 0;
}
.mw-tab {
  cursor: pointer;
  user-select: none;
  padding: 8px 12px;
  border-radius: 0;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(0,0,0,0.06);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-soft);
  margin-right: -1px;
}
.mw-tab.active {
  border-color: rgba(255,255,255,0.16);
  background: rgba(255,255,255,0.10);
  color: var(--surface-text);
}

/* Market Watch + toolbox tabs: match /winterminal .wt-mw-tabs / .wt-mw-tab */
body.webterminal .mw-tabs {
  margin-top: 0;
  padding: 0;
  gap: 0;
  border-top: 1px solid var(--border);
  background: var(--panel2);
}
body.webterminal .mw-tab {
  flex: 1 1 0;
  min-width: 0;
  margin: 0;
  padding: 7px 8px;
  border: none;
  border-right: 1px solid var(--border);
  border-radius: 0;
  background: var(--panel2);
  color: var(--text);
  font-family: var(--toolbox-font);
  font-size: 12px;
  font-weight: 600;
  cursor: default;
  text-align: center;
  opacity: 0.88;
}
body.webterminal .mw-tab:last-child {
  border-right: none;
}
body.webterminal .mw-tab:hover {
  opacity: 1;
  background: var(--menu-hover);
}
body.webterminal .mw-tab.active {
  opacity: 1;
  background: var(--surface);
  color: var(--text);
  box-shadow: inset 0 2px 0 0 var(--accent);
}

.mw-pane { display: none; }
.mw-pane.active { display: block; }
.wt-pane { display: none; }
.wt-pane.active { display: block; }
.wt-tabs { margin-top: 0; border-top: 0; padding-top: 0; }
.mw-chart {
  width: 100%;
  height: 260px;
  display: block;
  border-radius: var(--wt-radius);
  border: 1px solid var(--border);
  background: var(--chart-bg);
}
.mw-chart-meta {
  margin-top: 8px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}

.mw-details-wrap { overflow: hidden; }
.mw-details-table { min-width: 0; table-layout: fixed; }
.mw-details-table td { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.mw-trading-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
}

.mw-card {
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--wt-radius);
  background: rgba(0,0,0,0.10);
  overflow: hidden;
  cursor: pointer;
}
.mw-card.active {
  border-color: rgba(255,255,255,0.20);
  box-shadow: 0 0 0 1px rgba(124,92,255,0.25) inset;
}
.mw-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.03);
}
.mw-card-mid {
  display: grid;
  grid-template-columns: 1fr;
  align-items: stretch;
  position: relative;
}

.mw-trade-head {
  display: grid;
  grid-template-columns: 1fr 110px 1fr;
  gap: 0;
  align-items: stretch;
  border-bottom: 1px solid rgba(255,255,255,0.10);
}
.mw-trade-btn {
  border: 0;
  padding: 7px 10px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.3px;
  color: var(--surface-text);
  cursor: pointer;
}
.mw-trade-sell { background: rgba(255,96,120,0.72); text-align: left; }
.mw-trade-buy { background: rgba(110,150,255,0.72); text-align: right; }
.mw-vol-inline {
  display: grid;
  grid-template-columns: 22px 1fr 22px;
  gap: 4px;
  padding: 3px 4px;
  background: var(--chart-area-bg);
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
}

.mw-vol-input {
  width: 100%;
  border-radius: var(--wt-radius-sm);
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.06);
  color: var(--text-soft);
  padding: 5px 6px;
  font-size: 11px;
  outline: none;
  text-align: center;
}
.mw-vol-btn {
  border-radius: var(--wt-radius-sm);
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.06);
  color: var(--text-soft);
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1;
  padding: 0;
  cursor: pointer;
}
.mw-vol-btn:active { transform: translateY(0.5px); }


.mw-trade-prices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 48px;
}
.mw-price {
  display: flex;
  align-items: baseline;
  justify-content: flex-start;
  padding: 10px 10px 10px 10px;
  gap: 6px;
}
.mw-price-sell { background: linear-gradient(180deg, rgba(255,96,120,0.65), rgba(255,96,120,0.22)); }
.mw-price-buy { background: linear-gradient(180deg, rgba(110,150,255,0.65), rgba(110,150,255,0.22)); justify-content: flex-end; }
.mw-price-pre { font-size: 14px; opacity: 0.92; letter-spacing: 0.2px; }
.mw-price-main { font-size: 44px; letter-spacing: 0.4px; line-height: 1; }
.mw-price-sup { font-size: 14px; opacity: 0.92; position: relative; top: -10px; letter-spacing: 0.2px; }
.mw-price.mw-d1 .mw-price-main { font-size: 36px; }
.mw-price.mw-d2 .mw-price-main { font-size: 36px; }
.mw-price.mw-d3 .mw-price-main { font-size: 36px; }
.mw-price.mw-d4 .mw-price-main { font-size: 36px; }
.mw-price.mw-d5 .mw-price-main { font-size: 36px; }

.mw-card-bot {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0;
  border-top: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.03);
}
.mw-card-kv {
  padding: 8px 10px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  border-right: 1px solid rgba(255,255,255,0.08);
}
.mw-card-kv:last-child { border-right: none; }
.mw-card-kv span:first-child { opacity: 0.75; }

@media (max-width: 1100px) {
  .layout { grid-template-columns: 1fr; }
  .mw-trading-grid { grid-template-columns: 1fr; }
}

.trade-chart-wrap {
  margin-bottom: 12px;
  border-radius: var(--wt-radius);
  border: 1px solid var(--border);
  background: var(--chart-area-bg);
  padding: 10px;
  position: relative;
}
.trade-chart {
  width: 100%;
  height: 45vh;
  min-height: 340px;
  max-height: 560px;
  display: block;
  border-radius: var(--wt-radius);
  border: 1px solid var(--border);
  background: var(--chart-bg);
}
.trade-chart-meta {
  margin-top: 8px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}
body.webterminal .trade-chart-meta > * { min-width: 0; }
body.webterminal #tradeChartSymbol,
body.webterminal #tradeChartStatus {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
body.webterminal #tradeChartStatus { text-align: right; }
body.webterminal .trade-chart-meta { display: none; }

.chart-symbol-info {
  position: absolute;
  top: 14px;
  right: 18px;
  z-index: 6;
  padding: 6px 10px;
  border-radius: var(--wt-radius-sm);
  border: 1px solid var(--border);
  background: var(--chart-area-bg);
  backdrop-filter: blur(8px);
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-soft);
  max-width: calc(100% - 260px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}
:root[data-theme="light"] .mw-modal .chart-symbol-info,
:root[data-theme="light"] .mw-sym-card .chart-symbol-info {
  color: var(--text-soft);
}

/* Add symbol modal: respect selected theme (light) */
:root[data-theme="light"] .mw-modal-backdrop {
  background: rgba(0,0,0,0.35);
}
:root[data-theme="light"] .mw-modal-card,
:root[data-theme="light"] .mw-sym-card {
  background: var(--surface);
  border-color: var(--border);
  box-shadow: 0 20px 60px rgba(0,0,0,0.18);
}
:root[data-theme="light"] .mw-modal-head {
  border-bottom-color: var(--border);
}
:root[data-theme="light"] .mw-modal-title {
  color: var(--text-soft);
}
:root[data-theme="light"] .mw-modal-close {
  background: var(--panel);
  border-color: var(--border);
  color: var(--text-soft);
}
:root[data-theme="light"] .mw-modal-body {
  color: var(--text);
}
:root[data-theme="light"] .mw-sym-tab {
  background: var(--panel);
  border-color: var(--border);
  color: var(--text-soft);
}
:root[data-theme="light"] .mw-sym-tab.active {
  background: rgba(90,75,255,0.18);
  border-color: var(--accent);
  color: var(--text-soft);
}
:root[data-theme="light"] .mw-sym-search-input {
  background: var(--panel);
  border-color: var(--border);
  color: var(--text-soft);
}
:root[data-theme="light"] .mw-sym-exp {
  color: var(--muted);
}
:root[data-theme="light"] .mw-sym-left {
  background: var(--panel2);
  border-color: var(--border);
}
:root[data-theme="light"] .mw-sym-node {
  color: var(--text-soft);
}
:root[data-theme="light"] .mw-sym-node:hover {
  background: rgba(0,0,0,0.06);
}
:root[data-theme="light"] .mw-sym-node.active {
  background: rgba(90,75,255,0.14);
}
:root[data-theme="light"] .mw-sym-table tbody tr:hover td {
  background: rgba(0,0,0,0.04);
}
:root[data-theme="light"] .mw-sym-table tbody tr.active td {
  background: rgba(90,75,255,0.10);
}
:root[data-theme="light"] .mw-sym-table tbody tr.mw-sym-inwatch td {
  background: rgba(26,154,106,0.08);
}
:root[data-theme="light"] .mw-sym-table tbody tr.mw-sym-inwatch.active td {
  background: rgba(90,75,255,0.14);
}
:root[data-theme="light"] .mw-sym-title-row td {
  background: var(--panel2);
  border-bottom-color: var(--border);
}
:root[data-theme="light"] .mw-sym-details-table td,
:root[data-theme="light"] .mw-sym-table td,
:root[data-theme="light"] .mw-sym-table th {
  color: var(--text-soft);
}

.trade-overlay {
  position: absolute;
  left: 16px;
  top: 16px;
  width: 220px;
  z-index: 5;
  pointer-events: auto;
}

.trade-overlay .mw-card-top { display: none; }
.trade-overlay .mw-card-bot { display: none; }
.trade-overlay .mw-card {
  border-radius: var(--wt-radius-sm);
  background: var(--chart-card-bg);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
}
.trade-overlay .mw-trade-head { border-bottom-color: rgba(255,255,255,0.14); }
.trade-overlay .mw-trade-sell { background: rgba(255,96,120,0.78); }
.trade-overlay .mw-trade-buy { background: rgba(110,150,255,0.78); }
.trade-overlay .mw-trade-btn { padding: 6px 8px; font-size: 11px; }
.trade-overlay .mw-vol-inline { grid-template-columns: 20px 1fr 20px; padding: 3px 4px; background: var(--chart-card-bg); border-left: 1px solid var(--border); border-right: 1px solid var(--border); }
.trade-overlay .mw-vol-input {
  padding: 5px 6px;
  font-size: 11px;
  color: rgba(255, 255, 255, 1);
}
.trade-overlay .mw-vol-btn {
  font-size: 10px;
  border-radius: var(--wt-radius-sm);
  color: rgba(255, 255, 255, 1);
}
.trade-overlay .mw-price { padding: 8px 8px; }
.trade-overlay .mw-price-head { font-size: 13px; }
.trade-overlay .mw-price-tail { font-size: 22px; }

/* Light UI: keep chart trade strip (BUY/SELL + bid/ask tiles) same colors as dark */
:root[data-theme="light"] body.webterminal .trade-overlay .mw-trade-btn {
  color: rgba(255, 255, 255, 0.95);
}
:root[data-theme="light"] body.webterminal .trade-overlay .mw-trade-sell {
  background: rgba(255, 96, 120, 0.78);
}
:root[data-theme="light"] body.webterminal .trade-overlay .mw-trade-buy {
  background: rgba(110, 150, 255, 0.78);
}
:root[data-theme="light"] body.webterminal .trade-overlay .mw-price-sell {
  background: linear-gradient(180deg, rgba(255, 96, 120, 0.65), rgba(255, 96, 120, 0.22));
}
:root[data-theme="light"] body.webterminal .trade-overlay .mw-price-buy {
  background: linear-gradient(180deg, rgba(110, 150, 255, 0.65), rgba(110, 150, 255, 0.22));
}
:root[data-theme="light"] body.webterminal .trade-overlay .mw-price {
  color: rgba(255, 255, 255, 0.95);
}
:root[data-theme="light"] body.webterminal .trade-overlay .mw-price .mw-price-pre,
:root[data-theme="light"] body.webterminal .trade-overlay .mw-price .mw-price-sup {
  color: rgba(255, 255, 255, 0.92);
  opacity: 0.92;
}

.bottom-statusbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-right, 0px));
  padding-left: max(12px, env(safe-area-inset-left, 0px));
  border-top: 1px solid rgba(255,255,255,0.12);
  background: var(--surface-strong);
  backdrop-filter: blur(12px);
  font-size: 12px;
  color: var(--text-soft);
}
.bottom-statusbar .bottom-sysline {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bottom-statusbar .bottom-statusbar-mid {
  flex: 0 0 auto;
}
.bottom-statusbar #streamStatusBottom {
  flex: 0 1 40%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: right;
}

.wt-account-footer {
  border-top: 1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.06);
  padding: 10px 12px;
}
.wt-af-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 22px;
  font-size: 12px;
  color: var(--text-soft);
}
.wt-af-item {
  display: flex;
  gap: 10px;
  align-items: baseline;
}
.wt-af-item span:first-child { opacity: 0.72; }

.num-right { text-align: right; }

.wt-book {
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: var(--wt-radius);
  background: rgba(0,0,0,0.10);
  overflow: hidden;
}
body.webterminal .wt-book {
  border: 1px solid var(--border);
  border-radius: 0;
  background: var(--surface);
}
.wt-book .panel-title { padding: 10px 12px 8px; }
.wt-book .positions-table-wrap {
  border: 0;
  border-radius: 0;
  background: transparent;
}
.wt-book .positions-table tbody td { background: var(--surface-strong); }
.wt-book .positions-table tbody tr:nth-child(even) td { background: rgba(255,255,255,0.045); }
.wt-book .positions-table tbody tr:hover td { background: rgba(255,255,255,0.070); }
:root[data-theme="light"] .wt-book .positions-table tbody td { background: var(--surface-strong); }
:root[data-theme="light"] .wt-book .positions-table tbody tr:nth-child(even) td { background: rgba(0,0,0,0.06); }
:root[data-theme="light"] .wt-book .positions-table tbody tr:hover td { background: rgba(0,0,0,0.08); }
.wt-book .wt-tabs {
  border-top: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.03);
}
body.webterminal .wt-book .positions-table tbody tr:nth-child(odd) td {
  background: var(--surface);
}
body.webterminal .wt-book .positions-table tbody tr:nth-child(even) td {
  background: rgba(0, 0, 0, 0.14);
}
:root[data-theme="light"] body.webterminal .wt-book .positions-table tbody tr:nth-child(odd) td {
  background: #ffffff;
}
:root[data-theme="light"] body.webterminal .wt-book .positions-table tbody tr:nth-child(even) td {
  background: #f5f6f8;
}
body.webterminal .wt-book .positions-table tbody tr:hover td {
  background: var(--menu-hover) !important;
}
body.webterminal .wt-book .wt-tabs {
  border-top: 1px solid var(--border);
  background: var(--panel2);
}

.wt-chart-panel {
  margin-bottom: 6px;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
}
.wt-chart-panel { overflow: hidden; }
body.webterminal .trade-chart-wrap {
  margin-bottom: 0;
  height: 100%;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  padding: 2px 4px;
}
body.webterminal .trade-chart {
  flex: 1 1 auto;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: auto;
  min-height: 0;
  max-height: none;
  box-sizing: border-box;
}
body.webterminal .trade-chart-meta { flex: 0 0 auto; }
.wt-toolbox-panel {
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
}
.wt-toolbox-panel .panel-title { display: none; }

body.webterminal .wt-toolbox-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
body.webterminal .wt-chart-main .trade-chart-wrap {
  flex: 1 1 auto;
  min-height: 0;
}
body.webterminal .wt-book {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  display: flex;
  flex-direction: column;
}
body.webterminal #wtToolboxPanel .wt-book {
  padding-top: 6px;
}
body.webterminal .wt-pane { flex: 1 1 auto; min-height: 0; }
body.webterminal .wt-pane .positions-table-wrap { flex: 1 1 auto; min-height: 0; overflow: auto; }
/* Small inset so Trade / History tables don’t touch the toolbox edges */
body.webterminal #wtPaneTrade .positions-table-wrap,
body.webterminal #wtPaneHistory .positions-table-wrap {
  padding-left: 8px;
  padding-right: 8px;
  box-sizing: border-box;
}
body.webterminal #wtPaneCalendar .wt-cal-scroll,
body.webterminal #wtPaneCalendar .wtc-cal-scroll {
  padding-left: 8px;
  padding-right: 8px;
  box-sizing: border-box;
}
body.webterminal #wtPaneHistory .wt-history-footer {
  padding-left: 8px;
  padding-right: 8px;
  box-sizing: border-box;
}
body.webterminal .wt-account-footer { flex: 0 0 auto; }
body.webterminal .wt-tabs { flex: 0 0 auto; }

/* Trade tab: account summary + pending orders (positionsMetaSummaryBody / positionsMetaPendingBody). */
body.webterminal #wtPaneTrade .wt-account-footer { display: none; }

body.webterminal .positions-table tbody tr.row-new td {
  background: rgba(107, 207, 122, 0.14) !important;
  border-bottom-color: var(--wt-grid-line);
}
body.webterminal .positions-table tbody tr.row-closed-new td {
  background: rgba(255, 200, 80, 0.12) !important;
  border-bottom-color: var(--wt-grid-line);
}

body.webterminal .positions-table tbody#positionsMetaSummaryBody tr.wt-trade-meta-summary td.wt-mtr-sum-td {
  border-top: 1px solid var(--wt-grid-line);
  vertical-align: middle;
}
body.webterminal .positions-table tbody#positionsMetaPendingBody tr.wt-trade-meta-pending td {
  font-size: 11px;
  background: var(--surface);
}
body.webterminal .positions-table tbody#positionsMetaPendingBody tr.wt-trade-meta-pending-stripe td {
  background: rgba(0, 0, 0, 0.12);
}
body.webterminal .positions-table tbody#positionsMetaPendingBody .wt-trade-meta-pending-label {
  opacity: 0.75;
  font-style: italic;
}
:root[data-theme="light"] body.webterminal .positions-table tbody#positionsMetaPendingBody tr.wt-trade-meta-pending-stripe td {
  background: rgba(0, 0, 0, 0.075);
}

body.webterminal .wt-pane.active { display: flex; flex-direction: column; }

/* Toolbox Trade/History: sortable headers (WinTerminal-style) */
body.webterminal #positionsTable.wt-tb-sort-table thead th.wt-tb-sortable-th,
body.webterminal #closedPositionsTable.wt-tb-sort-table thead th.wt-tb-sortable-th {
  position: relative;
  padding-right: 16px;
  cursor: pointer;
  user-select: none;
}
body.webterminal #positionsTable.wt-tb-sort-table thead th.wt-tb-sortable-th::after,
body.webterminal #closedPositionsTable.wt-tb-sort-table thead th.wt-tb-sortable-th::after {
  content: "↕";
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
  opacity: 0.5;
}
body.webterminal #positionsTable.wt-tb-sort-table thead th.wt-tb-sortable-th.wt-tb-sort-active::after,
body.webterminal #closedPositionsTable.wt-tb-sort-table thead th.wt-tb-sortable-th.wt-tb-sort-active::after {
  opacity: 0.95;
}
body.webterminal #positionsTable.wt-tb-sort-table thead th.wt-tb-sortable-th.wt-tb-sort-asc::after,
body.webterminal #closedPositionsTable.wt-tb-sort-table thead th.wt-tb-sortable-th.wt-tb-sort-asc::after {
  content: "▲";
}
body.webterminal #positionsTable.wt-tb-sort-table thead th.wt-tb-sortable-th.wt-tb-sort-desc::after,
body.webterminal #closedPositionsTable.wt-tb-sort-table thead th.wt-tb-sortable-th.wt-tb-sort-desc::after {
  content: "▼";
}

body.webterminal #positionsTable.wt-tb-pos-gridlines thead th,
body.webterminal #positionsTable.wt-tb-pos-gridlines tbody td {
  border: 1px solid var(--wt-grid-line);
}
body.webterminal #closedPositionsTable.wt-tb-hist-gridlines thead th,
body.webterminal #closedPositionsTable.wt-tb-hist-gridlines tbody td {
  border: 1px solid var(--wt-grid-line);
}

/* WinTerminal-style toolbox context menus */
body.webterminal .wt-pos-ctx-menu,
body.webterminal .wt-hist-ctx-menu {
  min-width: 240px;
  max-width: 320px;
  max-height: min(92vh, 720px);
  overflow-x: hidden;
  overflow-y: auto;
}
body.webterminal .wt-mw-ctx-item.wt-mw-ctx-item--active {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
}

/* Navigator — MT5-style tree + PNG icons (same slots as /winterminal), themed with webterminal tokens */
.wt-nav {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border: 1px solid var(--border);
  border-radius: var(--wt-radius);
  background: var(--panel);
  overflow: hidden;
}
body.webterminal .wt-nav {
  border-radius: 0;
  background: var(--surface);
}
body.webterminal #wtNavigatorCard .wt-nav-tree-wrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
}
#wtNavigatorTree.wt-nav-tree,
#wtIndicatorListTree.wt-nav-tree {
  list-style: none;
  margin: 0;
  padding: 4px 6px;
  border-bottom: none;
  height: auto;
  min-height: min-content;
  font-family: var(--toolbox-font);
  font-size: 11px;
  color: var(--text);
}
#wtNavigatorTree.wt-nav-tree ul,
#wtIndicatorListTree.wt-nav-tree ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
#wtNavigatorTree.wt-nav-tree li,
#wtIndicatorListTree.wt-nav-tree li {
  display: block;
  min-height: var(--wt-nav-row-h);
  line-height: var(--wt-nav-row-h);
  white-space: nowrap;
  margin: 0;
}
#wtNavigatorTree.wt-nav-tree li.depth-0,
#wtIndicatorListTree.wt-nav-tree li.depth-0 { padding-left: var(--wt-nav-indent-0); position: relative; }
#wtNavigatorTree.wt-nav-tree li.depth-1,
#wtIndicatorListTree.wt-nav-tree li.depth-1 { padding-left: var(--wt-nav-indent-1); position: relative; }
#wtNavigatorTree.wt-nav-tree li.depth-2,
#wtIndicatorListTree.wt-nav-tree li.depth-2 { padding-left: var(--wt-nav-indent-2); position: relative; }
#wtNavigatorTree.wt-nav-tree li.depth-3,
#wtIndicatorListTree.wt-nav-tree li.depth-3 { padding-left: var(--wt-nav-indent-3); position: relative; }
.wt-nav-tree-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
  outline: none;
  cursor: default;
  min-height: var(--wt-nav-row-h);
}
.wt-nav-tree-row:focus { outline: none; }
#wtNavigatorTree.wt-nav-tree li.selected > .wt-nav-tree-row,
#wtIndicatorListTree.wt-nav-tree li.selected > .wt-nav-tree-row {
  background: var(--menu-hover);
}
#wtNavigatorTree.wt-nav-tree .wt-nav-tree-row:hover,
#wtIndicatorListTree.wt-nav-tree .wt-nav-tree-row:hover {
  background: var(--menu-hover);
}
#wtNavigatorTree.wt-nav-tree li.selected > .wt-nav-tree-row:hover,
#wtIndicatorListTree.wt-nav-tree li.selected > .wt-nav-tree-row:hover {
  background: var(--menu-hover);
}
#wtNavigatorTree.wt-nav-tree .wt-nav-label,
#wtIndicatorListTree.wt-nav-tree .wt-nav-label {
  user-select: none;
  font-size: 11px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wt-nav-label.wt-nav-label--strong { font-weight: 700; }
.wt-nav-label.wt-nav-label--muted {
  opacity: 0.72;
  font-style: italic;
}
.wt-nav-toggle {
  width: 18px;
  height: 18px;
  min-width: 18px;
  min-height: 18px;
  border: 0;
  background: transparent;
  color: var(--text);
  opacity: 0.75;
  font: inherit;
  line-height: 18px;
  text-align: center;
  padding: 0;
  flex-shrink: 0;
  cursor: pointer;
}
.wt-nav-toggle:not(.spacer)::before {
  content: "›";
  display: block;
  font-size: 14px;
  font-weight: 700;
  line-height: 18px;
  transform: rotate(0deg);
  transition: transform 0.1s ease;
}
#wtNavigatorTree.wt-nav-tree li:not(.collapsed) > .wt-nav-tree-row > .wt-nav-toggle:not(.spacer)::before,
#wtIndicatorListTree.wt-nav-tree li:not(.collapsed) > .wt-nav-tree-row > .wt-nav-toggle:not(.spacer)::before {
  transform: rotate(90deg);
}
.wt-nav-toggle.spacer {
  cursor: default;
  pointer-events: none;
}
.wt-nav-toggle.spacer::before { display: none; }
#wtNavigatorTree.wt-nav-tree li.collapsed > ul,
#wtIndicatorListTree.wt-nav-tree li.collapsed > ul { display: none; }
#wtNavigatorTree.wt-nav-tree li.depth-1::before,
#wtNavigatorTree.wt-nav-tree li.depth-2::before,
#wtNavigatorTree.wt-nav-tree li.depth-3::before,
#wtIndicatorListTree.wt-nav-tree li.depth-1::before,
#wtIndicatorListTree.wt-nav-tree li.depth-2::before,
#wtIndicatorListTree.wt-nav-tree li.depth-3::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 0;
  bottom: 0;
  border-left: 1px solid var(--border);
  opacity: 0.9;
}
#wtNavigatorTree.wt-nav-tree li.depth-1 .wt-nav-tree-row::before,
#wtNavigatorTree.wt-nav-tree li.depth-2 .wt-nav-tree-row::before,
#wtNavigatorTree.wt-nav-tree li.depth-3 .wt-nav-tree-row::before,
#wtIndicatorListTree.wt-nav-tree li.depth-1 .wt-nav-tree-row::before,
#wtIndicatorListTree.wt-nav-tree li.depth-2 .wt-nav-tree-row::before,
#wtIndicatorListTree.wt-nav-tree li.depth-3 .wt-nav-tree-row::before {
  content: "";
  position: absolute;
  left: 6px;
  width: 10px;
  border-top: 1px solid var(--border);
  opacity: 0.9;
}
.wt-nav-ico.ico,
.wt-nav-ico {
  width: 22px;
  height: 22px;
  min-width: 22px;
  min-height: 22px;
  flex-shrink: 0;
  border: 0;
  box-sizing: border-box;
  background-color: transparent;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
}
.wt-nav-tabs {
  flex-shrink: 0;
  margin-top: 0;
  display: flex;
  gap: 0;
  border-top: 1px solid var(--border);
  background: var(--panel2);
}
.wt-nav-tab {
  cursor: pointer;
  user-select: none;
  flex: 1 1 0;
  min-width: 0;
  padding: 7px 8px;
  border: 0;
  border-right: 1px solid var(--border);
  background: var(--panel2);
  font-family: var(--toolbox-font);
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  opacity: 0.88;
}
.wt-nav-tab:last-child { border-right: none; }
.wt-nav-tab:hover {
  opacity: 1;
  background: var(--menu-hover);
}
.wt-nav-tab.active {
  opacity: 1;
  background: var(--surface);
  color: var(--text);
  box-shadow: inset 0 2px 0 0 var(--accent);
}
.wt-nav-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.wt-history-footer {
  border-top: 1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.06);
  padding: 10px 12px;
}
body.webterminal .wt-history-footer {
  border-top: 1px solid var(--border);
  background: var(--panel);
  font-size: 11px;
  color: var(--text);
}

/* —— Lightweight Charts (webterminal-charts-lwc.js) —— */
.webterminal-lwc-host {
  position: absolute;
  inset: 0;
  z-index: 1;
  min-height: 0;
  min-width: 0;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  pointer-events: auto;
}
#tradeChartCanvas.webterminal-chart-canvas--hidden {
  visibility: hidden;
  pointer-events: none;
}

.webterminal-order-modal {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  box-sizing: border-box;
}

/* Above generic chart dialogs; trading 409 — compact message + OK */
.webterminal-market-closed-modal {
  z-index: 10060;
}
.webterminal-market-closed-modal .webterminal-mc-card {
  min-width: min(320px, calc(100vw - 24px));
  max-width: min(440px, calc(100vw - 24px));
  max-height: none;
}
.webterminal-mc-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-bottom: 14px;
}
.webterminal-mc-msg {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  word-break: break-word;
}
.webterminal-mc-actions {
  display: flex;
  justify-content: flex-end;
}

.webterminal-order-modal[hidden] {
  display: none !important;
}
.webterminal-order-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}
.webterminal-order-modal-card {
  position: relative;
  z-index: 1;
  box-sizing: border-box;
  min-width: min(440px, 100%);
  max-width: calc(100vw - 24px);
  max-height: calc(100vh - 24px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--wt-radius);
  background: var(--surface);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.35);
}
.webterminal-order-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  flex-shrink: 0;
}
.webterminal-order-modal-title {
  font-weight: 700;
  font-size: 13px;
  color: var(--text-soft);
}
.webterminal-order-modal-close {
  cursor: pointer;
  width: 28px;
  height: 28px;
  border-radius: var(--wt-radius-sm);
  border: 1px solid var(--border);
  background: var(--panel2);
  color: var(--text-soft);
  font-size: 18px;
  line-height: 1;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.webterminal-order-modal-close:hover {
  background: var(--panel);
}
.webterminal-order-modal-body {
  padding: 12px;
  overflow: auto;
  color: var(--text);
  flex: 1 1 auto;
  min-height: 0;
}

#webterminalGenericModal.webterminal-modal--chart-props {
  color-scheme: light;
}
#webterminalGenericModal.webterminal-modal--chart-props .webterminal-order-modal-head {
  cursor: default;
}
#webterminalGenericModal.webterminal-modal--chart-props .webterminal-order-modal-card.webterminal-order-modal-card--chart-props {
  width: min(840px, calc(100vw - 20px));
  min-width: min(760px, calc(100vw - 20px));
  min-height: 440px;
  height: auto;
  max-height: calc(100vh - 20px);
  background: #f0f0f0;
  border-color: #a0a0a0;
  box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.25);
}
#webterminalGenericModal.webterminal-modal--chart-props .webterminal-order-modal-title {
  font-weight: 400;
  font-size: 12px;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: #000;
}
#webterminalGenericModal.webterminal-modal--chart-props .webterminal-order-modal-head {
  background: linear-gradient(180deg, #fff 0%, #ececec 100%);
  border-bottom-color: #a0a0a0;
}
#webterminalGenericModal.webterminal-modal--chart-props .webterminal-order-modal-body {
  padding: 0;
  overflow: hidden;
  background: #f0f0f0;
  color: #000;
}

.wt-generic-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font: 12px/1.4 var(--sans);
  color: var(--text);
}
.wt-generic-hint {
  margin: 0 0 4px;
  opacity: 0.85;
  color: var(--muted);
}
.wt-lwc-ind-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.wt-lwc-ind-row .wt-mini-tab,
#webterminalGenericModal .wt-lwc-ind-row button {
  margin-left: auto;
  padding: 4px 8px;
  font-size: 11px;
  border: 1px solid var(--border);
  border-radius: var(--wt-radius-sm);
  background: var(--panel);
  color: var(--text-soft);
  cursor: pointer;
}
.wt-of-row {
  display: grid;
  grid-template-columns: 118px 1fr;
  gap: 8px;
  align-items: center;
  font-size: 12px;
  color: var(--text);
}
.wt-of-row label {
  color: var(--muted);
  text-align: right;
}
.wt-of-row input,
.wt-of-row select {
  width: 100%;
  padding: 6px 8px;
  border-radius: var(--wt-radius-sm);
  border: 1px solid var(--border);
  background: var(--panel2);
  color: var(--text-soft);
  font-family: var(--mono);
  font-size: 12px;
  outline: none;
}
.wt-order-num {
  text-align: right;
}
.wt-order-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 8px;
}
.wt-order-place,
.wt-order-close {
  cursor: pointer;
  padding: 8px 14px;
  border-radius: var(--wt-radius-sm);
  border: 1px solid var(--border);
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-soft);
}
.wt-order-place {
  background: color-mix(in srgb, var(--accent) 22%, var(--surface));
}
.wt-order-place:hover {
  background: color-mix(in srgb, var(--accent) 32%, var(--surface));
}
.wt-order-close {
  background: var(--panel);
}
.wt-order-close:hover {
  background: var(--panel2);
}

.wt-lwc-chart-props {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  font-size: 12px;
}
.wt-lwc-prop-split {
  display: grid;
  grid-template-columns: minmax(260px, 36%) 1fr;
  gap: 0;
  flex: 1 1 auto;
  min-height: 280px;
  max-height: min(420px, calc(100vh - 200px));
  border-bottom: 1px solid #c0c0c0;
}
.wt-lwc-prop-preview-wrap {
  box-sizing: border-box;
  padding: 8px;
  background: #e4e4e4;
  border-right: 1px solid #b0b0b0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.wt-lwc-prop-preview-host {
  flex: 1 1 auto;
  min-height: 200px;
  background: #000;
  border: 1px solid #808080;
}
.wt-lwc-prop-prev-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 160px;
  color: #888;
  font-size: 11px;
}
.wt-lwc-prop-side {
  box-sizing: border-box;
  background: #fff;
  padding: 8px 10px 10px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.wt-lwc-prop-tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid #c0c0c0;
  margin-bottom: 10px;
  flex-shrink: 0;
}
.wt-lwc-prop-tab {
  appearance: none;
  border: none;
  background: transparent;
  padding: 6px 14px 8px;
  margin: 0 2px -1px 0;
  font: inherit;
  font-size: 12px;
  color: #000;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}
.wt-lwc-prop-tab:hover {
  background: #f5f5f5;
}
.wt-lwc-prop-tab--on {
  border-bottom-color: #0a6ecc;
  font-weight: 600;
}
.wt-lwc-prop-panels {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.wt-lwc-prop-panel {
  display: none;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
  flex: 1 1 auto;
  min-height: 0;
}
.wt-lwc-prop-panel--on {
  display: block;
}
.wt-lwc-prop-fs {
  margin: 0 0 10px;
  padding: 8px 10px 10px;
  border: 1px solid #c0c0c0;
  background: #fff;
}
.wt-lwc-prop-fs-scale .wt-lwc-prop-scale-label {
  margin-bottom: 4px;
  color: #000;
}
.wt-lwc-prop-radio-row,
.wt-lwc-prop-cb-row {
  margin: 2px 0 6px;
}
.wt-lwc-prop-radio-row label,
.wt-lwc-prop-cb-row label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
}
.wt-lwc-prop-scale-slider {
  width: 100%;
  max-width: 100%;
  margin: 4px 0 10px;
  height: 4px;
  accent-color: #0a6ecc;
}
.wt-lwc-prop-num-pair {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 6px 0 4px;
}
.wt-lwc-prop-num-lab {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 11px;
  color: #222;
  flex: 1 1 140px;
  min-width: 120px;
}
.wt-lwc-prop-num {
  box-sizing: border-box;
  width: 100%;
  padding: 3px 6px;
  border: 1px solid #7a7a7a;
  background: #fff;
  color: #000;
  font: 11px Tahoma, "Segoe UI", sans-serif;
}
.wt-lwc-prop-num:disabled {
  background: #e0e0e0;
  color: #808080;
}
.wt-lwc-prop-color-row {
  display: grid;
  grid-template-columns: minmax(100px, 1fr) minmax(100px, 140px);
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.wt-lwc-prop-lab {
  text-align: right;
  font-size: 11px;
  color: #222;
}
.wt-lwc-prop-color-row input[type="color"] {
  width: 100%;
  height: 24px;
  padding: 0;
  border: 1px solid #7a7a7a;
  background: #fff;
  cursor: pointer;
}
.wt-lwc-prop-select {
  box-sizing: border-box;
  width: 100%;
  padding: 3px 4px;
  border: 1px solid #7a7a7a;
  background: #fff;
  color: #000;
  font: 11px Tahoma, "Segoe UI", sans-serif;
}
.wt-lwc-prop-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  padding: 10px 12px 12px;
  background: #f0f0f0;
  flex-shrink: 0;
  border-top: 1px solid #d0d0d0;
}
.wt-lwc-prop-btn {
  min-width: 72px;
  padding: 4px 16px;
  font: 12px "Segoe UI", Tahoma, sans-serif;
  border: 1px solid #7a7a7a;
  background: linear-gradient(180deg, #fff 0%, #e8e8e8 100%);
  color: #000;
  cursor: pointer;
  border-radius: 0;
}
.wt-lwc-prop-btn:hover {
  background: linear-gradient(180deg, #f5f5f5 0%, #dcdcdc 100%);
}
.wt-lwc-prop-btn:active {
  background: #d0d0d0;
}
.wt-lwc-prop-btn-ok {
  font-weight: 600;
}

/* —— Experts (toolbox): copier iframes, webterminal chrome —— */
body.webterminal #wtPaneExperts.wt-pane.active {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1 1 auto;
  width: 100%;
  max-width: 100%;
}
body.webterminal .wt-webt-experts-root {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
}
body.webterminal .wt-webt-experts-toolbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  padding: 4px 8px;
  border-bottom: 1px solid var(--border);
  background: var(--panel2);
}
body.webterminal .wt-webt-experts-subtabs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  flex: 1 1 auto;
  min-width: 0;
}
body.webterminal .wt-webt-experts-my-cluster {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-left: 1px solid var(--border);
  padding-left: 6px;
  margin-left: 2px;
}
body.webterminal .wt-webt-experts-subtab {
  flex: 0 1 auto;
  min-width: 0;
  margin: 0;
  padding: 7px 10px;
  border: none;
  border-radius: 0;
  background: var(--panel2);
  color: var(--text);
  font-family: var(--toolbox-font);
  font-size: 12px;
  font-weight: 600;
  cursor: default;
  text-align: center;
  opacity: 0.88;
}
body.webterminal .wt-webt-experts-subtab:hover {
  opacity: 1;
  background: var(--menu-hover);
}
body.webterminal .wt-webt-experts-subtab--active {
  opacity: 1;
  background: var(--surface);
  color: var(--text);
  box-shadow: inset 0 2px 0 0 var(--accent);
}
body.webterminal .wt-webt-experts-fs {
  flex: 0 0 auto;
  width: 28px;
  height: 26px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 0;
  background: var(--panel2);
  color: var(--text);
  cursor: pointer;
}
body.webterminal .wt-webt-experts-fs:hover {
  background: var(--menu-hover);
}
body.webterminal .wt-webt-experts-host {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  width: 100%;
  position: relative;
}
body.webterminal .wt-webt-experts-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: 100%;
  border: 0;
  background: transparent;
  display: none !important;
  visibility: hidden;
  pointer-events: none;
}
body.webterminal .wt-webt-experts-frame--active {
  display: block !important;
  visibility: visible;
  pointer-events: auto;
}

/* —— Economic calendar (toolbox): same grid/behaviour as /winterminal, themed with webterminal vars —— */
/* Only when Calendar tab is active — #wtPaneCalendar without .active must stay display:none like other panes */
body.webterminal #wtPaneCalendar.wt-pane.active {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1 1 auto;
}
body.webterminal .wt-cal-scroll,
body.webterminal .wtc-cal-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  overflow-anchor: none;
  -webkit-overflow-scrolling: touch;
  background: var(--surface);
}
body.webterminal .wt-cal-table {
  table-layout: fixed;
  width: 100%;
  font-size: 11px;
  border-collapse: separate;
  border-spacing: 0;
}
body.webterminal .wt-cal-table:not(.wt-cal-grid) th,
body.webterminal .wt-cal-table:not(.wt-cal-grid) td {
  border-left: none;
  border-right: none;
}
body.webterminal .wt-cal-table.wt-cal-grid th,
body.webterminal .wt-cal-table.wt-cal-grid td {
  border-left: 1px solid var(--wt-grid-line);
}
body.webterminal .wt-cal-th-time::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 3px;
  vertical-align: -1px;
  background: currentColor;
  opacity: 0.55;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='6.5' fill='none' stroke='black' stroke-width='1.2'/%3E%3Cpath d='M8 4.2V8l3 2' fill='none' stroke='black' stroke-width='1.2' stroke-linecap='round'/%3E%3C/svg%3E")
    center / contain no-repeat;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='6.5' fill='none' stroke='black' stroke-width='1.2'/%3E%3Cpath d='M8 4.2V8l3 2' fill='none' stroke='black' stroke-width='1.2' stroke-linecap='round'/%3E%3C/svg%3E")
    center / contain no-repeat;
}
body.webterminal .wt-cal-table tbody td {
  padding: 2px 4px;
  border-bottom: 1px solid var(--wt-grid-line);
  vertical-align: middle;
  color: var(--text);
  background: var(--surface);
}
body.webterminal .wt-cal-table tbody tr.wt-cal-day-row td {
  font-weight: 700;
  padding-top: 5px;
  padding-bottom: 3px;
  background: var(--panel2);
  border-bottom: 1px solid var(--wt-grid-line);
  color: var(--text);
}
body.webterminal .wt-cal-table tbody tr.wt-cal-data-row:hover td {
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
}
body.webterminal .wt-cal-table tbody tr.wt-cal-data-row.wt-cal-row-sel td {
  background: color-mix(in srgb, #e8a0a8 35%, var(--surface));
}
:root[data-theme="dark"] body.webterminal .wt-cal-table tbody tr.wt-cal-data-row.wt-cal-row-sel td {
  background: color-mix(in srgb, #8b4d55 38%, var(--surface));
}
body.webterminal .wt-cal-col-time {
  width: 96px;
  min-width: 88px;
}
body.webterminal .wt-cal-td-time {
  padding: 2px 4px 2px 3px;
}
body.webterminal .wt-cal-time-cell {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  white-space: nowrap;
}
body.webterminal .wt-cal-flag-slot {
  flex-shrink: 0;
  width: 22px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 1px;
  border: 1px solid color-mix(in srgb, var(--wt-grid-line) 75%, transparent);
  background: var(--panel2);
  box-sizing: border-box;
}
body.webterminal .wt-cal-flag-slot--empty {
  border-style: dashed;
  opacity: 0.35;
}
body.webterminal .wt-cal-flag-img {
  display: block;
  width: 22px;
  height: 14px;
  object-fit: cover;
  object-position: center;
}
body.webterminal .wt-cal-flag-img.wt-cal-flag-img--missing {
  width: 100%;
  height: 100%;
  min-height: 12px;
  background: color-mix(in srgb, var(--text) 8%, var(--panel2));
}
body.webterminal .wt-cal-time-txt {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
body.webterminal .wt-cal-td-ccy {
  text-align: left;
}
body.webterminal .wt-cal-col-ccy {
  width: 64px;
}
body.webterminal .wt-cal-col-pri {
  width: 28px;
}
body.webterminal .wt-cal-col-period {
  width: 40px;
}
body.webterminal .wt-cal-col-val {
  width: 56px;
}
body.webterminal .wt-cal-table:not(.wt-cal-auto) .wt-cal-col-event {
  width: auto;
}
body.webterminal .wt-cal-pri {
  display: block;
  width: 10px;
  height: 10px;
  margin: 0 auto;
  border-radius: 1px;
  border: 1px solid color-mix(in srgb, var(--text) 22%, transparent);
}
body.webterminal .wt-cal-pri--0 {
  background: #c5ccd4;
}
body.webterminal .wt-cal-pri--1 {
  background: #e8943a;
}
body.webterminal .wt-cal-pri--2 {
  background: #d94a4a;
}
:root[data-theme="dark"] body.webterminal .wt-cal-pri--0 {
  background: #5a6570;
}
:root[data-theme="dark"] body.webterminal .wt-cal-pri--1 {
  background: #c97d30;
}
:root[data-theme="dark"] body.webterminal .wt-cal-pri--2 {
  background: #c44;
}
body.webterminal .wt-cal-th-pri {
  text-align: center;
}
body.webterminal .wt-cal-table .mono.wt-tb-num {
  text-align: right;
}
body.webterminal .wt-cal-ctx-flyout.wt-mw-ctx-flyout {
  max-height: min(320px, 55vh);
  overflow-y: auto;
}
body.webterminal .wt-tb-table {
  table-layout: fixed;
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}
body.webterminal .wt-tb-table thead th {
  background: var(--panel2);
  color: var(--text);
  font-weight: normal;
  text-align: left;
  padding: 3px 6px;
  border: 1px solid var(--wt-grid-line);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
body.webterminal .wt-tb-table thead th.wt-tb-num {
  text-align: right;
}
body.webterminal .wt-tb-table tbody td {
  background: var(--surface);
  color: var(--text);
  padding: 2px 6px;
  border: 1px solid var(--wt-grid-line);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
body.webterminal .wt-cal-table.wt-tb-table thead th {
  position: sticky;
  top: 0;
  z-index: 6;
  font-weight: 400;
  padding: 3px 4px;
  color: var(--text);
  white-space: nowrap;
  background: var(--panel2);
  background-clip: padding-box;
  border-top: none;
  border-right: none;
  border-bottom: 1px solid var(--wt-grid-line);
  box-shadow: 0 1px 0 var(--wt-grid-line);
}
body.webterminal .wt-cal-table.wt-tb-table:not(.wt-cal-grid) thead th:not(:last-child) {
  border-right: 1px solid color-mix(in srgb, var(--wt-grid-line) 85%, transparent);
}
body.webterminal .wt-cal-table.wt-tb-table.wt-cal-grid thead th {
  border-left: 1px solid var(--wt-grid-line);
}
body.webterminal .wt-cal-table.wt-tb-table tbody td {
  border: none;
  border-bottom: 1px solid var(--wt-grid-line);
  padding: 2px 4px;
}
body.webterminal .wt-cal-table.wt-tb-table.wt-cal-grid tbody td {
  border-left: 1px solid var(--wt-grid-line);
}
