:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel-2: #1e222b;
  --border: #2a2f3a;
  --text: #e6e9ef;
  --muted: #9aa4b2;
  --accent: #3b82f6;
  --green: #16a34a;
  --red: #dc2626;
}

* { box-sizing: border-box; }

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

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.75rem 1.25rem;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.brand { font-weight: 700; }
.nav nav { display: flex; gap: 1rem; }
.nav nav a { color: var(--text); }
.logout { margin-left: auto; }
.mode {
  font-size: 0.7rem; font-weight: 700; padding: 0.1rem 0.45rem;
  border-radius: 999px; margin-left: 0.4rem; vertical-align: middle;
}
.mode.paper { background: #1e3a8a; color: #dbeafe; }
.mode.live { background: #7f1d1d; color: #fee2e2; }

main { max-width: 900px; margin: 0 auto; padding: 1.5rem 1.25rem 4rem; }
h1 { font-size: 1.5rem; margin: 0.5rem 0 1rem; }
h2 { font-size: 1.05rem; margin: 0 0 0.75rem; }

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}
.auth-card { max-width: 380px; margin: 4rem auto; text-align: left; }
.auth-card h1 { text-align: center; }

.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.error {
  background: #7f1d1d; color: #fee2e2; padding: 0.6rem 0.8rem;
  border-radius: 8px; margin: 0 0 1rem;
}

label { display: block; margin-bottom: 0.9rem; font-size: 0.9rem; color: var(--muted); }
input, select, textarea {
  width: 100%; margin-top: 0.3rem; padding: 0.55rem 0.7rem;
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-size: 0.95rem; font-family: inherit;
}
textarea { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

button {
  padding: 0.5rem 0.9rem; border: 1px solid var(--border);
  background: var(--panel-2); color: var(--text);
  border-radius: 8px; cursor: pointer; font-size: 0.9rem;
}
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); border-color: var(--accent); color: white; font-weight: 600; }
button.danger:hover { border-color: var(--red); color: #fca5a5; }

.grid-form { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.grid-form .full { grid-column: 1 / -1; }
.grid-form button { grid-column: 1 / -1; justify-self: start; }

.stats { display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: 1.25rem; }
.stat {
  flex: 1; min-width: 120px; background: var(--panel);
  border: 1px solid var(--border); border-radius: 12px; padding: 1rem;
}
.stat-label { color: var(--muted); font-size: 0.8rem; }
.stat-value { font-size: 1.4rem; font-weight: 700; margin-top: 0.2rem; }

.chart { color: var(--muted); overflow-x: auto; }
.chart svg { max-width: 100%; height: auto; display: block; }

table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; }
td code { font-size: 0.8rem; color: var(--muted); }

.buy, .badge.on { color: var(--green); }
.sell { color: var(--red); }
.badge { font-size: 0.72rem; font-weight: 700; padding: 0.12rem 0.5rem; border-radius: 999px; }
.badge.on { background: #052e16; }
.badge.off { background: var(--panel-2); color: var(--muted); }

.actions { display: flex; gap: 0.4rem; }
.actions form { display: inline; }

.qr { display: flex; justify-content: center; margin: 1rem 0; }
.qr svg { width: 240px; height: 240px; max-width: 100%; }

code { background: var(--panel-2); padding: 0.1rem 0.35rem; border-radius: 5px; }
