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

:root {
  --bg: #0a0a0d;
  --card: #131318;
  --card2: #1a1a21;
  --border: #26262e;
  --accent: #00e6d0;
  --accent-dim: rgba(0, 230, 208, 0.12);
  --blue: #2f6bff;
  --blue-dim: rgba(47, 107, 255, 0.14);
  --green: #26c281;
  --red: #f6465d;
  --text: #f2f2f4;
  --text-dim: #8b8b96;
}

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

.screen { display: none; min-height: 100vh; }
.screen.active { display: block; }

/* ---- login ---- */
#login-screen.active {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 24px;
  padding: 24px;
}
.logo {
  font-size: 28px;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: 0.5px;
}
.login-box {
  width: 100%;
  max-width: 360px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.login-box h2 { font-size: 18px; font-weight: 600; margin-bottom: 4px; }
.login-box input {
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  color: var(--text);
  font-size: 16px;
  text-align: center;
}
.login-box input:focus { outline: none; border-color: var(--accent); }
.btn {
  border: none;
  border-radius: 10px;
  padding: 14px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}
.btn:active { opacity: 0.85; }
.btn.primary { background: var(--blue); color: #fff; }
.btn.secondary {
  background: var(--card2);
  color: var(--text);
  border: 1px solid var(--border);
}
.error-text { color: var(--red); font-size: 13px; min-height: 16px; }

/* ---- header / tabs ---- */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 16px 4px;
}
.header-title { font-size: 18px; font-weight: 700; }
.header-right { display: flex; gap: 8px; align-items: center; }
.code-badge, .header-icon {
  font-size: 12px;
  color: var(--text-dim);
  background: var(--card2);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 20px;
  cursor: pointer;
}

.tabs-bar {
  display: flex;
  gap: 4px;
  padding: 14px 16px 0;
  border-bottom: 1px solid var(--border);
}
.tab-item {
  padding: 10px 4px;
  margin-right: 18px;
  font-size: 14px;
  color: var(--text-dim);
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}
.tab-item.active { color: var(--text); border-bottom-color: var(--accent); }

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

/* ---- assets tab ---- */
.donut-wrap { position: relative; width: 200px; height: 200px; margin: 20px auto; }
.donut-wrap svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.donut-label { font-size: 12px; color: var(--text-dim); margin-bottom: 4px; }
.donut-value { font-size: 24px; font-weight: 800; }

.asset-legend { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 20px; }
.legend-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
}
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot.usdt { background: var(--green); }
.legend-val { margin-left: auto; color: var(--text-dim); }

.actions-row { display: flex; gap: 12px; margin-top: 8px; }
.actions-row .btn { flex: 1; }

/* ---- dynamics tab ---- */
.pnl-cards { display: flex; gap: 12px; margin-bottom: 16px; }
.pnl-card {
  flex: 1;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
}
.pnl-card-label { font-size: 12px; color: var(--text-dim); margin-bottom: 6px; }
.pnl-card-value { font-size: 20px; font-weight: 800; }
.pnl-card-value.positive { color: var(--green); }
.pnl-card-value.negative { color: var(--red); }

.period-row { display: flex; gap: 8px; margin-bottom: 18px; overflow-x: auto; }
.period-chip {
  flex-shrink: 0;
  padding: 7px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  background: var(--card2);
  border: 1px solid var(--border);
  cursor: pointer;
}
.period-chip.active { background: var(--accent); color: #04201c; border-color: var(--accent); }

.chart-block { margin-bottom: 26px; }
.chart-title { font-size: 13px; color: var(--text-dim); margin-bottom: 4px; }
.chart-value { font-size: 20px; font-weight: 800; margin-bottom: 8px; }
.chart-value.positive { color: var(--green); }
.chart-value.negative { color: var(--red); }
.chart-block svg { width: 100%; height: 160px; display: block; }
.chart-axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-dim); margin-top: 4px; }

/* ---- calendar ---- */
.calendar-block { margin-bottom: 26px; }
.calendar-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.calendar-nav { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-dim); }
.cal-nav-btn {
  cursor: pointer;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: var(--card2);
  border: 1px solid var(--border);
  font-size: 14px;
}
.cal-month-label { font-weight: 700; color: var(--text); min-width: 66px; text-align: center; }
.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  font-size: 10px;
  color: var(--text-dim);
  text-align: center;
  margin-bottom: 6px;
}
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.cal-day {
  aspect-ratio: 1;
  border-radius: 8px;
  background: var(--card2);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: var(--text-dim);
  gap: 2px;
}
.cal-day.empty { visibility: hidden; }
.cal-day .cal-day-num { font-size: 11px; font-weight: 600; color: var(--text); }
.cal-day .cal-day-val { font-size: 9px; }
.cal-day.positive { background: rgba(38, 194, 129, 0.16); border-color: rgba(38, 194, 129, 0.3); }
.cal-day.positive .cal-day-val { color: var(--green); }
.cal-day.negative { background: rgba(246, 70, 93, 0.16); border-color: rgba(246, 70, 93, 0.3); }
.cal-day.negative .cal-day-val { color: var(--red); }

/* ---- trades ---- */
.section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-dim);
  margin: 0 0 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.trades-list { display: flex; flex-direction: column; gap: 8px; padding-bottom: 24px; }
.trade-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
}
.trade-pair { font-weight: 700; font-size: 14px; }
.trade-date { font-size: 11px; color: var(--text-dim); margin-top: 2px; }
.trade-side {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-dim);
  background: var(--card2);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 6px;
  margin-left: 6px;
}
.trade-prices { font-size: 11px; color: var(--text-dim); margin-top: 4px; }
.trade-pnl { font-weight: 700; font-size: 14px; }
.empty-note { color: var(--text-dim); font-size: 13px; }

.positive { color: var(--green); }
.negative { color: var(--red); }

/* ---- modal ---- */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  align-items: flex-end;
  justify-content: center;
  z-index: 50;
}
.modal-overlay.active { display: flex; }
.modal {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px 20px 0 0;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.modal h3 { font-size: 17px; margin-bottom: 4px; }
.balance-label { font-size: 13px; color: var(--text-dim); }
.wallet-box {
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  font-size: 13px;
  word-break: break-all;
  color: var(--accent);
}
.wallet-box.copyable { cursor: pointer; position: relative; padding-right: 40px; }
.wallet-box.copyable:active { opacity: 0.7; }
.wallet-box.copyable::after {
  content: "⧉";
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  font-size: 14px;
}
.network-badge {
  align-self: flex-start;
  background: var(--blue-dim);
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 8px;
}
.wallet-hint { font-size: 11px; color: var(--text-dim); line-height: 1.4; }
.modal input {
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  color: var(--text);
  font-size: 16px;
}
.modal-close { text-align: center; color: var(--text-dim); font-size: 13px; padding: 6px; cursor: pointer; }
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--card2);
  border: 1px solid var(--border);
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 13px;
  display: none;
  z-index: 60;
}
