:root {
  --bg: #0b0e14;
  --panel: #131722;
  --panel-border: #1f2530;
  --text: #e6e9ef;
  --text-muted: #7d8494;
  --gold: #d4a24c;
  --green: #3ecf8e;
  --red: #e8546b;
  --blue: #5b9dd9;
  --amber: #e0a940;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.mono { font-family: 'JetBrains Mono', monospace; }

/* ---------- Login ---------- */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 40px 32px;
  text-align: center;
}

.login-mark {
  font-size: 28px;
  color: var(--gold);
  margin-bottom: 8px;
}

.login-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 24px;
  font-weight: 700;
  margin: 0 0 4px;
}

.login-sub {
  color: var(--text-muted);
  font-size: 14px;
  margin: 0 0 28px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
}

.login-form label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 12px;
}

.login-form input {
  background: var(--bg);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
}

.login-form input:focus {
  outline: 2px solid var(--gold);
  outline-offset: 1px;
  border-color: var(--gold);
}

.login-form button {
  margin-top: 24px;
  background: var(--gold);
  color: #1a1206;
  border: none;
  border-radius: 8px;
  padding: 12px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}

.login-form button:hover { filter: brightness(1.08); }

.flash-error {
  background: rgba(232, 84, 107, 0.12);
  border: 1px solid var(--red);
  color: var(--red);
  border-radius: 8px;
  padding: 10px;
  font-size: 13px;
  margin-bottom: 16px;
}

/* ---------- Ticker (signature element) ---------- */
.ticker-wrap {
  background: var(--panel);
  border-bottom: 1px solid var(--panel-border);
  overflow: hidden;
  white-space: nowrap;
  padding: 8px 0;
}

.ticker-track {
  display: inline-block;
  animation: ticker-scroll 40s linear infinite;
}

@keyframes ticker-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

.ticker-item {
  display: inline-block;
  padding: 0 24px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  border-right: 1px solid var(--panel-border);
}

@media (prefers-reduced-motion: reduce) {
  .ticker-track { animation: none; }
}

/* ---------- Shell layout ---------- */
.shell {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: calc(100vh - 37px);
}

.sidebar {
  border-right: 1px solid var(--panel-border);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px 24px;
}

.brand-mark { color: var(--gold); font-size: 18px; }
.brand-name { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 15px; }

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }

.nav-item {
  color: var(--text-muted);
  text-decoration: none;
  padding: 10px 8px;
  border-radius: 6px;
  font-size: 13px;
}

.nav-item:hover, .nav-item.active {
  color: var(--text);
  background: rgba(255,255,255,0.04);
}

.logout-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 12px;
  padding: 8px;
}

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

.main {
  padding: 28px 32px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

/* ---------- Stat cards ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 16px 18px;
}

.stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.stat-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 24px;
  font-weight: 700;
}

.stat-warn { color: var(--red); }

/* ---------- Panels ---------- */
.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 20px;
}

.panel-title {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 500;
  font-size: 15px;
  margin-bottom: 16px;
}

.chart-panel { padding: 20px 20px 8px; }

.empty-state {
  color: var(--text-muted);
  font-size: 13px;
  padding: 24px 0;
  text-align: center;
}

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

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

.data-table td {
  padding: 10px;
  border-bottom: 1px solid var(--panel-border);
}

.badge {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 100px;
  font-family: 'JetBrains Mono', monospace;
}

.badge-owned { background: rgba(62,207,142,0.12); color: var(--green); }
.badge-watch { background: rgba(91,157,217,0.12); color: var(--blue); }

/* ---------- History feed ---------- */
.history-feed { display: flex; flex-direction: column; gap: 1px; }

.history-row {
  display: grid;
  grid-template-columns: 130px 170px 1fr 80px 1.4fr;
  gap: 12px;
  align-items: center;
  padding: 10px 10px;
  border-left: 3px solid transparent;
  font-size: 13px;
  border-bottom: 1px solid var(--panel-border);
}

.history-time, .history-price { color: var(--text-muted); font-size: 12px; }
.history-reason { color: var(--text-muted); font-size: 12px; }

.status-auto { border-left-color: var(--green); }
.status-auto .history-label { color: var(--green); }

.status-confirm { border-left-color: var(--amber); }
.status-confirm .history-label { color: var(--amber); }

.status-buy { border-left-color: var(--blue); }
.status-buy .history-label { color: var(--blue); }

.status-hold { border-left-color: var(--panel-border); }
.status-hold .history-label { color: var(--text-muted); }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--panel-border);
    flex-direction: row;
    align-items: center;
    padding: 12px 16px;
  }
  .nav { flex-direction: row; }
  .logout-link { margin-left: auto; }
  .history-row { grid-template-columns: 1fr; gap: 4px; }
}
