/* Manual Spot spreadsheet presentation. Read-only UI enhancement. */
.manual-spot-pnl-positive,
.manual-spot-sheet-cell--profit {
  color: var(--pnl-profit) !important;
}

.manual-spot-pnl-negative,
.manual-spot-sheet-cell--loss {
  color: var(--pnl-loss) !important;
}

.manual-spot-pnl-neutral,
.manual-spot-sheet-cell--neutral {
  color: var(--pnl-neutral) !important;
}

.manual-spot-manager,
.manual-spot-history {
  overflow-anchor: none;
}

.manual-spot-readiness,
.manual-spot-readiness-grid,
.manual-spot-detail-value,
.manual-spot-sheet-header,
.manual-spot-sheet-row {
  font-variant-numeric: tabular-nums;
}

.manual-spot-history {
  --manual-spot-sheet-columns:
    120px 128px 112px 130px 132px 138px 190px 96px 118px minmax(250px, 1fr) 170px 170px;
  display: block !important;
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  scrollbar-gutter: stable;
}

.manual-spot-history > .empty-state,
.manual-spot-history > .manual-spot-status-warning {
  border: 0;
  border-radius: 0;
}

.manual-spot-sheet-header,
.manual-spot-sheet-row {
  display: grid;
  grid-template-columns: var(--manual-spot-sheet-columns);
  min-width: 1760px;
}

.manual-spot-sheet-header {
  position: sticky;
  top: 0;
  z-index: 6;
  border-bottom: 1px solid var(--border);
  background: var(--panel-strong);
  box-shadow: 0 1px 0 var(--border);
}

.manual-spot-sheet-header__cell {
  display: flex;
  min-height: 42px;
  align-items: center;
  border-right: 1px solid var(--border);
  padding: 8px 10px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.055em;
  text-transform: uppercase;
  white-space: nowrap;
}

.manual-spot-sheet-header__cell:last-child {
  border-right: 0;
}

.manual-spot-trade-row {
  position: relative;
  min-width: 1760px;
  margin: 0;
  overflow: visible;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  padding: 0;
  background: var(--panel);
  contain: layout paint;
}

.manual-spot-trade-row:last-child {
  border-bottom: 0;
}

.manual-spot-trade-row[data-sheet-terminal="true"][data-sheet-tone="profit"] {
  box-shadow: inset 4px 0 0 var(--pnl-profit);
}

.manual-spot-trade-row[data-sheet-terminal="true"][data-sheet-tone="loss"] {
  box-shadow: inset 4px 0 0 var(--pnl-loss);
}

.manual-spot-trade-row > .manual-spot-trade-main,
.manual-spot-trade-row > .manual-spot-trade-details,
.manual-spot-trade-row > .manual-spot-result-banner {
  display: none !important;
}

.manual-spot-sheet-row {
  align-items: stretch;
  background: var(--panel);
}

.manual-spot-sheet-cell {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 62px;
  align-items: center;
  border-right: 1px solid var(--border);
  padding: 9px 10px;
  overflow: hidden;
  background: var(--panel);
  color: var(--text);
  white-space: nowrap;
  transition: none !important;
  animation: none !important;
}

.manual-spot-sheet-cell:last-child {
  border-right: 0;
}

.manual-spot-sheet-cell strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.manual-spot-sheet-cell--pair {
  display: grid;
  align-content: center;
  gap: 2px;
}

.manual-spot-sheet-cell--pair strong {
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 700;
}

.manual-spot-sheet-cell--pair small {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.66rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.manual-spot-sheet-cell--state strong {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: 4px 7px;
  font-size: 0.68rem;
  letter-spacing: 0.025em;
  text-transform: uppercase;
}

.manual-spot-sheet-cell--pnl,
.manual-spot-sheet-cell--return {
  background: color-mix(in srgb, currentColor 8%, var(--panel));
}

.manual-spot-sheet-cell--pnl strong,
.manual-spot-sheet-cell--return strong {
  font-size: 0.9rem;
  font-weight: 700;
}

.manual-spot-sheet-cell--protection strong {
  font-size: 0.76rem;
}

.manual-spot-sheet-cell--updated strong {
  font-size: 0.72rem;
}

.manual-spot-sheet-cell--actions {
  display: flex;
  gap: 6px;
  justify-content: flex-start;
  overflow: visible;
}

.manual-spot-sheet-cell--actions .manual-spot-trade-actions {
  display: inline-flex;
  flex: 0 0 auto;
  margin: 0;
  gap: 6px;
}

.manual-spot-sheet-cell--actions .manual-spot-trade-actions button,
.manual-spot-sheet-cell--actions .manual-spot-trade-disclosure summary {
  min-height: 32px;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 6px 9px;
  background: var(--panel-strong);
  color: var(--text);
  font: inherit;
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
}

.manual-spot-sheet-cell--actions .manual-spot-trade-disclosure {
  position: relative;
  flex: 0 0 auto;
  margin: 0;
  color: var(--text);
}

.manual-spot-sheet-cell--actions .manual-spot-trade-disclosure summary {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  list-style: none;
}

.manual-spot-sheet-cell--actions .manual-spot-trade-disclosure summary::-webkit-details-marker {
  display: none;
}

.manual-spot-sheet-cell--actions .manual-spot-trade-disclosure[open] > .manual-spot-trade-details {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 30;
  display: grid !important;
  width: min(620px, calc(100vw - 64px));
  max-height: 360px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1px;
  background: var(--border);
  box-shadow: var(--shadow);
}

.manual-spot-sheet-actions-empty {
  color: var(--muted);
}

.manual-spot-trade-row[data-sheet-terminal="true"] .manual-spot-sheet-cell--state,
.manual-spot-trade-row[data-sheet-terminal="true"] .manual-spot-sheet-cell--pnl,
.manual-spot-trade-row[data-sheet-terminal="true"] .manual-spot-sheet-cell--return {
  font-weight: 700;
}

.manual-spot-trade-row[data-sheet-terminal="true"][data-sheet-tone="profit"] .manual-spot-sheet-cell--state,
.manual-spot-trade-row[data-sheet-terminal="true"][data-sheet-tone="profit"] .manual-spot-sheet-cell--pnl,
.manual-spot-trade-row[data-sheet-terminal="true"][data-sheet-tone="profit"] .manual-spot-sheet-cell--return {
  background: color-mix(in srgb, var(--pnl-profit) 10%, var(--panel));
  color: var(--pnl-profit) !important;
}

.manual-spot-trade-row[data-sheet-terminal="true"][data-sheet-tone="loss"] .manual-spot-sheet-cell--state,
.manual-spot-trade-row[data-sheet-terminal="true"][data-sheet-tone="loss"] .manual-spot-sheet-cell--pnl,
.manual-spot-trade-row[data-sheet-terminal="true"][data-sheet-tone="loss"] .manual-spot-sheet-cell--return {
  background: color-mix(in srgb, var(--pnl-loss) 10%, var(--panel));
  color: var(--pnl-loss) !important;
}

@media (max-width: 900px) {
  .manual-spot-history {
    border-radius: 9px;
  }
}
