/*
 * Shadow Trader V2 — workspace redesign
 * Presentation-only overrides. Existing IDs, actions and backend contracts remain unchanged.
 */

:root {
  --ui-page: #101214;
  --ui-panel: #181b1f;
  --ui-panel-alt: #22262b;
  --ui-header: #14171a;
  --ui-line: #3a4048;
  --ui-line-soft: #2a2f35;
  --ui-copy: #f3f0e9;
  --ui-muted: #b8b2a8;
  --ui-faint: #8f8980;
  --ui-blue: #b5bdc8;
  --ui-blue-soft: rgba(181, 189, 200, 0.12);
  --ui-accent-ink: #111315;
  --accent: #b5bdc8;
  --accent-strong: #e0e4e9;
  --accent-soft: rgba(181, 189, 200, 0.12);
  --ui-green: #61c58b;
  --ui-red: #ff7c85;
  --ui-amber: #e8b75c;
  --ui-radius: 14px;
  --ui-shadow: 0 12px 34px rgba(0, 0, 0, 0.18);
  --ui-page-x: clamp(18px, 2.5vw, 42px);
}

html[data-theme="light"] {
  --ui-page: #ecefed;
  --ui-panel: #f8faf9;
  --ui-panel-alt: #eff3f1;
  --ui-header: #f6f8f7;
  --ui-line: #aeb9b3;
  --ui-line-soft: #cbd3cf;
  --ui-copy: #1d2924;
  --ui-muted: #526159;
  --ui-faint: #6e7d75;
  --ui-blue: #525c67;
  --ui-blue-soft: rgba(82, 92, 103, 0.1);
  --ui-accent-ink: #f5fffb;
  --accent: #59636e;
  --accent-strong: #343d46;
  --accent-soft: rgba(82, 92, 103, 0.1);
  --ui-green: #1f7a50;
  --ui-red: #b33e4d;
  --ui-amber: #89620d;
  --ui-shadow: 0 8px 22px rgba(35, 49, 42, 0.11);
}

html,
body {
  background: var(--ui-page);
}

body {
  color: var(--ui-copy);
}

.sidebar {
  border-right: 1px solid var(--ui-line);
  background: var(--ui-header);
  box-shadow: none;
}

.brand {
  border-bottom-color: var(--ui-line);
}

.nav-item {
  min-height: 40px;
  border-radius: 8px;
  color: var(--ui-muted);
  font-weight: 620;
}

.nav-item:hover {
  background: var(--ui-panel-alt);
  color: var(--ui-copy);
}

.nav-item.active {
  background: var(--ui-blue-soft);
  box-shadow: inset 3px 0 0 var(--ui-blue);
  color: var(--ui-blue);
}

.sidebar-collapse,
.nav-hover-label {
  border-color: var(--ui-line);
  background: var(--ui-panel-alt);
  color: var(--ui-copy);
}

.workspace {
  min-height: 100vh;
  background: var(--ui-page);
}

.topbar {
  height: 64px;
  padding: 0 var(--ui-page-x);
  border-bottom: 1px solid var(--ui-line);
  background: color-mix(in srgb, var(--ui-header) 94%, transparent);
  box-shadow: none;
  backdrop-filter: blur(14px);
}

.topbar-actions {
  gap: 10px;
}

.theme-toggle {
  font-size: 17px;
}

.market-strip {
  top: 50%;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.market-index {
  padding: 0;
}

.market-index-price {
  font-size: 14px;
}

.stale-banner {
  position: sticky;
  top: 64px;
  z-index: 33;
}

.page,
body.accounts-view-active .page {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 28px var(--ui-page-x) 64px;
}

.view,
.view.active {
  width: 100%;
  min-height: calc(100vh - 120px);
}

.page-heading {
  min-height: 68px;
  align-items: center;
  margin-bottom: 22px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--ui-line);
}

.page-heading h1,
#view-accounts .page-heading h1 {
  color: var(--ui-copy);
  font-size: clamp(24px, 2vw, 31px);
  font-weight: 760;
  letter-spacing: -0.035em;
}

.page-subtitle {
  max-width: 760px;
  margin-top: 6px;
  color: var(--ui-muted);
  font-size: 12px;
}

.eyebrow,
.surface-kicker {
  color: var(--ui-blue);
  font-weight: 780;
}

.surface,
.metric-card {
  border: 1px solid var(--ui-line);
  border-radius: var(--ui-radius);
  background: var(--ui-panel);
  box-shadow: none;
}

.surface {
  padding: 18px;
}

.view > .surface,
.view > .kpi-grid,
.view > .overview-grid,
.view > .chart-layout,
.view > .straddle-chart-layout,
.view > .payoff-grid,
.view > .hedge-command-center,
.view > .config-layout {
  margin-bottom: 18px;
}

.surface-header {
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--ui-line-soft);
}

.surface-header h2 {
  color: var(--ui-copy);
  font-size: 15px;
  font-weight: 730;
}

.kpi-grid {
  grid-template-columns: repeat(4, minmax(170px, 1fr));
  gap: 12px;
}

.metric-card {
  min-height: 108px;
  padding: 16px;
  background: var(--ui-panel);
}

.metric-card:hover {
  border-color: var(--border-strong);
  transform: none;
}

.tool-card:hover {
  transform: none;
}

.metric-card-value {
  color: var(--ui-copy);
  font-size: clamp(20px, 1.7vw, 28px);
}

.primary-button,
.secondary-button,
.danger-button,
.text-button,
.icon-button,
.picker-trigger,
.segmented,
.search-control,
.select-control select,
.date-control {
  border-color: var(--ui-line);
  box-shadow: none;
}

.primary-button {
  border-color: color-mix(in srgb, var(--ui-blue) 72%, var(--ui-line));
  background: var(--ui-blue);
  color: var(--ui-accent-ink);
}

.secondary-button,
.icon-button,
.picker-trigger,
.segmented,
.search-control,
.select-control select,
.date-control {
  background: var(--ui-panel-alt);
  color: var(--ui-copy);
}

select {
  color-scheme: dark;
}

select option {
  background: var(--ui-panel);
  color: var(--ui-copy);
}

html[data-theme="light"] select {
  color-scheme: light;
}

input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--ui-blue);
}

.overview-hedge-expiry-toolbar .config-field > span:first-child {
  display: block;
  margin-bottom: 7px;
  color: var(--ui-faint);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

.overview-hedge-expiry-toolbar .select-control {
  width: 100%;
}

.secondary-button:hover,
.icon-button:hover {
  border-color: var(--border-strong);
  background: var(--surface-hover);
  color: var(--ui-copy);
}

.primary-button:hover {
  border-color: color-mix(in srgb, var(--ui-blue) 55%, var(--ui-copy));
  filter: brightness(1.06);
}

.primary-button:focus-visible,
.secondary-button:focus-visible,
.danger-button:focus-visible,
.text-button:focus-visible,
.icon-button:focus-visible,
.picker-trigger:focus-visible,
.segmented button:focus-visible {
  outline-color: var(--ui-copy);
}

.primary-button:disabled,
.secondary-button:disabled,
.danger-button:disabled,
.icon-button:disabled {
  filter: none;
  opacity: 0.42;
}

.danger-button:hover {
  border-color: color-mix(in srgb, var(--ui-red) 55%, var(--ui-line));
  background: color-mix(in srgb, var(--ui-red) 15%, var(--ui-panel));
  color: var(--ui-red);
}

.table-surface {
  padding: 0;
  overflow: hidden;
  background: var(--ui-panel);
}

.table-toolbar,
.chart-toolbar,
.straddle-toolbar,
.pnl-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--ui-line);
  background: var(--ui-panel);
}

.table-toolbar .row-count,
.chart-toolbar .row-count {
  margin-left: auto;
}

.data-table-wrap {
  background: var(--ui-panel);
}

.data-table {
  background: var(--ui-panel);
  color: var(--ui-copy);
}

.data-table th {
  border-bottom: 1px solid var(--ui-line);
  background: var(--ui-panel-alt);
  color: var(--ui-muted);
}

.data-table td {
  border-bottom-color: var(--ui-line-soft);
}

.data-table tbody tr:nth-child(even) {
  background: color-mix(in srgb, var(--ui-panel-alt) 52%, transparent);
}

.data-table tbody tr:hover {
  background: var(--ui-blue-soft);
}

.pagination {
  border-top: 1px solid var(--ui-line);
  background: var(--ui-panel);
}

.row-count,
.page-subtitle,
.surface-header p,
.empty-state {
  color: var(--ui-muted);
}

/* Overview: broad operational canvas rather than nested floating boxes. */
.overview-grid {
  grid-template-columns: minmax(0, 1.6fr) minmax(300px, 0.8fr);
  gap: 14px;
}

.overview-hedge {
  padding: 20px;
}

.overview-hedge-metrics,
.custom-total-grid {
  gap: 0;
  border: 1px solid var(--ui-line);
  border-radius: 10px;
  overflow: hidden;
}

.overview-hedge-metrics > div,
.custom-total-grid > * {
  border-right: 1px solid var(--ui-line-soft);
  background: transparent;
}

.overview-hedge-disclosures details,
.overview-hedge-disclosures details[open],
.overview-hedge-disclosures summary {
  background: var(--ui-panel-alt);
}

.overview-hedge-account-row:hover {
  background: var(--ui-panel-alt);
}

.overview-hedge-account-toggle {
  width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ui-copy);
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.overview-hedge-account-toggle:focus-visible {
  outline: 2px solid var(--ui-accent);
  outline-offset: 3px;
  border-radius: 4px;
}

.overview-hedge-account-chevron {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  display: grid;
  place-items: center;
  border: 1px solid var(--ui-line);
  border-radius: 5px;
  color: var(--ui-muted);
  font-size: 14px;
  line-height: 1;
  transition: transform 120ms ease, color 120ms ease, border-color 120ms ease;
}

.overview-hedge-account-toggle[aria-expanded="true"] .overview-hedge-account-chevron {
  transform: rotate(90deg);
  border-color: var(--ui-accent);
  color: var(--ui-accent);
}

.data-table tbody .overview-hedge-breakdown-row > td {
  padding: 0;
  border-bottom: 1px solid var(--ui-line);
  background: var(--ui-panel-alt);
}

.overview-hedge-breakdown-table {
  width: calc(100% - 34px);
  margin: 5px 10px 8px 24px;
  border-collapse: collapse;
  table-layout: fixed;
}

.overview-hedge-breakdown-table th,
.overview-hedge-breakdown-table td {
  padding: 5px 8px;
  border-bottom: 1px solid var(--ui-line-soft);
  color: var(--ui-muted);
  font-size: 9px;
  white-space: nowrap;
}

.overview-hedge-breakdown-table th {
  color: var(--ui-copy);
  font-weight: 650;
  text-transform: none;
}

.overview-hedge-breakdown-table td:first-child,
.overview-hedge-breakdown-table td:nth-child(2) {
  color: var(--ui-copy);
  font-family: var(--mono);
}

.overview-hedge-breakdown-table tbody tr:last-child td {
  border-bottom: 0;
}

.overview-hedge-breakdown-empty {
  padding: 9px 12px 10px 34px;
  color: var(--ui-muted);
  font-size: 9px;
}

.tool-grid {
  grid-template-columns: repeat(4, minmax(190px, 1fr));
}

.tool-card {
  border-color: var(--ui-line);
  background: transparent;
  box-shadow: none;
}

/* Accounts: centered adaptive table with a unified control surface. */
#view-accounts .table-surface {
  width: max-content;
  max-width: 100%;
  margin-inline: auto;
  background: var(--ui-panel);
}

#view-accounts #accounts-table,
#view-accounts #accounts-table tbody tr,
#view-accounts #accounts-table tbody tr:nth-child(even) {
  background: var(--ui-panel);
}

#view-accounts #accounts-table tbody tr:nth-child(even) {
  background: var(--ui-panel-alt);
}

#view-accounts #accounts-table th {
  background: var(--ui-panel-alt);
  color: var(--ui-muted);
}

#view-accounts #accounts-table tbody td {
  border-bottom-color: var(--ui-line-soft);
}

/* PnL: controls first, summary second, detailed positions use the remaining page. */
#view-pnl .pnl-controls {
  position: sticky;
  top: 148px;
  z-index: 12;
}

.guest-mode #view-pnl .pnl-controls {
  position: static;
}

#view-pnl .pnl-account-summary,
#view-pnl > .table-surface:last-child {
  width: 100%;
}

.pnl-table-wrap,
.orders-table-wrap,
.operations-table-wrap {
  max-height: min(58vh, 720px);
}

/* Straddle keeps its premium panel and adds only the aligned risk charts. */
.straddle-pnl-view.active {
  display: flex;
  flex-direction: column;
}

.straddle-premium-workspace {
  order: -1;
}

.straddle-premium-workspace > .surface,
.straddle-premium-workspace > .straddle-chart-layout,
.straddle-premium-workspace > .chart-gesture-hint,
.straddle-premium-workspace > .straddle-session-banner {
  margin-bottom: 18px;
}

.chart-layout {
  grid-template-columns: minmax(0, 1.7fr) minmax(320px, 0.8fr);
  gap: 14px;
}

.chart-layout--stacked {
  grid-template-columns: minmax(0, 1fr);
}

.chart-panel {
  min-width: 0;
  padding: 16px;
}

.chart-layout--stacked .chart-panel--main .chart-host {
  min-height: 280px;
}

.chart-layout--stacked .chart-panel:not(.chart-panel--main) .chart-host,
#pnl-delta-panel .chart-host--compact {
  min-height: 210px;
}

#view-straddle > .chart-panel .chart-host--compact {
  min-height: 210px;
}

.chart-delta-disclosure {
  padding: 0;
  overflow: clip;
}

.chart-delta-disclosure > summary {
  min-height: 58px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.chart-delta-disclosure > summary::-webkit-details-marker {
  display: none;
}

.chart-delta-disclosure > summary::before {
  content: '';
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--ui-faint);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--ui-faint) 14%, transparent);
}

.chart-delta-disclosure[open] > summary::before {
  background: var(--ui-copy);
}

.chart-delta-disclosure > summary > span:first-child {
  display: grid;
  gap: 2px;
}

.chart-delta-disclosure > summary small {
  color: var(--ui-faint);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.chart-delta-disclosure > summary strong {
  color: var(--ui-copy);
  font-size: 14px;
}

.chart-delta-disclosure > summary .row-count {
  margin-left: auto;
}

.chart-delta-disclosure[open] > summary {
  border-bottom: 1px solid var(--ui-line-soft);
}

.chart-gesture-hint {
  margin: -8px 0 14px;
  color: var(--ui-faint);
}

/* Straddle and payoff receive the full available canvas. */
.straddle-unified-panel,
.payoff-card {
  background: var(--ui-panel);
}

.straddle-premium-chart {
  height: 520px;
  min-height: 520px;
}

.straddle-unified-panel {
  padding: 0;
  overflow: visible;
}

.straddle-unified-panel > .surface-header,
.straddle-unified-panel > .straddle-legend,
.straddle-unified-panel > .straddle-axis-guide {
  margin-left: 16px;
  margin-right: 16px;
}

.straddle-unified-panel > .surface-header {
  padding-top: 16px;
}

.straddle-canvas-wrap {
  min-height: 520px;
}

.straddle-axis-guide {
  min-height: 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  border-top: 1px solid var(--ui-line-soft);
  color: var(--ui-faint);
  font-size: 8px;
}

.straddle-axis-guide span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.straddle-axis-guide strong {
  color: var(--ui-muted);
  font-size: 8px;
}

.straddle-axis-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
}

.straddle-axis-dot--index {
  background: linear-gradient(90deg, #1261a6 50%, #087a55 50%);
}

.straddle-axis-dot--pnl {
  background: #7138b7;
}

.straddle-axis-dot--premium {
  background: #b45309;
}

html:not([data-theme="light"]) .straddle-axis-dot--index {
  background: linear-gradient(90deg, #5ea8ff 50%, #4dd6a5 50%);
}

html:not([data-theme="light"]) .straddle-axis-dot--pnl {
  background: #c084fc;
}

html:not([data-theme="light"]) .straddle-axis-dot--premium {
  background: #f5b85c;
}

.straddle-risk-account {
  width: min(270px, 100%);
  margin-left: auto;
  display: grid;
  gap: 5px;
}

.straddle-risk-account > span {
  color: var(--ui-faint);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.straddle-risk-account select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--ui-line);
  border-radius: 8px;
  background: var(--ui-panel);
  color: var(--ui-copy);
  padding: 0 32px 0 10px;
  font-size: 11px;
  font-weight: 650;
}

.straddle-picker {
  position: relative;
  min-width: 0;
}

.straddle-control.straddle-picker {
  width: 190px;
}

.straddle-picker-trigger {
  width: 100%;
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 10px;
  border: 1px solid var(--ui-line);
  border-radius: 8px;
  background: var(--ui-panel-alt);
  color: var(--ui-copy);
  cursor: pointer;
  text-align: left;
}

.straddle-picker-trigger strong {
  overflow: hidden;
  font-size: 11px;
  font-weight: 680;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.straddle-picker-trigger > span {
  color: var(--ui-faint);
  font-size: 12px;
  transition: transform 120ms ease;
}

.straddle-picker-trigger[aria-expanded="true"] {
  border-color: var(--ui-muted);
  background: var(--ui-panel);
  box-shadow: 0 0 0 3px var(--ui-blue-soft);
}

.straddle-picker-trigger[aria-expanded="true"] > span {
  transform: rotate(180deg);
}

.straddle-picker-menu {
  position: absolute;
  top: calc(100% + 7px);
  left: 0;
  z-index: 45;
  width: min(330px, calc(100vw - 32px));
  max-height: min(430px, calc(100vh - 120px));
  overflow: hidden;
  border: 1px solid var(--ui-line);
  border-radius: 10px;
  background: var(--ui-panel);
  box-shadow: var(--ui-shadow);
}

.straddle-picker-menu--account {
  right: 0;
  left: auto;
  width: min(390px, calc(100vw - 32px));
}

.straddle-picker-menu-head {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px;
  border-bottom: 1px solid var(--ui-line-soft);
}

.straddle-picker-menu-head .search-control {
  width: 100%;
  min-width: 0;
}

.straddle-picker-menu-head .icon-button {
  min-width: 34px;
  min-height: 34px;
}

.straddle-picker-options {
  max-height: min(354px, calc(100vh - 190px));
  overflow-y: auto;
  padding: 7px;
}

.straddle-picker-option {
  width: 100%;
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 9px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ui-copy);
  cursor: pointer;
  text-align: left;
}

.straddle-picker-option:hover,
.straddle-picker-option:focus-visible {
  background: var(--surface-hover);
}

.straddle-picker-option[data-selected="true"] {
  background: var(--ui-blue-soft);
  box-shadow: inset 3px 0 0 var(--ui-blue);
}

.straddle-picker-option > span {
  min-width: 0;
}

.straddle-picker-option strong,
.straddle-picker-option small {
  display: block;
}

.straddle-picker-option strong {
  overflow: hidden;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.straddle-picker-option small {
  margin-top: 3px;
  overflow: hidden;
  color: var(--ui-faint);
  font-family: var(--mono);
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.straddle-picker-option .straddle-picker-badge {
  flex: 0 0 auto;
  margin: 0;
  padding: 3px 6px;
  border: 1px solid var(--ui-line);
  border-radius: 999px;
  background: var(--ui-panel-alt);
  font-family: var(--sans);
  font-size: 7px;
  font-weight: 750;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.straddle-picker-group,
.straddle-picker-limit {
  padding: 7px 9px 5px;
  color: var(--ui-faint);
  font-size: 8px;
  font-weight: 750;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.straddle-picker-limit {
  border-top: 1px solid var(--ui-line-soft);
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.4;
  text-transform: none;
}

/* Shared data-density rules keep controls and numbers aligned across views. */
.data-table th.numeric,
.data-table td.numeric,
.numeric-value {
  text-align: right;
}

.numeric-value,
.metric-value,
.metric-card-value,
.market-index-price,
.market-index-compact-premium strong,
.market-index-premium-price,
.market-index-premium-metric strong,
.straddle-live-values strong,
.payoff-metric strong {
  min-width: 0;
  max-width: 100%;
  font-variant-numeric: tabular-nums;
}

input[type="number"],
input[type="time"] {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

.straddle-indicator-pane {
  position: relative;
  border-top: 1px solid var(--ui-line);
  background: color-mix(in srgb, var(--ui-panel) 94%, var(--ui-copy) 6%);
}

.straddle-indicator-pane[hidden] {
  display: none;
}

.straddle-indicator-pane .chart-host,
.straddle-indicator-pane .chart-host--compact {
  min-height: 180px;
}

.straddle-indicator-head {
  position: absolute;
  top: 9px;
  left: 14px;
  z-index: 3;
  display: flex;
  align-items: baseline;
  gap: 8px;
  pointer-events: none;
}

.straddle-indicator-head span {
  color: var(--ui-copy);
  font-size: 11px;
  font-weight: 700;
}

.straddle-indicator-head strong {
  color: var(--ui-faint);
  font: 600 9px var(--mono);
}

.payoff-grid {
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
}

.payoff-workspace {
  grid-template-columns: minmax(250px, 300px) minmax(0, 1fr);
}

.payoff-workspace.payoff-workspace--single {
  grid-template-columns: minmax(0, 1fr);
}

.payoff-rail,
.payoff-card {
  background: var(--ui-panel);
}

.payoff-combined {
  background: color-mix(in srgb, var(--ui-amber) 14%, var(--ui-panel));
  border-top-color: color-mix(in srgb, var(--ui-amber) 45%, var(--ui-line));
}

/* Hedge keeps account context visible while the selected workspace scrolls. */
.hedge-command-center {
  grid-template-columns: minmax(330px, 0.72fr) minmax(620px, 1.7fr);
  gap: 14px;
}

.hedge-account-rail {
  position: sticky;
  top: 150px;
  align-self: start;
  max-height: calc(100vh - 174px);
}

.hedge-console,
.hedge-account-rail {
  background: var(--ui-panel);
}

.hedge-console-tabs {
  border-color: var(--ui-line);
  background: var(--ui-panel-alt);
}

/* Operational pages: filters and evidence stay together on one dedicated page. */
.order-analytics,
.control-global,
.recon-uncertain,
.config-section {
  background: var(--ui-panel);
}

.operations-filter-toolbar,
.slippage-toolbar {
  align-items: center;
}

.operations-filter-toolbar .search-control,
.slippage-toolbar .slippage-global-search {
  min-width: min(320px, 100%);
}

#view-slippage .operations-table th:nth-child(1),
#view-slippage .operations-table td:nth-child(1),
#view-slippage .operations-table th:nth-child(2),
#view-slippage .operations-table td:nth-child(2) {
  background: var(--ui-panel);
  color: var(--ui-copy);
}

#view-slippage .operations-table thead th:nth-child(-n+2) {
  background: var(--ui-panel-alt);
  color: var(--ui-muted);
}

#view-slippage .operations-table tbody tr:hover td:nth-child(-n+2) {
  background: color-mix(in srgb, var(--ui-blue) 13%, var(--ui-panel));
}

.config-layout {
  grid-template-columns: minmax(540px, 1.25fr) minmax(390px, 0.75fr);
  gap: 14px;
}

.config-section {
  padding: 18px;
}

.config-pnl-window-heading-actions {
  align-items: center;
}

.config-pnl-window-heading-actions .row-count {
  margin-left: 0;
}

.config-pnl-window-list {
  gap: 9px;
}

.config-pnl-window-row {
  grid-template-columns: 52px minmax(180px, 1.05fr) minmax(310px, 1.45fr) minmax(155px, .7fr) auto;
  gap: 13px;
  padding: 14px;
  border-color: var(--ui-line);
  border-radius: 10px;
  background: var(--ui-panel-alt);
  box-shadow: inset 3px 0 0 var(--ui-blue);
}

.config-pnl-window-row[data-enabled="false"] {
  box-shadow: inset 3px 0 0 var(--ui-line);
}

.config-pnl-window-marker {
  align-self: center;
  text-align: center;
}

.config-pnl-window-marker span,
.config-pnl-window-marker small {
  display: block;
}

.config-pnl-window-marker span {
  color: var(--ui-copy);
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 800;
}

.config-pnl-window-marker small,
.config-pnl-window-row label > span,
.config-pnl-window-session-head > span {
  color: var(--ui-faint);
  font-size: 8px;
  font-weight: 750;
  letter-spacing: .065em;
  text-transform: uppercase;
}

.config-pnl-window-name,
.config-pnl-window-session {
  min-width: 0;
}

.config-pnl-window-name input,
.config-pnl-window-time-range input {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--ui-line);
  border-radius: 8px;
  outline: 0;
  background: var(--ui-panel);
  color: var(--ui-copy);
  font-size: 11px;
}

.config-pnl-window-name input:focus,
.config-pnl-window-time-range input:focus {
  border-color: var(--ui-muted);
  box-shadow: 0 0 0 3px var(--ui-blue-soft);
}

.config-pnl-window-session {
  display: grid;
  gap: 6px;
}

.config-pnl-window-session-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.config-pnl-window-session-head strong {
  color: var(--ui-muted);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
}

.config-pnl-window-time-range {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 18px minmax(0, 1fr);
  align-items: end;
  gap: 6px;
}

.config-pnl-window-time-range label {
  gap: 3px;
}

.config-pnl-window-time-arrow {
  align-self: center;
  color: var(--ui-faint);
  font-size: 14px;
  text-align: center;
  transform: translateY(4px);
}

.config-pnl-window-toggle {
  position: relative;
  min-height: 38px;
  display: flex !important;
  align-items: center;
  gap: 9px !important;
  cursor: pointer;
}

.config-pnl-window-toggle input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.config-pnl-window-toggle-track {
  width: 36px;
  height: 20px;
  flex: 0 0 auto;
  padding: 2px;
  border: 1px solid var(--ui-line);
  border-radius: 999px;
  background: var(--ui-panel);
  transition: border-color 120ms ease, background 120ms ease;
}

.config-pnl-window-toggle-track > span {
  display: block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--ui-faint);
  transition: transform 120ms ease, background 120ms ease;
}

.config-pnl-window-toggle input:checked + .config-pnl-window-toggle-track {
  border-color: var(--ui-blue);
  background: var(--ui-blue);
}

.config-pnl-window-toggle input:checked + .config-pnl-window-toggle-track > span {
  background: var(--ui-accent-ink);
  transform: translateX(16px);
}

.config-pnl-window-toggle input:focus-visible + .config-pnl-window-toggle-track {
  outline: 2px solid var(--ui-copy);
  outline-offset: 2px;
}

.config-pnl-window-toggle-copy strong,
.config-pnl-window-toggle-copy small {
  display: block;
}

.config-pnl-window-toggle-copy strong {
  color: var(--ui-copy);
  font-size: 10px;
}

.config-pnl-window-toggle-copy small {
  margin-top: 2px;
  color: var(--ui-faint);
  font-size: 8px;
  white-space: nowrap;
}

.config-pnl-window-remove {
  align-self: center;
  min-height: 34px;
  padding-inline: 10px;
}

.config-pnl-window-actions {
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--ui-line-soft);
}

.config-pnl-window-actions > span {
  color: var(--ui-faint);
  font-size: 9px;
}

.config-pnl-window-actions > div {
  display: flex;
  gap: 8px;
}

#config-pnl-window-empty {
  border: 1px dashed var(--ui-line);
  border-radius: 10px;
  background: var(--ui-panel-alt);
}

.config-form input,
.config-form select,
.config-add-row > input,
.drawer input,
.drawer select {
  border-color: var(--ui-line);
  background: var(--ui-panel-alt);
  color: var(--ui-copy);
}

.drawer,
.app-confirm-dialog,
.global-alert-popup,
.picker-menu {
  border-color: var(--ui-line);
  background: var(--ui-panel);
  color: var(--ui-copy);
}

.app-confirm-scrim,
.drawer-scrim {
  background: rgba(5, 6, 6, 0.72);
}

.app-confirm-dialog {
  border-radius: var(--ui-radius);
  background-image: none;
  box-shadow: var(--ui-shadow);
  animation: ui-dialog-in 120ms ease-out both;
}

@keyframes ui-dialog-in {
  from { opacity: 0; transform: translateY(5px) scale(0.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.app-confirm-icon {
  border: 1px solid var(--ui-line);
  background: var(--ui-panel-alt);
  color: var(--ui-muted);
}

.app-confirm-dialog[data-tone="danger"] {
  border-color: color-mix(in srgb, var(--ui-red) 52%, var(--ui-line));
}

.app-confirm-dialog[data-tone="danger"] .app-confirm-icon {
  border-color: color-mix(in srgb, var(--ui-red) 35%, var(--ui-line));
  background: color-mix(in srgb, var(--ui-red) 12%, var(--ui-panel));
  color: var(--ui-red);
}

.app-confirm-copy h2 {
  color: var(--ui-copy);
}

.app-confirm-copy p:last-child {
  color: var(--ui-muted);
}

.global-alert-popup {
  background-image: none;
  box-shadow: var(--ui-shadow);
}

.chart-tooltip,
.straddle-floating-tooltip,
.nav-hover-label {
  border-color: var(--ui-line);
  background: var(--ui-panel);
  box-shadow: var(--ui-shadow);
  color: var(--ui-copy);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.chart-tooltip strong,
.chart-tooltip small,
.straddle-tooltip-time,
.straddle-tooltip-label {
  color: var(--ui-muted);
}

.chart-tooltip span,
.straddle-tooltip-row strong {
  color: var(--ui-copy);
}

.straddle-tooltip-time {
  border-bottom-color: var(--ui-line-soft);
}

html[data-theme="light"] .chart-tooltip,
html[data-theme="light"] .straddle-floating-tooltip,
html[data-theme="light"] .nav-hover-label {
  border-color: var(--ui-line);
  background: var(--ui-panel);
  box-shadow: 0 7px 20px rgba(35, 49, 42, 0.14);
}

html[data-theme="light"] .market-index,
html[data-theme="light"] .data-table th,
html[data-theme="light"] #accounts-table th,
html[data-theme="light"] .hedge-console-tabs,
html[data-theme="light"] .segmented,
html[data-theme="light"] .picker-menu,
html[data-theme="light"] .drawer {
  background: var(--ui-panel-alt);
}

html[data-theme="light"] .surface,
html[data-theme="light"] .metric-card,
html[data-theme="light"] .market-index,
html[data-theme="light"] .picker-menu,
html[data-theme="light"] .drawer,
html[data-theme="light"] .app-confirm-dialog,
html[data-theme="light"] .global-alert-popup {
  border-color: var(--ui-line);
  box-shadow: 0 1px 3px rgba(35, 49, 42, 0.1);
}

html[data-theme="light"] .picker-actions--sticky,
html[data-theme="light"] .custom-total-row td,
html[data-theme="light"] .operation-details,
html[data-theme="light"] .overview-hedge-disclosures details {
  background: var(--ui-panel-alt);
  color: var(--ui-copy);
}

html[data-theme="light"] .positive {
  color: #087b4b;
}

html[data-theme="light"] .negative {
  color: #bf3044;
}

/* Accounts is a native workspace, not a card inside the Accounts page. */
#view-accounts .accounts-workspace {
  width: 100%;
  min-width: 0;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

#view-accounts .accounts-workspace .table-toolbar {
  padding: 9px 0 12px;
  border: 0;
  border-bottom: 1px solid var(--ui-line);
  background: transparent;
}

#view-accounts .accounts-table-wrap {
  width: 100%;
  height: auto;
  max-height: none;
  overflow-x: auto;
  background: transparent;
  scrollbar-color: var(--ui-line) transparent;
  scrollbar-width: thin;
}

#view-accounts #accounts-table {
  width: max-content;
  min-width: 100%;
  table-layout: auto;
  background: transparent;
  color: var(--ui-copy);
  font-size: 12.5px;
  user-select: text;
}

#view-accounts #accounts-table th {
  position: sticky;
  top: 0;
  z-index: 3;
  height: 34px;
  max-width: 132px;
  padding: 5px 9px;
  border-bottom: 1px solid var(--ui-line);
  background: var(--ui-panel-alt);
  color: var(--ui-muted);
  font-size: 10.5px;
  line-height: 1.2;
}

#view-accounts #accounts-table tbody tr,
#view-accounts #accounts-table tbody tr:nth-child(even) {
  background: transparent;
}

#view-accounts #accounts-table tbody tr:nth-child(even) {
  background: color-mix(in srgb, var(--ui-panel-alt) 42%, transparent);
}

#view-accounts #accounts-table tbody tr:hover,
#view-accounts #accounts-table tbody tr:nth-child(even):hover {
  background: color-mix(in srgb, var(--ui-muted) 10%, transparent);
}

#view-accounts #accounts-table tbody td {
  height: 39px;
  padding: 4px 9px;
  border-bottom: 1px solid var(--ui-line-soft);
  font-size: 12.5px;
  font-weight: 680;
  line-height: 1.15;
  cursor: text;
  user-select: text;
}

#view-accounts #accounts-table th:first-child,
#view-accounts #accounts-table td:first-child {
  position: sticky;
  left: 0;
  width: var(--account-column-width, max-content);
  min-width: var(--account-column-width, 132px);
  max-width: var(--account-column-width, 220px);
  box-shadow: 1px 0 0 var(--ui-line);
}

#view-accounts #accounts-table th:first-child {
  z-index: 5;
  background: var(--ui-panel-alt);
}

#view-accounts #accounts-table tbody td:first-child {
  z-index: 2;
  background: var(--ui-page);
}

#view-accounts #accounts-table tbody tr:nth-child(even) td:first-child {
  background: color-mix(in srgb, var(--ui-panel-alt) 42%, var(--ui-page));
}

#view-accounts #accounts-table tbody tr:hover td:first-child {
  background: color-mix(in srgb, var(--ui-muted) 10%, var(--ui-page));
}

#view-accounts #accounts-table .account-cell-line {
  gap: 6px;
}

#view-accounts #accounts-table .account-cell strong {
  max-width: calc(var(--account-column-width, 220px) - 48px);
  font-size: 12.5px;
  line-height: 1.08;
  user-select: text;
}

#view-accounts #accounts-table .account-cell > span {
  margin-top: 1px;
  color: var(--ui-muted);
  font-size: 9px;
  line-height: 1;
  user-select: text;
}

#view-accounts #accounts-table .account-row--lead .account-cell strong {
  color: var(--accent-strong);
}

#view-accounts #accounts-table .account-row--shadow .account-cell strong {
  color: var(--violet);
}

#view-accounts #accounts-table .account-row--lead td:first-child {
  box-shadow: inset 3px 0 0 var(--accent), 1px 0 0 var(--ui-line);
}

#view-accounts #accounts-table .account-row--shadow td:first-child {
  box-shadow: inset 3px 0 0 var(--violet), 1px 0 0 var(--ui-line);
}

#view-accounts #accounts-table .account-drag-handle {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  display: inline-grid;
  place-items: center;
  border-radius: 5px;
  cursor: grab;
  user-select: none;
}

#view-accounts #accounts-table td.numeric,
#view-accounts #accounts-table td.numeric-value {
  font-weight: 740;
}

#view-accounts #accounts-table td[data-account-column="gap_pnl"],
#view-accounts #accounts-table td[data-account-column="intraday_pnl"],
#view-accounts #accounts-table td[data-account-column="expenses"],
#view-accounts #accounts-table td[data-account-column="net_pnl"],
#view-accounts #accounts-table td[data-account-column="slippage"],
#view-accounts #accounts-table td[data-account-column="hedge_pnl"] {
  font-weight: 800;
}

#view-accounts #accounts-table td[data-account-column="total_pnl"],
#view-accounts #accounts-table td[data-account-column="roi"] {
  font-family: var(--mono);
  font-size: 14px;
  font-style: normal;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  letter-spacing: -0.01em;
  text-decoration: none;
}

#view-accounts #accounts-table td[data-account-column="total_pnl"]::after,
#view-accounts #accounts-table td[data-account-column="roi"]::after {
  content: "";
  width: 4px;
  height: 4px;
  display: inline-block;
  margin-left: 6px;
  border-radius: 50%;
  background: var(--ui-faint);
  opacity: 0.7;
  vertical-align: middle;
}

#view-accounts #accounts-table td[data-account-column="net_qty"] {
  font-size: 13.5px;
  font-weight: 850;
  letter-spacing: -0.015em;
}

#view-accounts #accounts-table .account-drag-handle:hover,
#view-accounts #accounts-table .account-drag-handle:focus-visible {
  background: var(--ui-panel-alt);
  color: var(--ui-copy);
}

#view-accounts #accounts-table button,
#view-accounts #accounts-table .status-pill,
#view-accounts #accounts-table .type-pill,
#view-accounts #accounts-table .account-drag-handle {
  cursor: pointer;
  user-select: none;
}

#view-accounts #accounts-table .account-drag-handle:active {
  cursor: grabbing;
}

#view-accounts #accounts-table tr.is-drop-target td {
  border-top: 2px solid var(--accent);
  background: color-mix(in srgb, var(--ui-blue) 10%, var(--ui-page));
}

#view-accounts .pagination {
  padding: 8px 0 0;
  border: 0;
  background: transparent;
}

#view-accounts #accounts-table .custom-total-row td,
#view-accounts #accounts-table .custom-total-row:hover td {
  position: sticky;
  bottom: 0;
  z-index: 3;
  border-top: 2px solid #747c86;
  border-bottom: 0;
  background: #24282d;
  color: var(--ui-copy);
  font-weight: 800;
}

#view-accounts #accounts-table .custom-total-row td:first-child,
#view-accounts #accounts-table .custom-total-row:hover td:first-child {
  left: 0;
  z-index: 4;
  background: #24282d;
  box-shadow: 1px 0 0 var(--ui-line);
}

#view-accounts #accounts-table .custom-total-row td.positive {
  color: var(--ui-green);
}

#view-accounts #accounts-table .custom-total-row td.negative {
  color: var(--ui-red);
}

html[data-theme="light"] #view-accounts #accounts-table .custom-total-row td,
html[data-theme="light"] #view-accounts #accounts-table .custom-total-row:hover td,
html[data-theme="light"] #view-accounts #accounts-table .custom-total-row td:first-child,
html[data-theme="light"] #view-accounts #accounts-table .custom-total-row:hover td:first-child {
  border-top-color: #7c8580;
  background: #e1e5e3;
  color: #1d2924;
}

html[data-theme="light"] #view-accounts #accounts-table .custom-total-row td.positive {
  color: #087b4b;
}

html[data-theme="light"] #view-accounts #accounts-table .custom-total-row td.negative {
  color: #bf3044;
}

/* One compact lot summary; ticker detail opens inline as part of the table. */
.side-lots-cell {
  width: 64px;
  min-width: 64px;
  color: var(--ui-copy);
  font-family: var(--mono);
  font-size: 13.5px !important;
  font-weight: 820 !important;
  text-align: center;
}

#view-accounts #accounts-table .account-lots-group-head {
  width: 128px;
  min-width: 128px;
  max-width: 128px;
  border-right: 1px solid var(--ui-line);
  border-left: 1px solid var(--ui-line);
  color: var(--ui-copy);
  font-size: 11px;
  text-align: center;
}

#view-accounts #accounts-table .account-lots-subhead th {
  width: 64px;
  min-width: 64px;
  max-width: 64px;
  top: 34px;
  height: 25px;
  padding: 3px 7px;
  border-bottom: 1px solid var(--ui-line);
  color: var(--ui-muted);
  font-size: 9px;
  letter-spacing: 0.05em;
  text-align: center;
  text-transform: uppercase;
}

#view-accounts #accounts-table [data-account-column="call_buy"],
#view-accounts #accounts-table [data-account-column="put_buy"] {
  border-left: 1px solid var(--ui-line);
}

#view-accounts #accounts-table [data-account-column="call_sell"],
#view-accounts #accounts-table [data-account-column="put_sell"] {
  border-right: 1px solid var(--ui-line);
  border-left: 1px solid var(--ui-line-soft);
}

.account-lots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
}

.account-lots-ticker {
  overflow: hidden;
  border: 1px solid var(--ui-line);
  border-radius: 9px;
  background: var(--ui-panel-alt);
}

.account-lots-ticker h4 {
  margin: 0;
  padding: 8px 10px;
  border-bottom: 1px solid var(--ui-line);
  color: var(--ui-copy);
  font-size: 11px;
  letter-spacing: 0.045em;
}

.account-lots-matrix {
  display: grid;
  grid-template-columns: 1fr repeat(2, minmax(54px, 0.7fr));
  align-items: center;
}

.account-lots-matrix > * {
  min-height: 31px;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 5px 8px;
  border-right: 1px solid var(--ui-line-soft);
  border-bottom: 1px solid var(--ui-line-soft);
}

.account-lots-matrix > :nth-child(3n) {
  border-right: 0;
}

.account-lots-matrix > :nth-last-child(-n + 3) {
  border-bottom: 0;
}

.account-lots-matrix small {
  color: var(--ui-faint);
  font-size: 8px;
  letter-spacing: 0.08em;
}

.account-lots-matrix b {
  justify-items: start;
  color: var(--ui-muted);
  font-size: 10px;
}

.account-lots-matrix strong {
  color: var(--ui-copy);
  font-family: var(--mono);
  font-size: 12px;
}

.account-lots-empty {
  margin: 0;
  padding: 12px;
  color: var(--ui-muted);
}

.overview-option-lots-card {
  padding: 0;
  overflow: hidden;
}

.overview-option-lots-toggle {
  width: 100%;
  min-height: 106px;
  display: block;
  padding: 16px;
  border: 0;
  background: transparent;
  color: var(--ui-copy);
  cursor: pointer;
  text-align: left;
}

.overview-option-lots-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 13px;
}

.overview-option-lots-summary small,
.overview-option-lots-summary strong {
  display: block;
}

.overview-option-lots-summary small {
  color: var(--ui-faint);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.overview-option-lots-summary strong {
  margin-top: 3px;
  color: var(--ui-copy);
  font-family: var(--mono);
  font-size: clamp(15px, 1.35vw, 20px);
}

.overview-lots-ticker-card {
  min-height: 106px;
  padding: 13px;
}

.overview-lots-ticker-card .metric-icon {
  width: auto;
  min-width: 32px;
  padding-inline: 6px;
  font-size: 8px;
}

.overview-lots-ticker-card .account-lots-matrix {
  margin-top: 9px;
  overflow: hidden;
  border: 1px solid var(--ui-line);
  border-radius: 7px;
  background: var(--ui-panel-alt);
}

.overview-lots-ticker-card .account-lots-matrix > * {
  min-height: 25px;
  padding: 3px 6px;
}

/* Configuration keeps the four backend limits in one truthful account-wide editor. */
.option-limit-editor {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 1px solid var(--ui-line);
  border-radius: 10px;
  background: var(--ui-panel-alt);
}

.option-limit-editor > legend {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.option-limit-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 13px;
  border-bottom: 1px solid var(--ui-line);
}

.option-limit-heading strong,
.option-limit-heading span {
  display: block;
}

.option-limit-heading strong {
  color: var(--ui-copy);
  font-size: 12px;
}

.option-limit-heading span {
  margin-top: 3px;
  color: var(--ui-muted);
  font-size: 10px;
}

.option-limit-heading > small {
  color: var(--ui-faint);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.1em;
}

.option-limit-matrix {
  display: grid;
  grid-template-columns: minmax(100px, 0.8fr) repeat(2, minmax(100px, 1fr));
  align-items: center;
  padding: 10px 12px 12px;
  gap: 8px 10px;
}

.option-limit-matrix > b {
  color: var(--ui-muted);
  font-size: 9px;
  letter-spacing: 0.06em;
  text-align: center;
  text-transform: uppercase;
}

.option-limit-matrix > strong {
  color: var(--ui-copy);
  font-size: 11px;
}

.option-limit-matrix > strong small {
  margin-left: 4px;
  color: var(--ui-faint);
  font-size: 8px;
}

.option-limit-matrix label,
.option-limit-matrix input {
  min-width: 0;
}

@media (max-width: 1180px) {
  .kpi-grid,
  .tool-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .chart-layout,
  .hedge-command-center,
  .config-layout,
  .overview-grid {
    grid-template-columns: 1fr;
  }

  .hedge-account-rail,
  #view-pnl .pnl-controls {
    position: static;
    max-height: none;
  }
}

@media (max-width: 900px) {
  :root {
    --ui-page-x: 15px;
  }

  .topbar {
    height: 58px;
  }

  .market-strip {
    top: 50%;
    min-height: 0;
  }

  .page,
  body.accounts-view-active .page {
    padding-top: 20px;
  }

  .page-heading {
    align-items: flex-start;
  }

  .heading-actions,
  .table-toolbar,
  .chart-toolbar,
  .straddle-toolbar,
  .pnl-controls-main {
    width: 100%;
  }

  .table-toolbar .row-count,
  .chart-toolbar .row-count {
    width: 100%;
    margin-left: 0;
  }

  .payoff-grid,
  .payoff-workspace {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .view.active {
    animation: none;
    transform: none;
  }

  .kpi-grid,
  .tool-grid {
    grid-template-columns: 1fr;
  }

  .surface {
    padding: 14px;
  }

  .table-surface {
    padding: 0;
  }

  #view-accounts #accounts-table th:first-child,
  #view-accounts #accounts-table td:first-child {
    width: min(var(--account-column-width, 180px), 58vw);
    min-width: min(var(--account-column-width, 180px), 58vw);
    max-width: 58vw;
    overflow: hidden;
  }

  #view-accounts #accounts-table .account-cell {
    min-width: 0;
  }

  #view-accounts #accounts-table .account-cell strong {
    max-width: calc(min(var(--account-column-width, 180px), 58vw) - 42px);
  }

  #view-accounts #accounts-table .account-cell > span {
    max-width: calc(min(var(--account-column-width, 180px), 58vw) - 18px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #account-column-menu,
  #account-total-menu {
    position: fixed;
    top: calc(var(--topbar) + 8px);
    right: 10px;
    bottom: 10px;
    left: 10px;
    width: auto;
    max-height: none;
    overflow: auto;
  }

  #account-total-menu .custom-total-options,
  #account-column-menu .picker-options {
    max-height: none;
  }
}

@media (max-width: 1050px) {
  .config-pnl-window-row {
    grid-template-columns: 44px minmax(0, 1fr) auto;
  }

  .config-pnl-window-session,
  .config-pnl-window-toggle {
    grid-column: 1 / -1;
  }

  .config-pnl-window-toggle {
    padding-left: 4px;
  }
}

@media (max-width: 620px) {
  .straddle-axis-guide {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }

  .straddle-control.straddle-picker,
  .straddle-risk-account {
    width: 100%;
  }

  .straddle-picker-menu,
  .straddle-picker-menu--account {
    position: fixed;
    top: calc(var(--topbar) + 8px);
    right: 10px;
    bottom: 10px;
    left: 10px;
    width: auto;
    max-height: none;
  }

  .straddle-picker-options {
    max-height: calc(100vh - var(--topbar) - 92px);
  }

  .config-pnl-window-heading-actions {
    align-items: stretch;
  }

  .config-pnl-window-heading-actions .row-count {
    width: auto;
  }

  .config-pnl-window-row {
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 12px;
  }

  .config-pnl-window-marker {
    display: flex;
    align-items: baseline;
    gap: 6px;
    text-align: left;
  }

  .config-pnl-window-marker span,
  .config-pnl-window-marker small {
    display: inline;
  }

  .config-pnl-window-name,
  .config-pnl-window-session,
  .config-pnl-window-toggle {
    grid-column: 1 / -1;
  }

  .config-pnl-window-remove {
    grid-column: 2;
    grid-row: 1;
  }

  .config-pnl-window-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .config-pnl-window-actions > div {
    width: 100%;
  }

  .config-pnl-window-actions > div button {
    flex: 1;
  }
}
