/**
 * F2FChart Pure Clean-Room Design System & Terminal Macro Grid (MIT).
 * Aligned to full-height Right Dock + Rail architecture, 28px Scale/Sessions bar,
 * 2-tier Watchlist Detail Split, Trade Ticket/DOM Sub-Tabs, and MT5 Ledger.
 * Zero third-party frameworks; zero emoji chrome (monoline 1.5px SVG + tabular monospace).
 */

@layer base, layout, components, responsive, forced;

@layer base {
  :root,
  [data-theme="dark"] {
    color-scheme: dark;
    --f2f-bg-canvas: #131722;
    --f2f-bg-surface: #0d1017;
    --f2f-bg-elevated: #181c27;
    --f2f-bg-hover: #242936;
    --f2f-bg-input: #1a1f2b;
    --f2f-border: #2a2e39;
    --f2f-border-strong: #363a45;
    --f2f-text-primary: #e2e8f0;
    --f2f-text-secondary: #9aa4b8;
    --f2f-text-muted: #8a96ab;
    --f2f-accent: #2962ff;
    --f2f-accent-text: #60a5fa;
    --f2f-accent-soft: rgba(41, 98, 255, 0.2);
    --f2f-accent-dim: var(--f2f-accent-soft);
    --f2f-bull: #089981;
    --f2f-bull-text: #10b981;
    --f2f-bull-soft: rgba(8, 153, 129, 0.18);
    --f2f-bear: #f23645;
    --f2f-bear-text: #fb7185;
    --f2f-bear-soft: rgba(242, 54, 69, 0.18);
    --f2f-warn: #f59e0b;
    --f2f-warn-text: #fbbf24;
    --f2f-warn-soft: rgba(245, 158, 11, 0.16);
    --f2f-shadow: 0 12px 32px rgba(0, 0, 0, 0.56);
    --f2f-elev-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.06);
    --f2f-hud-bg: rgba(19, 23, 34, 0.9);
    --f2f-tok-plain: #e2e8f0;
    --f2f-tok-kw: #c084fc;
    --f2f-tok-fn: #60a5fa;
    --f2f-tok-var: #38bdf8;
    --f2f-tok-number: #fbbf24;
    --f2f-tok-string: #34d399;
    --f2f-tok-comment: #94a3b8;
    --f2f-tok-color: #f472b6;
    --f2f-tok-op: #cbd5e1;
    --f2f-tok-selection: rgba(41, 98, 255, 0.34);
    --f2f-ladder-ask-fill: rgba(242, 54, 69, 0.16);
    --f2f-ladder-bid-fill: rgba(8, 153, 129, 0.16);
    --f2f-flag-red: #f23645;
    --f2f-flag-blue: #2962ff;
    --f2f-flag-green: #089981;
    --f2f-flag-amber: #f59e0b;
    --f2f-flag-orange: #f59e0b;
    --f2f-flag-purple: #a78bfa;
    --f2f-tone-slate: #94a3b8;
    --f2f-tone-slate-text: #94a3b8;
    --f2f-tone-sky: #38bdf8;
    --f2f-tone-sky-text: #38bdf8;
    --f2f-tone-cobalt: #3b82f6;
    --f2f-tone-cobalt-text: #60a5fa;
    --f2f-tone-emerald: #10b981;
    --f2f-tone-emerald-text: #10b981;
    --f2f-tone-rose: #f43f5e;
    --f2f-tone-rose-text: #fb7185;
    --f2f-tone-amber: #f59e0b;
    --f2f-tone-amber-text: #fbbf24;
    --f2f-tone-violet: #a78bfa;
    --f2f-tone-violet-text: #a78bfa;
    --f2f-tone-light: #e2e8f0;
    --f2f-tone-light-text: #e2e8f0;
  }

  [data-theme="light"] {
    color-scheme: light;
    --f2f-bg-canvas: #f8fafc;
    --f2f-bg-surface: #ffffff;
    --f2f-bg-elevated: #f1f5f9;
    --f2f-bg-hover: #e2e8f0;
    --f2f-bg-input: #ffffff;
    --f2f-border: #cbd5e1;
    --f2f-border-strong: #94a3b8;
    --f2f-text-primary: #0f172a;
    --f2f-text-secondary: #334155;
    --f2f-text-muted: #475569;
    --f2f-accent: #1e40af;
    --f2f-accent-text: #1e40af;
    --f2f-accent-soft: rgba(30, 64, 175, 0.12);
    --f2f-accent-dim: var(--f2f-accent-soft);
    --f2f-bull: #047857;
    --f2f-bull-text: #047857;
    --f2f-bull-soft: rgba(4, 120, 87, 0.1);
    --f2f-bear: #be123c;
    --f2f-bear-text: #9f1239;
    --f2f-bear-soft: rgba(190, 18, 60, 0.1);
    --f2f-warn: #b45309;
    --f2f-warn-text: #854d0e;
    --f2f-warn-soft: rgba(180, 83, 9, 0.12);
    --f2f-shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 10px 26px rgba(15, 23, 42, 0.12);
    --f2f-elev-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.75);
    --f2f-hud-bg: rgba(255, 255, 255, 0.94);
    --f2f-tok-plain: #0f172a;
    --f2f-tok-kw: #7e22ce;
    --f2f-tok-fn: #1d4ed8;
    --f2f-tok-var: #0369a1;
    --f2f-tok-number: #9a3412;
    --f2f-tok-string: #047857;
    --f2f-tok-comment: #475569;
    --f2f-tok-color: #be185d;
    --f2f-tok-op: #334155;
    --f2f-tok-selection: rgba(30, 64, 175, 0.22);
    --f2f-ladder-ask-fill: rgba(190, 18, 60, 0.12);
    --f2f-ladder-bid-fill: rgba(4, 120, 87, 0.12);
    --f2f-flag-red: #dc2626;
    --f2f-flag-blue: #1d4ed8;
    --f2f-flag-green: #047857;
    --f2f-flag-amber: #d97706;
    --f2f-flag-orange: #d97706;
    --f2f-flag-purple: #7c3aed;
    --f2f-tone-slate: #475569;
    --f2f-tone-slate-text: #475569;
    --f2f-tone-sky: #0284c7;
    --f2f-tone-sky-text: #0369a1;
    --f2f-tone-cobalt: #2563eb;
    --f2f-tone-cobalt-text: #1d4ed8;
    --f2f-tone-emerald: #047857;
    --f2f-tone-emerald-text: #047857;
    --f2f-tone-rose: #e11d48;
    --f2f-tone-rose-text: #be123c;
    --f2f-tone-amber: #d97706;
    --f2f-tone-amber-text: #92400e;
    --f2f-tone-violet: #7c3aed;
    --f2f-tone-violet-text: #6d28d9;
    --f2f-tone-light: #475569;
    --f2f-tone-light-text: #334155;
  }

  :root {
    --f2f-font-sans: Inter, "Segoe UI", system-ui, -apple-system, sans-serif;
    --f2f-font-mono: "JetBrains Mono", "Cascadia Code", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    --f2f-radius-xs: 4px;
    --f2f-radius-sm: 6px;
    --f2f-radius-md: 8px;
    --f2f-radius-lg: 12px;
    --f2f-radius-pill: 999px;
    --f2f-header-h: 2.5rem;
    --f2f-left-w: 42px;
    --f2f-scalebar-h: 1.75rem;
    --f2f-right-rail-w: 46px;
    --f2f-dock-w: 328px;
    --f2f-watch-detail-h: 235px;
    --f2f-bottom-h: 215px;
    --f2f-bottom-collapsed-h: 2.125rem;
  }

  *,
  *::before,
  *::after {
    box-sizing: border-box;
  }

  html,
  body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--f2f-bg-canvas);
    color: var(--f2f-text-primary);
    font-family: var(--f2f-font-sans);
    line-height: 1.35;
    -webkit-font-smoothing: antialiased;
  }

  body {
    font-size: 0.75rem;
  }

  button,
  input,
  select,
  textarea {
    font-family: inherit;
    font-size: 0.75rem;
    color: var(--f2f-text-primary);
  }

  [hidden] {
    display: none !important;
  }

  button {
    cursor: pointer;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    padding: 4px 8px;
    transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
  }

  button:focus-visible,
  input:focus-visible,
  select:focus-visible,
  textarea:focus-visible {
    outline: 2px solid var(--f2f-accent);
    outline-offset: 1px;
  }

  input,
  select,
  textarea {
    background: var(--f2f-bg-input);
    border: 1px solid var(--f2f-border-strong);
    border-radius: 4px;
    padding: 5px 8px;
  }

  .tabular-nums {
    font-variant-numeric: tabular-nums;
    font-family: var(--f2f-font-mono);
  }

  .f2f-mono {
    font-family: var(--f2f-font-mono);
  }

  * {
    scrollbar-width: thin;
    scrollbar-color: var(--f2f-border-strong) transparent;
  }

  *::-webkit-scrollbar {
    width: 6px;
    height: 6px;
  }

  *::-webkit-scrollbar-track {
    background: transparent;
  }

  *::-webkit-scrollbar-thumb {
    background: transparent;
    border-radius: 999px;
  }

  *:hover::-webkit-scrollbar-thumb,
  *:focus-within::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.32);
  }
}

@layer layout {
  /* Macro 2-column viewport: [Main Chart + Account Manager] | [Resizer] | [Full-Height Right Dock] | [Right Rail] */
  .f2f-app {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) 5px var(--f2f-dock-w) var(--f2f-right-rail-w);
    grid-template-rows: minmax(0, 1fr);
    width: 100vw;
    height: 100dvh;
    overflow: hidden;
    background: var(--f2f-bg-canvas);
  }

  .f2f-app.dock-collapsed {
    grid-template-columns: minmax(260px, 1fr) 0px 0px var(--f2f-right-rail-w);
  }

  .f2f-app.dock-collapsed .f2f-v-resizer,
  .f2f-app.dock-collapsed .f2f-right-dock {
    display: none;
  }

  .f2f-main-col {
    grid-column: 1;
    grid-row: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    background: var(--f2f-bg-canvas);
    container-type: inline-size;
    container-name: maincol;
  }

  /* ---- Zone 1: Single 40px Top Command Bar ---- */
  .f2f-topbar {
    height: var(--f2f-header-h);
    min-height: var(--f2f-header-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;
    gap: 3px;
    padding: 0 6px;
    background: var(--f2f-bg-surface);
    border-bottom: 1px solid var(--f2f-border);
    overflow: hidden;
    white-space: nowrap;
  }

  .f2f-topbar-group {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
    min-width: 0;
    flex-wrap: nowrap;
  }

  .f2f-topbar .f2f-tablet-more-only {
    display: none;
  }

  .f2f-divider-v {
    width: 1px;
    height: 18px;
    background: var(--f2f-border);
    margin: 0 1px;
    flex-shrink: 0;
  }

  .f2f-brand {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 700;
    font-size: 0.78125rem;
    letter-spacing: -0.02em;
    color: var(--f2f-text-primary);
    padding-right: 1px;
  }

  .f2f-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 5px;
    border-radius: 3px;
    font-size: 0.625rem;
    font-weight: 600;
    font-family: var(--f2f-font-mono);
    letter-spacing: 0.03em;
    text-transform: uppercase;
    background: var(--f2f-bg-elevated);
    border: 1px solid var(--f2f-border);
    color: var(--f2f-text-secondary);
  }

  .f2f-pill.sim,
  .f2f-pill.warn,
  .f2f-l1-badge {
    color: var(--f2f-warn-text);
    background: var(--f2f-warn-soft);
    border-color: rgba(245, 158, 11, 0.42);
  }

  [data-theme="light"] .f2f-pill.sim,
  [data-theme="light"] .f2f-pill.warn,
  [data-theme="light"] .f2f-l1-badge {
    color: #92400e;
    background: rgba(245, 158, 11, 0.16);
    border-color: rgba(180, 83, 9, 0.42);
  }

  .f2f-l1-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.625rem;
    font-weight: 700;
    font-family: var(--f2f-font-mono);
    letter-spacing: 0.03em;
    text-transform: uppercase;
    border: 1px solid rgba(245, 158, 11, 0.45);
  }

  .f2f-pill.bull {
    color: var(--f2f-bull-text);
    background: var(--f2f-bull-soft);
    border-color: rgba(8, 153, 129, 0.4);
  }

  .f2f-pill.bear {
    color: var(--f2f-bear-text);
    background: var(--f2f-bear-soft);
    border-color: rgba(242, 54, 69, 0.4);
  }

  .f2f-pill.accent {
    color: var(--f2f-accent-text);
    background: var(--f2f-accent-soft);
    border-color: rgba(59, 130, 246, 0.45);
  }

  .f2f-top-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: 1.625rem;
    min-width: 24px;
    padding: 0 5px;
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--f2f-text-secondary);
    border: 1px solid transparent;
    border-radius: var(--f2f-radius-xs);
  }

  .f2f-top-btn:hover {
    background: var(--f2f-bg-hover);
    color: var(--f2f-text-primary);
  }

  .f2f-top-btn:disabled {
    opacity: 0.38;
    cursor: not-allowed;
  }

  .f2f-top-btn.active,
  .f2f-top-btn[aria-pressed="true"] {
    background: var(--f2f-accent-soft);
    color: var(--f2f-accent-text);
    border-color: rgba(59, 130, 246, 0.48);
  }

  .f2f-symbol-trigger {
    background: var(--f2f-bg-elevated);
    border: 1px solid var(--f2f-border-strong);
    color: var(--f2f-text-primary);
    font-weight: 700;
    font-family: var(--f2f-font-mono);
  }

  .f2f-select-compact {
    min-height: 1.625rem;
    padding: 0 4px;
    font-size: 0.6875rem;
    font-weight: 600;
    background: var(--f2f-bg-elevated);
    border: 1px solid var(--f2f-border);
  }

  .f2f-compact-sel {
    padding: 2px 5px;
    font-size: 0.6875rem;
    min-width: 0;
  }

  .f2f-mini-control {
    padding: 1px 4px;
    font-size: 0.625rem;
    min-width: 0;
  }

  /* ---- Middle Area Inside Left Column ---- */
  .f2f-chart-body {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: row;
    overflow: hidden;
  }

  /* ---- Zone 2: Left 42px Drawing Rail ---- */
  .f2f-left-rail {
    width: var(--f2f-left-w);
    min-width: var(--f2f-left-w);
    background: var(--f2f-bg-surface);
    border-right: 1px solid var(--f2f-border);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 6px 0;
    gap: 4px;
    overflow-y: auto;
    position: relative;
    z-index: 25;
  }

  .f2f-rail-btn {
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    color: var(--f2f-text-secondary);
    border-radius: 6px;
  }

  .f2f-rail-btn:hover {
    background: var(--f2f-bg-hover);
    color: var(--f2f-text-primary);
  }

  .f2f-rail-btn.active,
  .f2f-rail-btn[aria-pressed="true"] {
    background: var(--f2f-accent-soft);
    color: var(--f2f-accent-text);
    border: 1px solid rgba(59, 130, 246, 0.45);
  }

  .f2f-rail-corner {
    position: absolute;
    right: 2px;
    bottom: 2px;
    width: 4px;
    height: 4px;
    border-right: 4px solid var(--f2f-text-muted);
    border-top: 4px solid transparent;
    pointer-events: none;
  }

  .f2f-rail-spacer {
    width: 24px;
    height: 1px;
    flex-shrink: 0;
    background: var(--f2f-border);
    margin: 3px 0;
  }

  .f2f-tool-flyout {
    position: fixed;
    left: 46px;
    min-width: 220px;
    background: var(--f2f-bg-elevated);
    border: none;
    border-radius: 6px;
    box-shadow: 0 0 0 1px var(--f2f-border-strong), var(--f2f-shadow);
    padding: 6px;
    z-index: 120;
    display: none;
    flex-direction: column;
    gap: 2px;
  }

  .f2f-tool-flyout.open {
    display: flex;
  }

  .f2f-flyout-title {
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--f2f-text-muted);
    padding: 4px 6px;
  }

  .f2f-flyout-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 8px;
    font-size: 0.75rem;
    color: var(--f2f-text-primary);
    border-radius: 4px;
    text-align: left;
  }

  .f2f-flyout-item:hover {
    background: var(--f2f-bg-hover);
  }

  .f2f-flyout-item.active {
    background: var(--f2f-accent-soft);
    color: var(--f2f-accent-text);
  }

  .f2f-popover {
    position: fixed;
    min-width: 220px;
    background: var(--f2f-bg-elevated);
    border: none;
    border-radius: 7px;
    box-shadow: 0 0 0 1px var(--f2f-border-strong), var(--f2f-elev-highlight), var(--f2f-shadow);
    padding: 8px;
    z-index: 125;
    display: none;
    flex-direction: column;
    gap: 4px;
  }

  .f2f-popover.open {
    display: flex;
  }

  /* Layout Popover matching F2FTerminal visual layout previews */
  .f2f-layout-popover {
    width: 312px;
    padding: 10px;
  }

  .f2f-layout-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    margin: 4px 0 8px;
  }

  .f2f-layout-btn {
    min-height: 62px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 6px 4px;
    border-radius: 6px;
    border: 1px solid var(--f2f-border);
    color: var(--f2f-text-secondary);
  }

  .f2f-layout-btn:hover,
  .f2f-layout-btn.active {
    background: var(--f2f-accent-soft);
    border-color: var(--f2f-accent);
    color: var(--f2f-text-primary);
  }

  .f2f-layout-preview {
    width: 38px;
    height: 26px;
    display: grid;
    gap: 2px;
  }

  .f2f-layout-preview.g-1x1 {
    grid-template-columns: 1fr;
  }

  .f2f-layout-preview.g-2x1 {
    grid-template-columns: 1fr 1fr;
  }

  .f2f-layout-preview.g-1x2 {
    grid-template-rows: 1fr 1fr;
  }

  .f2f-layout-preview.g-2x2 {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
  }

  .f2f-layout-preview i {
    display: block;
    border: 1px solid currentColor;
    border-radius: 1px;
    background: rgba(148, 163, 184, 0.22);
  }

  .f2f-check-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 5px 7px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
  }

  .f2f-check-row:hover {
    background: var(--f2f-bg-hover);
  }

  /* ---- Zone 3: Center Multi-Chart Stage + 28px Scale & Sessions Bar ---- */
  .f2f-center-column {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    position: relative;
    background: var(--f2f-bg-canvas);
  }

  .f2f-stage {
    flex: 1 1 0;
    min-height: 0;
    position: relative;
    display: grid;
    width: 100%;
    overflow: hidden;
    background: var(--f2f-border);
    gap: 1px;
  }

  .f2f-stage.layout-1x1 {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
  }

  .f2f-stage.layout-2x1 {
    grid-template-columns: var(--f2f-col-a, 1fr) var(--f2f-col-b, 1fr);
    grid-template-rows: 1fr;
  }

  .f2f-stage.layout-1x2 {
    grid-template-columns: 1fr;
    grid-template-rows: var(--f2f-row-a, 1fr) var(--f2f-row-b, 1fr);
  }

  .f2f-stage.layout-2x2 {
    grid-template-columns: var(--f2f-col-a, 1fr) var(--f2f-col-b, 1fr);
    grid-template-rows: var(--f2f-row-a, 1fr) var(--f2f-row-b, 1fr);
  }

  .f2f-stage.layout-3x1 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: 1fr;
  }

  .f2f-stage.layout-1x3 {
    grid-template-columns: 1fr;
    grid-template-rows: repeat(3, minmax(0, 1fr));
  }

  .f2f-stage.layout-4x2 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-template-rows: var(--f2f-row-a, 1fr) var(--f2f-row-b, 1fr);
  }

  .f2f-chart-cell {
    position: relative;
    min-width: 0;
    min-height: 0;
    background: var(--f2f-bg-canvas);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 1px solid transparent;
    container-type: inline-size;
    container-name: f2f-cell;
  }

  .f2f-chart-cell.active-cell {
    border: 1px solid var(--f2f-accent);
  }

  .f2f-stage.layout-1x1 > .f2f-chart-cell.active-cell {
    border-color: transparent;
  }

  .f2f-stage.layout-1x1:not(.has-maximized) .f2f-cell-max-btn {
    display: none;
  }

  .f2f-cell-canvas-wrap {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    position: relative;
  }

  .f2f-cell-hud {
    position: absolute;
    top: 6px;
    left: 8px;
    right: 78px;
    max-width: calc(100% - 16px);
    z-index: 8;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    pointer-events: none;
  }

  .f2f-cell-hud-card {
    pointer-events: auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
    background: var(--f2f-hud-bg);
    border: none;
    border-radius: 5px;
    padding: 2px 7px;
    font-size: 0.6875rem;
    box-shadow: 0 0 0 1px var(--f2f-border), var(--f2f-elev-highlight);
    backdrop-filter: blur(4px);
  }

  .f2f-cell-hud-card > span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .f2f-cell-badge-btn {
    min-height: 1.375rem;
    padding: 2px 7px;
    white-space: nowrap;
    font-weight: 700;
    font-size: 0.65625rem;
    background: var(--f2f-bg-elevated);
    border: 1px solid var(--f2f-border);
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
  }

  .f2f-ohlc-readout {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  @container f2f-cell (max-width: 340px) {
    .f2f-cell-hud {
      top: 4px;
      left: 4px;
      right: 54px;
      gap: 3px;
    }

    .f2f-cell-hud-card {
      padding: 2px 5px;
      gap: 4px;
      font-size: 0.625rem;
    }

    .f2f-ohlc-readout {
      max-width: 96px;
    }

    .f2f-oneclick-tile {
      display: none !important;
    }
  }

  @container f2f-cell (max-width: 240px) {
    .f2f-ohlc-readout {
      display: none;
    }
  }

  .f2f-cell-max-btn {
    padding: 2px 6px;
    font-size: 0.625rem;
    font-family: var(--f2f-font-mono);
    color: var(--f2f-text-secondary);
    border: 1px solid var(--f2f-border);
    flex-shrink: 0;
  }

  .f2f-cell-max-btn:hover {
    color: var(--f2f-text-primary);
    background: var(--f2f-bg-hover);
  }

  .f2f-cell-resizer-x {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 7px;
    margin-left: -3px;
    cursor: col-resize;
    z-index: 14;
  }

  .f2f-cell-resizer-x:hover {
    background: rgba(41, 98, 255, 0.35);
  }

  .f2f-cell-resizer-y {
    position: absolute;
    left: 0;
    right: 0;
    height: 7px;
    margin-top: -3px;
    cursor: row-resize;
    z-index: 14;
  }

  .f2f-cell-resizer-y:hover {
    background: rgba(41, 98, 255, 0.35);
  }

  /* ---- 28px Bottom Scale, Time-Range & Market Sessions Bar ---- */
  .f2f-scalebar {
    min-height: var(--f2f-scalebar-h);
    background: var(--f2f-bg-surface);
    border-top: 1px solid var(--f2f-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    padding: 2px 8px;
    gap: 6px 8px;
    position: relative;
    z-index: 22;
  }

  .f2f-scalebar-group {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    min-width: 0;
  }

  .f2f-scalebar-ranges {
    flex: 1 1 auto;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .f2f-scalebar-ranges::-webkit-scrollbar {
    display: none;
  }

  .f2f-scalebar-right {
    margin-left: auto;
    flex: 0 1 auto;
    max-width: 100%;
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .f2f-scale-btn {
    min-height: 1.375rem;
    min-width: 24px;
    padding: 1px 6px;
    font-size: 0.65625rem;
    font-weight: 600;
    color: var(--f2f-text-secondary);
    border-radius: 3px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .f2f-scale-btn:hover {
    background: var(--f2f-bg-hover);
    color: var(--f2f-text-primary);
  }

  .f2f-scale-btn.active {
    background: var(--f2f-accent-soft);
    color: var(--f2f-accent-text);
    border-color: rgba(59, 130, 246, 0.44);
  }

  /* Market Sessions Gantt Pill, Timezone Clock & Popovers */
  .f2f-session-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
  }

  .f2f-session-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 22px;
    min-height: 22px;
    padding: 0 8px;
    font-size: 0.6875rem;
    font-weight: 500;
    font-family: var(--f2f-font-mono);
    font-variant-numeric: tabular-nums;
    color: var(--f2f-text-primary);
    background: var(--f2f-bg-elevated);
    border: 1px solid var(--f2f-border-strong);
    border-radius: 4px;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background-color 140ms ease, border-color 140ms ease;
  }

  .f2f-session-pill:hover {
    border-color: var(--f2f-accent);
    background: var(--f2f-accent-soft);
  }

  .f2f-session-track {
    position: relative;
    width: 66px;
    height: 4px;
    border-radius: 2px;
    background: rgba(148, 163, 184, 0.22);
    overflow: visible;
    flex-shrink: 0;
  }

  .f2f-track-seg {
    position: absolute;
    top: 0;
    bottom: 0;
    border-radius: 1px;
    opacity: 0.85;
  }

  .f2f-track-seg.tokyo {
    left: 0%;
    width: 37.5%;
    background: rgba(249, 115, 22, 0.72);
  }

  .f2f-track-seg.london {
    left: 33.3%;
    width: 35.4%;
    background: #3b82f6;
  }

  .f2f-track-seg.ny {
    left: 56.25%;
    width: 27%;
    background: #10b981;
  }

  .f2f-track-needle {
    position: absolute;
    top: -3px;
    bottom: -3px;
    width: 1.5px;
    background: #ffffff;
    box-shadow: 0 0 3px rgba(255, 255, 255, 0.85);
    border-radius: 1px;
    z-index: 2;
    pointer-events: none;
  }

  [data-theme="light"] .f2f-track-needle {
    background: #0f172a;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.65);
  }

  .f2f-tz-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 22px;
    padding: 0 7px;
    border-radius: 4px;
    border: 1px solid transparent;
    font-family: var(--f2f-font-mono);
    font-size: 0.6875rem;
    font-variant-numeric: tabular-nums;
    color: var(--f2f-text-secondary);
    white-space: nowrap;
    flex-shrink: 0;
  }

  .f2f-tz-btn:hover,
  .f2f-tz-btn[aria-expanded="true"] {
    background: var(--f2f-bg-hover);
    color: var(--f2f-text-primary);
    border-color: var(--f2f-border-strong);
  }

  .f2f-tz-popover {
    position: fixed;
    width: 276px;
    max-width: calc(100vw - 16px);
    max-height: min(400px, calc(100vh - 96px));
    overflow: hidden;
    padding: 0;
    background: var(--f2f-bg-elevated);
    border: none;
    border-radius: 8px;
    box-shadow: 0 0 0 1px var(--f2f-border-strong), var(--f2f-shadow);
    z-index: 132;
    display: none;
    flex-direction: column;
  }

  .f2f-tz-popover.open {
    display: flex;
  }

  .f2f-tz-search-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    border-bottom: 1px solid var(--f2f-border);
    color: var(--f2f-text-muted);
    flex-shrink: 0;
  }

  .f2f-tz-search {
    width: 100%;
    min-width: 0;
    border: 0;
    outline: none;
    background: transparent;
    color: var(--f2f-text-primary);
    font-size: 0.75rem;
    padding: 0;
  }

  .f2f-tz-search::placeholder {
    color: var(--f2f-text-muted);
  }

  .f2f-tz-list {
    overflow-y: auto;
    padding: 4px;
    display: flex;
    flex-direction: column;
    gap: 1px;
    flex: 1 1 auto;
    min-height: 0;
  }

  .f2f-tz-sep {
    height: 1px;
    background: var(--f2f-border);
    margin: 4px 6px;
    flex-shrink: 0;
  }

  .f2f-tz-empty {
    padding: 14px 10px;
    text-align: center;
    font-size: 0.71875rem;
    color: var(--f2f-text-muted);
  }

  .f2f-tz-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    padding: 6px 8px;
    border-radius: 5px;
    font-size: 0.75rem;
    color: var(--f2f-text-primary);
    text-align: left;
    flex-shrink: 0;
  }

  .f2f-tz-item:hover {
    background: var(--f2f-bg-hover);
  }

  .f2f-tz-item.active {
    background: var(--f2f-accent-soft);
    color: var(--f2f-accent-text);
    font-weight: 600;
  }

  .f2f-tz-item-main {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    flex: 1 1 auto;
  }

  .f2f-tz-offset {
    font-family: var(--f2f-font-mono);
    font-size: 0.6875rem;
    font-variant-numeric: tabular-nums;
    color: var(--f2f-text-secondary);
    min-width: 68px;
    flex-shrink: 0;
  }

  .f2f-tz-item.active .f2f-tz-offset {
    color: var(--f2f-accent-text);
  }

  .f2f-tz-city {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .f2f-session-popover {
    position: fixed;
    width: 600px;
    max-width: calc(100vw - 24px);
    background: var(--f2f-bg-elevated);
    border: none;
    border-radius: 8px;
    box-shadow: 0 0 0 1px var(--f2f-border-strong), var(--f2f-shadow);
    padding: 0;
    overflow: hidden;
    z-index: 130;
    display: none;
    flex-direction: column;
    gap: 0;
    user-select: none;
  }

  .f2f-session-popover.open {
    display: flex;
  }

  .f2f-sess-gantt-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--f2f-bg-surface);
    border-bottom: 1px solid var(--f2f-border);
  }

  .f2f-sess-gantt-title {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 0.71875rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--f2f-text-primary);
  }

  .f2f-sess-tz-badge {
    padding: 1px 6px;
    border-radius: 4px;
    border: 1px solid var(--f2f-border-strong);
    background: var(--f2f-bg-elevated);
    font-family: var(--f2f-font-mono);
    font-size: 0.625rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: none;
    color: var(--f2f-text-secondary);
  }

  .f2f-sess-gantt-right {
    display: inline-flex;
    align-items: center;
    gap: 8px;
  }

  .f2f-sess-live-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 7px;
    border-radius: 4px;
    background: rgba(16, 185, 129, 0.14);
    border: 1px solid rgba(16, 185, 129, 0.35);
    color: #34d399;
    font-size: 0.625rem;
    font-weight: 700;
  }

  [data-theme="light"] .f2f-sess-live-badge {
    background: rgba(4, 120, 87, 0.1);
    border-color: rgba(4, 120, 87, 0.35);
    color: #047857;
  }

  .f2f-sess-gantt-ruler {
    position: relative;
    width: 100%;
    height: 22px;
    background: var(--f2f-bg-elevated, #181c27);
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-bottom: 1px solid var(--f2f-border);
    box-sizing: border-box;
  }

  .f2f-ruler-slot {
    position: absolute;
    top: 0;
    height: 100%;
    transform: translateX(-50%);
    text-align: center;
  }

  .f2f-ruler-slot:first-child {
    transform: none;
    padding-left: 0;
  }

  .f2f-ruler-slot:first-child .f2f-ruler-tick {
    left: 0;
  }

  .f2f-ruler-slot-end {
    transform: translateX(-100%);
    text-align: right;
  }

  .f2f-ruler-slot-end .f2f-ruler-tick {
    left: auto;
    right: 0;
  }

  .f2f-ruler-label {
    display: block;
    font-family: var(--f2f-font-mono);
    font-size: 9.5px;
    font-weight: 500;
    color: var(--f2f-text-secondary, #9aa4b8);
    line-height: 15px;
    white-space: nowrap;
  }

  [data-theme="light"] .f2f-ruler-label {
    color: #475569;
  }

  .f2f-ruler-tick {
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 1px;
    height: 5px;
    background: var(--f2f-border-strong);
  }

  .f2f-sess-chart {
    position: relative;
    width: 100%;
    background: var(--f2f-bg-canvas);
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    padding: 8px 0 10px 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    box-sizing: border-box;
  }

  .f2f-sess-row {
    position: relative;
    z-index: 2;
    width: 100%;
    height: 26px;
    display: block;
  }

  .f2f-sess-bar {
    position: absolute;
    top: 0;
    bottom: 0;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 0 3px;
    border-radius: 3px;
    min-width: 4px;
    white-space: nowrap;
    overflow: hidden;
    box-sizing: border-box;
    background: #1b2231;
    border: none;
    box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.24);
    color: #cbd5e1;
  }

  .f2f-sess-bar.active {
    background: linear-gradient(90deg, #13312b, #163e35);
    border: none;
    box-shadow: inset 0 0 0 1px rgba(16, 185, 129, 0.62), 0 2px 8px rgba(16, 185, 129, 0.16);
    color: #f8fafc;
  }

  .f2f-sess-bar-dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #10b981;
    flex-shrink: 0;
    position: relative;
    z-index: 2;
  }

  .f2f-sess-bar-city {
    font-weight: 700;
    font-size: 11px;
    color: inherit;
    flex-shrink: 0;
    position: relative;
    z-index: 2;
  }

  .f2f-sess-bar-time {
    font-family: var(--f2f-font-mono);
    font-size: 10px;
    color: #94a3b8;
    min-width: 0;
    flex: 0 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    position: relative;
    z-index: 2;
  }

  .f2f-sess-bar.active .f2f-sess-bar-time {
    color: #6ee7b7;
  }

  [data-theme="light"] .f2f-sess-bar {
    background: #e2e8f0;
    box-shadow: inset 0 0 0 1px #cbd5e1;
    color: #1e293b;
  }

  [data-theme="light"] .f2f-sess-bar-time {
    color: #475569;
  }

  [data-theme="light"] .f2f-sess-bar.active {
    background: linear-gradient(90deg, #dcfce7, #d1fae5);
    box-shadow: inset 0 0 0 1px rgba(4, 120, 87, 0.52), 0 1px 4px rgba(4, 120, 87, 0.12);
    color: #064e3b;
  }

  [data-theme="light"] .f2f-sess-bar.active .f2f-sess-bar-dot {
    background: #047857;
  }

  [data-theme="light"] .f2f-sess-bar.active .f2f-sess-bar-time {
    color: #065f46;
  }

  .f2f-sess-needle {
    position: absolute;
    top: -22px;
    bottom: 0;
    width: 1.5px;
    background: #38bdf8;
    box-shadow: 0 0 6px rgba(56, 189, 248, 0.85);
    z-index: 1;
    pointer-events: none;
  }

  .f2f-sess-needle::before {
    content: "";
    position: absolute;
    top: 0;
    left: -3px;
    width: 0;
    height: 0;
    border-left: 3.5px solid transparent;
    border-right: 3.5px solid transparent;
    border-top: 5px solid #38bdf8;
  }

  [data-theme="light"] .f2f-sess-needle {
    background: #0284c7;
    box-shadow: 0 0 4px rgba(2, 132, 199, 0.45);
  }

  [data-theme="light"] .f2f-sess-needle::before {
    border-top-color: #0284c7;
  }

  /* ---- Floating One-Click Big-Pip Trade Tile ---- */
  .f2f-oneclick-tile {
    position: relative;
    pointer-events: auto;
    z-index: 11;
    display: none;
    align-items: stretch;
    gap: 3px;
    background: var(--f2f-hud-bg);
    border: none;
    border-radius: 7px;
    padding: 3px;
    box-shadow: 0 0 0 1px var(--f2f-border-strong), var(--f2f-elev-highlight), var(--f2f-shadow);
    backdrop-filter: blur(6px);
  }

  .f2f-oneclick-tile.visible {
    display: inline-flex;
  }

  .f2f-oc-btn {
    min-width: 78px;
    padding: 3px 8px;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    border: 1px solid transparent;
  }

  .f2f-oc-btn.sell {
    background: var(--f2f-bear-soft);
    border-color: rgba(242, 54, 69, 0.5);
    color: var(--f2f-bear-text);
  }

  .f2f-oc-btn.sell:hover {
    background: rgba(242, 54, 69, 0.28);
  }

  .f2f-oc-btn.buy {
    background: var(--f2f-bull-soft);
    border-color: rgba(8, 153, 129, 0.5);
    color: var(--f2f-bull-text);
  }

  .f2f-oc-btn.buy:hover {
    background: rgba(8, 153, 129, 0.28);
  }

  .f2f-oc-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
  }

  .f2f-oc-side {
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.05em;
  }

  .f2f-bigpip {
    font-family: var(--f2f-font-mono);
    font-variant-numeric: tabular-nums;
    display: inline-flex;
    align-items: baseline;
    line-height: 1;
  }

  .f2f-bigpip .p-main {
    font-size: 1rem;
    font-weight: 800;
    margin: 0 1px;
  }

  .f2f-bigpip .p-sub {
    font-size: 0.625rem;
    vertical-align: super;
  }

  .f2f-oc-qty-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
  }

  .f2f-oc-qty-box input {
    width: 4.5em;
    min-width: 3.375rem;
    padding: 3px 4px;
    font-size: 0.6875rem;
    text-align: center;
    font-family: var(--f2f-font-mono);
  }

  /* ---- Floating R:R Banner, Palette & Replay Strip ---- */
  .f2f-rr-banner {
    position: absolute;
    bottom: 118px;
    left: 12px;
    z-index: 16;
    display: none;
    align-items: center;
    flex-wrap: wrap;
    max-width: calc(100% - 24px);
    gap: 8px 10px;
    padding: 6px 10px;
    background: var(--f2f-bg-elevated);
    border: none;
    border-radius: 6px;
    box-shadow: 0 0 0 1px var(--f2f-accent), var(--f2f-shadow);
    font-size: 11px;
  }

  .f2f-rr-banner.visible {
    display: inline-flex;
  }

  .f2f-draw-palette-bar {
    position: absolute;
    bottom: 118px;
    right: 84px;
    z-index: 16;
    display: none;
    align-items: center;
    flex-wrap: wrap;
    max-width: calc(100% - 96px);
    gap: 4px;
    padding: 4px 7px;
    background: var(--f2f-bg-elevated);
    border: none;
    border-radius: 5px;
    box-shadow: 0 0 0 1px var(--f2f-border-strong), var(--f2f-shadow);
  }

  .f2f-draw-palette-bar.visible {
    display: inline-flex;
  }

  .f2f-draw-palette-bar.visible ~ .f2f-rr-banner.visible,
  #f2f-draw-palette-bar.visible ~ #f2f-rr-banner.visible {
    bottom: 164px;
  }

  .f2f-swatch {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.25);
  }

  [data-theme="light"] .f2f-swatch {
    border-color: rgba(15, 23, 42, 0.28);
  }

  .f2f-drag-pill {
    position: absolute;
    bottom: 36px;
    right: 82px;
    z-index: 15;
    display: none;
    padding: 4px 8px;
    border-radius: 4px;
    background: var(--f2f-bg-elevated);
    border: 1px solid var(--f2f-accent);
    font-size: 11px;
    font-family: var(--f2f-font-mono);
  }

  .f2f-drag-pill.visible {
    display: inline-flex;
  }

  .f2f-replay-bar,
  #f2f-replay-bar {
    display: none;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: nowrap;
    min-height: 34px;
    max-height: 38px;
    gap: 4px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    padding: 3px 6px;
    background: var(--f2f-bg-elevated);
    border-top: 1px solid var(--f2f-warn);
    color: var(--f2f-text-primary);
    flex-shrink: 0;
  }

  .f2f-replay-bar::-webkit-scrollbar,
  #f2f-replay-bar::-webkit-scrollbar {
    display: none;
  }

  .f2f-replay-bar.visible,
  #f2f-replay-bar.visible {
    display: flex;
  }

  .f2f-replay-bar .f2f-topbar-group,
  .f2f-replay-row-primary {
    display: inline-flex;
    flex: 1 1 auto;
    min-width: 0;
    max-width: 100%;
    flex-wrap: nowrap;
    gap: 3px !important;
    align-items: center;
    width: 100%;
    justify-content: flex-start;
    white-space: nowrap;
  }

  .f2f-replay-row-primary > * {
    flex-shrink: 0;
  }

  #f2f-replay-slider {
    flex: 0 1 76px !important;
    min-width: 48px !important;
    max-width: 140px;
  }

  .f2f-replay-bal-wrap,
  #f2f-replay-balance-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    font-size: 0.6875rem;
    color: var(--f2f-text-secondary);
    white-space: nowrap;
  }

  .f2f-replay-bar .f2f-chip {
    min-height: 24px;
    min-width: 24px;
    padding: 2px 5px;
    font-size: 0.65625rem;
    white-space: nowrap;
  }

  .f2f-replay-bar .f2f-compact-sel {
    min-height: 24px;
    padding: 2px 5px;
    font-size: 0.65625rem;
  }

  #f2f-replay-balance {
    width: 72px;
    min-height: 24px;
    padding: 2px 5px;
    font-size: 0.6875rem;
  }

  .f2f-replay-core-group {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    flex-wrap: nowrap;
    flex: 0 0 auto;
    max-width: 100%;
  }

  .f2f-replay-settings-popover {
    position: absolute;
    bottom: 72px;
    right: 12px;
    left: auto;
    top: auto;
    width: min(360px, calc(100% - 24px));
    max-width: calc(100% - 24px);
    z-index: 56;
    padding: 10px 12px;
    border: none;
    border-radius: var(--f2f-radius-lg, 12px);
    background: var(--f2f-bg-elevated);
    box-shadow: 0 0 0 1px var(--f2f-border-strong), var(--f2f-shadow);
    display: none;
    flex-direction: column;
    gap: 8px;
  }

  .f2f-replay-settings-popover.open {
    display: flex;
  }

  .f2f-replay-settings-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    align-items: center;
  }

  .f2f-replay-settings-popover:not(:has(.f2f-replay-settings-grid)) {
    display: none;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    align-items: center;
  }

  .f2f-replay-settings-popover:not(:has(.f2f-replay-settings-grid)).open {
    display: grid;
  }

  .f2f-replay-settings-popover:not(:has(.f2f-replay-settings-grid)) > .f2f-flyout-title {
    grid-column: 1 / -1;
    padding: 0 0 2px;
  }

  .f2f-replay-settings-popover .f2f-chip,
  .f2f-replay-settings-popover .f2f-compact-sel {
    width: 100%;
    min-height: 28px;
    justify-content: center;
  }

  .f2f-replay-settings-popover #f2f-replay-balance-wrap {
    width: 100%;
    min-height: 28px;
    padding: 2px 6px;
    border: 1px solid var(--f2f-border-strong);
    border-radius: 4px;
    background: var(--f2f-bg-input);
  }

  .f2f-replay-settings-popover #f2f-replay-balance {
    width: 74px;
    min-height: 22px;
    border: none;
    background: transparent;
    padding: 0 2px;
    text-align: right;
  }

  /* ---- Resizers ---- */
  .f2f-v-resizer {
    grid-column: 2;
    grid-row: 1;
    width: 5px;
    height: 100%;
    cursor: col-resize;
    background: var(--f2f-border);
    transition: background-color 120ms ease;
    z-index: 20;
  }

  .f2f-v-resizer:hover,
  .f2f-v-resizer.dragging {
    background: var(--f2f-accent);
  }

  .f2f-h-resizer {
    height: 5px;
    min-height: 5px;
    cursor: row-resize;
    background: var(--f2f-border);
    transition: background-color 120ms ease;
    z-index: 20;
  }

  .f2f-h-resizer:hover,
  .f2f-h-resizer.dragging {
    background: var(--f2f-accent);
  }

  /* ---- Zone 4: Full-Height Right Dock + 46px Right Icon Rail ---- */
  .f2f-right-dock {
    grid-column: 3;
    grid-row: 1;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    background: var(--f2f-bg-surface);
    border-left: 1px solid var(--f2f-border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .f2f-dock-header {
    min-height: 2.25rem;
    padding: 3px 10px;
    border-bottom: 1px solid var(--f2f-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 6px;
    font-weight: 700;
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--f2f-text-secondary);
  }

  .f2f-dock-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  .f2f-dock-panel {
    display: none;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 10px;
    gap: 9px;
  }

  .f2f-dock-panel.active {
    display: flex;
  }

  .f2f-dock-panel.is-floating {
    position: fixed;
    right: 60px;
    top: 56px;
    width: min(310px, calc(100vw - 76px));
    max-height: min(82dvh, calc(100dvh - 72px));
    z-index: 110;
    background: var(--f2f-bg-surface);
    border: 1px solid var(--f2f-accent);
    border-radius: 8px;
    box-shadow: var(--f2f-shadow);
    overflow-y: auto;
  }

  .f2f-dock-panel.is-floating .f2f-trade-subtabs {
    cursor: grab;
    user-select: none;
  }

  .f2f-dock-panel[data-panel="watchlist"] {
    padding: 0;
    gap: 0;
    overflow: hidden;
  }

  .f2f-right-rail {
    grid-column: 4;
    grid-row: 1;
    position: relative;
    z-index: 81;
    width: var(--f2f-right-rail-w);
    height: 100%;
    min-height: 0;
    overflow-y: auto;
    scrollbar-width: none;
    background: var(--f2f-bg-surface);
    border-left: 1px solid var(--f2f-border);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 7px 0;
  }

  .f2f-right-rail::-webkit-scrollbar {
    display: none;
  }

  .f2f-rail-stack {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
  }

  /* ---- Watchlist 2-Tier Split + Symbol Detail Panel ---- */
  .f2f-watch-top {
    flex: 1 1 auto;
    min-height: 110px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .f2f-watch-catbar {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 4px 8px 0;
    border-bottom: 1px solid var(--f2f-border);
    overflow-x: auto;
    scrollbar-width: none;
  }

  .f2f-watch-catbar::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
  }

  .f2f-watch-cat {
    padding: 5px 7px;
    font-size: 10.5px;
    font-weight: 600;
    color: var(--f2f-text-secondary);
    border-bottom: 2px solid transparent;
    border-radius: 0;
    white-space: nowrap;
  }

  .f2f-watch-cat.active {
    color: var(--f2f-text-primary);
    border-bottom-color: var(--f2f-accent);
  }

  .f2f-watch-searchbar {
    padding: 6px 8px;
    border-bottom: 1px solid var(--f2f-border);
  }

  .f2f-watch-searchbar input {
    width: 100%;
  }

  .f2f-watch-cols {
    display: grid;
    grid-template-columns: minmax(86px, 1.4fr) minmax(60px, 1fr) minmax(56px, 0.85fr) minmax(48px, 0.75fr);
    gap: 4px;
    padding: 5px 8px;
    font-size: 10px;
    font-weight: 700;
    color: var(--f2f-text-secondary);
    text-transform: uppercase;
    border-bottom: 1px solid var(--f2f-border);
  }

  .f2f-watch-cols span:not(:first-child) {
    text-align: right;
  }

  .f2f-watch-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 2px 4px;
  }

  .f2f-watch-row {
    display: grid;
    grid-template-columns: minmax(86px, 1.4fr) minmax(60px, 1fr) minmax(56px, 0.85fr) minmax(48px, 0.75fr);
    align-items: center;
    gap: 4px;
    padding: 6px 6px;
    border-radius: 4px;
    border-left: 2px solid transparent;
    cursor: pointer;
    font-size: 11px;
  }

  .f2f-watch-row:hover {
    background: var(--f2f-bg-hover);
  }

  .f2f-watch-row.active {
    background: var(--f2f-accent-soft);
    border-left-color: var(--f2f-accent);
  }

  .f2f-watch-row > span {
    text-align: right;
  }

  .f2f-watch-resizer {
    height: 6px;
    min-height: 6px;
    background: var(--f2f-bg-elevated);
    border-top: 1px solid var(--f2f-border);
    border-bottom: 1px solid var(--f2f-border);
    cursor: row-resize;
  }

  .f2f-watch-resizer:hover {
    background: var(--f2f-accent);
  }

  .f2f-watch-detail {
    flex: 0 0 var(--f2f-watch-detail-h);
    min-height: 140px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--f2f-bg-surface);
  }

  .f2f-detail-head {
    padding: 6px 10px;
    border-bottom: 1px solid var(--f2f-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
  }

  .f2f-detail-tabs {
    display: flex;
    gap: 2px;
    padding: 0 8px;
    border-bottom: 1px solid var(--f2f-border);
  }

  .f2f-detail-tab {
    flex: 1;
    padding: 5px 4px;
    font-size: 11px;
    font-weight: 600;
    color: var(--f2f-text-secondary);
    border-bottom: 2px solid transparent;
    border-radius: 0;
  }

  .f2f-detail-tab.active {
    color: var(--f2f-text-primary);
    border-bottom-color: var(--f2f-accent);
  }

  .f2f-detail-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 9px 10px;
  }

  .f2f-stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px 10px;
    font-size: 11px;
  }

  .f2f-stat-item {
    display: flex;
    justify-content: space-between;
    gap: 4px;
  }

  .f2f-range-track {
    position: relative;
    height: 4px;
    border-radius: 3px;
    background: var(--f2f-border-strong);
    margin: 7px 0 4px;
  }

  .f2f-range-marker {
    position: absolute;
    top: -3px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--f2f-accent);
    transform: translateX(-50%);
  }

  /* ---- Trade Sub-Tabs, Lot Stepper & Brackets ---- */
  .f2f-trade-subtabs {
    display: flex;
    align-items: center;
    gap: 0;
    padding-right: 4px;
    border-bottom: 1px solid var(--f2f-border);
    margin: -10px -10px 4px;
    background: var(--f2f-bg-elevated);
  }

  .f2f-trade-subtab {
    flex: 1 1 0;
    padding: 8px 6px;
    font-size: 0.71875rem;
    font-weight: 700;
    color: var(--f2f-text-secondary);
    border-bottom: 2px solid transparent;
    border-radius: 0;
  }

  .f2f-trade-subtab.active {
    color: var(--f2f-text-primary);
    border-bottom-color: var(--f2f-accent);
    background: var(--f2f-bg-surface);
  }

  .f2f-trade-view[hidden] {
    display: none !important;
  }

  .f2f-quote-pair {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 6px;
  }

  .f2f-quote-card {
    border: 1px solid var(--f2f-border-strong);
    background: var(--f2f-bg-elevated);
    border-radius: 6px;
    padding: 8px;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 3px;
  }

  .f2f-quote-card.active.sell {
    border-color: var(--f2f-bear);
    background: var(--f2f-bear-soft);
  }

  .f2f-quote-card.active.buy {
    border-color: var(--f2f-bull);
    background: var(--f2f-bull-soft);
  }

  .f2f-seg {
    display: inline-flex;
    background: var(--f2f-bg-elevated);
    border: 1px solid var(--f2f-border);
    border-radius: 5px;
    padding: 2px;
    gap: 0;
  }

  .f2f-seg button {
    flex: 1 1 0;
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 5px 6px;
    border-radius: 3px;
    color: var(--f2f-text-secondary);
  }

  .f2f-seg button.active {
    background: var(--f2f-accent);
    color: #ffffff;
  }

  .f2f-qty-stepper {
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr) 32px;
    gap: 4px;
    align-items: center;
  }

  .f2f-qty-stepper button {
    height: 30px;
    padding: 0;
    border: 1px solid var(--f2f-border-strong);
    background: var(--f2f-bg-elevated);
    font-weight: 700;
  }

  .f2f-form-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px;
    min-width: 0;
  }

  .f2f-form-grid > * {
    min-width: 0;
  }

  .f2f-be-inputs {
    display: flex;
    gap: 4px;
    width: 100%;
    min-width: 0;
  }

  .f2f-be-inputs input {
    flex: 1 1 0;
    min-width: 0;
    width: 0;
  }

  .f2f-compact-sel {
    padding: 2px 4px;
    font-size: 0.65625rem;
  }

  .f2f-mini-control {
    padding: 1px 3px;
    font-size: 0.625rem;
  }

  .f2f-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
  }

  .f2f-field input,
  .f2f-field select {
    width: 100%;
    min-width: 0;
  }

  .f2f-field label {
    font-size: 10px;
    font-weight: 600;
    color: var(--f2f-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    display: flex;
    align-items: center;
    gap: 5px;
  }

  .f2f-bracket-check {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    text-transform: none;
  }

  .f2f-bracket-check input[type="checkbox"] {
    width: 14px;
    height: 14px;
    margin: 0;
    accent-color: var(--f2f-accent);
  }

  .f2f-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
  }

  .f2f-chip {
    font-size: 11px;
    min-height: 22px;
    padding: 3px 7px;
    border: 1px solid var(--f2f-border-strong);
    background: var(--f2f-bg-elevated);
    border-radius: 4px;
    font-family: var(--f2f-font-mono);
  }

  .f2f-chip:hover {
    border-color: var(--f2f-accent);
  }

  .f2f-primary-btn {
    width: 100%;
    padding: 9px 12px;
    font-weight: 700;
    font-size: 12px;
    border-radius: 5px;
    background: var(--f2f-accent);
    color: #ffffff;
    border: none;
  }

  .f2f-primary-btn.sell-mode {
    background: #be123c;
  }

  .f2f-primary-btn.buy-mode {
    background: #047857;
  }

  .f2f-primary-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
  }

  .f2f-metrics-box {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    padding: 8px;
    background: var(--f2f-bg-elevated);
    border: 1px solid var(--f2f-border);
    border-radius: 5px;
    font-size: 11px;
  }

  .f2f-ladder-box {
    border: 1px solid var(--f2f-border);
    border-radius: 5px;
    overflow: hidden;
  }

  .f2f-ladder-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 8px;
    font-size: 11px;
    font-family: var(--f2f-font-mono);
    font-variant-numeric: tabular-nums;
    cursor: pointer;
    border-bottom: 1px solid rgba(42, 46, 57, 0.35);
  }

  [data-theme="light"] .f2f-ladder-row {
    border-bottom-color: rgba(203, 213, 225, 0.72);
  }

  .f2f-ladder-row:hover {
    background-color: var(--f2f-bg-hover);
  }

  .f2f-ladder-row.ask {
    background-image: linear-gradient(
      to left,
      var(--f2f-ladder-ask-fill) 0%,
      var(--f2f-ladder-ask-fill) var(--f2f-depth-pct, 0%),
      transparent var(--f2f-depth-pct, 0%)
    );
  }

  .f2f-ladder-row.bid {
    background-image: linear-gradient(
      to left,
      var(--f2f-ladder-bid-fill) 0%,
      var(--f2f-ladder-bid-fill) var(--f2f-depth-pct, 0%),
      transparent var(--f2f-depth-pct, 0%)
    );
  }

  .f2f-code-area {
    width: 100%;
    min-height: 190px;
    resize: vertical;
    font-family: var(--f2f-font-mono);
    font-size: var(--f2f-code-font-size, 12px);
    line-height: 1.5;
    background: var(--f2f-bg-canvas);
  }

  .f2f-code-stage {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
    min-height: 170px;
    display: flex;
    flex-direction: column;
    font-family: var(--f2f-font-mono);
    font-size: var(--f2f-code-font-size, 12px);
    line-height: 1.5;
    letter-spacing: 0;
    background: var(--f2f-bg-canvas);
    border-radius: var(--f2f-radius-xs, 4px);
  }

  .f2f-code-highlight {
    position: absolute;
    inset: 0;
    z-index: 0;
    margin: 0;
    padding: 8px 10px;
    border: 1px solid transparent;
    border-radius: var(--f2f-radius-xs, 4px);
    font-family: var(--f2f-font-mono);
    font-size: var(--f2f-code-font-size, 12px);
    line-height: 1.5;
    letter-spacing: 0;
    tab-size: 2;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: break-word;
    overflow: hidden;
    pointer-events: none;
    color: var(--f2f-tok-plain);
    background: transparent;
    box-sizing: border-box;
  }

  .f2f-code-stage > textarea {
    position: relative;
    z-index: 1;
    flex: 1 1 auto;
    width: 100%;
    height: 100%;
    min-height: 170px;
    margin: 0;
    padding: 8px 10px;
    border: 1px solid var(--f2f-border-strong);
    border-radius: var(--f2f-radius-xs, 4px);
    font-family: var(--f2f-font-mono);
    font-size: var(--f2f-code-font-size, 12px);
    line-height: 1.5;
    letter-spacing: 0;
    tab-size: 2;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: break-word;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
    resize: none;
    background: transparent !important;
    color: transparent !important;
    caret-color: var(--f2f-text-primary);
    -webkit-text-fill-color: transparent;
    box-sizing: border-box;
  }

  .f2f-code-stage > textarea::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
  }

  .f2f-code-stage > textarea::selection {
    background: var(--f2f-tok-selection);
    color: transparent;
    -webkit-text-fill-color: transparent;
  }

  .f2f-tok-plain {
    color: var(--f2f-tok-plain);
  }

  .f2f-tok-kw {
    color: var(--f2f-tok-kw);
    font-weight: 600;
  }

  .f2f-tok-fn {
    color: var(--f2f-tok-fn);
  }

  .f2f-tok-var {
    color: var(--f2f-tok-var);
  }

  .f2f-tok-number {
    color: var(--f2f-tok-number);
  }

  .f2f-tok-string {
    color: var(--f2f-tok-string);
  }

  .f2f-tok-comment {
    color: var(--f2f-tok-comment);
    font-style: italic;
  }

  .f2f-tok-color {
    color: var(--f2f-tok-color);
  }

  .f2f-tok-op {
    color: var(--f2f-tok-op);
  }

  .f2f-ide-ac-popup {
    position: fixed;
    z-index: 260;
    width: min(280px, calc(100vw - 16px));
    max-width: calc(100vw - 16px);
    max-height: 180px;
    overflow-y: auto;
    padding: 4px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    background: var(--f2f-bg-elevated);
    border: none;
    border-radius: var(--f2f-radius-md, 8px);
    box-shadow: 0 0 0 1px var(--f2f-border-strong), var(--f2f-shadow);
  }

  .f2f-ide-ac-item {
    width: 100%;
    min-height: 24px;
    padding: 4px 7px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
    border: 1px solid transparent;
    border-radius: 5px;
    text-align: left;
    color: var(--f2f-text-primary);
    flex-shrink: 0;
  }

  .f2f-ide-ac-item:hover {
    background: var(--f2f-bg-hover);
  }

  .f2f-ide-ac-item.active {
    background: var(--f2f-accent-soft);
    border-color: rgba(59, 130, 246, 0.45);
  }

  .f2f-ide-ac-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--f2f-accent-text);
    line-height: 1.3;
  }

  .f2f-ide-ac-detail {
    font-size: 10px;
    color: var(--f2f-text-secondary);
    line-height: 1.3;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  #f2f-panel-script {
    overflow-y: auto;
  }

  #f2f-panel-script .f2f-code-stage {
    flex: 1 1 180px;
    min-height: 150px;
  }

  #f2f-panel-script .f2f-code-stage > textarea {
    min-height: 150px;
  }

  #f2f-script-run {
    width: auto;
    flex: 1 1 auto !important;
    white-space: nowrap;
    min-height: 28px;
    padding: 6px 10px;
  }

  #f2f-panel-script > div:has(#f2f-script-run) {
    gap: 5px !important;
  }

  #f2f-panel-script > div:has(#f2f-script-run) > .f2f-chip {
    flex: 0 1 auto;
    white-space: nowrap;
    min-height: 28px;
    padding: 4px 7px;
  }

  .f2f-gpu-canvas-host {
    width: 100%;
    height: 300px;
    min-height: 240px;
    position: relative;
    border: 1px solid var(--f2f-border-strong);
    border-radius: 6px;
    overflow: hidden;
    background: var(--f2f-bg-canvas);
  }

  /* ---- Zone 5: Bottom MT5 Account Manager (Inside Main Chart Column) ---- */
  .f2f-bottom-panel {
    height: var(--f2f-bottom-h);
    min-height: var(--f2f-bottom-collapsed-h);
    background: var(--f2f-bg-surface);
    border-top: 1px solid var(--f2f-border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex-shrink: 0;
  }

  .f2f-bottom-panel.collapsed {
    height: auto !important;
    min-height: var(--f2f-bottom-collapsed-h) !important;
  }

  .f2f-bottom-panel.maximized {
    height: 75dvh !important;
  }

  .f2f-bottom-panel.collapsed .f2f-bottom-body {
    display: none;
  }

  .f2f-bottom-header {
    min-height: var(--f2f-bottom-collapsed-h);
    height: auto;
    flex-shrink: 0;
    padding: 2px 6px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;
    gap: 4px 8px;
    border-bottom: 1px solid var(--f2f-border);
    background: var(--f2f-bg-elevated);
    overflow: hidden;
  }

  .f2f-bottom-tabs {
    display: inline-flex;
    align-items: center;
    gap: 1px;
    flex: 1 1 auto;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .f2f-bottom-tabs::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
  }

  .f2f-tab-btn {
    padding: 4px 5px;
    font-size: 0.65625rem;
    font-weight: 600;
    color: var(--f2f-text-secondary);
    border-bottom: 2px solid transparent;
    border-radius: 0;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .f2f-tab-btn.active {
    color: var(--f2f-text-primary);
    border-bottom-color: var(--f2f-accent);
  }

  .f2f-account-summary-strip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.625rem;
    flex: 0 0 auto;
    max-width: 100%;
    flex-wrap: nowrap;
    white-space: nowrap;
  }

  .f2f-bottom-body {
    flex: 1 1 0;
    min-height: 0;
    overflow: auto;
    padding: 6px 8px;
  }

  #f2f-account-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    min-width: 0;
  }

  /* MT5 Unified Table + Balance Separator Row */
  .f2f-mt5-table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--f2f-font-mono);
    font-size: 11px;
    white-space: nowrap;
  }

  .f2f-mt5-table th {
    text-align: left;
    padding: 5px 8px;
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--f2f-text-secondary);
    border-bottom: 1px solid var(--f2f-border);
    position: sticky;
    top: 0;
    z-index: 3;
    background: var(--f2f-bg-surface);
  }

  .f2f-mt5-table td {
    padding: 4px 8px;
    font-variant-numeric: tabular-nums;
    border-bottom: 1px solid rgba(42, 46, 57, 0.48);
  }

  [data-theme="light"] .f2f-mt5-table td {
    border-bottom-color: rgba(203, 213, 225, 0.72);
  }

  .f2f-mt5-subhead-row td {
    padding: 4px 8px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--f2f-text-secondary);
    background: var(--f2f-bg-elevated);
    border-top: 1px solid var(--f2f-border);
    border-bottom: 1px solid var(--f2f-border);
  }

  .f2f-mt5-balance-row td {
    background: var(--f2f-bg-elevated);
    border-top: 1px solid var(--f2f-border-strong);
    border-bottom: 1px solid var(--f2f-border-strong);
    padding: 5px 8px;
    font-size: 11px;
  }

  .f2f-row-act-btn,
  .f2f-row-close-btn {
    min-width: 24px;
    min-height: 22px;
    padding: 2px 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    border-radius: 3px;
    color: var(--f2f-text-secondary);
    border: 1px solid var(--f2f-border);
  }

  .f2f-row-act-btn:hover {
    color: var(--f2f-text-primary);
    background: var(--f2f-bg-hover);
    border-color: var(--f2f-border-strong);
  }

  .f2f-row-close-btn {
    font-size: 12px;
    font-weight: 700;
  }

  .f2f-row-close-btn:hover {
    color: #ffffff;
    background: var(--f2f-bear);
    border-color: var(--f2f-bear);
  }

  .f2f-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(110px, 1fr));
    gap: 8px;
    margin-bottom: 8px;
  }

  .f2f-kpi-card {
    background: var(--f2f-bg-elevated);
    border: 1px solid var(--f2f-border);
    border-radius: 5px;
    padding: 6px 10px;
    min-width: 0;
  }

  .f2f-kpi-card > div:first-child {
    gap: 6px;
    flex-wrap: wrap;
    min-width: 0;
  }

  .f2f-kpi-card select {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .f2f-calendar-grid-8 {
    display: grid;
    grid-template-columns: repeat(8, minmax(44px, 1fr));
    gap: 4px;
  }

  .f2f-cal-head {
    font-size: 0.625rem;
    font-weight: 700;
    color: var(--f2f-text-secondary);
    text-align: center;
    padding: 3px 2px;
  }

  .f2f-cal-cell {
    padding: 5px 4px;
    border-radius: 4px;
    background: var(--f2f-bg-elevated);
    border: 1px solid var(--f2f-border);
    text-align: center;
    font-size: 0.625rem;
    font-family: var(--f2f-font-mono);
  }

  /* ---- Symbol Modal ---- */
  .f2f-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(5, 8, 14, 0.72);
    z-index: 160;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding-top: 72px;
  }

  [data-theme="light"] .f2f-modal-backdrop {
    background: rgba(15, 23, 42, 0.36);
  }

  .f2f-modal-backdrop.open {
    display: flex;
  }

  .f2f-modal {
    width: min(560px, 94vw);
    max-height: 74vh;
    background: var(--f2f-bg-surface);
    border: none;
    border-radius: 8px;
    box-shadow: 0 0 0 1px var(--f2f-border-strong), var(--f2f-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .f2f-modal input,
  .f2f-modal select,
  .f2f-modal textarea {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
  }

  .f2f-ide-grid {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr);
    border: 1px solid var(--f2f-border);
    border-radius: var(--f2f-radius-xs, 4px);
    background: var(--f2f-bg-canvas);
    overflow: hidden;
  }

  .f2f-ide-gutter {
    padding: 6px 4px;
    min-width: 34px;
    flex-shrink: 0;
    white-space: pre;
    font-family: var(--f2f-font-mono);
    font-size: 11px;
    line-height: 1.5;
    text-align: right;
    color: var(--f2f-text-muted);
    background: var(--f2f-bg-elevated);
    border-right: 1px solid var(--f2f-border);
    user-select: none;
  }

  .f2f-ide-grid .f2f-code-area,
  .f2f-ide-editor {
    border: none;
    border-radius: 0;
    line-height: 1.5;
    font-size: 11px;
    padding: 6px 8px;
  }

  .f2f-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  /* ---- Mobile & Tablet Drawer Helpers ---- */
  .f2f-mobile-action-bar,
  .f2f-mobile-nav,
  .f2f-mobile-sheet,
  .f2f-desktop-close-drawer,
  .f2f-mobile-only,
  .f2f-tablet-scrim {
    display: none;
  }

  .f2f-stage.layout-1x1:not(.has-maximized) .f2f-cell-badge-btn,
  [data-layout="1x1"] .f2f-cell-badge-btn {
    display: none;
  }
}

@layer components {
  .f2f-topbar .f2f-tf-btn,
  #f2f-tf-more-btn,
  #f2f-topbar-more-btn {
    min-width: 24px;
  }

  #f2f-bottom-max-btn {
    min-width: 24px;
    min-height: 24px;
    padding: 0 5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  select#f2f-chart-type.f2f-sr-only {
    font-size: 16px;
  }

  #f2f-replay-more-btn {
    position: relative;
  }

  #f2f-replay-more-btn.active,
  #f2f-replay-more-btn.has-active-filters {
    border-color: var(--f2f-accent);
    background: var(--f2f-accent-soft);
    color: var(--f2f-accent-text);
  }

  #f2f-replay-more-btn.has-active-filters {
    padding-right: 14px;
  }

  #f2f-replay-more-btn.has-active-filters::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 5px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    transform: translateY(-50%);
    background: var(--f2f-warn);
  }

  /* Bottom IDE 220px cap & 1:1 synced gutter + highlight surface */
  .f2f-ide-grid {
    max-height: 220px;
    overflow: visible;
    align-items: stretch;
  }

  .f2f-ide-grid .f2f-ide-gutter {
    padding: 6px 4px;
    min-width: 34px;
    white-space: pre;
    font-family: var(--f2f-font-mono);
    font-size: var(--f2f-code-font-size, 12px);
    line-height: 1.5;
    max-height: 220px;
    overflow: hidden;
    border-radius: var(--f2f-radius-xs, 4px) 0 0 var(--f2f-radius-xs, 4px);
  }

  .f2f-ide-grid .f2f-code-stage {
    min-height: 110px;
    max-height: 220px;
    border-radius: 0 var(--f2f-radius-xs, 4px) var(--f2f-radius-xs, 4px) 0;
  }

  .f2f-ide-grid .f2f-code-highlight,
  .f2f-ide-grid .f2f-code-stage > textarea {
    min-height: 110px;
    max-height: 220px;
    padding: 6px 8px;
    border: none;
    border-radius: 0 var(--f2f-radius-xs, 4px) var(--f2f-radius-xs, 4px) 0;
    font-size: var(--f2f-code-font-size, 12px);
    line-height: 1.5;
  }

  /* Pro Object Tree */
  #f2f-obj-toolbar,
  .f2f-obj-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--f2f-border);
  }

  #f2f-obj-folder-form,
  .f2f-obj-folder-form {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px;
    border-radius: 5px;
    background: var(--f2f-bg-elevated);
    border: 1px solid var(--f2f-border-strong);
  }

  #f2f-obj-folder-form input {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 24px;
    padding: 3px 6px;
    font-size: 11px;
  }

  #f2f-obj-folder-form button {
    min-height: 24px;
    min-width: 24px;
    padding: 2px 7px;
  }

  .f2f-obj-folder {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--f2f-border);
    border-radius: 5px;
    background: var(--f2f-bg-elevated);
    overflow: hidden;
  }

  .f2f-obj-folder-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 5px 7px;
    background: var(--f2f-bg-elevated);
    border-bottom: 1px solid var(--f2f-border);
    font-size: 11px;
    font-weight: 700;
    color: var(--f2f-text-primary);
    cursor: pointer;
    min-width: 0;
  }

  .f2f-obj-folder-toggle,
  .f2f-obj-select-btn {
    min-height: 22px;
    min-width: 0;
  }

  .f2f-obj-folder.is-collapsed .f2f-obj-folder-head {
    border-bottom-color: transparent;
  }

  .f2f-obj-folder.is-collapsed .f2f-obj-folder-body {
    display: none;
  }

  .f2f-obj-folder-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 5px;
    background: var(--f2f-bg-surface);
  }

  .f2f-obj-item {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 5px;
    padding: 6px 7px;
    border-radius: 5px;
    border: 1px solid var(--f2f-border);
    background: var(--f2f-bg-elevated);
    font-size: 11px;
    min-width: 0;
    cursor: default;
    transition: background-color 110ms ease, border-color 110ms ease;
  }

  .f2f-obj-item:hover {
    background: var(--f2f-bg-hover);
    border-color: var(--f2f-border-strong);
  }

  .f2f-obj-item.selected,
  .f2f-obj-item.is-selected {
    background: var(--f2f-accent-soft);
    border-color: var(--f2f-accent);
  }

  .f2f-obj-item.is-hidden {
    opacity: 0.6;
  }

  .f2f-obj-item-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    width: 100%;
    min-width: 0;
  }

  .f2f-obj-item-main {
    display: inline-flex;
    align-items: center;
    flex: 1 1 auto;
    gap: 6px;
    min-width: 0;
    line-height: 1.3;
    overflow-wrap: anywhere;
  }

  .f2f-obj-select-btn {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 22px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0;
    border: none;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
  }

  .f2f-obj-select-btn > span:last-child,
  .f2f-obj-item-top .f2f-obj-name {
    flex: 1 1 auto;
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.3;
  }

  .f2f-obj-item-controls,
  .f2f-obj-item-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    width: 100%;
    min-width: 0;
    flex-wrap: wrap;
  }

  .f2f-obj-folder-sel,
  #f2f-object-tree-list select {
    flex: 1 1 70px;
    max-width: 120px;
    min-width: 56px;
    min-height: 22px;
    padding: 1px 4px;
    font-size: 10.5px;
    margin-right: auto;
  }

  .f2f-obj-dot {
    width: 9px;
    height: 9px;
    min-width: 9px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
    background-color: var(--f2f-tone-dot, var(--f2f-custom-color, var(--f2f-accent)));
    border: 1px solid rgba(255, 255, 255, 0.24);
  }

  [data-theme="light"] .f2f-obj-dot {
    border-color: rgba(15, 23, 42, 0.22);
  }

  .f2f-obj-act-btn {
    min-width: 22px;
    min-height: 22px;
    width: auto;
    padding: 0 5px;
    border-radius: 4px;
    border: 1px solid var(--f2f-border);
    background: transparent;
    color: var(--f2f-text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10.5px;
    font-weight: 600;
    line-height: 1;
    flex-shrink: 0;
  }

  .f2f-obj-act-btn:hover {
    background: var(--f2f-bg-hover);
    color: var(--f2f-text-primary);
    border-color: var(--f2f-border-strong);
  }

  .f2f-obj-act-btn.active,
  .f2f-obj-act-btn[aria-pressed="true"] {
    background: var(--f2f-accent-soft);
    color: var(--f2f-accent-text);
    border-color: var(--f2f-accent);
  }

  .f2f-obj-act-btn.danger:hover {
    background: var(--f2f-bear);
    color: #ffffff;
    border-color: var(--f2f-bear);
  }

  .f2f-obj-rename-input {
    flex: 1 1 auto;
    min-width: 60px;
    min-height: 22px;
    padding: 1px 6px;
    font-size: 11px;
    font-family: var(--f2f-font-mono);
    border: 1px solid var(--f2f-accent);
    border-radius: 3px;
    background: var(--f2f-bg-input);
    color: var(--f2f-text-primary);
  }

  .f2f-obj-empty {
    padding: 16px 12px;
    text-align: center;
    font-size: 11.5px;
    line-height: 1.5;
    color: var(--f2f-text-muted);
    border: 1px dashed var(--f2f-border-strong);
    border-radius: 6px;
    background: var(--f2f-bg-elevated);
  }

  .f2f-excursion-subtitle {
    font-size: 11px;
    line-height: 1.4;
    color: var(--f2f-text-secondary);
    margin: 2px 0 6px;
  }

  #f2f-rr-place-btn {
    background: #047857;
    border-color: rgba(16, 185, 129, 0.65);
    color: #ffffff;
    font-weight: 700;
    padding: 0 9px;
  }

  #f2f-rr-place-btn:hover:not(:disabled) {
    background: #059669;
    border-color: #34d399;
  }

  #f2f-rr-place-btn:active:not(:disabled) {
    filter: brightness(0.94);
  }
}

@layer responsive {
  @container maincol (max-width: 1180px) {
    .f2f-topbar .f2f-mobile-kbd,
    .f2f-topbar #f2f-theme-label,
    .f2f-topbar #f2f-ind-btn > span,
    .f2f-topbar #f2f-alert-top-btn > span,
    .f2f-topbar #f2f-replay-btn > span,
    .f2f-topbar #f2f-workspace-name,
    .f2f-topbar #f2f-glass-mode-tag {
      display: none;
    }

    .f2f-topbar .f2f-top-btn {
      padding: 0 4px;
    }
  }

  @container maincol (max-width: 680px) {
    .f2f-bottom-header {
      height: auto;
      min-height: var(--f2f-bottom-collapsed-h);
      flex-wrap: wrap;
    }

    .f2f-account-summary-strip {
      flex-wrap: wrap;
      white-space: normal;
    }
  }

  /* Tablet (`641px..1180px`): slide-over drawer right dock so Chart keeps width & Topbar never clips */
  @media (max-width: 1180px) and (min-width: 641px) {
    .f2f-app {
      grid-template-columns: minmax(240px, 1fr) 0px 0px var(--f2f-right-rail-w);
    }

    .f2f-v-resizer {
      display: none !important;
    }

    .f2f-right-dock {
      position: fixed;
      top: var(--f2f-header-h);
      bottom: 0;
      right: var(--f2f-right-rail-w);
      width: min(360px, calc(100vw - 46px));
      z-index: 80;
      box-shadow: var(--f2f-shadow);
    }

    .f2f-tablet-scrim,
    #f2f-tablet-scrim {
      right: var(--f2f-right-rail-w);
    }

    .f2f-tablet-scrim.open,
    #f2f-tablet-scrim.open {
      display: block;
      position: fixed;
      inset: var(--f2f-header-h) var(--f2f-right-rail-w) 0 0;
      right: var(--f2f-right-rail-w);
      background: rgba(5, 8, 14, 0.48);
      z-index: 75;
    }

    [data-theme="light"] .f2f-tablet-scrim.open,
    [data-theme="light"] #f2f-tablet-scrim.open {
      background: rgba(15, 23, 42, 0.25);
    }

    .f2f-desktop-close-drawer {
      display: inline-flex;
    }

    .f2f-tablet-hide,
    .f2f-tablet-secondary {
      display: none !important;
    }

    .f2f-topbar .f2f-tablet-more-only {
      display: inline-flex;
    }

    #f2f-session-text {
      max-width: 22ch;
      overflow: hidden;
      text-overflow: ellipsis;
    }
  }

  @media (max-width: 960px) and (min-width: 641px) {
    .f2f-tab-btn {
      padding: 4px 4px;
      font-size: 0.625rem;
    }

    .f2f-scalebar {
      padding: 2px 6px;
      gap: 4px;
    }
  }

  /* Short Landscape (`max-height: 500px`, e.g. 812x375): protect stage >=120px & keep DPR 1:1 */
  @media (max-height: 500px) {
    :root {
      --f2f-header-h: 2.25rem;
      --f2f-scalebar-h: 1.5rem;
      --f2f-bottom-collapsed-h: 1.75rem;
    }

    .f2f-bottom-panel:not(.collapsed):not(.maximized) {
      height: 110px !important;
    }

    .f2f-h-resizer {
      display: none !important;
    }

    .f2f-fav-toolbar,
    .f2f-oneclick-tile {
      display: none !important;
    }

    .f2f-cell-hud {
      max-height: calc(100% - 22px);
      overflow-y: auto;
      scrollbar-width: none;
    }

    .f2f-rail-btn {
      flex-shrink: 0;
      min-height: 28px;
      height: 28px;
    }

    .f2f-scalebar {
      overflow-x: auto;
      flex-wrap: nowrap;
      scrollbar-width: none;
    }

    .f2f-scalebar::-webkit-scrollbar {
      display: none;
      width: 0;
      height: 0;
    }

    .f2f-scalebar-right {
      flex-wrap: nowrap;
      white-space: nowrap;
      flex-shrink: 0;
    }

    .f2f-replay-bar,
    #f2f-replay-bar {
      max-height: none;
    }

    .f2f-replay-bar select,
    .f2f-replay-bar input:not([type="range"]),
    #f2f-replay-settings-popover select,
    #f2f-replay-settings-popover input:not([type="range"]),
    .f2f-replay-settings-popover select,
    .f2f-replay-settings-popover input:not([type="range"]),
    .f2f-pro-modal select,
    .f2f-pro-modal input:not([type="checkbox"]):not([type="color"]):not([type="range"]),
    .f2f-pro-modal textarea {
      font-size: max(16px, 1rem);
      min-height: 44px;
    }

    .f2f-replay-bar input[type="range"],
    #f2f-replay-settings-popover input[type="range"] {
      font-size: max(16px, 1rem);
    }

    .f2f-replay-bar .f2f-chip,
    #f2f-replay-settings-popover .f2f-chip {
      min-height: 36px;
    }
  }

  /* Mobile (`<= 640px`): Single-hand bottom nav + >=44px touch buttons + 16px inputs */
  @media (max-width: 640px) {
    .f2f-app {
      display: flex;
      flex-direction: column;
    }

    .f2f-left-rail,
    .f2f-right-dock,
    .f2f-right-rail,
    .f2f-v-resizer,
    .f2f-h-resizer,
    .f2f-bottom-panel,
    .f2f-oneclick-tile,
    .f2f-desktop-only {
      display: none !important;
    }

    .f2f-mobile-only {
      display: inline-flex;
    }

    .f2f-topbar {
      min-height: 44px;
      height: auto;
      padding: 0 4px;
      gap: 2px;
      flex-wrap: nowrap;
      overflow: hidden;
    }

    .f2f-brand {
      font-size: 0.71875rem;
      gap: 3px;
    }

    .f2f-brand svg {
      width: 15px;
      height: 15px;
    }

    .f2f-pill {
      padding: 1px 5px;
      font-size: 0.625rem;
    }

    .f2f-mobile-kbd,
    .f2f-tf-btn:not(.active),
    #f2f-theme-label {
      display: none !important;
    }

    .f2f-tf-btn.active {
      display: inline-flex !important;
    }

    .f2f-topbar .f2f-top-btn,
    .f2f-select-compact {
      min-height: 44px;
      min-width: 44px;
      padding: 0 5px;
      font-size: 0.71875rem;
    }

    .f2f-top-icon-btn,
    #f2f-theme-btn,
    #f2f-mobile-more-btn {
      min-width: 44px;
      min-height: 44px;
    }

    .f2f-cell-hud {
      top: 4px;
      left: 6px;
      right: 56px;
      max-width: calc(100% - 62px);
    }

    .f2f-cell-hud-card {
      max-width: 100%;
      padding: 2px 8px;
      gap: 5px;
      overflow: hidden;
    }

    .f2f-cell-badge-btn,
    .f2f-cell-max-btn {
      white-space: nowrap;
      flex-shrink: 0;
      min-width: 44px;
      min-height: 44px;
    }

    .f2f-ohlc-readout {
      flex: 1 1 auto;
      min-width: 0;
      max-width: none;
      overflow: hidden;
      text-overflow: ellipsis;
      font-size: 0.625rem;
      gap: 4px;
    }

    .f2f-legend-collapse-btn {
      flex-shrink: 0;
      min-width: 26px;
      min-height: 26px;
    }

    .f2f-scalebar {
      min-height: 44px;
      padding: 0 4px;
      gap: 4px;
      overflow-x: auto;
      flex-wrap: nowrap;
      scrollbar-width: none;
    }

    .f2f-scalebar::-webkit-scrollbar {
      display: none;
      width: 0;
      height: 0;
    }

    .f2f-scalebar-right {
      margin-left: 0 !important;
      flex-wrap: nowrap;
      white-space: nowrap;
      flex-shrink: 0;
      justify-content: flex-start;
    }

    .f2f-qty-stepper {
      grid-template-columns: 44px minmax(0, 1fr) 44px;
    }

    .f2f-qty-stepper button {
      min-width: 44px;
      min-height: 44px;
      height: 44px;
    }

    .f2f-replay-bar,
    #f2f-replay-bar {
      max-height: none;
    }

    .f2f-replay-bar select,
    .f2f-replay-bar input:not([type="range"]),
    #f2f-replay-settings-popover select,
    #f2f-replay-settings-popover input:not([type="range"]),
    .f2f-replay-settings-popover select,
    .f2f-replay-settings-popover input:not([type="range"]) {
      font-size: max(16px, 1rem);
      min-height: 44px;
    }

    .f2f-replay-bar input[type="range"],
    #f2f-replay-settings-popover input[type="range"] {
      font-size: max(16px, 1rem);
    }

    #f2f-replay-settings-popover,
    .f2f-replay-settings-popover {
      z-index: 90;
    }

    .f2f-replay-bar .f2f-chip,
    #f2f-replay-settings-popover .f2f-chip,
    #f2f-replay-settings-popover #f2f-replay-balance-wrap {
      min-height: 44px;
    }

    .f2f-session-track {
      width: 22px;
    }

    .f2f-session-pill {
      min-width: 44px;
      min-height: 44px;
      font-size: 0.625rem;
      padding: 0 6px;
      gap: 4px;
    }

    .f2f-tz-btn {
      min-width: 44px;
      min-height: 44px;
      font-size: 0.625rem;
      padding: 0 6px;
    }

    .f2f-scale-btn {
      min-width: 44px;
      min-height: 44px;
      font-size: 0.625rem;
      padding: 0 6px;
    }

    .f2f-main-col {
      flex: 1 1 auto;
      width: 100%;
      padding-bottom: 104px;
    }

    .f2f-mobile-action-bar {
      position: fixed;
      left: 0;
      right: 0;
      bottom: 52px;
      height: 52px;
      z-index: 85;
      background: var(--f2f-bg-surface);
      border: none;
      box-shadow: inset 0 1px 0 var(--f2f-border);
      display: grid;
      grid-template-columns: 1fr auto 1fr;
      align-items: center;
      gap: 6px;
      padding: 4px 8px;
    }

    .f2f-mobile-action-bar button {
      min-height: 44px;
      font-weight: 700;
      font-size: 0.8125rem;
    }

    .f2f-mobile-action-bar input {
      font-size: max(16px, 1rem);
      min-height: 40px;
    }

    #f2f-mob-lot {
      width: 68px;
      min-height: 44px;
      text-align: center;
      font-size: max(16px, 1rem);
      padding: 4px 4px;
    }

    .f2f-mobile-nav {
      position: fixed;
      left: 0;
      right: 0;
      bottom: 0;
      height: 52px;
      z-index: 86;
      background: var(--f2f-bg-surface);
      border-top: 1px solid var(--f2f-border);
      display: grid;
      grid-template-columns: repeat(5, 1fr);
      padding-bottom: env(safe-area-inset-bottom, 0px);
    }

    .f2f-mobile-tab {
      min-height: 44px;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 2px;
      font-size: 0.625rem;
      font-weight: 600;
      color: var(--f2f-text-secondary);
      border-radius: 0;
    }

    .f2f-mobile-tab.active {
      color: var(--f2f-accent-text);
      background: var(--f2f-accent-soft);
    }

    .f2f-mobile-sheet {
      position: fixed;
      left: 0;
      right: 0;
      bottom: 52px;
      max-height: calc(100dvh - 56px);
      z-index: 92;
      background: var(--f2f-bg-surface);
      border: none;
      border-radius: 12px 12px 0 0;
      box-shadow: inset 0 2px 0 var(--f2f-accent), 0 0 0 1px var(--f2f-border-strong), var(--f2f-shadow);
      display: none;
      flex-direction: column;
      overflow: hidden;
    }

    .f2f-mobile-sheet.open {
      display: flex;
    }

    .f2f-mobile-sheet-head {
      min-height: 48px;
      padding: 6px 12px;
      border-bottom: 1px solid var(--f2f-border);
      display: flex;
      align-items: center;
      justify-content: space-between;
      font-weight: 700;
      font-size: 0.875rem;
    }

    .f2f-mobile-sheet-head button {
      min-width: 44px;
      min-height: 44px;
    }

    .f2f-mobile-sheet-body {
      flex: 1 1 auto;
      min-height: 0;
      overflow-x: hidden;
      overflow-y: auto;
      padding: 10px 12px;
    }

    .f2f-mobile-sheet-body button {
      min-height: 44px;
    }

    .f2f-mobile-sheet-body .f2f-chip,
    .f2f-mobile-sheet-body .f2f-watch-mini-btn,
    .f2f-watch-listbar button,
    .f2f-mobile-sheet-body .f2f-watch-flag-pill,
    .f2f-mobile-sheet-body .f2f-row-act-btn,
    .f2f-mobile-sheet-body .f2f-row-close-btn,
    .f2f-mobile-sheet-body .f2f-obj-act-btn {
      min-width: 44px;
      min-height: 44px;
    }

    .f2f-mobile-sheet-body .f2f-watch-cat {
      min-width: 44px;
      min-height: 44px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
    }

    #f2f-ticket-detach-btn {
      display: none !important;
    }

    .f2f-bottom-header {
      height: auto;
      min-height: var(--f2f-bottom-collapsed-h);
      flex-wrap: wrap;
    }

    .f2f-account-summary-strip {
      flex-wrap: wrap;
      white-space: normal;
    }

    .f2f-watch-listbar {
      flex-wrap: wrap;
    }

    .f2f-mobile-sheet-body input,
    .f2f-mobile-sheet-body select,
    .f2f-mobile-sheet-body textarea,
    .f2f-modal input,
    .f2f-modal select,
    .f2f-modal textarea {
      min-height: 44px;
      font-size: max(16px, 1rem);
    }

    .f2f-mobile-sheet-body .f2f-code-stage {
      --f2f-code-font-size: max(16px, 1rem);
    }

    .f2f-mobile-sheet-body .f2f-dock-panel,
    .f2f-mobile-sheet-body .f2f-bottom-panel {
      display: flex !important;
      height: auto !important;
      overflow: visible !important;
      padding: 0;
      border: none;
      max-width: 100%;
    }
  }

  @media (max-width: 480px) {
    .f2f-brand-name {
      display: none;
    }
  }

  @media (max-width: 380px) {
    .f2f-topbar {
      padding: 0 2px;
      gap: 2px;
    }

    .f2f-topbar > .f2f-topbar-group:first-child {
      flex: 1 1 auto;
      min-width: 0;
      gap: 2px;
    }

    .f2f-topbar > .f2f-topbar-group:last-child {
      flex: 0 0 auto;
      gap: 1px;
    }

    .f2f-topbar .f2f-divider-v {
      display: none;
    }

    .f2f-topbar .f2f-brand {
      flex: 0 0 auto;
      gap: 2px;
      padding-right: 0;
    }

    #f2f-sim-badge {
      padding: 1px 3px;
      font-size: 0.625rem;
    }

    #f2f-symbol-btn {
      min-width: 0;
      flex: 1 1 auto;
      max-width: 118px;
      overflow: hidden;
      padding: 0 4px;
      justify-content: flex-start;
    }

    #f2f-symbol-btn svg {
      flex-shrink: 0;
    }

    #f2f-symbol-label {
      min-width: 0;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
  }

  @media (pointer: coarse) {
    :root {
      --f2f-left-w: 48px;
      --f2f-right-rail-w: 48px;
    }

    .f2f-topbar {
      min-height: 44px;
      height: auto;
    }

    .f2f-topbar .f2f-top-btn,
    .f2f-topbar .f2f-select-compact,
    .f2f-top-icon-btn,
    #f2f-theme-btn,
    #f2f-mobile-more-btn,
    #f2f-topbar-more-btn {
      min-height: 44px;
      min-width: 44px;
    }

    .f2f-rail-btn {
      min-width: 44px;
      min-height: 44px;
      width: 44px;
      height: 44px;
      flex-shrink: 0;
    }

    .f2f-scalebar {
      min-height: 44px;
    }

    .f2f-scale-btn,
    .f2f-session-pill,
    .f2f-tz-btn {
      min-height: 44px;
      min-width: 44px;
    }

    .f2f-bottom-header {
      min-height: 44px;
    }

    .f2f-tab-btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-width: 44px;
      min-height: 44px;
    }

    .f2f-trade-subtab,
    .f2f-detail-tab,
    .f2f-watch-cat,
    .f2f-ord-type-btn,
    .f2f-primary-btn,
    .f2f-oc-btn,
    .f2f-ctx-item,
    .f2f-flyout-item,
    .f2f-tz-item,
    .f2f-layout-btn {
      min-height: 44px;
    }

    .f2f-chip,
    .f2f-qty-stepper button,
    .f2f-row-act-btn,
    .f2f-row-close-btn,
    .f2f-obj-act-btn,
    .f2f-goto-rt-btn,
    .f2f-dock-header button,
    .f2f-modal button:not(.f2f-swatch) {
      min-width: 44px;
      min-height: 44px;
    }

    .f2f-replay-bar,
    #f2f-replay-bar {
      max-height: none;
    }

    .f2f-replay-bar .f2f-chip,
    .f2f-replay-bar select,
    .f2f-replay-bar input:not([type="range"]),
    #f2f-replay-settings-popover .f2f-chip,
    #f2f-replay-settings-popover select,
    #f2f-replay-settings-popover input:not([type="range"]),
    #f2f-replay-settings-popover #f2f-replay-balance-wrap,
    .f2f-replay-settings-popover select,
    .f2f-replay-settings-popover input:not([type="range"]),
    .f2f-modal input:not([type="checkbox"]):not([type="color"]):not([type="range"]),
    .f2f-modal select,
    .f2f-modal textarea {
      min-height: 44px;
      font-size: max(16px, 1rem);
    }

    .f2f-replay-bar input[type="range"],
    #f2f-replay-settings-popover input[type="range"] {
      font-size: max(16px, 1rem);
    }
  }
}

@layer forced {
  :root[data-solid-ui="true"],
  :root[data-glass-mode="solid"] {
    --f2f-hud-bg: var(--f2f-bg-surface);
  }

  [data-solid-ui="true"] .f2f-cell-hud-card,
  [data-solid-ui="true"] .f2f-oneclick-tile,
  [data-solid-ui="true"] .f2f-pane-controls,
  [data-solid-ui="true"] .f2f-fav-toolbar,
  [data-solid-ui="true"] #f2f-pro-modal-backdrop,
  [data-solid-ui="true"] .f2f-quick-tf-hud,
  [data-solid-ui="true"] .f2f-chart-zoom-bar,
  [data-glass-mode="solid"] .f2f-cell-hud-card,
  [data-glass-mode="solid"] .f2f-oneclick-tile,
  [data-glass-mode="solid"] .f2f-pane-controls,
  [data-glass-mode="solid"] .f2f-fav-toolbar,
  [data-glass-mode="solid"] #f2f-pro-modal-backdrop,
  [data-glass-mode="solid"] .f2f-quick-tf-hud,
  [data-glass-mode="solid"] .f2f-chart-zoom-bar {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  [data-solid-ui="true"] #f2f-pro-modal-backdrop,
  [data-glass-mode="solid"] #f2f-pro-modal-backdrop {
    background: rgba(5, 8, 14, 0.88);
  }

  [data-theme="light"][data-solid-ui="true"] #f2f-pro-modal-backdrop,
  [data-theme="light"][data-glass-mode="solid"] #f2f-pro-modal-backdrop {
    background: rgba(15, 23, 42, 0.56);
  }

  @media (prefers-reduced-transparency: reduce) {
    :root:not([data-solid-ui="false"]) {
      --f2f-hud-bg: var(--f2f-bg-surface);
    }

    :root:not([data-solid-ui="false"]) .f2f-cell-hud-card,
    :root:not([data-solid-ui="false"]) .f2f-oneclick-tile,
    :root:not([data-solid-ui="false"]) .f2f-pane-controls,
    :root:not([data-solid-ui="false"]) .f2f-fav-toolbar,
    :root:not([data-solid-ui="false"]) #f2f-pro-modal-backdrop,
    :root:not([data-solid-ui="false"]) .f2f-quick-tf-hud,
    :root:not([data-solid-ui="false"]) .f2f-chart-zoom-bar {
      -webkit-backdrop-filter: none;
      backdrop-filter: none;
    }

    :root:not([data-solid-ui="false"]) #f2f-pro-modal-backdrop {
      background: rgba(5, 8, 14, 0.88);
    }

    :root[data-theme="light"]:not([data-solid-ui="false"]) #f2f-pro-modal-backdrop {
      background: rgba(15, 23, 42, 0.56);
    }
  }

  @media (forced-colors: active) {
    :root {
      --f2f-hud-bg: Canvas;
    }

    .f2f-cell-hud-card,
    .f2f-oneclick-tile,
    .f2f-pane-controls,
    .f2f-fav-toolbar,
    #f2f-pro-modal-backdrop,
    .f2f-quick-tf-hud,
    .f2f-chart-zoom-bar {
      -webkit-backdrop-filter: none;
      backdrop-filter: none;
    }

    .f2f-chart-cell.active-cell,
    .f2f-top-btn.active,
    .f2f-rail-btn.active,
    .f2f-mobile-tab.active {
      outline: 2px solid Highlight;
    }

    button {
      border: 1px solid ButtonText;
    }
  }
}

@layer layout {
  /* ---- Upgraded Features: 3-Day Overlay, Latency Pill, Rolling Digits, A11y Resizers, Playbook/Journal ---- */
  .f2f-threeday-host {
    position: absolute;
    inset: 0 0 28px 0;
    z-index: 22;
    background: var(--f2f-bg-canvas);
    display: flex;
    flex-direction: column;
  }

  .f2f-threeday-host[hidden] {
    display: none;
  }

  .f2f-td-root {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    min-height: 0;
  }

  .f2f-td-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 6px 12px;
    border-bottom: 1px solid var(--f2f-border);
    background: var(--f2f-bg-surface);
    font-size: 12px;
  }

  .f2f-td-head-left {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
  }

  .f2f-td-legend {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 11px;
  }

  .f2f-td-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--f2f-text-secondary);
  }

  .f2f-td-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
  }

  .f2f-td-plot {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
  }

  .f2f-td-svg {
    display: block;
    width: 100%;
    height: 100%;
    cursor: crosshair;
  }

  .f2f-td-tooltip {
    position: absolute;
    pointer-events: none;
    background: var(--f2f-bg-elevated);
    border: none;
    border-radius: 4px;
    padding: 5px 8px;
    font-size: 10.5px;
    box-shadow: 0 0 0 1px var(--f2f-border-strong), 0 8px 20px rgba(0, 0, 0, 0.35);
    min-width: 125px;
    z-index: 4;
  }

  .f2f-td-tip-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 2px;
  }

  .f2f-td-msg {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--f2f-text-muted);
    font-size: 12px;
  }

  .f2f-td-msg[hidden],
  .f2f-td-tooltip[hidden] {
    display: none;
  }

  .f2f-td-session-strip {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 4px 14px 5px;
    border-top: 1px solid var(--f2f-border);
    background: var(--f2f-bg-surface);
  }

  .f2f-td-session-lane {
    position: relative;
    height: 15px;
  }

  .f2f-td-session-box {
    position: absolute;
    top: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.4px;
    border-radius: 2px;
    background: rgba(56, 189, 248, 0.14);
    border: 1px solid rgba(56, 189, 248, 0.28);
    color: var(--f2f-text-secondary);
    overflow: hidden;
    white-space: nowrap;
  }

  .f2f-latency-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 1.375rem;
    padding: 0 7px;
    border-radius: 3px;
    font-size: 0.65625rem;
    background: var(--f2f-bg-elevated);
    border: 1px solid var(--f2f-border);
    color: var(--f2f-text-secondary);
    white-space: nowrap;
  }

  .f2f-lat-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--f2f-bull);
  }

  .f2f-latency-pill.warn .f2f-lat-dot {
    background: #f59e0b;
  }

  .f2f-latency-pill.err .f2f-lat-dot {
    background: var(--f2f-bear);
  }

  @keyframes f2fRollUp {
    0% { transform: translateY(45%); opacity: 0.25; }
    100% { transform: translateY(0); opacity: 1; }
  }

  @keyframes f2fRollDown {
    0% { transform: translateY(-45%); opacity: 0.25; }
    100% { transform: translateY(0); opacity: 1; }
  }

  .f2f-roll-char {
    display: inline-block;
  }

  .f2f-roll-char.f2f-roll-up {
    color: var(--f2f-bull-text);
    animation: f2fRollUp 0.18s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  }

  .f2f-roll-char.f2f-roll-down {
    color: var(--f2f-bear-text);
    animation: f2fRollDown 0.18s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  }

  @media (prefers-reduced-motion: reduce) {
    .f2f-roll-char.f2f-roll-up,
    .f2f-roll-char.f2f-roll-down {
      animation: none;
    }
  }

  .f2f-v-resizer:focus-visible,
  .f2f-h-resizer:focus-visible,
  .f2f-watch-resizer:focus-visible {
    outline: 2px solid var(--f2f-accent);
    outline-offset: -1px;
    background: var(--f2f-accent);
  }

  .f2f-cmd-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 60px;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 700;
    background: var(--f2f-accent-dim);
    color: var(--f2f-accent-text);
    border: 1px solid var(--f2f-border-strong);
  }

  .f2f-grade-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    padding: 1px 6px;
    border-radius: 3px;
    font-weight: 700;
    font-size: 10.5px;
    border: 1px solid var(--f2f-border);
    color: var(--f2f-text-secondary);
  }

  .f2f-grade-pill.grade-A {
    color: var(--f2f-bull-text);
    border-color: var(--f2f-bull);
    background: rgba(8, 153, 129, 0.12);
  }

  .f2f-grade-pill.grade-B {
    color: var(--f2f-warn-text);
    border-color: var(--f2f-warn);
    background: rgba(245, 158, 11, 0.12);
  }

  [data-theme="light"] .f2f-grade-pill.grade-B {
    color: #92400e;
    border-color: #b45309;
    background: rgba(217, 119, 6, 0.14);
  }

  .f2f-grade-pill.grade-C {
    color: var(--f2f-bear-text);
    border-color: var(--f2f-bear);
    background: rgba(242, 54, 69, 0.12);
  }

  .f2f-pb-grid {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 10px;
    min-height: 170px;
  }

  .f2f-pb-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    border-right: 1px solid var(--f2f-border);
    padding-right: 8px;
  }

  .f2f-pb-item {
    text-align: left;
    padding: 6px 8px;
    border-radius: 4px;
    border: 1px solid var(--f2f-border);
    background: var(--f2f-bg-surface);
    color: var(--f2f-text-primary);
    font-size: 11px;
    cursor: pointer;
  }

  .f2f-pb-item.active {
    border-color: var(--f2f-accent);
    background: var(--f2f-accent-dim);
  }

  .f2f-pb-detail {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 11px;
  }

  .f2f-journal-checklist-box {
    margin-top: 6px;
    padding: 8px 10px;
    border: 1px solid var(--f2f-border-strong);
    border-radius: 4px;
    background: var(--f2f-bg-surface);
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 11px;
  }
}
