/* ── Reset / Base ─────────────────────────────────────────────────────────── */

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

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: #0d0f14;
  color: #e2e8f0;
  min-height: 100vh;
}

a { text-decoration: none; color: inherit; }


/* ── Top Nav ──────────────────────────────────────────────────────────────── */

.topnav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #13161e;
  border-bottom: 1px solid #1e2330;
  padding: 0 20px;
  height: 54px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.topnav-left  { display: flex; align-items: center; gap: 20px; }
.topnav-right { display: flex; align-items: center; gap: 12px; }

.nav-brand {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: .02em;
  color: #60a5fa;
  white-space: nowrap;
}

.nav-user   { font-size: .85rem; color: #94a3b8; }

.nav-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid #252b3b;
}

.nav-role {
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid;
}

.nav-role.rank-network_oversight {
  background: #2d1f4a; color: #c084fc; border-color: #6d28d9;
}
.nav-role.rank-network_manager {
  background: #1e2d3d; color: #60a5fa; border-color: #2d4a6a;
}
.nav-role.rank-network_staff {
  background: #0f2a1a; color: #4ade80; border-color: #166534;
}
.nav-role.rank-network_billing {
  background: #1a2a1a; color: #34d399; border-color: #065f46;
}

/* Dropdown */
.nav-dropdown { position: relative; }

.nav-dropdown-btn {
  background: #1a1e2a;
  color: #e2e8f0;
  border: 1px solid #252b3b;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: .88rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background .15s;
}
.nav-dropdown-btn:hover { background: #252b3b; }

.caret { font-size: .7rem; opacity: .7; }

.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: #1a1e2a;
  border: 1px solid #252b3b;
  border-radius: 8px;
  overflow: hidden;
  min-width: 200px;
  box-shadow: 0 8px 24px rgba(0,0,0,.45);
}
.nav-dropdown-menu.open { display: block; }

.nav-item {
  display: block;
  padding: 10px 16px;
  font-size: .9rem;
  color: #cbd5e1;
  transition: background .12s;
}
.nav-item:hover   { background: #252b3b; color: #fff; }
.nav-item.active  { color: #60a5fa; background: #1e2d3d; font-weight: 600; }

/* Logout */
.btn-logout {
  background: transparent;
  border: 1px solid #374151;
  color: #94a3b8;
  border-radius: 6px;
  padding: 5px 12px;
  font-size: .82rem;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.btn-logout:hover { background: #1f2937; color: #e2e8f0; }


/* ── Page Wrap ─────────────────────────────────────────────────────────────── */

.page-wrap { max-width: 1200px; margin: 0 auto; padding: 24px 20px; }


/* ── Stats Cards ───────────────────────────────────────────────────────────── */

.stats {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.card {
  background: #13161e;
  border: 1px solid #1e2330;
  border-radius: 10px;
  padding: 18px 24px;
  flex: 1;
  min-width: 160px;
  text-align: center;
}

.card h3 {
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #64748b;
  margin-bottom: 8px;
}

.card p { font-size: 1.4rem; font-weight: 700; }


/* ── Layout ────────────────────────────────────────────────────────────────── */

.layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 20px;
}

@media (max-width: 768px) { .layout { grid-template-columns: 1fr; } }


/* ── Panels / Sections ──────────────────────────────────────────────────────── */

.detections, .players-panel, .mgmt-section {
  background: #13161e;
  border: 1px solid #1e2330;
  border-radius: 10px;
  padding: 20px;
}

.mgmt-section { border-radius: 12px; padding: 22px 24px; margin-bottom: 24px; }

.detections h2, .players-panel h2 { font-size: 1rem; margin-bottom: 14px; }

.detections input, .detections select {
  background: #0d0f14;
  border: 1px solid #252b3b;
  color: #e2e8f0;
  border-radius: 6px;
  padding: 7px 10px;
  font-size: .88rem;
  margin-bottom: 10px;
  margin-right: 8px;
  width: calc(60% - 8px);
}
.detections select { width: 36%; }

.log {
  background: #0d0f14;
  border: 1px solid #1e2330;
  border-radius: 8px;
  padding: 12px 14px;
  font-size: .84rem;
  line-height: 1.7;
  margin-bottom: 8px;
}

.player {
  background: #0d0f14;
  border: 1px solid #1e2330;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: .83rem;
  margin-bottom: 8px;
}


/* ── Section header ──────────────────────────────────────────────────────────── */

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  flex-wrap: wrap;
  gap: 10px;
}

.section-header h2        { font-size: 1rem; }
.section-header-actions   { display: flex; align-items: center; gap: 8px; }


/* ── Buttons ─────────────────────────────────────────────────────────────────── */

.btn-primary {
  display: inline-block;
  background: #1e3a5f;
  border: 1px solid #2d5a9e;
  color: #93c5fd;
  border-radius: 8px;
  padding: 9px 20px;
  font-size: .9rem;
  cursor: pointer;
  transition: filter .15s;
}
.btn-primary:hover { filter: brightness(1.15); }

.btn-refresh {
  background: #1a1e2a;
  border: 1px solid #252b3b;
  color: #94a3b8;
  border-radius: 6px;
  padding: 5px 12px;
  font-size: .82rem;
  cursor: pointer;
  transition: background .15s;
}
.btn-refresh:hover { background: #252b3b; color: #e2e8f0; }

.btn-danger-sm {
  background: #2d1515;
  border: 1px solid #5b2222;
  color: #f87171;
  border-radius: 6px;
  padding: 5px 12px;
  font-size: .82rem;
  cursor: pointer;
  transition: background .15s;
}
.btn-danger-sm:hover { background: #3d1a1a; }

.btn-success-sm {
  background: #0f2a1a;
  border: 1px solid #166534;
  color: #4ade80;
  border-radius: 6px;
  padding: 5px 12px;
  font-size: .82rem;
  cursor: pointer;
  transition: background .15s;
}
.btn-success-sm:hover { background: #14532d; }

.btn-search {
  background: #1e3a5f;
  border: 1px solid #2d5a9e;
  color: #93c5fd;
  border-radius: 6px;
  padding: 7px 16px;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  transition: filter .15s;
}
.btn-search:hover { filter: brightness(1.2); }

.btn-unban {
  background: #0f2a1a;
  border: 1px solid #166534;
  color: #4ade80;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: .78rem;
  cursor: pointer;
  transition: background .15s;
}
.btn-unban:hover { background: #14532d; }

.btn-force-logout {
  background: #2d1515;
  border: 1px solid #5b2222;
  color: #f87171;
  border-radius: 6px;
  padding: 5px 12px;
  font-size: .8rem;
  cursor: pointer;
  transition: background .15s;
}
.btn-force-logout:hover { background: #3d1a1a; }


/* ── Forms / Inputs ──────────────────────────────────────────────────────────── */

.search-row {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.search-row input, .form-input {
  flex: 1;
  min-width: 220px;
  background: #0d0f14;
  border: 1px solid #252b3b;
  color: #e2e8f0;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: .88rem;
}

.form-input { display: block; width: 100%; margin-bottom: 10px; }

select.form-input {
  cursor: pointer;
}

.offline-ban-form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 12px;
}

.offline-ban-form input {
  flex: 1;
  min-width: 200px;
  background: #0d0f14;
  border: 1px solid #252b3b;
  color: #e2e8f0;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: .88rem;
}

.section-hint { font-size: .82rem; color: #475569; margin-bottom: 14px; }


/* ── Tables ──────────────────────────────────────────────────────────────────── */

.mod-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .83rem;
}

.mod-table th {
  text-align: left;
  padding: 8px 10px;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: #475569;
  border-bottom: 1px solid #1e2330;
}

.mod-table td {
  padding: 10px 10px;
  border-bottom: 1px solid #13161e;
  vertical-align: top;
}

.mod-table tr:last-child td { border-bottom: none; }
.mod-table tr:hover td { background: #0f1118; }


/* ── Cards ───────────────────────────────────────────────────────────────────── */

.session-card {
  background: #0d0f14;
  border: 1px solid #1e2330;
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 10px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.session-username {
  font-size: .95rem;
  font-weight: 600;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.session-meta     { font-size: .79rem; color: #64748b; margin-top: 3px; }
.session-actions  { display: flex; gap: 8px; flex-wrap: wrap; flex-shrink: 0; align-items: center; }

.tag-self {
  font-size: .67rem;
  font-weight: 700;
  letter-spacing: .06em;
  background: #1e2d3d;
  color: #60a5fa;
  border: 1px solid #2d4a6a;
  border-radius: 4px;
  padding: 1px 6px;
}

.failed-card {
  background: #120a0a;
  border: 1px solid #2d1515;
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 8px;
}

.failed-info     { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; font-size: .83rem; }
.failed-username { font-weight: 600; color: #fca5a5; }
.failed-meta     { color: #64748b; }
.failed-time     { color: #475569; margin-left: auto; }

.player-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.player-card {
  background: #0d0f14;
  border: 1px solid #1e2330;
  border-radius: 10px;
  padding: 14px 16px;
}

.player-card-name    { font-size: .95rem; font-weight: 600; margin-bottom: 4px; }
.player-card-meta    { font-size: .79rem; color: #64748b; margin-top: 2px; }
.player-card-ids     { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 4px; }
.player-card-actions { margin-top: 10px; }

/* Ticket cards */
.ticket-card {
  background: #0d0f14;
  border: 1px solid #1e2330;
  border-radius: 10px;
  padding: 16px 18px;
  margin-bottom: 10px;
}

.ticket-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.ticket-id   { font-size: .75rem; color: #475569; }
.ticket-from { font-size: .92rem; font-weight: 600; }
.ticket-server { font-size: .8rem; color: #60a5fa; margin-top: 2px; }
.ticket-msg  { font-size: .86rem; color: #cbd5e1; line-height: 1.6; margin-bottom: 10px; }
.ticket-footer { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ticket-time { font-size: .76rem; color: #475569; }


/* ── Badges / Tags ───────────────────────────────────────────────────────────── */

.badge-alert {
  background: #451a1a;
  border: 1px solid #7f1d1d;
  color: #fca5a5;
  border-radius: 100px;
  padding: 2px 10px;
  font-size: .75rem;
  font-weight: 600;
}

.id-list { display: flex; flex-wrap: wrap; gap: 4px; }

.id-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: #1a1e2a;
  border: 1px solid #252b3b;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: .72rem;
  font-family: monospace;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.id-key { color: #60a5fa; font-weight: 600; }
.id-key::after { content: ":"; }
.id-none { color: #334155; font-size: .78rem; font-style: italic; }

.status-badge {
  display: inline-block;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  border-radius: 4px;
  padding: 2px 8px;
  border: 1px solid;
}

.status-open    { background: #0f2a1a; color: #4ade80; border-color: #166534; }
.status-pending { background: #1c1a0a; color: #fbbf24; border-color: #78350f; }
.status-closed  { background: #1a1e2a; color: #64748b; border-color: #252b3b; }
.status-online  { color: #4ade80; font-size: .8rem; }
.status-offline { color: #475569; font-size: .8rem; }

.tag-offline-ban {
  font-size: .65rem;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  background: #1c1a0a;
  color: #fbbf24;
  border: 1px solid #78350f;
  border-radius: 3px;
  padding: 1px 5px;
  margin-left: 4px;
}

.rank-badge {
  display: inline-block;
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  border-radius: 4px;
  padding: 2px 7px;
  border: 1px solid;
}

.rank-network_oversight { background: #2d1f4a; color: #c084fc; border-color: #6d28d9; }
.rank-network_manager   { background: #1e2d3d; color: #60a5fa; border-color: #2d4a6a; }
.rank-network_staff     { background: #0f2a1a; color: #4ade80; border-color: #166534; }
.rank-pending           { background: #1c1a0a; color: #fbbf24; border-color: #78350f; }
.rank-denied            { background: #2d1515; color: #f87171; border-color: #5b2222; }
.rank-network_billing   { background: #1a2a1a; color: #34d399; border-color: #065f46; }


/* ── Colour utilities ───────────────────────────────────────────────────────── */

.green  { color: #4ade80; }
.orange { color: #fb923c; }
.red    { color: #f87171; }

h1 { font-size: 1.5rem; margin-bottom: 6px; }


/* ── Access denied ───────────────────────────────────────────────────────────── */

.denied-box { text-align: center; padding: 80px 20px; }
.denied-icon { font-size: 3rem; margin-bottom: 16px; }
.denied-box h2 { font-size: 1.5rem; margin-bottom: 8px; }
.denied-box p  { color: #64748b; margin-bottom: 24px; }


/* ── Empty state ─────────────────────────────────────────────────────────────── */

.empty-state { color: #475569; font-size: .88rem; padding: 12px 0; }


/* ── Toast ───────────────────────────────────────────────────────────────────── */

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #1a1e2a;
  border: 1px solid #2d4a6a;
  color: #e2e8f0;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: .88rem;
  z-index: 9999;
  transition: opacity .4s;
  opacity: 0;
  pointer-events: none;
  box-shadow: 0 4px 20px rgba(0,0,0,.5);
}
.toast.show { opacity: 1; }
.toast.toast-error { border-color: #5b2222; background: #1a0f0f; color: #f87171; }

.toast-inline-ok  { color: #4ade80; font-size: .85rem; margin-top: 8px; }
.toast-inline-err { color: #f87171; font-size: .85rem; margin-top: 8px; }


/* ── Login page ──────────────────────────────────────────────────────────────── */

.login-box {
  max-width: 380px;
  margin: 100px auto;
  background: #13161e;
  border: 1px solid #1e2330;
  border-radius: 14px;
  padding: 40px 36px;
  text-align: center;
}

.login-logo   { font-size: 2.8rem; margin-bottom: 12px; }
.login-box h1 { font-size: 1.5rem; margin-bottom: 4px; }
.login-box h2 { font-size: .9rem; color: #64748b; margin-bottom: 28px; }

.btn-discord {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: #5865f2;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 11px 24px;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  transition: filter .15s;
  text-decoration: none;
  width: 100%;
  justify-content: center;
}
.btn-discord:hover { filter: brightness(1.12); }

.login-error {
  background: #1a0f0f;
  border: 1px solid #5b2222;
  color: #f87171;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: .85rem;
  margin-bottom: 18px;
}

.login-note {
  margin-top: 18px;
  font-size: .78rem;
  color: #475569;
}


/* ── Homepage profile card ───────────────────────────────────────────────────── */

.profile-card {
  background: #13161e;
  border: 1px solid #1e2330;
  border-radius: 14px;
  padding: 28px 32px;
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 24px;
}

.profile-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 3px solid #252b3b;
  flex-shrink: 0;
}

.profile-info h2   { font-size: 1.3rem; margin-bottom: 6px; }
.profile-info p    { font-size: .85rem; color: #64748b; margin-top: 6px; }

/* Status indicator */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4ade80;
  margin-right: 6px;
  box-shadow: 0 0 6px #4ade80;
}


/* ── Restriction form ────────────────────────────────────────────────────────── */

.restriction-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

@media (max-width: 640px) { .restriction-form { grid-template-columns: 1fr; } }

.restriction-form input,
.restriction-form select {
  background: #0d0f14;
  border: 1px solid #252b3b;
  color: #e2e8f0;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: .88rem;
  width: 100%;
}

.restriction-form .full-width { grid-column: 1 / -1; }

.restriction-table { width: 100%; border-collapse: collapse; font-size: .83rem; }
.restriction-table th {
  text-align: left;
  padding: 8px 10px;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: #475569;
  border-bottom: 1px solid #1e2330;
}
.restriction-table td {
  padding: 10px;
  border-bottom: 1px solid #13161e;
  vertical-align: top;
}
.restriction-table tr:last-child td { border-bottom: none; }
.restriction-table tr:hover td { background: #0f1118; }


/* ── Staff table ─────────────────────────────────────────────────────────────── */

.staff-table { width: 100%; border-collapse: collapse; font-size: .83rem; }
.staff-table th {
  text-align: left;
  padding: 8px 10px;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: #475569;
  border-bottom: 1px solid #1e2330;
}
.staff-table td {
  padding: 10px;
  border-bottom: 1px solid #13161e;
  vertical-align: middle;
}
.staff-table tr:last-child td { border-bottom: none; }
.staff-table tr:hover td { background: #0f1118; }

.staff-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 1px solid #252b3b;
  vertical-align: middle;
  margin-right: 8px;
}


/* ── Server table ────────────────────────────────────────────────────────────── */

.server-table { width: 100%; border-collapse: collapse; font-size: .83rem; }
.server-table th {
  text-align: left;
  padding: 8px 10px;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: #475569;
  border-bottom: 1px solid #1e2330;
}
.server-table td {
  padding: 10px;
  border-bottom: 1px solid #13161e;
  vertical-align: middle;
  font-family: monospace;
  font-size: .8rem;
}
.server-table tr:last-child td { border-bottom: none; }
.server-table tr:hover td { background: #0f1118; }

.api-key-cell {
  font-family: monospace;
  font-size: .76rem;
  color: #64748b;
  cursor: pointer;
  transition: color .15s;
}
.api-key-cell:hover { color: #e2e8f0; }

/* Tabs */
.tab-bar {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 1px solid #1e2330;
  padding-bottom: 0;
}

.tab-btn {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: #64748b;
  padding: 8px 16px;
  font-size: .88rem;
  cursor: pointer;
  transition: color .15s, border-color .15s;
  margin-bottom: -1px;
}
.tab-btn:hover { color: #e2e8f0; }
.tab-btn.active { color: #60a5fa; border-bottom-color: #60a5fa; font-weight: 600; }

/* Modal */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
.modal-overlay.open { display: flex; }

.modal {
  background: #13161e;
  border: 1px solid #1e2330;
  border-radius: 14px;
  padding: 28px 32px;
  width: 100%;
  max-width: 480px;
  margin: 20px;
}

.modal h3     { font-size: 1.1rem; margin-bottom: 16px; }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }