:root {
  --bg: #0e0e10;
  --surface: #18181b;
  --surface2: #1f1f23;
  --border: #2d2d35;
  --purple: #9147ff;
  --purple-dark: #7c3aed;
  --text: #efeff1;
  --text-muted: #adadb8;
  --green: #00b373;
  --red: #eb0400;
  --yellow: #f0a500;
  --radius: 8px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--purple); text-decoration: none; }
a:hover { text-decoration: underline; }

code {
  background: var(--surface2);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.875em;
}

/* ── Navbar ─────────────────────────────────────────────────────────────────── */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.brand {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--purple);
  text-decoration: none;
  letter-spacing: 0.02em;
}
.nav-right { display: flex; align-items: center; gap: 0.75rem; }
.nav-user { font-weight: 600; }
.avatar { width: 28px; height: 28px; border-radius: 50%; }

/* ── Buttons ─────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-block;
  padding: 0.45rem 1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity .15s;
  white-space: nowrap;
}
.btn:hover { opacity: 0.85; text-decoration: none; }
.btn-purple { background: var(--purple); color: #fff; }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-danger { background: var(--red); color: #fff; }
.btn-sm { padding: 0.2rem 0.55rem; font-size: 0.8rem; }
.btn-lg { padding: 0.7rem 1.75rem; font-size: 1rem; }

/* ── Main layout ─────────────────────────────────────────────────────────────── */
main {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem 1.5rem;
}

footer {
  text-align: center;
  padding: 1rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  border-top: 1px solid var(--border);
}

/* ── Hero ────────────────────────────────────────────────────────────────────── */
.hero {
  text-align: center;
  padding: 5rem 1rem;
}
.hero h1 { font-size: 2.5rem; margin-bottom: 1rem; }
.hero p { color: var(--text-muted); max-width: 480px; margin: 0 auto 2rem; }
.hint { color: var(--text-muted); font-size: 0.8rem; margin-top: 0.5rem; }

/* ── Stats bar ───────────────────────────────────────────────────────────────── */
.stats-bar {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 120px;
}
.stat-val { font-size: 1.75rem; font-weight: 700; color: var(--purple); }
.stat-label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }

/* ── Cards ───────────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}
.card h2 { margin-bottom: 1rem; font-size: 1rem; }

.add-user-card .add-form {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}
.add-user-card input {
  flex: 1;
  min-width: 200px;
  padding: 0.45rem 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.875rem;
}
.add-user-card input:focus { outline: none; border-color: var(--purple); }

/* ── User grid ───────────────────────────────────────────────────────────────── */
.user-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}
.user-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: border-color .15s;
}
.user-card:hover { border-color: var(--purple); }
.user-card.is-control { border-left: 3px solid var(--purple); }
.user-card-header { display: flex; align-items: center; gap: 0.75rem; }
.user-avatar { width: 44px; height: 44px; border-radius: 50%; }
.user-link { font-weight: 700; font-size: 1rem; color: var(--text); }
.user-link:hover { color: var(--purple); text-decoration: none; }
.user-sub { color: var(--text-muted); font-size: 0.8rem; margin-top: 2px; }
.mod-count { }
.user-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  padding-top: 0.6rem;
}

/* ── Tags / badges ───────────────────────────────────────────────────────────── */
.tag {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.tag-control { background: rgba(145,71,255,.2); color: var(--purple); }
.tag-api { background: rgba(0,179,115,.2); color: var(--green); }
.tag-irc { background: rgba(240,165,0,.2); color: var(--yellow); }
.count-badge {
  display: inline-block;
  background: var(--surface2);
  color: var(--text-muted);
  border-radius: 12px;
  padding: 0 8px;
  font-size: 0.75rem;
  font-weight: 400;
  vertical-align: middle;
}

/* ── User header ─────────────────────────────────────────────────────────────── */
.user-header {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}
.user-avatar-lg { width: 80px; height: 80px; border-radius: 50%; }
.user-header h1 { font-size: 1.75rem; }
.user-id-label { color: var(--text-muted); font-size: 0.8rem; }

/* ── Summary pills ───────────────────────────────────────────────────────────── */
.summary-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}
.summary-pill {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 100px;
}
.pill-val { font-size: 1.4rem; font-weight: 700; color: var(--purple); }
.pill-label { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; }

/* ── Two column layout ───────────────────────────────────────────────────────── */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  align-items: start;
}
@media (max-width: 800px) {
  .two-col { grid-template-columns: 1fr; }
}

/* ── Data table ──────────────────────────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}
.data-table th {
  text-align: left;
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: .04em;
}
.data-table td {
  padding: 0.5rem 0.5rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--surface2); }
.ts { color: var(--text-muted); white-space: nowrap; }
.chan-link { color: var(--purple); }

/* ── Timeline ────────────────────────────────────────────────────────────────── */
.timeline {
  list-style: none;
  max-height: 520px;
  overflow-y: auto;
  padding-right: 4px;
}
.timeline::-webkit-scrollbar { width: 4px; }
.timeline::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.tl-item {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
}
.tl-item:last-child { border-bottom: none; }
.tl-icon { width: 1.25rem; text-align: center; flex-shrink: 0; }
.tl-body { flex: 1; }
.tl-type { font-weight: 600; text-transform: capitalize; }
.tl-detail { color: var(--text-muted); font-size: 0.75rem; }
.tl-ts { color: var(--text-muted); white-space: nowrap; font-size: 0.75rem; flex-shrink: 0; }

.tl-stream_start .tl-type { color: var(--green); }
.tl-stream_end   .tl-type { color: var(--text-muted); }
.tl-ban          .tl-type { color: var(--red); }
.tl-timeout      .tl-type { color: var(--yellow); }
.tl-chat         .tl-type { color: var(--purple); }

/* ── Empty state ─────────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}
