main.sdock-original-hidden,
.sdock-mount[hidden],
.sdock-mount [hidden],
.sdock-editor [hidden] {
  display: none !important;
}
.sdock-mount {
  width: 100%;
  padding: 2px;
  min-width: 0;
  background: var(--bg);
}
.header-actions .arrange-toggle {
  min-height: 30px;
  padding: 4px 10px;
  gap: 5px;
  font-size: 12px;
  color: var(--ink);
  white-space: nowrap;
}
.arrange-toggle[aria-pressed='true'] {
  color: var(--accent);
  background: var(--panel);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.sdock-grid {
  --sd-row: 26px;
  position: relative;
  display: grid;
  grid-template-columns: var(--sd-watch-columns, repeat(12, minmax(0, 1fr)));
  grid-auto-rows: var(--sd-row);
  gap: 2px;
  isolation: isolate;
}
@media (min-width: 761px) {
  body:not(.news-open) {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
  }
  body > header, body > footer {
    flex: none;
  }
  .sdock-mount {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
  }
  .sdock-grid {
    flex: 1 0 auto;
    /* Rows share the window height so the whole layout fits on one screen without page scrolling. */
    grid-auto-rows: var(--sd-drag-row, minmax(14px, 1fr));
  }
}
.sdock-tile,
.sdock-guide {
  grid-column: var(--sd-x) / span var(--sd-w);
  grid-row: var(--sd-y) / span var(--sd-h);
}
.sdock-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
}
.sdock-content {
  flex: 1 1 0;
  min-height: 0;
  min-width: 0;
  overflow: auto;
  scrollbar-width: thin;
}
.sdock-content > :first-child {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  min-width: 0;
  margin: 0;
}
.sdock-tile[data-panel='chart'] .sdock-content {
  overflow: hidden;
}
.sdock-tile[data-panel='chart'] .sdock-content > :first-child {
  height: 100%;
  min-height: 0;
}
.sdock-tile .chart-row,
.sdock-tile .pane-grid,
.sdock-tile .pane-grid .pane,
.sdock-tile .chart-area {
  min-height: 0;
}
.sdock-tile .chart-row,
.sdock-tile .pane-grid {
  flex: 1 1 0;
  overflow: hidden;
}
.sdock-tile .tools {
  overflow: auto;
  scrollbar-width: none;
}
.sdock-tile .controlbar,
.sdock-tile .tools {
  flex-shrink: 0;
}
.sdock-tile[data-panel='watch'] .sdock-content > :first-child,
.sdock-tile[data-panel='flow'] .sdock-content > :first-child {
  height: 100%;
  min-height: 0;
}
.sdock-tile #watchRows,
.sdock-tile #flowBody {
  height: auto;
  flex: 1 1 0;
  min-height: 0;
  max-height: none;
  overflow: auto;
}
.sdock-tile :is(.panelhead, .watchhead) {
  flex-shrink: 0;
}
.sdock-tile .panelhead {
  overflow-x: auto;
  scrollbar-width: thin;
}
.sdock-tile .side,
.sdock-tile .flow {
  border: 0;
  box-shadow: none;
}
.sdock-gripbar,
.sdock-size {
  display: none;
}
.sdock-editing .sdock-tile {
  border-color: color-mix(in srgb, var(--line) 70%, var(--accent));
}
.sdock-editing .sdock-gripbar {
  display: flex;
  align-items: stretch;
  min-height: 26px;
  height: 26px;
  flex: none;
  background: var(--surface-raised, var(--panel));
  border-bottom: 1px solid var(--line);
}
.sdock-gripbar button {
  min-height: 0;
  border-radius: 0;
  font-size: 11px;
  color: var(--muted);
}
.sdock-grip {
  min-width: 0;
  flex: 1;
  justify-content: flex-start;
  text-align: left;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  cursor: grab;
  padding: 2px 7px;
  touch-action: none;
}
.sdock-gripmark {
  font-size: 16px;
  color: var(--accent);
  line-height: 1;
  flex: none;
}
.sdock-options {
  width: 28px;
  padding: 0 4px;
  letter-spacing: 1px;
}
.sdock-editing .sdock-size {
  display: grid;
  place-items: center;
  position: absolute;
  right: 0;
  bottom: 0;
  width: 25px;
  height: 25px;
  min-height: 0;
  z-index: 3;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 5px 0 0 0;
  background: var(--surface-raised, var(--panel));
  color: var(--accent);
  cursor: nwse-resize;
  touch-action: none;
}
.sdock-size:before {
  content: '';
  width: 11px;
  height: 11px;
  background: repeating-linear-gradient(135deg, transparent 0 2px, currentColor 2px 3px);
  clip-path: polygon(100% 0, 100% 100%, 0 100%);
}
.sdock-grip:focus-visible,
.sdock-size:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.sdock-bar {
  position: sticky;
  top: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 9px;
  margin-bottom: 5px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--panel);
}
.sdock-bartext {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.sdock-bartext b {
  font-size: 12px;
  font-weight: 600;
}
.sdock-touch-hint { display: none; }
.sdock-bartext span,
.sdock-note {
  font-size: 12px;
  color: var(--muted);
}
.sdock-bar button,
.sdock-editor button,
.sdock-empty button {
  font-size: 12px;
  min-height: 32px;
}
.sdock-bar .sdock-history {width:32px;padding:4px}
.sdock-history:disabled {opacity:.38}
.sdock-redo i {transform:scaleX(-1)}
.sdock-empty {
  padding: 34px 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--muted);
}
.sdock-guide {
  z-index: 4;
  pointer-events: none;
  border: 2px dashed var(--accent);
  border-radius: 5px;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}
.sdock-guide-label {
  display: inline-block;
  background: var(--accent);
  color: #211f2b;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 7px;
  white-space: nowrap;
}
.sdock-dragging {
  user-select: none;
}
.sdock-dragging .sdock-grip {
  cursor: grabbing;
}
.sdock-moving {
  opacity: 0.76;
}
.sdock-target {
  outline: 1px solid var(--accent);
  outline-offset: -1px;
}
.sdock-editor {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}
.sdock-choice,
.sdock-swap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}
.sdock-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
  font-size: 12px;
  color: var(--muted);
}
.sdock-field input,
.sdock-field select {
  display: block;
  width: 100%;
  min-width: 0;
  height: 36px;
  padding: 4px 8px;
  color: var(--ink);
  font: inherit;
  border: 1px solid var(--line);
}
.sdock-fields {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
}
.sdock-position {
  margin-top: -7px;
  display: flex;
  justify-content: flex-end;
}
.sdock-note {
  margin: 0;
  line-height: 1.5;
}
.sdock-actions {
  border-top: 1px solid var(--line);
  padding-top: 13px;
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}
.sdock-actions .sdock-quiet {
  margin-right: auto;
  color: var(--muted);
}
@media (max-width: 760px) {
  .sdock-mount {
    padding: 3px;
  }
  .sdock-grid {
    --sd-row: 24px;
    display: flex;
    flex-direction: column;
    gap: 4px;
  }
  .sdock-tile {
    height: calc(var(--sd-h) * (var(--sd-row) + 4px) - 4px);
    flex: none;
  }
  .sdock-guide {
    position: absolute;
    left: 0;
    width: 100%;
  }
  .sdock-bar {
    padding: 5px 7px;
    gap: 4px;
  }
  .sdock-bartext {
    gap: 2px;
    align-items: flex-start;
    flex-direction: column;
  }
  .sdock-desktop-hint {
    display: none;
  }
  .sdock-touch-hint { display: inline; font-size: 11px; }
  .sdock-editing .sdock-gripbar {
    height: 40px;
    min-height: 40px;
  }
  .sdock-gripbar button {
    font-size: 12px;
  }
  .sdock-editing .sdock-size {
    width: 40px;
    height: 40px;
    cursor: ns-resize;
  }
  .sdock-options {
    width: 40px;
  }
  .sdock-editor {
    gap: 13px;
  }
  .sdock-actions {
    justify-content: flex-end;
  }
  .sdock-actions button {
    min-height: 36px;
  }
  .sdock-tile .pane-grid {
    min-height: 0;
    height: auto;
  }
}
@media (min-width: 501px) and (max-width: 720px) {
  .header-actions .arrange-toggle {
    min-width: 25px;
    padding: 4px;
  }
  .arrange-toggle span { display: none; }
}
@media (max-width: 500px) {
  body > header {
    height: auto;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 2px 8px;
    padding-block: 4px;
  }
  body > header .header-actions { grid-column: 2; grid-row: 1; }
  body > header #mainNav { grid-row: 2; grid-column: 1 / -1; width: 100%; }
  body > header #mainNav button { flex: 1; }
}
@media (min-width: 761px) and (max-width: 1020px) {
  body > header { gap: 10px; padding-inline: 10px; }
  body > header .brand > span { display: none; }
  body > header #mainNav {min-width:0;overflow-x:auto;scrollbar-width:none}
  body > header #mainNav button {flex:none;padding-inline:8px}
}
.sdock-left-edge { display:none; }
@media(min-width:761px) {
  .sdock-editing .sdock-left-edge { display:block; position:absolute; top:27px; bottom:0; left:0; width:7px; padding:0; z-index:2; background:transparent; cursor:col-resize; touch-action:none; }
  .sdock-editing .sdock-left-edge:hover,.sdock-editing .sdock-left-edge:focus-visible { background:color-mix(in srgb,var(--accent) 42%,transparent); }
}

.sdock-add-here {
  grid-column: var(--sd-x) / span var(--sd-w);
  grid-row: var(--sd-y);
  justify-self: start;
  align-self: start;
  min-height: 26px;
  padding: 3px 8px;
  margin: 2px;
  border: 1px dashed var(--popup-edge);
  background: var(--popup-surface);
  color: var(--muted);
  font-size: 11px;
}
.sdock-add-here:hover { color: var(--ink); border-color: var(--accent); }
.sdock-picker {
  position: fixed;
  inset: auto;
  margin: 0;
  width: min(198px, calc(100vw - 12px));
  max-height: min(370px, 68dvh);
  overflow: auto;
  padding: 4px;
}
.sdock-picker button { display: flex; width: 100%; justify-content: space-between; min-height: 27px; padding: 4px 7px; font-size: 12px; }
.sdock-picker button:hover { background: #ffffff0b; }
.sdock-picker button span { color: var(--accent); }
.sdock-picker-actions { margin-top: 3px; padding-top: 3px; border-top: 1px solid var(--line); }
.sdock-picker-actions button { color: var(--muted); }
@media (pointer: coarse) {
  .sdock-picker button, .sdock-add-here { min-height: 38px; }
  .sdock-add-here { order: 100; }
}

@media (max-width: 600px) {
  /* Give the default single chart more height while keeping each drag resize step intact. */
  .sdock-tile[data-panel='chart']:has(.layout1) {
    height: calc(var(--sd-h) * (var(--sd-row) + 4px) - 4px + clamp(0px, 74svh - 425px, 200px));
  }
  #chartWidget .controlbar { gap: 3px; padding-inline: 5px; }
  #chartWidget .controlbar > [data-action] { min-height: 34px; min-width: 35px; }
  #chartWidget .controlbar > [data-action=layout] span { display: none; }
  #chartWidget .controlbar > [data-action=studies] span { display: inline; }
  #chartWidget .controlbar > [data-action=studies] { margin-right: auto; }
  #chartWidget .chart-row > .tools { order: 1; border-top: 1px solid var(--line); }
  .study-legend {
    inset: 3px auto auto 7px; display: grid; grid-template-columns: auto auto;
    gap: 0 5px; align-items: center; justify-items: start;
  }
  .study-legend .legend-disclosure { grid-area: 1 / 2; min-height: 32px; margin: 0; padding: 2px 7px; }
  .study-legend .legend-volume-row { grid-area: 1 / 1; min-height: 22px; margin: 0; }
  .study-legend .legend-rows:not([hidden]) {
    grid-column: 1 / -1; max-height: min(35dvh,225px); pointer-events: auto; overscroll-behavior: contain;
    border: 1px solid var(--line); border-radius: 7px; padding: 2px 4px; background: var(--panel);
  }
  .legend-rows .legend-row { width: 100%; }
  .legend-row .legend-settings { flex: 1; justify-content: start; text-align: left; min-height: 36px; }
  .legend-row .legend-eye { width: 36px; min-height: 36px; }

}
@media (max-width: 600px) {
  main .pane-grid.layout1 .pane { min-height: clamp(380px, 73svh, 750px); }
}

/* Order-flow widgets: live footprint ladder, tape and book delta. */
.fpw { display: flex; flex-direction: column; gap: 6px; min-height: 100%; font: 11px var(--mono); }
.fpw-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.fpw-stat { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.fpw-stat span { color: var(--muted); font: 10px Inter, sans-serif; white-space: nowrap; }
.fpw-stat b { font-weight: 600; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fpw-balance { height: 3px; border-radius: 2px; background: color-mix(in srgb, var(--down) 70%, transparent); overflow: hidden; }
.fpw-balance i { display: block; height: 100%; background: var(--up); }
.fpw-grid { display: flex; flex-direction: column; gap: 1px; }
.fpw-row { display: grid; grid-template-columns: minmax(0, 1fr) 86px minmax(0, 1fr) 58px; align-items: center; gap: 4px; min-height: 18px; }
.fpw-head { position: sticky; top: 0; z-index: 1; background: var(--panel); color: var(--muted); font: 10px Inter, sans-serif; }
.fpw-head span:first-child { text-align: right; } .fpw-head span:nth-child(2) { text-align: center; }
.fpw-head span:nth-child(4) { text-align: right; }
.fpw-price { padding: 0 4px; overflow: hidden; text-overflow: ellipsis; text-align: center; color: var(--ink); }
.fpw-row.current .fpw-price { color: var(--bg); background: var(--accent); border-radius: 3px; }
.fpw-row.poc { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 55%, transparent); border-radius: 3px; }
.fpw-cell { position: relative; display: flex; align-items: center; height: 16px; border-radius: 2px; overflow: hidden; }
.fpw-cell em { position: relative; font-style: normal; padding: 0 5px; }
.fpw-cell i { position: absolute; top: 0; bottom: 0; }
.fpw-cell.sell { justify-content: flex-end; }
.fpw-cell.sell i { right: 0; background: color-mix(in srgb, var(--down) 24%, transparent); }
.fpw-cell.buy i { left: 0; background: color-mix(in srgb, var(--up) 22%, transparent); }
.fpw-cell.sell.imbalance em { color: var(--down); font-weight: 700; }
.fpw-cell.buy.imbalance em { color: var(--up); font-weight: 700; }
.fpw-delta { text-align: right; }
.fpw-foot { margin-top: auto; color: var(--muted); font: 10px Inter, sans-serif; }
.tapetable tr.buy td.side { color: var(--up); }
.tapetable tr.sell td.side { color: var(--down); }
.tapetable tr td:first-child { box-shadow: inset 2px 0 0 transparent; color: var(--muted); }
.tapetable tr.buy td:first-child { box-shadow: inset 2px 0 0 var(--up); }
.tapetable tr.sell td:first-child { box-shadow: inset 2px 0 0 var(--down); }
.tapetable tr.big td { font-weight: 700; background: color-mix(in srgb, var(--accent) 7%, transparent); }
.flowtable th { position: sticky; top: 0; background: var(--panel); z-index: 1; }
.deltatable td.net { position: relative; }
.deltatable td.net i { position: absolute; right: 0; top: 3px; bottom: 3px; border-radius: 2px; opacity: .22; background: currentColor; }
.deltatable td.net em { position: relative; font-style: normal; }
.extraWidget .panelhead { min-height: 34px; padding: 0 10px; border-bottom: 1px solid var(--line); }
.extraWidget .panelhead h2 { font-size: 12px; font-weight: 600; letter-spacing: .01em; }
