* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; background: #131722; color: #d1d4dc; font-family: -apple-system, "Segoe UI", Roboto, sans-serif; overflow: hidden; }

header { display: flex; align-items: center; gap: 12px; padding: 8px 12px; background: #0f1218; border-bottom: 1px solid #1e222d; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; letter-spacing: 0.4px; font-size: 14px; }
.brand .logo { width: 24px; height: 24px; flex-shrink: 0; }
.brand span { background: linear-gradient(120deg, #26a69a, #4dd0c1); -webkit-background-clip: text; background-clip: text; color: transparent; }
.setup { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.setup input, .setup select, .setup button { background: #1e222d; color: #d1d4dc; border: 1px solid #2a2e39; border-radius: 4px; padding: 4px 8px; }
.setup button { cursor: pointer; background: #2962ff; border-color: #2962ff; }
.setup button:hover { background: #1d4ed8; }
#status {
  position: fixed; bottom: 12px; right: 12px;
  font-size: 11px; color: #d1d4dc;
  background: rgba(15, 18, 24, 0.92);
  border: 1px solid #2a2e39;
  padding: 4px 10px; border-radius: 4px;
  pointer-events: none; z-index: 1000;
  max-width: 360px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
  opacity: 0; transition: opacity 0.15s;
}
#status:not(:empty) { opacity: 1; }
.user-info { margin-left: auto; position: relative; }
.user-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: #26a69a;
  color: #0f1218;
  border: 0;
  font: 600 13px/1 inherit;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0,0,0,0.4);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.user-avatar:hover { transform: translateY(-1px); box-shadow: 0 3px 8px rgba(0,0,0,0.45); }
.user-avatar:active { transform: translateY(0); }
.user-avatar.is-guest { background: #3a4255; color: #d1d4dc; }
.user-menu {
  position: absolute; top: calc(100% + 6px); right: 0;
  min-width: 220px; max-width: 280px;
  background: #161a22;
  border: 1px solid #232936;
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.55);
  padding: 6px;
  z-index: 1500;
  animation: usermenu-pop 0.12s ease-out;
}
.user-menu[hidden] { display: none; }
.user-menu-label {
  font-size: 12px; color: #d1d4dc;
  padding: 6px 10px;
  word-break: break-all;
  border-bottom: 1px solid #232936;
  margin-bottom: 4px;
}
.user-menu-hint {
  font-size: 11px; color: #8a93a3;
  padding: 4px 10px 6px;
}
.user-menu-item {
  display: block; width: 100%;
  background: transparent; color: #d1d4dc;
  border: 0; border-radius: 6px;
  padding: 8px 10px;
  font: inherit; font-size: 13px; text-align: left;
  cursor: pointer;
}
.user-menu-item:hover { background: #2a2e39; }
.user-menu-item.primary-item { color: #26a69a; font-weight: 600; }
.user-menu-item.primary-item:hover { background: rgba(38,166,154,0.12); }
@keyframes usermenu-pop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- Auth modal (overlay on top of the chart) ----------
   Uses the same auth-card styles as /login. The backdrop dims the chart
   behind, and clicking the backdrop or pressing Escape closes the modal. */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(7, 9, 13, 0.78);
  display: grid; place-items: center;
  z-index: 2000;
  padding: 20px;
  padding-top: max(20px, env(safe-area-inset-top));
  padding-bottom: max(20px, env(safe-area-inset-bottom));
  backdrop-filter: blur(2px);
  animation: modal-fade 0.15s ease-out;
}
.modal-backdrop[hidden] { display: none; }
.modal-card {
  position: relative;
  width: min(380px, 100%);
  background: #161a22;
  color: #e6e9ee;
  border: 1px solid #232936;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  animation: modal-pop 0.15s ease-out;
}
.modal-close {
  position: absolute; top: 6px; right: 8px;
  background: none; border: 0; color: #d1d4dc;
  font-size: 26px; line-height: 1;
  cursor: pointer; padding: 4px 10px;
  opacity: 0.55;
}
.modal-close:hover { opacity: 1; }

/* The auth form pieces (same layout as /login). */
.modal-card .brand { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.modal-card .brand svg { width: 32px; height: 32px; }
.modal-card .brand span { font-weight: 600; color: #e6e9ee; }
.modal-card h1 { margin: 0 0 6px; font-size: 22px; }
.modal-card .subtitle { margin: 0 0 18px; opacity: 0.7; font-size: 13px; }
.modal-card form { display: grid; gap: 10px; }
.modal-card input[type=email],
.modal-card input[type=password] {
  width: 100%; padding: 10px 12px;
  background: #0f1218; color: #e6e9ee;
  border: 1px solid #2a3142; border-radius: 8px;
  font: inherit;
}
.modal-card button.primary {
  padding: 10px 12px; background: #26a69a; color: #0f1218;
  border: 0; border-radius: 8px; font-weight: 600; cursor: pointer;
}
.modal-card button.primary:hover { background: #34c5b8; }
.modal-card .divider {
  display: flex; align-items: center; gap: 12px;
  margin: 14px 0 8px; opacity: 0.6; font-size: 12px;
}
.modal-card .divider::before, .modal-card .divider::after {
  content: ""; flex: 1; height: 1px; background: #232936;
}
.modal-card .google-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 10px; background: #fff; color: #1a1a1a; border-radius: 8px;
  text-decoration: none; font-weight: 600; cursor: pointer; border: 0; font: inherit;
}
.modal-card .google-btn:hover { background: #f3f3f3; }
.modal-card .toggle { text-align: center; font-size: 13px; opacity: 0.75; margin-top: 12px; }
.modal-card .toggle a { color: #90caf9; cursor: pointer; }
.modal-card .error { color: #ef5350; font-size: 13px; min-height: 1em; }

@keyframes modal-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-pop  { from { transform: translateY(8px); opacity: 0; }
                         to { transform: translateY(0);    opacity: 1; } }

.symbol-picker { position: relative; }
.symbol-picker > input { min-width: 130px; }
.symbol-popover {
  position: absolute; top: calc(100% + 4px); left: 0;
  width: 320px; max-height: 360px; overflow: auto;
  background: #1e222d; color: #d1d4dc;
  border: 1px solid #2a2e39; border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.45);
  z-index: 200; padding: 6px;
}
.symbol-picker[hidden] { display: none; }
.symbol-section + .symbol-section { margin-top: 8px; padding-top: 6px; border-top: 1px solid #2a2e39; }
.symbol-section-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; color: #8a93a3; padding: 2px 6px; }
.symbol-list { display: flex; flex-direction: column; gap: 2px; }
.symbol-row { display: flex; align-items: center; gap: 4px; padding: 0 2px; }
.symbol-row .symbol-pick {
  flex: 1; text-align: left; background: transparent; color: #d1d4dc;
  border: 1px solid transparent; border-radius: 4px;
  padding: 4px 8px; font: inherit; font-size: 12px; cursor: pointer;
}
.symbol-row .symbol-pick:hover { background: #2a2e39; border-color: #2a2e39; }
.symbol-row .symbol-add, .symbol-row .symbol-del {
  background: #1e222d; color: #d1d4dc; border: 1px solid #2a2e39; border-radius: 4px;
  width: 24px; height: 24px; cursor: pointer; padding: 0; font-size: 14px; line-height: 1;
}
.symbol-row .symbol-add:hover:not(:disabled) { background: #26a69a; color: #0f1218; border-color: #26a69a; }
.symbol-row .symbol-del:hover { background: #ef5350; color: #fff; border-color: #ef5350; }
.symbol-row .symbol-add:disabled { opacity: 0.6; cursor: default; }
.symbol-empty { font-size: 11px; padding: 6px 8px; color: #8a93a3; }
.live-indicator { font-size: 11px; font-weight: 700; color: #81c784; letter-spacing: 0.5px;
  display: inline-flex; align-items: center; gap: 4px;
  animation: live-pulse 1.5s ease-in-out infinite; }
@keyframes live-pulse { 0%, 100% { opacity: 1 } 50% { opacity: 0.55 } }
/* hide replay-only controls in live mode */
.live-mode .controls,
.live-mode #replay-date,
.live-mode input[name=warmup],
.live-mode .setup button[type=submit] { display: none !important; }

main { display: grid; grid-template-columns: 1fr 320px; height: calc(100% - 56px); }
.drawer-toggle { display: none; background: none; border: 0; color: inherit; font: inherit; }
.drawer-tabs { display: none; }
.mobile-toggle { display: none; }

/* ---------- Responsive layout (Android Chrome + iOS Safari) ----------
   Below 900px: stack the chart and the side pane vertically, with the side
   pane collapsing into a draggable bottom drawer that the user expands to
   place trades / see the tape. Above 900px we keep the existing two-column
   desktop layout untouched. */
@media (max-width: 900px) {
  /* The viewport itself never scrolls. `main` flexes to fill whatever's left
     of the header (no magic 100svh - 96px), and the side-pane shrinks the
     chart when expanded instead of pushing content off the bottom. */
  body { display: flex; flex-direction: column; min-height: 100svh; }
  header { flex: 0 0 auto; }
  main {
    flex: 1 1 0;
    min-height: 0;
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto;
    height: auto;
  }
  header {
    padding: 6px 8px;
    padding-top: max(6px, env(safe-area-inset-top));
    gap: 6px;
    flex-wrap: wrap;
    row-gap: 6px;
  }
  /* Row 1: brand left, avatar right. Row 2: setup, single horizontal strip. */
  .brand     { order: 0; }
  .user-info { order: 1; width: auto; margin-left: auto; padding-top: 0; border-top: 0; }
  .setup     { order: 2; flex: 1 0 100%; flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; gap: 4px; }
  .setup > * { flex-shrink: 0; }
  #status    { order: 3; }
  .setup select, .setup input, .setup button { font-size: 12px; padding: 6px 8px; min-height: 36px; }
  .setup input[name="warmup"] { width: 64px !important; }
  .symbol-popover { width: min(92vw, 360px); max-height: 50vh; }

  .side-pane {
    border-top: 1px solid #1e222d;
    /* `height` rather than `max-height` — flex children inside use
       `flex: 1 1 0`, which needs a definite parent height to grow into.
       Without this the Tape/Trades panels collapse to 0px. */
    height: 50svh;
    overflow-y: auto;
    flex-shrink: 0;
    padding-bottom: max(0px, env(safe-area-inset-bottom));
  }
  .side-pane[data-collapsed="true"] { height: 44px; overflow: hidden; }
  /* Tab strip inside the drawer — pick one of Trade/Tape/History at a time so
     each tab gets the full drawer body instead of three panels fighting for
     scraps of vertical space. */
  .drawer-tabs {
    display: flex;
    background: #0f1218;
    border-bottom: 1px solid #1e222d;
    position: sticky; top: 40px; z-index: 4;
  }
  .drawer-tabs button {
    flex: 1; background: transparent; color: #8a93a3;
    border: 0; border-bottom: 2px solid transparent;
    padding: 8px 4px; font: inherit; font-size: 12px;
    font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px;
    cursor: pointer; min-height: 40px;
  }
  .drawer-tabs button.active { color: #26a69a; border-bottom-color: #26a69a; }
  .side-pane[data-tab="trade"]   > .tape-panel,
  .side-pane[data-tab="trade"]   > .trades-panel,
  .side-pane[data-tab="tape"]    > .trade-panel,
  .side-pane[data-tab="tape"]    > .trades-panel,
  .side-pane[data-tab="history"] > .trade-panel,
  .side-pane[data-tab="history"] > .tape-panel { display: none; }
  /* Per-panel h3 headers become redundant (tab strip already labels them). */
  .side-pane > .trade-panel  > h3,
  .side-pane > .tape-panel   > h3,
  .side-pane > .trades-panel > h3 { display: none; }
  /* When collapsed the tab strip hides too (only the toggle bar shows). */
  .side-pane[data-collapsed="true"] .drawer-tabs { display: none; }
  .side-pane .drawer-toggle {
    position: sticky; top: 0; width: 100%;
    display: flex; align-items: center; justify-content: space-between;
    background: #0f1218; border-bottom: 1px solid #1e222d;
    padding: 8px 12px; font-size: 13px; font-weight: 600;
    color: #d1d4dc;
    cursor: pointer; user-select: none; z-index: 5;
    min-height: 40px;
  }
  .side-pane .drawer-toggle::after { content: "▾"; font-size: 11px; opacity: 0.7; }
  .side-pane[data-collapsed="true"] .drawer-toggle::after { transform: rotate(180deg); }

  /* Touch-friendly hit targets — but small icon buttons (avatar, +/× in the
     symbol popover) get explicit equal width+height so they stay square
     instead of being stretched into ovals by the min-height alone. */
  button, .pick, .tool { min-height: 36px; }
  .user-avatar { width: 36px; height: 36px; font-size: 14px; }
  .symbol-row .symbol-add, .symbol-row .symbol-del { width: 36px; height: 36px; }
  .controls-center button { min-width: 64px; padding: 8px 12px; }
  .chart-toolbar { flex-wrap: wrap; }

  /* Collapsible Tools + Indicators rows. The dropdown trigger lives as the
     first child of each row; the row's other children hide until the user
     taps the trigger (.open class), then wrap onto multiple lines. The
     `measure-summary` span stays visible regardless so the measure readout
     is never trapped behind a closed toolbar. */
  .mobile-toggle {
    display: inline-flex; align-items: center; gap: 6px;
    background: #1e222d; color: #d1d4dc;
    border: 1px solid #2a2e39; border-radius: 4px;
    padding: 6px 10px; font: inherit; font-size: 12px;
    font-weight: 600; cursor: pointer; min-height: 36px;
  }
  .mobile-toggle::after { content: "▾"; font-size: 10px; opacity: 0.7; transition: transform 0.15s; }
  .chart-toolbar.open .mobile-toggle::after,
  .indicators.open .mobile-toggle::after { transform: rotate(180deg); }
  .chart-toolbar > *:not(.mobile-toggle):not(#measure-summary) { display: none; }
  .indicators > *:not(.mobile-toggle) { display: none; }
  .chart-toolbar.open > *:not(.mobile-toggle):not(#measure-summary) { display: inline-flex; align-items: center; }
  .indicators.open > *:not(.mobile-toggle) { display: inline-flex; align-items: center; gap: 4px; }

  /* Chart container should never lose touch gestures to native scroll */
  #chart, #rsi-chart, #cvd-chart { touch-action: none; }

  .drawer-toggle { display: flex; }
}

.chart-pane { display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.chart-toolbar { display: flex; gap: 6px; padding: 4px 8px; background: #0f1218; border-bottom: 1px solid #1e222d; align-items: center; flex-shrink: 0; font-size: 12px; }
.chart-toolbar button { background: #1e222d; color: #d1d4dc; border: 1px solid #2a2e39; border-radius: 4px; padding: 3px 8px; cursor: pointer; font-size: 11px; }
.chart-toolbar button:hover:not(:disabled) { background: #2a2e39; }
.chart-toolbar button.armed { background: #ffb74d; color: #1e222d; border-color: #ffb74d; }
.chart-toolbar input[type=color] { width: 24px; height: 22px; padding: 0; border: 1px solid #2a2e39; border-radius: 4px; background: #1e222d; cursor: pointer; }
.chart-toolbar input[type=color]::-webkit-color-swatch-wrapper { padding: 2px; }
.chart-toolbar input[type=color]::-webkit-color-swatch { border: none; border-radius: 2px; }

.hlines-strip { display: flex; gap: 4px; padding: 4px 8px; background: #0f1218; border-bottom: 1px solid #1e222d; flex-wrap: wrap; font-size: 11px; }
.hlines-strip:empty { display: none; }
.hline-chip { display: inline-flex; align-items: center; gap: 4px; background: #1e222d; border: 1px solid #2a2e39; border-radius: 4px; padding: 1px 4px 1px 2px; font-family: monospace; }
.hline-chip input[type=color] { width: 18px; height: 16px; padding: 0; border: none; background: transparent; cursor: pointer; }
.hline-chip input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
.hline-chip input[type=color]::-webkit-color-swatch { border: none; border-radius: 2px; }
.hline-chip .px { color: #d1d4dc; }
.hline-chip button { background: transparent; color: #888; border: none; cursor: pointer; padding: 0 2px; font-size: 14px; line-height: 1; }
.hline-chip button:hover { color: #ef5350; }
#measure-summary { margin-left: auto; color: #ddd; font-family: monospace; font-size: 12px; }
#measure-summary b { color: #ffb74d; }

.chart-stack { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }
#chart { flex: 1; min-height: 0; }
#chart.armed { outline: 2px dashed #ffb74d; outline-offset: -2px; }
/* sub-pane visibility — no height transition so the chart's autoSize doesn't
   redraw at every interpolated height (was causing initial flicker).
   Inline style.height (set by the resize handle) overrides the defaults. */
#rsi-chart { height: 0; }
#rsi-chart.visible { height: 160px; }
#cvd-chart { height: 0; }
#cvd-chart.visible { height: 140px; }

.pane-resize {
  height: 5px; flex-shrink: 0; background: #1e222d;
  cursor: ns-resize; border-top: 1px solid #2a2e39;
}
.pane-resize:hover { background: #2962ff; }
.pane-resize.hidden { display: none; }

.controls { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; padding: 6px 10px; background: #0f1218; border-top: 1px solid #1e222d; flex-shrink: 0; }
.controls-left { display: flex; gap: 8px; align-items: center; justify-self: start; }
.controls-center { display: flex; gap: 8px; align-items: center; justify-self: center; }
.controls-right { display: flex; gap: 8px; align-items: center; justify-self: end; min-width: 0; }
.controls button { background: #1e222d; color: #d1d4dc; border: 1px solid #2a2e39; border-radius: 4px; padding: 4px 12px; cursor: pointer; }
.controls-center button { min-width: 64px; }
.controls button:hover:not(:disabled) { background: #2a2e39; }
.controls button:disabled { opacity: 0.4; cursor: not-allowed; }
.controls input, .controls select { background: #1e222d; color: #d1d4dc; border: 1px solid #2a2e39; border-radius: 4px; padding: 2px 6px; }
#cursor-info { font-size: 12px; color: #999; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.indicators { padding: 6px 10px; background: #0f1218; border-top: 1px solid #1e222d; font-size: 12px; display: flex; gap: 12px; flex-wrap: wrap; flex-shrink: 0; }
.indicators label { cursor: pointer; }

.side-pane { display: flex; flex-direction: column; border-left: 1px solid #1e222d; background: #0f1218; overflow: hidden; }
.trade-panel, .trades-panel, .tape-panel {
  padding: 10px; border-bottom: 1px solid #1e222d;
  display: flex; flex-direction: column; min-height: 0; flex-shrink: 0;
}
/* tape & trades flex to share remaining space; trade panel is content-sized */
.side-pane > .tape-panel,
.side-pane > .trades-panel { flex: 1 1 0; }
.side-pane > .trade-panel  { flex: 0 0 auto; }
/* collapsed state — only header visible, no flex grow */
.side-pane > .collapsed { flex: 0 0 auto; }
.side-pane > .collapsed > :not(h3) { display: none; }
/* clickable header with chevron */
.trade-panel h3, .trades-panel h3, .tape-panel h3 {
  margin: 0 0 8px 0; font-size: 13px; color: #999;
  text-transform: uppercase; letter-spacing: 1px;
  cursor: pointer; user-select: none;
}
.trade-panel h3::before, .trades-panel h3::before, .tape-panel h3::before {
  content: "▼"; display: inline-block; width: 14px; font-size: 9px;
  color: #666; transition: transform 0.15s;
}
.collapsed > h3::before { transform: rotate(-90deg); }
.collapsed > h3 { margin-bottom: 0; }
.row { display: flex; gap: 6px; margin-bottom: 6px; align-items: center; position: relative; }
.row label { font-size: 12px; display: flex; align-items: center; gap: 4px; flex: 1; min-width: 0; position: relative; }
.row label.toggle-label { gap: 6px; flex: 0 0 70px; cursor: pointer; white-space: nowrap; }
.row label.toggle-label input[type=checkbox] { width: auto; flex: none; margin: 0; }
.row.sltp-row > input[type=number] { flex: 1 1 auto; min-width: 0; width: auto; }
.row input, .row select { width: 100%; background: #1e222d; color: #d1d4dc; border: 1px solid #2a2e39; border-radius: 4px; padding: 4px 6px; }
.row input:disabled { opacity: 0.4; }
.row input.bad, .row select.bad { border-color: #ef5350; }
.row.buttons button { flex: 1; padding: 8px; border: none; border-radius: 4px; color: white; font-weight: 600; cursor: pointer; }
.row.buttons button:disabled { opacity: 0.4; cursor: not-allowed; }
.long { background: #26a69a; }
.short { background: #ef5350; }

.pick { background: #2a2e39; border: 1px solid #444; color: #ffb74d; border-radius: 4px; padding: 2px 6px; font-size: 11px; cursor: pointer; line-height: 1; flex-shrink: 0; }
.pick:hover { background: #3a3e49; }
.pick.armed { background: #ffb74d; color: #1e222d; border-color: #ffb74d; }

.tape-controls { font-size: 12px; color: #aaa; margin-bottom: 4px; display: flex; gap: 8px; align-items: center; }
.tape-controls .tc-label { color: #888; }
.tape-controls .tc-readout {
  color: #4dd0c1; font-variant-numeric: tabular-nums; min-width: 36px; text-align: right;
}
.tape-controls input[type="range"] {
  flex: 1; min-width: 80px; height: 4px; -webkit-appearance: none; appearance: none;
  background: linear-gradient(to right, #26a69a 0%, #26a69a var(--fill, 10%), #2a2e39 var(--fill, 10%), #2a2e39 100%);
  border-radius: 2px; outline: none; cursor: pointer;
}
.tape-controls input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 12px; height: 12px;
  background: #4dd0c1; border-radius: 50%; cursor: pointer; border: 2px solid #131722;
  box-shadow: 0 0 0 1px #4dd0c1;
}
.tape-controls input[type="range"]::-moz-range-thumb {
  width: 12px; height: 12px; background: #4dd0c1; border-radius: 50%; cursor: pointer;
  border: 2px solid #131722; box-shadow: 0 0 0 1px #4dd0c1;
}
.tape-status { font-size: 12px; color: #777; margin-bottom: 4px; min-height: 14px; }
.tape-list { flex: 1; overflow-y: auto; font-family: monospace; font-size: 14px; line-height: 1.55; min-height: 0; }
.tape-row { display: grid; grid-template-columns: 72px 1fr 1fr; gap: 8px; padding: 2px 5px; border-radius: 2px; }
.tape-row.buy  { background: rgba(38, 166, 154, 0.10); color: #4dd0c1; }
.tape-row.sell { background: rgba(239, 83, 80, 0.10); color: #ff7d75; }
.tape-row .t { color: #777; }
.tape-row .q { text-align: right; }
.tape-row.large { font-weight: 700; }
.tape-row.large.buy  { background: rgba(38, 166, 154, 0.28); }
.tape-row.large.sell { background: rgba(239, 83, 80, 0.28); }

.trades-panel { flex: 1; overflow: auto; }
#trades-table { width: 100%; font-size: 13px; border-collapse: collapse; }
#trades-table th { text-align: left; padding: 6px 4px; color: #aaa; border-bottom: 1px solid #2a2e39; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; }
#trades-table td { padding: 6px 4px; border-bottom: 1px solid #1e222d; }
#trades-table .pnl-pos { color: #4dd0c1; font-weight: 600; }
#trades-table .pnl-neg { color: #ff7d75; font-weight: 600; }
#trades-table .closed { opacity: 0.7; }
#trades-table button { background: #2a2e39; color: #d1d4dc; border: none; border-radius: 3px; padding: 3px 8px; cursor: pointer; font-size: 11px; }
.totals { font-size: 13px; padding: 8px 0; color: #d1d4dc; line-height: 1.7; border-bottom: 1px solid #1e222d; margin-bottom: 6px; }
.totals span { margin-right: 14px; display: inline-block; }
.totals b { font-size: 15px; }
#mark-info { font-size: 13px; color: #d1d4dc; font-weight: 600; }

.field-error {
  position: absolute;
  top: 100%; left: 0;
  margin-top: 4px;
  background: #2b1416; color: #ffb4ab;
  border: 1px solid #ef5350;
  padding: 4px 8px; border-radius: 4px;
  font-size: 11px; white-space: nowrap;
  z-index: 100; box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  animation: fade-in 0.15s ease-out;
  pointer-events: none;
}
.field-error::before {
  content: "";
  position: absolute; top: -5px; left: 10px;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 5px solid #ef5350;
}
@keyframes fade-in { from { opacity: 0; transform: translateY(-2px); } to { opacity: 1; } }

.arm-hint {
  position: absolute;
  top: 8px; left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 183, 77, 0.95);
  color: #1e222d;
  padding: 4px 10px; border-radius: 4px;
  font-size: 12px; font-weight: 600;
  z-index: 50; pointer-events: none;
}

/* flatpickr dark fixes for our colors */
.flatpickr-calendar { background: #1e222d; color: #d1d4dc; border-color: #2a2e39; }
.flatpickr-day { color: #d1d4dc; }
.flatpickr-day.today { border-color: #2962ff; }
.flatpickr-day.selected, .flatpickr-day.startRange, .flatpickr-day.endRange { background: #2962ff; border-color: #2962ff; }
