@import url("https://fonts.googleapis.com/css2?family=Roboto+Mono:wght@400;500;600&display=swap");

:root {
  color-scheme: dark;
  font-family:
    Inter,
    system-ui,
    -apple-system,
    Segoe UI,
    Roboto,
    sans-serif;
  --pl-bid-rgb: 70, 150, 255;
  --pl-ask-rgb: 255, 100, 50;
  --pl-row-h: 24px;
  --pl-header-bg: #1a1a1a;
  --pl-surface-bg: #0d0d0e;
}

body {
  margin: 0;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: #0b0f17;
  color: #d4e0ff;
}

.container {
  max-width: none;
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  padding: 0;
}

.perf-value {
  display: inline-block;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.top-header {
  padding: 8px 12px;
  background: #1a1a1a;
  color: #aaa;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  border-bottom: 1px solid #2b3550;
}

.top-header-left {
  display: flex;
  align-items: center;
  gap: 6px;
}

.top-header-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
  row-gap: 6px;
  min-width: 0;
}

.top-host {
  color: #f59e0b;
}

.top-mode {
  opacity: 0.7;
}

.top-user {
  color: #4ade80;
  font-size: 12px;
}

.top-muted {
  opacity: 0.65;
  font-size: 12px;
}

.top-error {
  color: #f87171;
  font-size: 12px;
}

.perf-inline {
  font-size: 12px;
  font-family: "Roboto Mono", monospace;
  color: #9aa4b2;
  background: #111827;
  border: 1px solid #2b3550;
  border-radius: 4px;
  padding: 4px 6px;
  width: 260px;
  box-sizing: border-box;
  white-space: nowrap;
  display: flex;
  flex-direction: column;
  gap: 2px;
  line-height: 1.1;
  flex-shrink: 0;
}

.perf-inline-line {
  display: flex;
  align-items: center;
  gap: 2px;
}

.auth-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.auth-inline .pl-btn.top-login-btn {
  background: #2563eb;
  border: none;
  color: #fff;
  padding: 4px 14px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
}

.auth-inline .pl-btn.top-login-btn:hover {
  background: #1d4ed8;
}

.auth-inline .pl-btn.top-logout-btn {
  background: transparent;
  border: 1px solid #555;
  color: #aaa;
  padding: 2px 10px;
  border-radius: 4px;
  font-size: 12px;
}

.auth-inline .pl-btn.top-logout-btn:hover {
  background: #2a2a2a;
}

.pl-btn.top-cancel-all-btn {
  background: #dc2626;
  border: 1px solid #b91c1c;
  color: #fff;
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.pl-btn.top-cancel-all-btn:hover {
  background: #b91c1c;
}

.pl-btn.top-cancel-all-btn:disabled {
  background: #7f1d1d;
  cursor: not-allowed;
  opacity: 0.3;
}

.workspace-shell {
  display: flex;
  flex: 1;
  min-height: 0;
  transition: filter 0.3s ease;
}

h1 {
  margin-bottom: 0.5rem;
}

.panel {
  margin-top: 0;
  padding: 1rem;
  border: 1px solid #2b3550;
  border-radius: 12px;
  background: #121a2a;
}

.workspace {
  margin-top: 0;
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  padding: 6px;
}

.ladders-column {
  display: flex;
  min-width: 0;
  min-height: 0;
}

.ladders-strip {
  display: flex;
  gap: 6px;
  height: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  align-items: stretch;
  padding-bottom: 0;
}

.ladder-shell {
  flex: 0 0 auto;
  display: flex;
  height: 100%;
}

.ladder-shell .price-ladder {
  height: 100%;
}

a {
  color: #7aa2ff;
}

.price-ladder {
  --bid-rgb: var(--pl-bid-rgb);
  --ask-rgb: var(--pl-ask-rgb);
  --col-price: 10ch;
  --col-data: 92px;
  --cols: var(--col-price) var(--col-data) var(--col-data);
  --row-h: var(--pl-row-h);
  --bg: var(--pl-surface-bg);
  --bg-header: var(--pl-header-bg);
  --stripe: #161616;

  margin-top: 0;
  border: 1px solid #333;
  border-radius: 4px;
  background: var(--bg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  color: #ccc;
  font-family: "Roboto Mono", monospace;
  font-size: 14px;
  max-width: calc(var(--col-price) + var(--col-data) * 2 + 5px);
  user-select: none;
  box-sizing: border-box;
}

.pl-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-bottom: 1px solid #333;
  background: var(--bg-header);
}

.pl-header-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pl-header h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
}

.pl-sparkline {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.pl-inst-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.pl-sparkline svg {
  display: block;
}

.pl-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.pl-dot.connected {
  background: #4ade80;
  box-shadow: 0 0 4px #4ade80;
}

.pl-dot.disconnected {
  background: #f87171;
  box-shadow: 0 0 4px #f87171;
}

.pl-controls {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 6px 12px;
  border-bottom: 1px solid #333;
  background: var(--bg-header);
  font-size: 11px;
}

.pl-controls label {
  font-size: 11px;
  color: #888;
  line-height: 1;
}

.pl-control-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pl-pos-net {
  min-width: 2.5ch;
  font-size: 23px;
  font-weight: 600;
  line-height: 1;
}

.pl-pos-net.long {
  color: #4ade80;
}

.pl-pos-net.short {
  color: #f87171;
}

.pl-pos-net.flat {
  color: #8a8a8a;
}

.pl-controls input {
  width: 60px;
  padding: 3px 6px;
  background: var(--bg);
  border: 1px solid #444;
  border-radius: 3px;
  color: #fff;
  font-size: 13px;
  text-align: right;
}

.pl-controls .pl-btn {
  align-self: flex-end;
}

.pl-btn {
  background: #333;
  color: #fff;
  border: none;
  border-radius: 3px;
  padding: 2px 8px;
  cursor: pointer;
  font-size: 12px;
  font-family: inherit;
}

.pl-btn:hover {
  background: #444;
}

.pl-col-headers {
  display: grid;
  grid-template-columns: var(--cols);
  padding: 4px 0;
  background: var(--bg-header);
  border-bottom: 1px solid #333;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #555;
}

.pl-col-headers > div {
  padding: 0 4px;
  text-align: center;
}

.pl-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  position: relative;
}

.pl-offscreen {
  position: absolute;
  z-index: 5;
  display: block;
  right: calc(var(--col-data) * 2);
  width: 7px;
  height: 3px;
  border-radius: 1px;
  pointer-events: none;
}

.pl-offscreen.top {
  top: 0;
}

.pl-offscreen.bot {
  bottom: 0;
}

.pl-offscreen.bid {
  background: rgba(var(--bid-rgb), 1);
}

.pl-offscreen.ask {
  background: rgba(var(--ask-rgb), 1);
}

/* ask above bid at top, ask above bid at bottom */
.pl-offscreen.top.ask {
  top: 0;
}

.pl-offscreen.top.bid {
  top: 3px;
}

.pl-offscreen.bot.ask {
  bottom: 3px;
}

.pl-offscreen.bot.bid {
  bottom: 0;
}

.pl-price-overlay {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: calc(var(--col-price) + 1px);
  pointer-events: none;
  z-index: 6;
}

.pl-side-cancel {
  position: absolute;
  left: 0px;
  right: 8px;
  z-index: 1;
  border-radius: 3px;
  padding: 2px;
  font-size: 11px;
  font-family: "Roboto Mono", monospace;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-sizing: border-box;
  pointer-events: auto;
  margin: -1px 0px;
}

.pl-side-cancel.top {
  top: 2px;
}

.pl-side-cancel.bot {
  bottom: 2px;
}

.pl-side-cancel.ask {
  background: #5a2b2b;
  border: 1px solid rgba(255, 255, 255, 0.75);
  color: #fff;
}

.pl-side-cancel.bid {
  background: #2c4463;
  border: 1px solid rgba(255, 255, 255, 0.75);
  color: #fff;
}

.cancel-circle-glyph {
  width: 16px;
  height: 16px;
  display: inline-flex;
  background: #e05050;
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
  font-size: 0;
  line-height: 0;
}

.cancel-circle-glyph::before,
.cancel-circle-glyph::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 7px;
  width: 10px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
}

.cancel-circle-glyph::before {
  transform: rotate(45deg);
}

.cancel-circle-glyph::after {
  transform: rotate(-45deg);
}

.pl-side-cancel-label,
.pl-side-cancel-count {
  font-size: 11px;
  line-height: 1;
  text-transform: lowercase;
  white-space: nowrap;
}

.pl-row {
  position: relative;
  display: grid;
  grid-template-columns: var(--cols);
  height: var(--row-h);
  align-items: stretch;
}

.pl-row-spread {
  background: #0d0d0e;
}

.pl-price,
.pl-market,
.pl-actions {
  padding: 0 4px;
  font-size: 14px;
  display: flex;
  align-items: center;
}

.pl-price {
  text-align: right;
  color: #ccc;
  font-weight: 400;
  justify-content: flex-end;
  padding: 0 6px 0 4px;
}

.pl-market {
  position: relative;
  display: flex;
  gap: 2px;
  padding: 2px;
  align-items: stretch;
  background: var(--bg);
  overflow: hidden;
}

.pl-market-qty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 500;
  border-radius: 3px;
  margin: 0;
  z-index: 1;
  pointer-events: none;
}

.pl-market-qty.bid {
  background: rgba(var(--bid-rgb), 0.2);
  color: #fff;
  border: 1px solid rgba(var(--bid-rgb), 0.4);
}

.pl-market-qty.ask {
  background: rgba(var(--ask-rgb), 0.2);
  color: #fff;
  border: 1px solid rgba(var(--ask-rgb), 0.4);
}

.pl-hover {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 0;
  background: var(--stripe);
  cursor: pointer;
}

.pl-hover.bid-half {
  left: 0;
  right: calc(50% + 1px);
}

.pl-hover.ask-half {
  left: calc(50% + 1px);
  right: 0;
}

.pl-hover.bid-half:hover {
  background: rgba(var(--bid-rgb), 0.06);
}

.pl-hover.ask-half:hover {
  background: rgba(var(--ask-rgb), 0.06);
}

.pl-user {
  display: flex;
  align-items: stretch;
  gap: 1px;
  overflow: hidden;
}

.pl-user-group {
  position: relative;
  display: flex;
  align-items: stretch;
  flex: 0 1 0;
  margin: 2px;
  border-radius: 2px;
  border: 1px solid transparent;
  overflow: hidden;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}

.pl-user-group.bid {
  flex-grow: 1;
  background: rgba(var(--bid-rgb), 0.2);
  border-color: rgba(var(--bid-rgb), 0.4);
}

.pl-user-group.ask {
  flex-grow: 1;
  background: rgba(var(--ask-rgb), 0.2);
  border-color: rgba(var(--ask-rgb), 0.4);
}

.pl-user-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  pointer-events: none;
  z-index: 1;
}

/* Shared cancel button primitive (reused by ladder/tables) */
.cancel-circle {
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #e05050;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  padding: 0;
  opacity: 0.5;
  transition: opacity 0.15s;
  position: relative;
  font-size: 0;
  line-height: 0;
}

.cancel-circle::before,
.cancel-circle::after {
  content: "";
  position: absolute;
  width: 10px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
}

.cancel-circle::before {
  transform: rotate(45deg);
}

.cancel-circle::after {
  transform: rotate(-45deg);
}

.cancel-circle:hover {
  opacity: 1;
}

.pl-cancel {
  display: none;
  position: absolute;
  right: 2px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
}

.pl-user-group:hover .pl-cancel {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.pl-ghost {
  position: absolute;
  top: 3px;
  bottom: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  border-radius: 2px;
  pointer-events: none;
  z-index: 3;
}

.pl-ghost.bid {
  left: 2px;
  right: calc(50% + 1px);
  background: rgba(var(--bid-rgb), 0.32);
  color: #fff;
  border: 1px solid rgba(var(--bid-rgb), 0.7);
}

.pl-ghost.ask {
  left: calc(50% + 1px);
  right: 2px;
  background: rgba(var(--ask-rgb), 0.32);
  color: #fff;
  border: 1px solid rgba(var(--ask-rgb), 0.7);
}

.pl-empty {
  padding: 24px;
  text-align: center;
  color: #555;
}

.pl-avg-markers {
  position: absolute;
  left: 0;
  top: 0;
  width: calc(var(--col-price) + 1px);
  bottom: 0;
  pointer-events: none;
  z-index: 5;
}

.pl-avg-marker {
  position: absolute;
  left: 0;
  width: 100%;
  transform: translateY(-50%);
}

.pl-avg-marker-line {
  display: block;
  width: 100%;
  height: 1px;
  background: currentColor;
  opacity: 0.9;
}

.pl-avg-marker-label {
  position: absolute;
  left: 2px;
  top: -9px;
  padding: 0 2px;
  border-radius: 2px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  background: rgba(13, 13, 14, 0.9);
  color: currentColor;
}

.pl-avg-marker.bid {
  color: #4ade80;
}

.pl-avg-marker.ask {
  color: #f87171;
}

.pl-error {
  padding: 4px 12px;
  background: #7f1d1d;
  color: #fca5a5;
  font-size: 11px;
}
