/* Панель «Торговля» — верхнее меню в стиле TMM (слева, тёмный фон, активный блок) */

.trading-page {
  --trading-bar-bg: #161a22;
  --trading-bar-active: #1c2330;
  --trading-bar-hover: #1a2029;
  --trading-brand-green: #3dba6a;
  min-height: 100%;
  margin: 0;
  background: var(--bg);
}

.trading-topbar {
  position: sticky;
  top: 0;
  z-index: 200;
  height: 40px;
  background: var(--trading-bar-bg);
  border-bottom: 1px solid #232833;
}

.trading-topbar__inner {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  height: 100%;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: thin;
}

.trading-topbar__left {
  display: flex;
  align-items: stretch;
  min-width: 0;
  flex: 1 1 auto;
}

.trading-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  padding: 0 14px 0 12px;
  border-right: 1px solid #232833;
}

.trading-brand__mark {
  display: flex;
  align-items: center;
  color: var(--trading-brand-green);
  line-height: 0;
}

.trading-brand__icon {
  display: block;
}

.trading-brand__text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1.05;
}

.trading-brand__line {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--trading-brand-green);
  text-transform: uppercase;
}

.trading-project-wrap {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  padding: 0 12px;
}

.trading-project-select {
  height: 28px;
  max-width: 200px;
  padding: 0 28px 0 10px;
  border: 1px solid #2a3342;
  border-radius: 4px;
  background: #1c2330 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23a8b0bd' stroke-width='1.4' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 8px center;
  color: #e7eaf0;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  appearance: none;
}

.trading-project-select:focus {
  outline: none;
  border-color: var(--trading-brand-green);
}

.trading-topbar__sep {
  width: 1px;
  flex-shrink: 0;
  align-self: stretch;
  background: #232833;
}

.trading-nav {
  display: flex;
  align-items: stretch;
  justify-content: flex-start;
  flex: 0 1 auto;
  gap: 0;
  margin: 0;
  padding: 0;
}

.trading-nav__item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  height: 100%;
  margin: 0;
  padding: 0 18px;
  border: none;
  border-radius: 0;
  outline: none;
  box-shadow: none;
  background: transparent;
  color: rgba(231, 234, 240, 0.92);
  font: inherit;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.01em;
  white-space: nowrap;
  cursor: pointer;
}

.trading-nav__item:focus,
.trading-nav__item:focus-visible,
.trading-nav__item:active {
  outline: none;
  box-shadow: none;
}

.trading-nav__item:hover {
  background: var(--trading-bar-hover);
  color: #fff;
  filter: none;
}

.trading-nav__item.is-active {
  background: var(--trading-bar-active);
  color: #fff;
  filter: none;
}

.trading-nav__item.is-active:hover {
  background: var(--trading-bar-active);
}

.trading-topbar__wallet {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-shrink: 0;
  padding: 0 16px 0 20px;
  margin-left: auto;
  border-left: 1px solid #232833;
  font-variant-numeric: tabular-nums;
}

.trading-wallet__item {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  min-width: 5.5rem;
}

.trading-wallet__label {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(231, 234, 240, 0.45);
  white-space: nowrap;
}

.trading-wallet__value {
  font-size: 13px;
  font-weight: 600;
  color: #e7eaf0;
  white-space: nowrap;
}

.trading-wallet__value.is-loading {
  color: rgba(231, 234, 240, 0.35);
}

.trading-wallet__value.is-error {
  color: #ef5350;
  font-size: 11px;
  font-weight: 500;
  max-width: 10rem;
  white-space: normal;
  text-align: right;
}

.trading-topbar__logout {
  flex-shrink: 0;
  height: 26px;
  margin-left: 4px;
  padding: 0 10px;
  border: 1px solid #2a3140;
  border-radius: 4px;
  background: transparent;
  color: rgba(231, 234, 240, 0.7);
  font-size: 11px;
  cursor: pointer;
  align-self: center;
}

.trading-topbar__logout:hover {
  color: #e7eaf0;
  border-color: #3a4356;
  background: #222833;
}

.trading-main {
  max-width: 1100px;
  margin: 0;
  padding: 24px 20px 48px;
}

.trading-panel#trading-panel-summary {
  max-width: none;
}

.trading-main:has(#trading-panel-summary.is-active) {
  max-width: 1280px;
}

.trading-summary {
  margin-top: 4px;
}

.trading-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.trading-summary-widget {
  display: flex;
  flex-direction: column;
  min-height: 320px;
  padding: 12px 14px 8px;
  border: 1px solid #232833;
  border-radius: 8px;
  background: #12151c;
}

.trading-summary-widget--span-left {
  grid-column: 1 / 2;
}

.trading-summary-widget__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.trading-summary-widget__title {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: #e7eaf0;
}

.trading-summary-widget__menu {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  width: 28px;
  height: 24px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  cursor: default;
  opacity: 0.45;
}

.trading-summary-widget__menu::before,
.trading-summary-widget__menu::after,
.trading-summary-widget__menu span {
  display: block;
  width: 14px;
  height: 2px;
  margin: 0 auto;
  border-radius: 1px;
  background: #8b93a7;
  content: '';
}

.trading-summary-widget__menu::before {
  margin-bottom: 3px;
}

.trading-summary-widget__menu::after {
  margin-top: 3px;
}

.trading-summary-widget__chart {
  flex: 1;
  min-height: 280px;
}

.trading-summary__axis-hint {
  margin: 0 0 14px;
  font-size: 12px;
  line-height: 1.45;
  color: rgba(231, 234, 240, 0.5);
}

.trading-summary__status {
  margin: 12px 0 0;
  font-size: 13px;
  color: rgba(231, 234, 240, 0.55);
}

.trading-summary__status.is-error {
  color: #ef5350;
}

@media (max-width: 900px) {
  .trading-summary-grid {
    grid-template-columns: 1fr;
  }
  .trading-summary-widget--span-left {
    grid-column: auto;
  }
}

.trading-panel {
  display: none;
  padding: 20px 0 32px;
}

.trading-panel.is-active {
  display: block;
}

.trading-panel__heading {
  margin: 0 0 12px;
  font-size: 20px;
  font-weight: 600;
}

.trading-settings {
  max-width: 960px;
}

.trading-settings__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.trading-settings__heading {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: #e7eaf0;
}

.trading-settings__actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.trading-settings__save-status {
  font-size: 13px;
  color: rgba(231, 234, 240, 0.55);
  min-width: 6rem;
  text-align: right;
}

.trading-settings__save-status.is-ok {
  color: #3dba6a;
}

.trading-settings__save-status.is-error {
  color: #ef5350;
}

.trading-settings__hint {
  margin: 0 0 16px;
  font-size: 12px;
  line-height: 1.45;
  color: rgba(231, 234, 240, 0.45);
}

.trading-settings-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  align-items: start;
}

.trading-settings-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

@media (max-width: 720px) {
  .trading-settings-form {
    grid-template-columns: 1fr;
  }
}

.trading-settings-section {
  padding: 16px 18px;
  border: 1px solid #232833;
  border-radius: 8px;
  background: #12151c;
  min-width: 0;
}

.trading-settings-section__title {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 600;
  color: #e7eaf0;
}

.trading-settings-section__hint {
  margin: 0 0 12px;
  font-size: 12px;
  line-height: 1.45;
  color: rgba(231, 234, 240, 0.5);
}

.trading-settings-section--password {
  margin-top: 20px;
  max-width: 420px;
}

.trading-settings-form--password {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.trading-settings-form--password .trading-settings__save-status.is-ok {
  color: #3dba6a;
}

.trading-settings-form--password .trading-settings__save-status.is-error {
  color: #f87171;
}

.trading-settings-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.trading-settings-options--inline {
  flex-direction: row;
  flex-wrap: wrap;
  gap: 16px 24px;
}

.trading-settings-radio {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: #e7eaf0;
  cursor: pointer;
}

.trading-settings-radio input {
  accent-color: #3d7cf5;
}

.trading-settings-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-left: 26px;
}

.trading-settings-field--compact {
  margin-left: 0;
}

.trading-settings-field[hidden] {
  display: none !important;
}

.trading-settings-field.is-disabled {
  opacity: 0.4;
  pointer-events: none;
}

.trading-settings-field__label {
  font-size: 11px;
  font-weight: 500;
  color: rgba(231, 234, 240, 0.5);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.trading-settings-input,
.trading-settings-select {
  width: 100%;
  max-width: 100%;
  height: 34px;
  padding: 0 10px;
  border: 1px solid #2a3140;
  border-radius: 4px;
  background: #1a1f28;
  color: #e7eaf0;
  font: inherit;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.trading-settings-input:focus,
.trading-settings-select:focus {
  outline: none;
  border-color: #3d7cf5;
}

.trading-settings-select {
  cursor: pointer;
}

.trading-panel__stub {
  margin: 0;
  font-size: 14px;
  color: var(--fg);
  line-height: 1.5;
}

.trading-panel__stub--muted {
  color: var(--fg-dim);
  font-size: 13px;
}

/* —— Сделки: таблица в стиле TMM —— */
.trading-page:has(.trading-panel--trades.is-active) {
  overflow: hidden;
}

.trading-panel--trades {
  padding: 0;
  max-width: none;
}

.trading-main:has(.trading-panel--trades.is-active) {
  max-width: none;
  margin: 0;
  padding: 0;
  height: calc(100vh - 40px);
  overflow: hidden;
}

.trading-panel--trades.is-active {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.trade-deals {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  width: 100%;
}

.trade-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
  padding: 8px 12px;
  background: #12151c;
  border-bottom: 1px solid #232833;
}

.trade-toolbar__left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.trade-toolbar__period-wrap {
  position: relative;
}

.trade-toolbar__btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 10px;
  border: 1px solid #2a3140;
  border-radius: 4px;
  background: #1a1f28;
  color: #e7eaf0;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}

.trade-toolbar__btn:hover {
  background: #222833;
  border-color: #3a4356;
}

.trade-toolbar__btn--primary {
  background: #2a4a8a;
  border-color: #3d7cf5;
}

.trade-toolbar__btn--primary:hover {
  background: #3258a0;
}

.trade-toolbar__caret {
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid rgba(231, 234, 240, 0.55);
}

.trade-ticker-combo {
  position: relative;
  width: 140px;
}

.trade-ticker-combo__input {
  width: 100%;
  height: 30px;
  padding: 0 8px;
  border: 1px solid #2a3140;
  border-radius: 4px;
  background: #1a1f28;
  color: #e7eaf0;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.trade-ticker-combo__input::placeholder {
  color: rgba(231, 234, 240, 0.45);
  font-weight: 400;
}

.trade-ticker-combo__input:focus {
  outline: none;
  border-color: #3d7cf5;
  box-shadow: 0 0 0 1px rgba(61, 124, 245, 0.35);
}

.trade-ticker-combo__list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 300;
  min-width: 100%;
  max-height: 220px;
  margin: 0;
  padding: 4px 0;
  overflow: auto;
  list-style: none;
  border: 1px solid #2a3140;
  border-radius: 6px;
  background: #1a1f28;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

.trade-ticker-combo__list[hidden] {
  display: none !important;
}

.trade-ticker-combo__item {
  padding: 7px 12px;
  font-size: 12px;
  color: #e7eaf0;
  cursor: pointer;
  white-space: nowrap;
}

.trade-ticker-combo__item:hover,
.trade-ticker-combo__item.is-highlighted {
  background: #252d3a;
}

.trade-ticker-combo__item.is-selected {
  color: #3d7cf5;
}

.trade-toolbar__icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  margin-left: auto;
  padding: 0;
  border: 1px solid #2a3140;
  border-radius: 4px;
  background: #1a1f28;
  color: rgba(231, 234, 240, 0.75);
  cursor: pointer;
}

.trade-toolbar__icon-btn:hover {
  color: #e7eaf0;
  background: #222833;
}

.trade-toolbar__sep {
  width: 1px;
  height: 20px;
  margin: 0 4px;
  background: #2a3140;
  flex-shrink: 0;
}

.trade-toolbar__btn--refresh {
  gap: 6px;
  color: rgba(231, 234, 240, 0.85);
}

.trade-toolbar__btn--refresh .trade-toolbar__refresh-icon {
  flex-shrink: 0;
  transition: color 0.15s ease;
}

.trade-toolbar__btn--refresh.is-refreshing {
  border-color: #3d7cf5;
  color: #6da3ff;
  pointer-events: none;
}

.trade-toolbar__btn--refresh.is-refreshing .trade-toolbar__refresh-icon {
  animation: trade-refresh-spin 0.85s linear infinite;
}

@keyframes trade-refresh-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.trade-period-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 300;
  min-width: 200px;
  padding: 6px 0;
  border: 1px solid #2a3140;
  border-radius: 6px;
  background: #1a1f28;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

.trade-period-menu__item {
  display: block;
  width: 100%;
  padding: 8px 14px;
  border: none;
  background: transparent;
  color: #e7eaf0;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}

.trade-period-menu__item:hover,
.trade-period-menu__item.is-active {
  background: #252d3a;
  color: #fff;
}

.trade-period-menu__custom {
  padding: 10px 12px 8px;
  border-top: 1px solid #2a3140;
}

.trade-period-menu__field {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 12px;
  color: rgba(231, 234, 240, 0.7);
}

.trade-period-menu__field input {
  flex: 1;
  height: 28px;
  padding: 0 8px;
  border: 1px solid #2a3140;
  border-radius: 4px;
  background: #12151c;
  color: #e7eaf0;
  font-size: 12px;
}

.trade-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.55);
}

.trade-modal-backdrop[hidden] {
  display: none !important;
}

.trade-modal {
  width: 100%;
  max-width: 360px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  border: 1px solid #2a3140;
  border-radius: 8px;
  background: #1a1f28;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

.trade-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid #2a3140;
}

.trade-modal__title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: #e7eaf0;
}

.trade-modal__close {
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: rgba(231, 234, 240, 0.6);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.trade-modal__close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #e7eaf0;
}

.trade-modal__body {
  flex: 1;
  overflow: auto;
  padding: 12px 16px;
}

.trade-modal__footer {
  padding: 12px 16px;
  border-top: 1px solid #2a3140;
  text-align: right;
}

.trade-columns-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  font-size: 13px;
  color: #e7eaf0;
  cursor: pointer;
}

.trade-columns-item input {
  width: 16px;
  height: 16px;
  accent-color: #3d7cf5;
}

.trade-deals-th-inner {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
}

.trade-deals-th-drag {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  padding: 2px 1px;
  color: rgba(231, 234, 240, 0.35);
  cursor: grab;
  touch-action: none;
}

.trade-deals-th-drag:hover {
  color: rgba(231, 234, 240, 0.7);
}

.trade-deals-th-drag.is-dragging,
.trade-deals-th--movable.is-dragging {
  opacity: 0.5;
}

.trade-deals-th-drag.is-dragging {
  cursor: grabbing;
}

.trade-deals-th-drag__icon {
  display: block;
}

.trade-deals-th--movable.is-drag-over {
  box-shadow: inset 0 -2px 0 #3d7cf5;
}

.trade-deals-th-inner .trade-deals-th-btn {
  min-width: 0;
}

.trade-deals__scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  border-top: 1px solid #232833;
  scrollbar-width: thin;
}

.trade-deals-table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.trade-deals-table thead th {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 10px 12px;
  background: #12151c;
  border-bottom: 1px solid #232833;
  color: rgba(231, 234, 240, 0.55);
  font-size: 11px;
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
  vertical-align: middle;
}

.trade-deals-th-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}

.trade-deals-th-btn:hover {
  color: #e7eaf0;
}

.trade-deals-th-btn:focus-visible {
  outline: 1px solid #3d7cf5;
  outline-offset: 2px;
  border-radius: 2px;
}

.trade-deals-th__label {
  pointer-events: none;
}

.trade-deals-table tbody tr.is-open {
  background: #181e28;
}

.trade-deals-table tbody tr.is-open:hover {
  background: #1c2330;
  border-left-color: transparent;
}

.trade-deals-open-dots {
  color: rgba(231, 234, 240, 0.55);
  font-weight: 600;
  letter-spacing: 0.12em;
}

.trade-deals-exit-dash {
  color: rgba(231, 234, 240, 0.45);
}

.trade-deals-leverage--open {
  justify-content: flex-end;
  width: 100%;
}

.trade-deals-excursion {
  font-size: 11px;
  font-weight: 600;
  color: rgba(231, 234, 240, 0.85);
}

.trade-deals-sort {
  position: relative;
  flex-shrink: 0;
  width: 8px;
  height: 12px;
  pointer-events: none;
}

.trade-deals-sort::before,
.trade-deals-sort::after {
  content: '';
  position: absolute;
  left: 0;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  opacity: 0.3;
}

.trade-deals-sort::before {
  top: 0;
  border-bottom: 5px solid #8b93a7;
}

.trade-deals-sort::after {
  bottom: 0;
  border-top: 5px solid #8b93a7;
}

.trade-deals-th-btn.is-sorted-asc .trade-deals-sort::before {
  opacity: 1;
  border-bottom-color: #3d7cf5;
}

.trade-deals-th-btn.is-sorted-asc .trade-deals-sort::after {
  opacity: 0.15;
}

.trade-deals-th-btn.is-sorted-desc .trade-deals-sort::after {
  opacity: 1;
  border-top-color: #3d7cf5;
}

.trade-deals-th-btn.is-sorted-desc .trade-deals-sort::before {
  opacity: 0.15;
}

.trade-deals-table tbody tr:first-child td {
  padding-top: 14px;
}

.trade-deals-table tbody tr {
  background: #161a22;
  border-left: 3px solid transparent;
  transition: border-color 0.12s ease, background 0.12s ease;
}

.trade-deals-table tbody tr:hover {
  background: #1a1f28;
  border-left-color: #3d7cf5;
}

.trade-deals-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #1e232d;
  color: #e7eaf0;
  vertical-align: middle;
  white-space: nowrap;
}

.trade-deals-table__col-expand {
  width: 36px;
  padding-left: 14px !important;
  padding-right: 0 !important;
}

.trade-deals-expand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: rgba(231, 234, 240, 0.4);
  cursor: pointer;
}

.trade-deals-expand:hover {
  color: rgba(231, 234, 240, 0.85);
  background: rgba(255, 255, 255, 0.06);
}

.trade-deals-expand svg {
  display: block;
  width: 14px;
  height: 14px;
}

.trade-deals-expand.is-expanded {
  color: #3d7cf5;
  background: rgba(61, 124, 245, 0.12);
}

.trade-deals-detail td {
  padding: 0 !important;
  border-bottom: 1px solid #232833;
  background: #12151c;
  white-space: normal;
}

.trade-deals-detail__panel {
  padding: 12px 14px 16px;
}

.trade-deals-detail__cols {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
  min-height: 360px;
}

.trade-deals-detail__left-col,
.trade-deals-detail__right-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  min-height: 0;
}

.trade-detail-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.trade-detail-chart-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.trade-detail-chart-title--long {
  color: #3dba6a;
}

.trade-detail-chart-title--short {
  color: #ef5350;
}

.trade-detail-tf-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.trade-detail-tf-btn {
  height: 24px;
  padding: 0 8px;
  border: 1px solid #2a3140;
  border-radius: 3px;
  background: #1a1f28;
  color: rgba(231, 234, 240, 0.65);
  font-size: 11px;
  cursor: pointer;
}

.trade-detail-tf-btn:hover {
  color: #e7eaf0;
  border-color: #3a4356;
}

.trade-detail-tf-btn.is-active {
  color: #e7eaf0;
  border-color: #3d7cf5;
  background: rgba(61, 124, 245, 0.15);
}

.trade-detail-chart-wrap {
  flex: 1;
  min-height: 320px;
  position: relative;
  border: 1px solid #232833;
  border-radius: 6px;
  overflow: hidden;
  background: #0f1115;
}

.trade-detail-chart {
  width: 100%;
  height: 100%;
  min-height: 320px;
}

.trade-detail-chart-status {
  position: absolute;
  left: 12px;
  bottom: 10px;
  margin: 0;
  font-size: 12px;
  color: rgba(231, 234, 240, 0.55);
  pointer-events: none;
}

.trade-detail-chart-status.is-error {
  color: #ef5350;
}

.trade-detail-summary-wrap {
  flex-shrink: 0;
}

.trade-detail-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  padding: 10px 12px;
  border: 1px solid #232833;
  border-radius: 6px;
  background: #1a1f28;
  font-size: 12px;
}

.trade-detail-summary__item {
  white-space: nowrap;
}

.trade-detail-summary__label {
  color: rgba(231, 234, 240, 0.5);
}

.trade-detail-summary__lock {
  opacity: 0.85;
}

.trade-detail-orders-wrap {
  flex: 1;
  min-height: 0;
  overflow: auto;
  border: 1px solid #232833;
  border-radius: 6px;
  background: #1a1f28;
}

.trade-detail-orders-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.trade-detail-orders-table th {
  position: sticky;
  top: 0;
  padding: 8px 10px;
  background: #12151c;
  border-bottom: 1px solid #232833;
  color: rgba(231, 234, 240, 0.45);
  font-size: 10px;
  font-weight: 600;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.trade-detail-orders-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #1e232d;
  color: #e7eaf0;
}

.trade-detail-orders__side {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}

.trade-detail-orders__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.trade-detail-orders__side--entry .trade-detail-orders__dot {
  background: #3d7cf5;
}

.trade-detail-orders__side--exit .trade-detail-orders__dot {
  background: #f0b429;
}

.trade-detail-orders__empty,
.trade-detail-error {
  margin: 0;
  padding: 16px 12px;
  font-size: 12px;
  color: rgba(231, 234, 240, 0.5);
}

.trade-detail-error {
  color: #ef5350;
}

@media (max-width: 1100px) {
  .trade-deals-detail__cols {
    grid-template-columns: 1fr;
  }
  .trade-detail-chart-wrap {
    min-height: 280px;
  }
}

.trade-deals-ticker {
  font-weight: 600;
  letter-spacing: 0.02em;
}

.trade-deals-dt {
  display: flex;
  flex-direction: column;
  gap: 2px;
  line-height: 1.25;
  white-space: normal;
}

.trade-deals-dt__date {
  font-size: 11px;
  color: rgba(231, 234, 240, 0.5);
}

.trade-deals-dt__time {
  font-size: 12px;
  color: #e7eaf0;
}

.trade-deals-price {
  font-weight: 500;
}

.trade-deals-duration {
  color: rgba(231, 234, 240, 0.85);
}

.trade-deals-side {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.trade-deals-table .trade-deals-side--long,
.trade-deals-table .trade-deals-side--short {
  color: #e7eaf0;
  font-weight: 600;
}

.trade-deals-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.25;
}

/* Закрытая сделка — заливка */
.trade-deals-pill--loss {
  background: rgba(183, 28, 28, 0.5);
  border-color: rgba(183, 28, 28, 0.65);
  color: #ffe0e0;
}

.trade-deals-pill--gain {
  background: rgba(27, 94, 32, 0.5);
  border-color: rgba(46, 125, 50, 0.65);
  color: #e8f5e9;
}

.trade-deals-pill--flat {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.14);
  color: rgba(231, 234, 240, 0.8);
}

/* Открытая сделка — только рамка, без заливки */
.trade-deals-table tbody tr.is-open .trade-deals-pill--loss {
  background: transparent;
  border-color: #b71c1c;
  color: #ef9a9a;
}

.trade-deals-table tbody tr.is-open .trade-deals-pill--gain {
  background: transparent;
  border-color: #2e7d32;
  color: #a5d6a7;
}

.trade-deals-table tbody tr.is-open .trade-deals-pill--flat {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.2);
  color: rgba(231, 234, 240, 0.75);
}

.trade-deals-leverage {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #e7eaf0;
}

.trade-deals-leverage__lock {
  color: #f0b429;
  line-height: 0;
}

.trade-deals-leverage__lock svg {
  width: 14px;
  height: 14px;
}

.trade-deals__status {
  margin: 0;
  padding: 16px 20px;
  font-size: 13px;
  color: var(--fg-dim);
}

.trade-deals__status.is-error {
  color: #ef5350;
}

.trade-deals-table tbody tr.is-empty td {
  padding: 32px 20px;
  text-align: center;
  color: var(--fg-dim);
  border: none;
}

.trading-monitor {
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(0, 1fr);
  gap: 20px;
  min-height: calc(100vh - 120px);
}

.trading-monitor__heading {
  margin: 0 0 12px;
  font-size: 16px;
  font-weight: 600;
  color: #e7eaf0;
}

.trading-monitor-units {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.trading-monitor-unit {
  padding: 14px 16px;
  border: 1px solid #232833;
  border-radius: 8px;
  background: #12151c;
}

.trading-monitor-unit__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.trading-monitor-unit__title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.trading-monitor-unit__state {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
}

.trading-monitor-unit__state--ok {
  background: rgba(61, 186, 106, 0.15);
  color: #3dba6a;
}

.trading-monitor-unit__state--warn {
  background: rgba(255, 193, 7, 0.12);
  color: #ffc107;
}

.trading-monitor-unit__state--bad {
  background: rgba(239, 83, 80, 0.15);
  color: #ef5350;
}

.trading-monitor-unit__meta {
  margin: 0;
  font-size: 11px;
  color: rgba(231, 234, 240, 0.45);
}

.trading-monitor-unit__error {
  margin: 8px 0 0;
  font-size: 12px;
  color: #ef5350;
}

.trading-monitor-logs {
  height: calc(100vh - 140px);
  min-height: 400px;
  overflow: auto;
  padding: 10px 12px;
  border: 1px solid #232833;
  border-radius: 8px;
  background: #0e1014;
  font-family: ui-monospace, monospace;
  font-size: 12px;
}

.trading-monitor-log {
  display: grid;
  grid-template-columns: 10px 52px 140px minmax(0, 1fr);
  gap: 8px 10px;
  align-items: start;
  padding: 6px 4px;
  border-bottom: 1px solid rgba(35, 40, 51, 0.6);
}

.trading-monitor-log__level {
  width: 8px;
  height: 8px;
  margin-top: 4px;
  border-radius: 50%;
  background: #8b93a7;
}

.trading-monitor-log__level--success {
  background: #3dba6a;
}

.trading-monitor-log__level--warn {
  background: #ffc107;
}

.trading-monitor-log__level--error {
  background: #ef5350;
}

.trading-monitor-log__level--info {
  background: #5b8ff9;
}

.trading-monitor-log__time {
  color: rgba(231, 234, 240, 0.45);
}

.trading-monitor-log__unit {
  color: rgba(231, 234, 240, 0.65);
}

.trading-monitor-log__msg {
  color: #e7eaf0;
  word-break: break-word;
}

.trading-monitor-empty {
  margin: 0;
  color: rgba(231, 234, 240, 0.45);
}

@media (max-width: 900px) {
  .trading-monitor {
    grid-template-columns: 1fr;
  }
  .trading-monitor-logs {
    height: 50vh;
  }
}

@media (max-width: 640px) {
  .trading-topbar {
    height: auto;
    min-height: 40px;
  }
  .trading-topbar__inner {
    flex-wrap: nowrap;
  }
  .trading-nav__item {
    padding: 0 14px;
    font-size: 12px;
  }
}
