/* Same palette as Desktop_App/research/research_app.py's _BG/_FG/_MUTED/
   _GRID/_OK/_WARN/_BAD/_LINE_COLORS - this is an internal ops dashboard, not
   a public-facing page like Portal, so it keeps that tool's existing dark
   identity rather than Portal's light one. */
:root {
  --bg: #1a1a1f;
  --card-bg: #232329;
  --border: #33333d;
  --text: #e6e6e6;
  --muted: #8a8a94;
  --grid: #3a3a42;
  --ok: #3ddc84;
  --warn: #e0b23e;
  --bad: #ff5c5c;
  --line-cpu: #4fb3a9;
  --line-mem: #c99a3e;
  --line-disk: #7aa2f7;
  --accent: #375fd6;
  --accent-hover: #2c4cb0;
}

* { box-sizing: border-box; }

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

h1 { font-size: 1.3rem; margin: 0 0 12px; }

/* ---- Token gate ---- */

#gate {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
#gate[hidden] { display: none; }

.card {
  width: 100%;
  max-width: 420px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px;
}

.hint {
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.5;
  margin: 0 0 16px;
}

input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  color: var(--text);
  background: #1e1e24;
  margin-bottom: 12px;
}
input:focus { outline: none; border-color: var(--accent); }

.btn-primary {
  display: block;
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.6; cursor: default; }

.msg {
  display: none;
  margin-bottom: 12px;
  padding: 8px 10px;
  border-radius: 6px;
  background: #3a2323;
  color: var(--bad);
  font-size: 0.82rem;
}
.msg.visible { display: block; }

/* ---- Dashboard ---- */

#dashboard[hidden] { display: none; }

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 24px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.topbar-title { font-weight: 700; }
.status-line { color: var(--muted); font-size: 0.82rem; }
.spacer { flex: 1; }

.btn-outline {
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
  font-size: 0.85rem;
  cursor: pointer;
}
.btn-outline:hover { background: #2a2a32; }
.btn-muted { color: var(--muted); }

.container { max-width: 1100px; margin: 0 auto; padding: 24px; }

/* ---- Stat cards ---- */

.cards-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
@media (max-width: 900px) {
  .cards-row { grid-template-columns: repeat(2, 1fr); }
}

.stat-card {
  background: var(--card-bg);
  border-radius: 8px;
  padding: 12px;
}
.stat-header {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.stat-value {
  color: var(--text);
  font-size: 1.35rem;
  font-weight: 700;
  margin-top: 4px;
}
.stat-bar {
  height: 8px;
  border-radius: 4px;
  background: #33333d;
  margin-top: 10px;
  overflow: hidden;
}
.stat-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--ok);
  transition: width 0.3s ease, background-color 0.3s ease;
}
.stat-bar.hidden { visibility: hidden; }
.stat-sub {
  color: var(--muted);
  font-size: 0.75rem;
  margin-top: 6px;
}

/* ---- Chart ---- */

.chart-card {
  background: var(--card-bg);
  border-radius: 8px;
  padding: 16px;
}
.chart-title {
  color: var(--text);
  font-size: 0.85rem;
  margin-bottom: 8px;
}
#chart {
  width: 100%;
  height: 320px;
  display: block;
}
.chart-legend {
  display: flex;
  gap: 20px;
  margin-top: 10px;
  font-size: 0.78rem;
  color: var(--muted);
}
.legend-item { display: flex; align-items: center; gap: 6px; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
