/* ── Tokens ─────────────────────────────────────────────────── */
:root {
  --bg:      #0e1217;
  --surface: #161c24;
  --border:  #232c36;
  --text:    #d4dce6;
  --subtle:  #6b7a8d;
  --mint:    #19e59b;
  --orange:  #ff6a2c;
  --red:     #e05252;
  --yellow:  #f5c542;
  --font-display: 'Chakra Petch', sans-serif;
  --font-body:    'Barlow', sans-serif;
  --font-mono:    'JetBrains Mono', monospace;
  --radius: 8px;
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { background: var(--bg); color: var(--text); font-family: var(--font-body); font-size: 15px; line-height: 1.5; }
a { color: var(--mint); text-decoration: none; }
a:hover { text-decoration: underline; }
input, button, select, textarea { font: inherit; }
.hidden { display: none !important; }

/* ── Auth ───────────────────────────────────────────────────── */
#auth-shell {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at center, #0d1a1a 0%, var(--bg) 70%);
}
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem;
  width: 100%; max-width: 380px;
  display: flex; flex-direction: column; gap: 1.25rem;
}
.auth-logo {
  font-family: var(--font-display); font-size: 1.6rem; font-weight: 700;
  letter-spacing: 0.12em; text-align: center;
}
.auth-card h2 { font-size: 1.1rem; font-weight: 600; }
.auth-card input {
  width: 100%; padding: 0.6rem 0.9rem;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text);
  transition: border-color 0.15s;
}
.auth-card input:focus { outline: none; border-color: var(--mint); }
.auth-switch { font-size: 0.85rem; color: var(--subtle); text-align: center; }
.err-msg { font-size: 0.85rem; color: var(--red); min-height: 1.2em; text-align: center; }

/* ── App layout ─────────────────────────────────────────────── */
#app-shell { display: flex; min-height: 100vh; }

#sidebar {
  width: 200px; flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 1.5rem 0;
  position: sticky; top: 0; height: 100vh;
}
.sidebar-logo {
  font-family: var(--font-display); font-size: 1.1rem; font-weight: 700;
  letter-spacing: 0.1em; padding: 0 1.25rem 1.5rem;
}
.nav-item {
  display: block; padding: 0.65rem 1.25rem;
  color: var(--subtle); cursor: pointer; transition: all 0.15s;
  border-left: 3px solid transparent;
  font-size: 0.9rem;
}
.nav-item:hover { color: var(--text); background: rgba(255,255,255,0.03); }
.nav-item.active { color: var(--mint); border-left-color: var(--mint); }
.nav-logout { margin-top: auto; color: var(--subtle); font-size: 0.85rem; }
.nav-logout:hover { color: var(--red); }

#main-content { flex: 1; padding: 2rem; overflow-y: auto; max-width: 1100px; }

/* ── Common ─────────────────────────────────────────────────── */
.mint   { color: var(--mint); }
.orange { color: var(--orange); }
.subtle { color: var(--subtle); font-size: 0.85rem; }
.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1rem;
}
.panel-title { font-family: var(--font-display); font-size: 0.75rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--subtle); margin-bottom: 0.85rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1rem; }
@media (max-width: 720px) { .grid-2 { grid-template-columns: 1fr; } }

.btn-primary {
  width: 100%; padding: 0.65rem; border: none; border-radius: var(--radius);
  background: var(--mint); color: #0a0f12; font-weight: 700; cursor: pointer;
  font-family: var(--font-display); letter-spacing: 0.06em; transition: opacity 0.15s;
}
.btn-primary:hover { opacity: 0.88; }

.view h1 { font-family: var(--font-display); font-size: 1.4rem; margin-bottom: 1.25rem; }

/* ── Identity strip ─────────────────────────────────────────── */
#identity-strip {
  display: flex; align-items: center; gap: 1.25rem;
  margin-bottom: 1.25rem; padding: 1rem 1.25rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.id-avatar {
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--border); display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 1.3rem; color: var(--mint);
}
.id-name { font-family: var(--font-display); font-size: 1.1rem; font-weight: 600; }
.id-meta { font-size: 0.85rem; color: var(--subtle); }
.level-chip {
  padding: 0.3rem 0.8rem;
  background: var(--border); border-radius: 20px;
  font-family: var(--font-display); font-size: 0.8rem; font-weight: 700;
  color: var(--orange);
}

/* ── Tier chip ──────────────────────────────────────────────── */
.tier-chip {
  padding: 0.3rem 0.8rem; border-radius: 20px;
  font-family: var(--font-display); font-size: 0.75rem; font-weight: 700;
}
.tier-free    { background: var(--border); color: var(--subtle); }
.tier-premium { background: rgba(25,229,155,0.12); color: var(--mint); border: 1px solid var(--mint); }

/* ── KPI row ────────────────────────────────────────────────── */
.kpi-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.kpi {
  flex: 1; min-width: 90px; text-align: center;
  padding: 0.75rem 0.5rem;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
}
.kpi-val { font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; }
.kpi-lbl { font-size: 0.72rem; color: var(--subtle); text-transform: uppercase; letter-spacing: 0.08em; margin-top: 0.2rem; }

/* ── Focus card ─────────────────────────────────────────────── */
.focus-card {
  border: 1px solid var(--mint);
  background: linear-gradient(135deg, rgba(25,229,155,0.06), transparent);
  border-radius: var(--radius); padding: 1.5rem; margin-bottom: 1rem;
}
.focus-label {
  font-family: var(--font-display); font-size: 0.65rem; letter-spacing: 0.18em;
  color: var(--mint); margin-bottom: 0.5rem;
}
.focus-title { font-family: var(--font-display); font-size: 1.25rem; font-weight: 700; margin-bottom: 0.75rem; }
.focus-body  { color: var(--text); margin-bottom: 0.75rem; line-height: 1.6; }
.focus-drill {
  font-size: 0.88rem; color: var(--subtle);
  border-left: 2px solid var(--mint); padding-left: 0.75rem;
}
.focus-drill::before { content: "DRILL: "; font-weight: 600; color: var(--mint); }
.focus-card.loading .focus-title { color: var(--subtle); }
.btn-refresh {
  padding: 0.25rem 0.65rem; font-size: 0.75rem; border: 1px solid var(--border);
  background: transparent; color: var(--subtle); border-radius: var(--radius);
  cursor: pointer; transition: all 0.15s; font-family: var(--font-display);
}
.btn-refresh:hover { color: var(--mint); border-color: var(--mint); }
.btn-refresh:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Form dots ──────────────────────────────────────────────── */
#form-dots { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 0.75rem; }
.form-dot {
  width: 24px; height: 24px; border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem; font-weight: 700; font-family: var(--font-display);
  cursor: default;
}
.form-dot.win  { background: rgba(25,229,155,0.18); color: var(--mint); }
.form-dot.loss { background: rgba(224,82,82,0.18);  color: var(--red); }

#elo-trend { font-size: 0.85rem; color: var(--subtle); }

/* ── Insights ───────────────────────────────────────────────── */
.insight-card {
  padding: 1rem; border-radius: var(--radius);
  border: 1px solid var(--border); margin-bottom: 0.65rem;
  background: var(--bg);
}
.insight-header { display: flex; align-items: center; gap: 0.65rem; margin-bottom: 0.4rem; }
.severity-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.sev-3 { background: var(--red); }
.sev-2 { background: var(--orange); }
.sev-1 { background: var(--yellow); }
.insight-title { font-weight: 600; font-size: 0.95rem; }
.insight-body  { font-size: 0.88rem; color: var(--text); margin-bottom: 0.4rem; line-height: 1.5; }
.insight-drill { font-size: 0.82rem; color: var(--subtle); border-left: 2px solid var(--border); padding-left: 0.6rem; }
.insight-target { font-size: 0.75rem; color: var(--subtle); margin-left: auto; font-family: var(--font-mono); }

/* ── Map table ──────────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.data-table th {
  text-align: left; padding: 0.5rem 0.75rem;
  color: var(--subtle); font-size: 0.72rem; text-transform: uppercase;
  letter-spacing: 0.08em; border-bottom: 1px solid var(--border);
}
.data-table td { padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--border); font-family: var(--font-mono); }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(255,255,255,0.025); }
.map-name { font-family: var(--font-body); font-weight: 500; }
.positive { color: var(--mint); }
.negative { color: var(--red); }

/* ── Upload ─────────────────────────────────────────────────── */
.drop-zone {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 3rem 2rem; text-align: center; cursor: pointer;
  transition: all 0.2s; color: var(--subtle);
}
.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--mint); color: var(--mint);
  background: rgba(25,229,155,0.04);
}
.drop-icon { font-size: 2rem; margin-bottom: 0.5rem; }
#upload-progress { margin-top: 1rem; padding: 0.75rem; background: var(--bg); border-radius: var(--radius); }
.upload-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.6rem 0; border-bottom: 1px solid var(--border); font-size: 0.88rem;
}
.upload-row:last-child { border-bottom: none; }
.status-pending { color: var(--subtle); }
.status-parsing { color: var(--yellow); }
.status-done    { color: var(--mint); }
.status-failed  { color: var(--red); }

/* ── Connect steps ──────────────────────────────────────────── */
.steps-panel { margin-bottom: 1rem; }
.step-title { font-family: var(--font-display); font-weight: 700; font-size: 1rem; margin-bottom: 0.85rem; color: var(--mint); }
.steps { padding-left: 1.4rem; display: flex; flex-direction: column; gap: 0.5rem; font-size: 0.92rem; line-height: 1.55; }
.steps li strong { color: var(--text); }
.step-example { margin-top: 0.85rem; font-size: 0.85rem; color: var(--subtle); padding: 0.6rem 1rem; background: var(--bg); border-radius: var(--radius); }
code { font-family: var(--font-mono); font-size: 0.85em; background: var(--border); padding: 0.15em 0.4em; border-radius: 3px; }

/* ── Profile form ───────────────────────────────────────────── */
#profile-form { display: flex; flex-direction: column; gap: 1.1rem; }
#profile-form label { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.88rem; color: var(--subtle); }
#profile-form input {
  padding: 0.6rem 0.9rem; background: var(--bg);
  border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); transition: border-color 0.15s;
}
#profile-form input:focus { outline: none; border-color: var(--mint); }
#profile-form input:disabled { opacity: 0.45; }
#profile-form small { color: var(--subtle); font-size: 0.78rem; }
.status-msg { font-size: 0.88rem; min-height: 1.2em; }
.status-msg.ok  { color: var(--mint); }
.status-msg.err { color: var(--red); }
