:root {
  --bg: #0f172a;
  --panel: #1e293b;
  --panel2: #273549;
  --border: #334155;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --green: #22c55e;
  --red: #ef4444;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
  flex-wrap: wrap;
}
.topbar h1 { font-size: 18px; margin: 0; }
.topbar-actions { margin-left: auto; }

nav { display: flex; gap: 4px; flex-wrap: wrap; }
nav button {
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
}
nav button:hover { color: var(--text); background: var(--panel2); }
nav button.active { color: var(--accent); background: var(--panel2); }

main { padding: 24px; max-width: 1200px; margin: 0 auto; }

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

.toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 12px; }
.toolbar h2 { margin: 0; font-size: 20px; }
.toolbar small { color: var(--muted); font-weight: normal; font-size: 12px; }

.btn {
  background: var(--panel2);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  text-decoration: none;
  display: inline-block;
}
.btn:hover { background: var(--border); }
.btn.primary { background: var(--accent); color: #06283d; border-color: var(--accent); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.1); }
.btn.danger { color: var(--red); }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
.card .label { color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.card .value { font-size: 24px; font-weight: 700; }
.card .sub { color: var(--muted); font-size: 12px; margin-top: 4px; }

.pos { color: var(--green); }
.neg { color: var(--red); }

.table { width: 100%; border-collapse: collapse; background: var(--panel); border-radius: 12px; overflow: hidden; }
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); font-size: 14px; }
.table th { background: var(--panel2); color: var(--muted); font-weight: 600; }
.table tr:last-child td { border-bottom: none; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .actions { text-align: right; white-space: nowrap; }

.panel { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 16px; margin-bottom: 16px; }
.panel p { margin: 0 0 12px; font-size: 14px; color: var(--muted); }
.panel code { background: var(--panel2); padding: 2px 6px; border-radius: 4px; }

input, textarea, select {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 14px;
  width: 100%;
}
form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
form input { flex: 1; min-width: 120px; }

.muted { color: var(--muted); }
.mt { margin-top: 16px; }

.badge { padding: 2px 8px; border-radius: 999px; font-size: 12px; background: var(--panel2); border: 1px solid var(--border); }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.6); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px; }
.modal.hidden { display: none; }
.modal-box { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 20px; width: 100%; max-width: 520px; max-height: 90vh; overflow: auto; }
.modal-box h3 { margin-top: 0; }
.modal-box .form-row { margin-bottom: 12px; }
.modal-box label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.modal-box .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }

pre { background: var(--bg); padding: 12px; border-radius: 8px; overflow: auto; font-size: 13px; white-space: pre-wrap; }
