:root {
  --bg: #0a0c0f;
  --surface: #12161c;
  --surface2: #181e27;
  --border: #1e2630;
  --text: #e8eaed;
  --muted: #8b939e;
  --accent: #c9a227;
  --accent-dim: #9a7a1c;
  --up: #3dd68c;
  --down: #f07178;
  --radius: 14px;
  --font: "DM Sans", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.45;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.up { color: var(--up); }
.down { color: var(--down); }

.wrap {
  width: 100%;
  max-width: 920px;
  margin: 0 auto;
  padding: 12px 16px 96px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0 14px;
  position: sticky;
  top: 0;
  z-index: 20;
  background: linear-gradient(180deg, var(--bg) 70%, transparent);
}
.brand {
  font-weight: 700;
  letter-spacing: 0.04em;
  font-size: 1.15rem;
  color: var(--text);
  text-decoration: none;
  flex-shrink: 0;
}
.brand:hover { text-decoration: none; }
.brand span { color: var(--accent); }

/* Desktop links in header — hidden on phone */
.nav-top {
  display: none;
  align-items: center;
  gap: 16px;
}
.nav-top a {
  color: var(--muted);
  font-size: 0.9rem;
  text-decoration: none;
}
.nav-top a.active,
.nav-top a:hover {
  color: var(--accent);
  text-decoration: none;
}

/* Mobile tab bar — hidden on desktop */
.nav-bottom {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  background: rgba(10, 12, 15, 0.96);
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  backdrop-filter: blur(8px);
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.nav-bottom a {
  text-align: center;
  padding: 12px 4px;
  color: var(--muted);
  font-size: 0.78rem;
  text-decoration: none;
}
.nav-bottom a.active,
.nav-bottom a:hover {
  color: var(--accent);
  text-decoration: none;
}

.market {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 10px;
  -webkit-overflow-scrolling: touch;
}
.chip {
  flex: 0 0 auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 12px;
  min-width: 108px;
}
.chip .lbl { font-size: 0.7rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.chip .val { font-family: var(--mono); font-size: 0.92rem; margin-top: 2px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  width: 100%;
}
.card.hero { background: var(--surface2); border-color: #2a3340; }
.card h2, .card h3 { margin: 0 0 10px; font-size: 1rem; font-weight: 600; }

.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.kpi {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px;
}
.kpi .lbl { font-size: 0.72rem; color: var(--muted); }
.kpi .val { font-family: var(--mono); font-size: 0.95rem; margin-top: 4px; word-break: break-all; }

label { display: block; font-size: 0.8rem; color: var(--muted); margin-bottom: 4px; }
input, select, textarea {
  width: 100%; background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 12px; font: inherit; margin-bottom: 10px;
}
input:focus, select:focus { outline: 2px solid var(--accent-dim); border-color: var(--accent); }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; border: none; border-radius: 12px; cursor: pointer;
  font: inherit; font-weight: 600; padding: 12px 16px;
}
.btn-primary {
  width: 100%; min-height: 52px; background: var(--accent); color: #111;
  font-size: 1.05rem;
}
.btn-primary:hover { filter: brightness(1.05); }
.btn-ghost {
  background: transparent; color: var(--muted); border: 1px solid var(--border);
  width: 100%; min-height: 44px;
}
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 520px) {
  .row { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: 1fr; }
}
.checks { display: flex; gap: 14px; flex-wrap: wrap; margin: 8px 0 12px; font-size: 0.9rem; }
.checks label { display: flex; align-items: center; gap: 6px; margin: 0; color: var(--text); }
.checks input { width: auto; margin: 0; }

.bars { display: grid; gap: 10px; }
.bar-row .meta { display: flex; justify-content: space-between; font-size: 0.85rem; margin-bottom: 4px; gap: 8px; }
.track { height: 8px; background: #0d1117; border-radius: 99px; overflow: hidden; }
.fill { height: 100%; background: var(--accent); border-radius: 99px; }

.table-wrap { overflow: auto; max-height: 360px; border: 1px solid var(--border); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
th { position: sticky; top: 0; background: var(--surface2); text-align: left; padding: 8px; color: var(--muted); font-weight: 500; }
td { padding: 8px; border-top: 1px solid var(--border); font-family: var(--mono); }
th:first-child, td:first-child { font-family: var(--font); }

.flash {
  background: #1a2418; border: 1px solid #2f4a32; color: var(--up);
  padding: 10px 12px; border-radius: 10px; margin-bottom: 12px; font-size: 0.9rem;
}
.flash.warn { background: #2a2214; border-color: #5a4a22; color: var(--accent); }
.errors { background: #2a1518; border: 1px solid #5a2a32; color: var(--down); padding: 10px 12px; border-radius: 10px; margin-bottom: 12px; }

.auth-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
}
.auth-card { width: 100%; max-width: 400px; }

.horizon { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.horizon a, .horizon button {
  background: var(--bg); border: 1px solid var(--border); color: var(--muted);
  border-radius: 999px; padding: 8px 12px; font: inherit; cursor: pointer;
}
.horizon .on { border-color: var(--accent); color: var(--accent); }

@media (min-width: 800px) {
  .wrap { padding: 20px 24px 40px; }
  .nav-top { display: flex; }
  .nav-bottom { display: none; }
}
