/* ─── tokens ────────────────────────────────────────────────────────────── */
:root {
  --bg:          #080808;
  --bg-card:     #111111;
  --bg-hover:    #161616;
  --border:      #222222;
  --accent:      #6366f1;
  --accent-glow: rgba(99,102,241,.15);
  --text:        #f0f0f0;
  --text-muted:  #666666;
  --success:     #22c55e;
  --danger:      #ef4444;
  --warning:     #f59e0b;
  --flood:       #3b82f6;
  --radius:      10px;
  --font: "Inter", system-ui, -apple-system, sans-serif;
}

/* ─── reset / base ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 14px; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: .9375rem;
  line-height: 1.55;
  letter-spacing: -.01em;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ambient glow in top-left corner */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 600px 400px at -10% -5%,
      rgba(99,102,241,.07) 0%, transparent 70%);
  z-index: 0;
}

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

/* ─── nav ───────────────────────────────────────────────────────────────── */
nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 24px;
  height: 52px;
  background: rgba(8,8,8,.82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav-logo {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -.03em;
  margin-right: 24px;
  background: linear-gradient(135deg, #fff 30%, var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  flex-shrink: 0;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  list-style: none;
}

.nav-links a {
  display: block;
  padding: 5px 12px;
  border-radius: 6px;
  font-size: .875rem;
  color: var(--text-muted);
  transition: color .15s, background .15s;
}

.nav-links a:hover {
  color: var(--text);
  background: var(--bg-hover);
  text-decoration: none;
}

.nav-links a.active {
  color: var(--accent);
  background: var(--accent-glow);
}

/* ─── layout ────────────────────────────────────────────────────────────── */
.page {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 36px 24px 64px;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-title {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -.025em;
}

.page-subtitle {
  color: var(--text-muted);
  font-size: .875rem;
  margin-top: 2px;
}

/* ─── card ──────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}

.card + .card { margin-top: 16px; }

.card-title {
  font-size: .8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* ─── table ─────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
}

thead tr {
  border-bottom: 1px solid var(--border);
}

thead th {
  padding: 0 12px 10px;
  text-align: left;
  font-size: .6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid rgba(255,255,255,.03);
  transition: background .1s;
}

tbody tr:last-child { border-bottom: none; }

tbody tr:hover { background: var(--bg-hover); }

tbody td {
  padding: 11px 12px;
  font-size: .875rem;
  vertical-align: middle;
}

.td-muted { color: var(--text-muted); font-size: .8125rem; }

/* ─── badges ────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: .75rem;
  font-weight: 500;
  letter-spacing: .01em;
  white-space: nowrap;
}

.badge-active   { background: rgba(34,197,94,.12);  color: #4ade80; }
.badge-flood    { background: rgba(59,130,246,.12);  color: #60a5fa; }
.badge-banned   { background: rgba(239,68,68,.12);   color: #f87171; }
.badge-error    { background: rgba(245,158,11,.12);  color: #fbbf24; }
.badge-cooldown { background: rgba(156,163,175,.1);  color: #9ca3af; }
.badge-sent     { background: rgba(34,197,94,.12);   color: #4ade80; }
.badge-failed   { background: rgba(239,68,68,.12);   color: #f87171; }
.badge-active-ch { background: rgba(99,102,241,.12); color: #818cf8; }

/* ─── buttons ───────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 6px;
  font-size: .875rem;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  border: none;
  transition: opacity .15s, box-shadow .15s, background .15s;
  letter-spacing: -.01em;
  white-space: nowrap;
}

.btn:disabled { opacity: .4; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 0 0 0 var(--accent-glow);
}
.btn-primary:hover {
  opacity: .9;
  box-shadow: 0 0 16px 2px var(--accent-glow);
}

.btn-danger {
  background: rgba(239,68,68,.15);
  color: #f87171;
  border: 1px solid rgba(239,68,68,.2);
}
.btn-danger:hover { background: rgba(239,68,68,.22); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text); }

.btn-sm { padding: 4px 10px; font-size: .8125rem; }
.btn-icon { padding: 6px 10px; }

/* ─── forms ─────────────────────────────────────────────────────────────── */
.form-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.field { display: flex; flex-direction: column; gap: 5px; }

.field label {
  font-size: .75rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: .02em;
}

input[type="text"],
input[type="number"],
input[type="password"],
select,
textarea {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 11px;
  font-size: .875rem;
  font-family: var(--font);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  min-width: 0;
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="password"]:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

input::placeholder,
textarea::placeholder { color: var(--text-muted); }

select { cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}

textarea { resize: vertical; min-height: 80px; line-height: 1.5; }

.field-full { flex: 1 1 100%; }
.field-wide { flex: 1 1 240px; }
.field-md   { flex: 0 0 140px; }
.field-sm   { flex: 0 0 90px; }

/* ─── inline form row inside card ──────────────────────────────────────── */
.inline-form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: flex-end;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  margin-top: 16px;
}

/* ─── settings form ─────────────────────────────────────────────────────── */
.settings-grid {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.settings-row {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 16px;
  align-items: start;
}

.settings-label { font-size: .875rem; font-weight: 500; padding-top: 9px; }
.settings-desc  { font-size: .75rem; color: var(--text-muted); margin-top: 4px; }

/* ─── empty state ───────────────────────────────────────────────────────── */
.empty {
  text-align: center;
  padding: 56px 24px;
  color: var(--text-muted);
  font-size: .9375rem;
}

.empty-icon { font-size: 2rem; display: block; margin-bottom: 10px; opacity: .4; }

/* ─── pagination ────────────────────────────────────────────────────────── */
.pagination {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-top: 24px;
}

/* ─── stat chips ────────────────────────────────────────────────────────── */
.stats-bar {
  display: flex;
  gap: 20px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.stat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 20px;
  min-width: 110px;
}

.stat-value {
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -.03em;
}

.stat-label {
  font-size: .75rem;
  color: var(--text-muted);
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: .05em;
}

/* ─── misc ──────────────────────────────────────────────────────────────── */
.mono { font-family: "JetBrains Mono", "Fira Code", monospace; font-size: .8125rem; }
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.gap-2 { display: flex; gap: 6px; align-items: center; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 280px; }

/* ─── profile switcher ──────────────────────────────────────────────────── */
.profile-switcher {
  position: relative;
  margin: 0 12px 0 4px;
  flex-shrink: 0;
}

.profile-switcher > summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: .8125rem;
  color: var(--text-muted);
  border: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
  transition: color .15s, background .15s, border-color .15s;
  white-space: nowrap;
}

.profile-switcher > summary:hover {
  color: var(--text);
  background: var(--bg-hover);
  border-color: #333;
}

.profile-switcher > summary::marker,
.profile-switcher > summary::-webkit-details-marker { display: none; }

.profile-switcher[open] > summary {
  color: var(--text);
  background: var(--bg-hover);
  border-color: var(--accent);
}

.profile-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 170px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px;
  box-shadow: 0 8px 32px rgba(0,0,0,.55);
  z-index: 300;
}

.profile-item {
  display: block;
  width: 100%;
  padding: 7px 12px;
  border-radius: 5px;
  font-size: .8125rem;
  color: var(--text-muted);
  text-align: left;
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: var(--font);
  transition: background .1s, color .1s;
  text-decoration: none;
}

.profile-item:hover {
  background: var(--bg-hover);
  color: var(--text);
  text-decoration: none;
}

.profile-item--active {
  color: var(--accent) !important;
  background: var(--accent-glow) !important;
}

.profile-menu-sep {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

/* ─── scrollbar ─────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #333; }
