@import url("/merchant/css/merchant.css");

:root {
  --merchant-accent: #6366f1;
  --merchant-accent-soft: rgba(99, 102, 241, 0.14);
  --merchant-accent-glow: rgba(99, 102, 241, 0.25);
}

body.trader-body {
  background:
    radial-gradient(ellipse 70% 55% at 0% 0%, var(--merchant-accent-glow), transparent 55%),
    var(--bg-0);
}

.trader-auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.trader-auth-card {
  width: min(420px, 100%);
}

.trader-auth-logo {
  margin: 0 0 24px;
  text-align: center;
  font-size: clamp(1.75rem, 5vw, 2.25rem);
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text);
}

.trader-nav-badge {
  margin-left: auto;
  min-width: 1.25rem;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--merchant-accent);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.35rem;
  text-align: center;
}

.trader-panel-hint {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.trader-active-deals .merchant-panel-head {
  flex-wrap: wrap;
  gap: 4px 16px;
}

.trader-active-deals .trader-countdown {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--merchant-accent);
}

.trader-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: grid;
  place-items: center;
  z-index: 100;
  padding: 16px;
}

.trader-modal {
  width: min(480px, 100%);
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.4);
}

.trader-modal h3 { margin: 0 0 8px; }
.trader-modal p { color: var(--text-muted); margin: 0 0 16px; line-height: 1.5; }
.trader-modal-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }

.trader-toast {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 110;
  background: var(--bg-1);
  border: 1px solid var(--merchant-accent);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  max-width: 320px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.trader-locked-banner {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 0.92rem;
}

.trader-countdown {
  font-variant-numeric: tabular-nums;
  color: var(--merchant-accent);
  font-weight: 600;
}

.trader-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 240px 1fr;
}

@media (max-width: 860px) {
  .trader-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }
}

.trader-sidebar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px 14px;
  border-right: 1px solid var(--border);
  background: linear-gradient(180deg, var(--bg-1) 0%, var(--bg-0) 100%);
  position: sticky;
  top: 0;
  min-height: 100vh;
}

@media (max-width: 860px) {
  .trader-sidebar {
    min-height: auto;
    position: static;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    padding: 12px 14px 14px;
  }
}

.trader-sidebar-logo {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 4px 8px 12px;
}

.trader-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

@media (max-width: 860px) {
  .trader-nav {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
  }
}

.trader-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.92rem;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

@media (max-width: 860px) {
  .trader-nav-item {
    width: auto;
    flex: 1 1 calc(50% - 6px);
    min-width: 120px;
  }
}

.trader-nav-item:hover {
  background: var(--bg-2);
  color: var(--text);
}

.trader-nav-item.active {
  background: var(--merchant-accent-soft);
  border-color: rgba(99, 102, 241, 0.35);
  color: var(--text);
}

.trader-nav-icon {
  width: 1.1rem;
  text-align: center;
  opacity: 0.85;
}

.trader-sidebar-session {
  padding: 14px 10px;
  margin-top: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-2);
}

.trader-session-label {
  font-size: 0.78rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.trader-session-state {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 10px;
}

.trader-session-state.is-on { color: #6ee7b7; }
.trader-session-state.is-off { color: var(--text-muted); }

.trader-btn-session {
  width: 100%;
}

.trader-btn-end {
  border-color: rgba(239, 68, 68, 0.35);
  color: #fca5a5;
}

.trader-sidebar-footer {
  margin-top: auto;
  padding: 12px 8px 4px;
  border-top: 1px solid var(--border);
}

.trader-user-name {
  font-weight: 600;
  font-size: 0.92rem;
}

.trader-user-login {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin: 2px 0 10px;
}

.trader-btn-logout {
  width: 100%;
}

.trader-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.trader-main-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 24px 12px;
  border-bottom: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.15);
}

.trader-page-title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
}

.trader-main-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: nowrap;
}

.trader-header-balance {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-2);
  line-height: 1.2;
}

.trader-header-balance span {
  font-size: 0.68rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.trader-header-balance strong {
  font-size: 0.88rem;
  color: var(--text);
}

.trader-header-session {
  font-size: 0.85rem;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  white-space: nowrap;
}

#btn-session-toggle {
  min-width: 104px;
  white-space: nowrap;
}

.trader-header-session.is-on {
  color: #6ee7b7;
  border-color: rgba(16, 185, 129, 0.35);
  background: rgba(16, 185, 129, 0.1);
}

.trader-header-session.is-off {
  color: var(--text-muted);
}

.trader-main-content {
  padding: 20px 24px 32px;
  flex: 1;
}

.trader-session-on { color: #6ee7b7; }
.trader-session-off { color: var(--text-muted); }

.trader-overview-limits p {
  margin: 0 0 8px;
  color: var(--text-muted);
}

.trader-overview-limits strong {
  color: var(--text);
}

.trader-modal--wide {
  width: min(520px, calc(100vw - 32px));
}

.trader-dispute-meta {
  margin: 0 0 12px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.trader-dispute-block {
  margin-bottom: 12px;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.trader-dispute-label {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-bottom: 4px;
}

.trader-tg-link {
  font-weight: 600;
  font-size: 1rem;
}

.trader-dispute-instructions {
  margin: 0 0 14px;
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.trader-dispute-preview {
  margin: 0;
  padding: 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.25);
  font-size: 0.82rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 220px;
  overflow: auto;
}

.trader-dispute-hint {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-dim);
}

.trader-dispute-actions {
  flex-wrap: wrap;
  justify-content: flex-start;
}

.trader-tg-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.trader-muted {
  color: var(--text-dim);
  opacity: 0.65;
}

.trader-history-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.trader-history-stat {
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.trader-history-stat-label {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.trader-history-stat-value {
  font-size: 1.25rem;
  font-weight: 700;
}

.trader-history-stat-profit {
  color: #6ee7b7;
}

.trader-history-stat-sub {
  margin-top: 4px;
  font-size: 0.88rem;
  color: var(--text-dim);
  opacity: 0.55;
}

.trader-history-stat-hint {
  margin-top: 4px;
  font-size: 0.72rem;
  color: var(--text-dim);
}

.trader-history-by-status {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.trader-status-bucket {
  padding: 10px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.12);
}

.trader-status-bucket-head {
  font-weight: 600;
  margin-bottom: 4px;
}

.trader-status-bucket-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.trader-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.trader-filter-chip {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.82rem;
  cursor: pointer;
}

.trader-filter-chip.active {
  border-color: rgba(99, 102, 241, 0.45);
  background: rgba(99, 102, 241, 0.12);
  color: var(--text);
}

.trader-history-table .trader-deal-row {
  cursor: pointer;
}

.trader-history-table .trader-deal-row:hover td {
  background: rgba(99, 102, 241, 0.08);
}

.trader-col-profit {
  white-space: nowrap;
}

.trader-deal-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding-right: 28px;
}

.trader-deal-detail-id {
  font-size: 1.2rem;
  font-weight: 700;
  min-width: 0;
  line-height: 1.3;
}

.trader-deal-detail-status {
  flex-shrink: 0;
}

.trader-deal-detail-status .badge {
  text-transform: none;
  font-size: 0.78rem;
  white-space: nowrap;
  vertical-align: middle;
}

.trader-deal-detail-id-sub {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin: 4px 0 10px;
  word-break: break-all;
}

.trader-deal-detail-block {
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.trader-deal-detail-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  font-size: 0.92rem;
}

.trader-deal-detail-row span {
  color: var(--text-dim);
}

.trader-deal-detail-profit strong {
  color: #6ee7b7;
}

.trader-rate-tag {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
}

.trader-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
}

.trader-deal-detail {
  position: relative;
}

@media (max-width: 720px) {
  .trader-history-summary {
    grid-template-columns: 1fr;
  }
}
