:root {
  --bg-obsidian: #06070a;
  --surface-1: rgba(12, 14, 20, 0.88);
  --surface-2: rgba(18, 21, 30, 0.94);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-bright: rgba(255, 255, 255, 0.22);
  --reflektor-coral: #e15b4b;
  --reflektor-gold: #d9a05b;
  --reflektor-cyan: #72b4d4;
  --neon-green: #46d369;
  --text-main: #f4f4f6;
  --text-muted: #8a909e;
}

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

body {
  min-height: 100dvh;
  background-color: var(--bg-obsidian);
  color: var(--text-main);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.reflektor-prism-beam {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  z-index: 60;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(114, 180, 212, 0.55) 28%,
    rgba(255, 255, 255, 0.92) 50%,
    rgba(225, 91, 75, 0.65) 72%,
    transparent 100%
  );
  pointer-events: none;
}

.admin-ambient-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 20% 15%, rgba(225, 91, 75, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(114, 180, 212, 0.1) 0%, transparent 52%),
    #06070a;
}

.reflektor-emblem-lg {
  width: 34px;
  height: 34px;
  color: #f4f4f6;
}

.reflektor-emblem-sm {
  width: 24px;
  height: 24px;
  color: #f4f4f6;
}

/* ==========================================================================
   Administration Sign-In Gate
   ========================================================================== */
.fortress-gate {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.fortress-card {
  width: min(380px, 100%);
  padding: 2.3rem 2.1rem;
  border-radius: 6px;
  background: var(--surface-1);
  border: 1px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(28px);
  box-shadow: 0 32px 72px rgba(0, 0, 0, 0.92);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.fortress-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.45rem;
}

.fortress-brand {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.34em;
  color: var(--text-muted);
}

.fortress-header h1 {
  font-size: 1.25rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.fortress-form,
.admin-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 0.38rem;
}

.field-group label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.toggle-pwd-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
}

.toggle-pwd-btn:hover {
  color: var(--text-main);
}

.field-group input,
.admin-select {
  width: 100%;
  padding: 0.72rem 0.9rem;
  border-radius: 4px;
  border: 1px solid var(--border-subtle);
  background: rgba(6, 7, 10, 0.85);
  color: #ffffff;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.18s ease;
}

.field-group input:focus,
.admin-select:focus {
  border-color: rgba(255, 255, 255, 0.45);
}

.btn-fortress-primary {
  padding: 0.8rem 1.4rem;
  border-radius: 4px;
  border: 1px solid #ffffff;
  background: #f4f4f6;
  color: #06070a;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.16s ease;
}

.btn-fortress-primary:hover {
  background: #ffffff;
}

.fortress-error {
  padding: 0.65rem 0.85rem;
  border-radius: 4px;
  background: rgba(225, 91, 75, 0.14);
  border: 1px solid rgba(225, 91, 75, 0.42);
  color: #f3a69c;
  font-size: 0.82rem;
  font-weight: 600;
}

/* ==========================================================================
   Administration Shell
   ========================================================================== */
.admin-shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.admin-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem clamp(1.25rem, 4vw, 3.5rem);
  background: rgba(6, 7, 10, 0.88);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.brand-title {
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.24em;
}

.brand-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.mesh-badge {
  padding: 0.34rem 0.75rem;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  background: rgba(114, 180, 212, 0.12);
  border: 1px solid rgba(114, 180, 212, 0.32);
  color: #bae6fd;
}

.btn-ghost-sm,
.btn-danger-sm,
.btn-invite-direct,
.btn-approve-sm {
  padding: 0.44rem 0.88rem;
  border-radius: 4px;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.05);
  color: #ffffff;
  transition: all 0.16s ease;
  white-space: nowrap;
}

.btn-ghost-sm:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--border-bright);
}

.btn-danger-sm {
  background: rgba(225, 91, 75, 0.14);
  border-color: rgba(225, 91, 75, 0.4);
  color: #f3a69c;
}

.btn-approve-sm,
.btn-invite-direct {
  background: #f4f4f6;
  color: #06070a;
  border-color: #ffffff;
}

.btn-approve-sm:hover,
.btn-invite-direct:hover {
  background: #ffffff;
}

.admin-main {
  flex: 1;
  padding: 1.6rem clamp(1.25rem, 4vw, 3.5rem) 3rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
}

/* KPI Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.1rem;
}

.kpi-card {
  padding: 1.25rem 1.4rem;
  border-radius: 6px;
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.kpi-online {
  border-top: 2px solid var(--neon-green);
}

.kpi-matches {
  border-top: 2px solid var(--reflektor-cyan);
}

.kpi-users {
  border-top: 2px solid var(--reflektor-gold);
}

.kpi-shield {
  border-top: 2px solid var(--reflektor-coral);
}

.kpi-label {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--text-muted);
}

.kpi-value {
  font-size: 2.15rem;
  font-weight: 600;
  line-height: 1.05;
}

.kpi-foot {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Approval Queue & Panels */
.approval-queue-panel {
  border-left: 3px solid var(--reflektor-gold);
}

.inline-switch-label {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  cursor: pointer;
}

.pending-approvals-list,
.blocked-ips-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.pending-user-card,
.blocked-ip-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.85rem 1rem;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.09);
}

.pending-user-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.pending-ts-input {
  width: 155px;
  padding: 0.42rem 0.65rem;
  border-radius: 4px;
  border: 1px solid var(--border-subtle);
  background: rgba(6, 7, 10, 0.85);
  color: #ffffff;
  font-size: 0.78rem;
}

.charts-grid {
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  gap: 1.25rem;
}

.social-admin-grid,
.bottom-security-grid {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 1.25rem;
}

.panel-card {
  padding: 1.4rem 1.5rem;
  border-radius: 6px;
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.panel-eyebrow {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--reflektor-gold);
  text-transform: uppercase;
}

.panel-header h2 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-top: 0.18rem;
}

.panel-helper {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.chart-legend {
  display: flex;
  gap: 1rem;
  font-size: 0.74rem;
  color: #cbd5e1;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.dot-cyan,
.dot-coral {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.dot-cyan {
  background: var(--reflektor-cyan);
}

.dot-coral {
  background: var(--reflektor-coral);
}

.svg-chart-wrap {
  width: 100%;
  height: 210px;
  background: rgba(6, 7, 10, 0.65);
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 0.75rem;
}

.svg-chart-wrap svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* Top Games Bars */
.top-games-bars {
  display: flex;
  flex-direction: column;
  gap: 0.78rem;
}

.xp-bar-row {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.xp-bar-head {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 600;
}

.xp-bar-track {
  height: 6px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
}

.xp-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--reflektor-cyan) 0%, var(--reflektor-coral) 100%);
}

/* Online Players List */
.online-players-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.online-player-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem 1rem;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.player-ident {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--neon-green);
}

.player-activity-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}

.form-feedback {
  padding: 0.55rem 0.8rem;
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: 600;
  background: rgba(70, 211, 105, 0.14);
  border: 1px solid rgba(70, 211, 105, 0.35);
  color: #86efac;
}

/* Users Table */
.users-table-wrap {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.admin-table th,
.admin-table td {
  padding: 0.85rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.admin-table th {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.history-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.history-chip {
  padding: 0.18rem 0.5rem;
  border-radius: 3px;
  background: rgba(114, 180, 212, 0.12);
  border: 1px solid rgba(114, 180, 212, 0.25);
  font-size: 0.7rem;
  color: #bae6fd;
}

.badge-online {
  padding: 0.2rem 0.52rem;
  border-radius: 3px;
  background: rgba(70, 211, 105, 0.15);
  color: #86efac;
  font-size: 0.7rem;
  font-weight: 600;
}

.badge-offline {
  padding: 0.2rem 0.52rem;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 600;
}

/* Tailscale & Event Log */
.tailscale-box {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1rem;
  border-radius: 4px;
  background: rgba(114, 180, 212, 0.06);
  border: 1px solid rgba(114, 180, 212, 0.22);
}

.tailscale-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.tailscale-toggle-row p {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.admin-switch {
  width: 20px;
  height: 20px;
  accent-color: var(--reflektor-cyan);
  cursor: pointer;
}

.tailscale-cmd-hint {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: #cbd5e1;
}

.tailscale-cmd-hint code {
  padding: 0.22rem 0.52rem;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.45);
  color: var(--reflektor-cyan);
}

.panel-divider {
  border: none;
  border-top: 1px solid var(--border-subtle);
}

.inline-input-btn {
  display: flex;
  gap: 0.55rem;
}

.audit-log-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  max-height: 320px;
  overflow-y: auto;
}

.audit-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 0.75rem;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.35);
  font-size: 0.74rem;
}

.audit-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.audit-event {
  font-weight: 700;
  color: var(--reflektor-cyan);
}

.audit-event.danger {
  color: var(--reflektor-coral);
}

@media (max-width: 960px) {
  .charts-grid,
  .social-admin-grid,
  .bottom-security-grid {
    grid-template-columns: 1fr;
  }
}
