/* trading platform */
.trade-shell {
  height: 100vh; display: flex; flex-direction: column;
  background: var(--bg);
}

/* nav */
.t-nav {
  display: flex; align-items: center; gap: 24px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  flex-shrink: 0;
}
.t-nav-l { display: flex; align-items: center; gap: 16px; }
.t-logo { display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: 15px; }
.t-nav-stats { display: flex; gap: 28px; flex: 1; padding-left: 24px; border-left: 1px solid var(--border); }
.t-stat { display: flex; flex-direction: column; gap: 1px; }
.t-stat-l { font-size: 10px; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 500; }
.t-stat-v { font-size: 15px; font-weight: 500; }
.t-nav-r { display: flex; align-items: center; gap: 8px; }

.user-menu { position: relative; }
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--ink); color: var(--bg);
  font-size: 12px; font-weight: 600; letter-spacing: 0.04em;
  display: flex; align-items: center; justify-content: center;
}
.user-pop {
  position: absolute; right: 0; top: 42px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  min-width: 220px; padding: 8px;
  z-index: 100;
}
.user-pop-h { padding: 8px 10px; }
.user-pop-divider { height: 1px; background: var(--border); margin: 6px 0; }
.user-pop-item {
  display: block; width: 100%; text-align: left;
  padding: 8px 10px; font-size: 13px; border-radius: 6px;
  color: var(--ink-2);
}
.user-pop-item:hover { background: var(--bg-2); color: var(--ink); }

/* grid */
.trade-grid {
  flex: 1; display: grid; gap: 12px;
  padding: 12px;
  grid-template-columns: 280px 1fr 320px;
  grid-template-rows: minmax(0, 1.4fr) minmax(0, 1fr);
  grid-template-areas:
    "watch chart order"
    "watch bottom bottom";
  min-height: 0;
}
.t-watchlist { grid-area: watch; }
.t-chart-pane { grid-area: chart; }
.t-order { grid-area: order; }
.t-bottom { grid-area: bottom; }

.t-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex; flex-direction: column;
  min-height: 0; overflow: hidden;
}
.t-panel-h {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  font-weight: 500;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: space-between;
}

/* watchlist */
.t-watch-tabs { display: flex; padding: 8px 8px 0; gap: 4px; flex-shrink: 0; }
.t-watch-tab {
  font-size: 11px; padding: 5px 10px; border-radius: 6px;
  color: var(--ink-3); flex: 1;
}
.t-watch-tab.active { background: var(--bg-2); color: var(--ink); font-weight: 500; }
.t-watch-list { overflow-y: auto; padding: 4px; }
.t-watch-row {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; border-radius: 8px;
  text-align: left;
}
.t-watch-row:hover { background: var(--bg-2); }
.t-watch-row.active { background: var(--accent-soft); }
.t-watch-row.active .t-watch-sym .mono:first-child { color: var(--accent); }
.t-watch-px { text-align: right; }

/* chart */
.t-chart-h {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  flex-shrink: 0;
}
.t-chart-h-l { display: flex; align-items: center; gap: 28px; }
.t-chart-sym { font-size: 22px; }
.t-chart-px { font-size: 24px; font-weight: 500; }
.t-chart-prices { display: flex; flex-direction: column; }
.t-chart-stats { display: flex; gap: 18px; }
.t-mini { display: flex; flex-direction: column; gap: 2px; }
.t-chart-h-r { display: flex; gap: 4px; background: var(--bg-2); padding: 3px; border-radius: 8px; }
.t-seg {
  font-size: 12px; padding: 5px 10px; border-radius: 6px; color: var(--ink-3);
}
.t-seg.active { background: var(--panel); color: var(--ink); box-shadow: var(--shadow-sm); }
.t-chart-body { flex: 1; min-height: 0; }

/* order */
.t-order-body { padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; }
.t-order-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; background: var(--bg-2); padding: 3px; border-radius: 10px; margin-bottom: 8px; }
.t-order-tab {
  padding: 10px; font-size: 12px; font-weight: 600; letter-spacing: 0.04em;
  border-radius: 7px; color: var(--ink-3);
}
.t-order-tab.active.long { background: var(--success); color: white; }
.t-order-tab.active.short { background: var(--danger); color: white; }
.t-order-row {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 13px; padding: 5px 0;
}
.t-qty-row { display: flex; gap: 6px; }
.t-qty-row .input { flex: 1; text-align: right; }
.t-qty-row .btn { width: 36px; padding: 0; }
.t-qty-presets { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: 6px; }
.t-preset {
  font-size: 11px; padding: 6px;
  border: 1px solid var(--border); border-radius: 6px;
  background: var(--panel); color: var(--ink-2);
}
.t-preset:hover { border-color: var(--ink-3); color: var(--ink); }
.t-order-summary {
  margin-top: 8px; padding-top: 12px;
  border-top: 1px dashed var(--border);
}
.t-presets { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-top: 10px; }

/* bottom */
.t-bottom-h { padding: 0 8px; }
.t-tabs { display: flex; gap: 2px; }
.t-tab {
  padding: 12px 14px; font-size: 12px;
  font-weight: 500; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: 0.06em;
  border-bottom: 2px solid transparent;
}
.t-tab.active { color: var(--ink); border-bottom-color: var(--accent); }
.t-bottom-body { flex: 1; overflow: auto; }
.t-empty {
  padding: 56px 24px; text-align: center;
}
.t-empty-title { font-size: 22px; margin-bottom: 6px; }

/* modal helpers */
.modal-h {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px; border-bottom: 1px solid var(--border);
}
.modal-body { padding: 20px 24px; }

/* responsive */
@media (max-width: 1100px) {
  .trade-shell { height: auto; min-height: 100vh; }
  .trade-grid {
    grid-template-columns: 240px 1fr;
    grid-template-rows: minmax(420px, 1fr) auto minmax(360px, auto);
    grid-template-areas:
      "watch chart"
      "watch order"
      "bottom bottom";
  }
  .t-chart-pane { min-height: 420px; }
  .t-bottom { min-height: 320px; }
}
@media (max-width: 800px) {
  .trade-grid {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(380px, auto) auto auto auto;
    grid-template-areas:
      "chart"
      "order"
      "watch"
      "bottom";
  }
  .t-chart-pane { min-height: 380px; }
  .t-watchlist { min-height: 320px; }
  .t-nav-stats { display: none; }
}
