* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #0d1117;
  --card-bg: #161b22;
  --border: #30363d;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --accent: #58a6ff;
  --green: #3fb950;
  --red: #f85149;
  --yellow: #d29922;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.screen { display: none; }
.screen.active { display: block; }

/* LOGIN */
.login-box {
  max-width: 400px;
  margin: 15vh auto;
  padding: 48px 40px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  text-align: center;
}

.login-box h1 {
  font-size: 28px;
  margin-bottom: 8px;
  background: linear-gradient(135deg, var(--accent), #a371f7);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle { color: var(--text-muted); margin-bottom: 32px; }

.login-box input {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 16px;
  margin-bottom: 16px;
  outline: none;
  transition: border-color 0.2s;
}

.login-box input:focus { border-color: var(--accent); }

#btn-login {
  width: 100%;
  padding: 14px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

#btn-login:hover { opacity: 0.9; }

.error { color: var(--red); margin-top: 12px; font-size: 14px; }

/* HEADER */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--card-bg);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left { display: flex; align-items: center; gap: 16px; }
.header-left h2 { font-size: 20px; }
.account-label { color: var(--text-muted); font-size: 14px; }

.btn-logout {
  padding: 8px 16px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}

.btn-logout:hover { border-color: var(--red); color: var(--red); }

/* CARDS */
.card {
  margin: 16px 24px;
  padding: 24px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.card h3 { font-size: 16px; font-weight: 600; }

/* TIMEFRAME BUTTONS */
.timeframe-btns { display: flex; gap: 4px; }

.tf-btn {
  padding: 6px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s;
}

.tf-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* CHART */
.chart-container {
  height: 260px;
  position: relative;
}

/* PNL */
.pnl-global .pnl-row { display: flex; gap: 24px; margin-top: 16px; }

.section-summary { display: flex; gap: 16px; margin-top: 12px; flex-wrap: wrap; }

.pnl-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 120px;
}

.pnl-label { color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; }
.pnl-value { font-size: 20px; font-weight: 700; }
.pnl-value.positive { color: var(--green); }
.pnl-value.negative { color: var(--red); }

/* SECTIONS */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
}

.chevron { font-size: 18px; color: var(--text-muted); transition: transform 0.2s; }
.chevron.open { transform: rotate(90deg); }

.section-detail { margin-top: 16px; }

/* TABS */
.tabs { display: flex; gap: 4px; margin-bottom: 12px; }

.tab {
  padding: 8px 20px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}

.tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* TABLES */
.trades-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.trades-table th {
  text-align: left;
  padding: 10px 12px;
  color: var(--text-muted);
  font-weight: 500;
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.trades-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(48,54,61,0.5);
}

.trades-table tr:hover { background: rgba(88,166,255,0.05); }

/* LOADING */
#loading {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(13,17,23,0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 200;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.hidden { display: none !important; }

/* RESPONSIVE */
@media (max-width: 600px) {
  .card { margin: 8px 12px; padding: 16px; }
  .section-summary { flex-direction: column; }
  .pnl-value { font-size: 16px; }
  header { padding: 12px 16px; }
}
