:root {
  --bg: #0e1015;
  --surface: #171a22;
  --surface-2: #1e222c;
  --border: #2a2f3b;
  --text: #e8eaf0;
  --text-dim: #8b91a3;
  --amber: #f0a93d;
  --green: #4ac26b;
  --yellow: #e8c547;
  --red: #e05a5a;
  --mono: 'IBM Plex Mono', monospace;
  --sans: 'Inter', -apple-system, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ---------- Login ---------- */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 36px 32px;
  width: 100%;
  max-width: 340px;
  text-align: center;
}
.login-mark {
  font-family: var(--mono);
  color: var(--amber);
  font-weight: 600;
  letter-spacing: 2px;
  margin-bottom: 12px;
}
.login-card h1 { font-size: 1.3rem; margin: 0 0 6px; }
.login-card p { color: var(--text-dim); font-size: 0.85rem; margin: 0 0 20px; }
.login-card input {
  width: 100%; padding: 10px 12px; margin-bottom: 12px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); font-size: 0.95rem;
}
.error-text { color: var(--red); font-size: 0.8rem; min-height: 1em; }

/* ---------- Layout ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--bg); z-index: 10;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  font-family: var(--mono); background: var(--amber); color: #1a1305;
  padding: 3px 7px; border-radius: 5px; font-weight: 700; font-size: 0.8rem;
}
.brand-name { font-weight: 600; font-size: 0.95rem; }

.tabs {
  display: flex; gap: 4px; padding: 10px 20px 0; border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.tab-btn {
  background: none; border: none; color: var(--text-dim); font-family: var(--sans);
  font-size: 0.88rem; font-weight: 500; padding: 10px 14px; cursor: pointer;
  border-bottom: 2px solid transparent; white-space: nowrap;
}
.tab-btn.active { color: var(--text); border-bottom-color: var(--amber); }

main { padding: 18px 20px 60px; max-width: 1100px; margin: 0 auto; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---------- Buttons ---------- */
.primary-btn {
  background: var(--amber); color: #1a1305; border: none; border-radius: 8px;
  padding: 9px 16px; font-weight: 600; font-size: 0.85rem; cursor: pointer;
}
.primary-btn:hover { filter: brightness(1.08); }
.secondary-btn {
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: 9px 14px; font-size: 0.85rem; cursor: pointer;
}
.secondary-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ---------- Stats ---------- */
.stat-row {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-bottom: 22px;
}
@media (max-width: 800px) { .stat-row { grid-template-columns: repeat(2, 1fr); } }
.stat-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 14px;
}
.stat-label { font-size: 0.72rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.06em; }
.stat-value { font-family: var(--mono); font-size: 1.6rem; font-weight: 600; margin-top: 4px; }
.stat-good { color: var(--green); }
.stat-warn { color: var(--yellow); }
.stat-bad { color: var(--red); }

.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 16px; margin-bottom: 18px;
}
.panel h2 { font-size: 0.95rem; margin: 0 0 12px; }

.alerts-list { list-style: none; margin: 0; padding: 0; font-size: 0.85rem; }
.alerts-list li { padding: 8px 0; border-bottom: 1px solid var(--border); color: var(--yellow); }
.alerts-list li:last-child { border-bottom: none; }
.alerts-list .empty { color: var(--text-dim); }

/* ---------- Catalogue ---------- */
.toolbar { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar input, .toolbar select {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); padding: 8px 10px; font-size: 0.85rem;
}
.toolbar input { flex: 1; min-width: 180px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--text-dim); font-weight: 500; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; background: var(--surface); }
td { font-family: var(--mono); }
tbody tr:hover { background: var(--surface-2); cursor: pointer; }

.status-pill {
  display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 0.72rem;
  font-family: var(--sans); font-weight: 600;
}
.status-winning { background: rgba(74,194,107,0.15); color: var(--green); }
.status-close { background: rgba(232,197,71,0.15); color: var(--yellow); }
.status-losing { background: rgba(224,90,90,0.15); color: var(--red); }
.status-unknown { background: rgba(139,145,163,0.15); color: var(--text-dim); }

/* ---------- Drawer ---------- */
.drawer-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 50;
  display: flex; justify-content: flex-end;
}
.drawer {
  background: var(--surface); width: 100%; max-width: 420px; height: 100%;
  padding: 24px; overflow-y: auto; position: relative;
}
.drawer-close {
  position: absolute; top: 18px; right: 18px; background: none; border: none;
  color: var(--text-dim); font-size: 1.4rem; cursor: pointer;
}
.drawer-body label { display: block; font-size: 0.75rem; color: var(--text-dim); margin: 14px 0 5px; }
.drawer-body input, .drawer-body select {
  width: 100%; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); padding: 9px 10px; font-family: var(--mono); font-size: 0.9rem;
}
.drawer-save {
  margin-top: 20px; width: 100%; background: var(--amber); color: #1a1305; border: none;
  border-radius: 8px; padding: 11px; font-weight: 600; cursor: pointer;
}
