* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: #0e1117;
  color: #e6e9ef;
}
.hidden { display: none !important; }

/* ---------- Auth screen ---------- */
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at top, #1a2233, #0e1117);
}
.auth-card {
  background: #161b26;
  border: 1px solid #232a3b;
  border-radius: 12px;
  padding: 32px;
  width: 380px;
}
.auth-card h1 { font-size: 20px; margin: 0 0 4px; }
.subtitle { color: #8b93a7; font-size: 13px; margin-bottom: 20px; }
.tabs { display: flex; margin-bottom: 16px; border-bottom: 1px solid #232a3b; }
.tab {
  flex: 1; background: none; border: none; color: #8b93a7;
  padding: 10px; cursor: pointer; font-size: 14px; border-bottom: 2px solid transparent;
}
.tab.active { color: #4f8cff; border-bottom-color: #4f8cff; }
.auth-form { display: flex; flex-direction: column; gap: 10px; }
.auth-form input, .auth-form select {
  background: #0e1117; border: 1px solid #2a3244; color: #e6e9ef;
  padding: 10px; border-radius: 6px; font-size: 14px;
}
.auth-form button {
  background: #4f8cff; border: none; color: white; padding: 11px;
  border-radius: 6px; font-size: 14px; cursor: pointer; margin-top: 6px;
}
.auth-form button:hover { background: #3f76e0; }
.auth-error { color: #ff5c5c; font-size: 12px; min-height: 16px; }

/* ---------- Terminal screen ---------- */
.terminal-screen { height: 100vh; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  background: #161b26; border-bottom: 1px solid #232a3b; padding: 10px 16px;
}
.brand { font-weight: 600; font-size: 15px; }
.demo-badge {
  background: #ff9f43; color: #1a1200; font-size: 10px; padding: 2px 6px;
  border-radius: 4px; margin-left: 6px; vertical-align: middle;
}
.account-summary { display: flex; gap: 20px; font-size: 12px; }
.account-summary .label { display: block; color: #8b93a7; font-size: 10px; }
.account-summary span:not(.label) { font-weight: 600; font-size: 13px; }
.user-info { display: flex; align-items: center; gap: 10px; font-size: 13px; }
#logout-btn {
  background: #232a3b; border: none; color: #e6e9ef; padding: 6px 12px;
  border-radius: 6px; cursor: pointer; font-size: 12px;
}

.main-layout { flex: 1; display: flex; overflow: hidden; }

.watchlist { width: 180px; background: #12161f; border-right: 1px solid #232a3b; overflow-y: auto; }
.watchlist-item {
  padding: 12px; border-bottom: 1px solid #1c2230; cursor: pointer;
}
.watchlist-item.active { background: #1c2436; }
.watchlist-item .sym { font-weight: 600; font-size: 13px; }
.watchlist-item .px { font-size: 13px; color: #8b93a7; margin-top: 2px; }
.watchlist-item .px.up { color: #26a69a; }
.watchlist-item .px.down { color: #ef5350; }

.chart-area { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.chart-toolbar {
  display: flex; align-items: center; gap: 14px; padding: 8px 12px;
  background: #12161f; border-bottom: 1px solid #232a3b; font-size: 12px; flex-wrap: wrap;
}
.chart-toolbar select, .chart-toolbar button {
  background: #1c2436; border: 1px solid #2a3244; color: #e6e9ef;
  padding: 5px 8px; border-radius: 5px; font-size: 12px; cursor: pointer;
}
.chart-toolbar label { display: flex; align-items: center; gap: 4px; color: #cdd3e0; }
.fib-hint { color: #ff9f43; }
#chart-container { flex: 1; min-height: 300px; }
.sub-chart { height: 120px; border-top: 1px solid #232a3b; }

.order-panel {
  width: 260px; background: #12161f; border-left: 1px solid #232a3b;
  padding: 14px; display: flex; flex-direction: column; overflow-y: auto;
}
.order-panel h3 { margin: 0 0 10px; font-size: 15px; }
.price-display { margin-bottom: 12px; }
.bid-ask { display: flex; justify-content: space-between; font-size: 20px; font-weight: 700; }
.order-panel label { font-size: 11px; color: #8b93a7; margin-top: 8px; margin-bottom: 3px; display: block; }
.order-panel input {
  width: 100%; background: #0e1117; border: 1px solid #2a3244; color: #e6e9ef;
  padding: 7px; border-radius: 5px; font-size: 13px;
}
.order-buttons { display: flex; gap: 8px; margin-top: 12px; }
.order-buttons button {
  flex: 1; padding: 12px; border: none; border-radius: 6px; font-weight: 700;
  cursor: pointer; font-size: 13px;
}
.btn-sell { background: #ef5350; color: white; }
.btn-buy { background: #26a69a; color: white; }
.order-error { color: #ff5c5c; font-size: 11px; min-height: 14px; margin-top: 6px; }

.tables-tabs { display: flex; margin-top: 18px; border-bottom: 1px solid #232a3b; }
.table-tab {
  flex: 1; background: none; border: none; color: #8b93a7; padding: 8px;
  cursor: pointer; font-size: 12px; border-bottom: 2px solid transparent;
}
.table-tab.active { color: #4f8cff; border-bottom-color: #4f8cff; }
.positions-table { margin-top: 8px; font-size: 11px; }
.position-row {
  border-bottom: 1px solid #1c2230; padding: 8px 0; display: flex;
  flex-direction: column; gap: 3px;
}
.position-row .row-top { display: flex; justify-content: space-between; font-weight: 600; }
.position-row .side-buy { color: #26a69a; }
.position-row .side-sell { color: #ef5350; }
.position-row .pnl-pos { color: #26a69a; }
.position-row .pnl-neg { color: #ef5350; }
.position-row button {
  margin-top: 4px; background: #2a3244; border: none; color: #e6e9ef;
  padding: 4px 8px; border-radius: 4px; cursor: pointer; font-size: 11px;
}
