/* ==========================================================================
   Neon Tower Admin — дизайн-система.
   Тёмная неоновая тема в тон игре: глубокий фон, циановый акцент, аккуратные
   стеклянные панели. Всё построено на CSS-переменных, чтобы тему можно было
   менять в одном месте.
   ========================================================================== */

:root {
  --bg-0: #07060f;
  --bg-1: #0d0b1a;
  --bg-2: #141126;
  --bg-3: #1c1833;
  --line: rgba(120, 110, 200, 0.18);
  --line-strong: rgba(120, 110, 200, 0.35);

  --text: #e8e6f5;
  --text-dim: #9d97bd;
  --text-faint: #6b6588;

  --cyan: #29f7ff;
  --magenta: #ff2ee6;
  --violet: #9b3bff;
  --green: #3bff9a;
  --amber: #ffd23b;
  --red: #ff3d6e;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  --shadow-soft: 0 8px 24px rgba(0, 0, 0, 0.35);

  --font: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", "SF Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg-0);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

body {
  background:
    radial-gradient(1100px 600px at 12% -10%, rgba(41, 247, 255, 0.09), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(155, 59, 255, 0.11), transparent 55%),
    var(--bg-0);
  min-height: 100vh;
}

a { color: var(--cyan); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: rgba(41, 247, 255, 0.28); }

/* Скроллбары — тонкие и в тон теме. */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(120, 110, 200, 0.32);
  border-radius: 99px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: rgba(41, 247, 255, 0.45); background-clip: padding-box; }

/* ---------- Каркас ---------- */

.shell {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 20px 14px;
  background: linear-gradient(180deg, rgba(20, 17, 38, 0.95), rgba(10, 8, 20, 0.95));
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 18px;
  backdrop-filter: blur(8px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 12px;
  border-bottom: 1px solid var(--line);
}
.brand-mark {
  width: 34px; height: 34px;
  border-radius: 10px;
  background: linear-gradient(140deg, var(--cyan), var(--violet));
  box-shadow: 0 0 18px rgba(41, 247, 255, 0.45);
  display: grid; place-items: center;
  font-weight: 800; color: #04121a; font-size: 15px;
}
.brand-title { font-weight: 700; letter-spacing: 0.04em; }
.brand-sub { font-size: 10.5px; color: var(--text-faint); letter-spacing: 0.16em; text-transform: uppercase; }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  cursor: pointer;
  border: 1px solid transparent;
  background: none;
  text-align: left;
  width: 100%;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}
.nav-item:hover { background: rgba(41, 247, 255, 0.07); color: var(--text); }
.nav-item.active {
  background: linear-gradient(90deg, rgba(41, 247, 255, 0.16), rgba(155, 59, 255, 0.10));
  border-color: rgba(41, 247, 255, 0.35);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(41, 247, 255, 0.08);
}
.nav-icon { width: 18px; text-align: center; opacity: 0.9; }
.nav-badge {
  margin-left: auto;
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 99px;
  background: rgba(255, 61, 110, 0.18);
  color: #ff8aa8;
  border: 1px solid rgba(255, 61, 110, 0.35);
}

.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.sidebar-user {
  font-size: 12px; color: var(--text-faint);
  display: flex; align-items: center; gap: 8px;
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); }

.main { padding: 26px 30px 60px; max-width: 1500px; }

.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 18px; margin-bottom: 22px; flex-wrap: wrap;
}
.page-title { font-size: 24px; font-weight: 700; margin: 0; letter-spacing: -0.01em; }
.page-sub { color: var(--text-dim); font-size: 13px; margin-top: 4px; }

/* ---------- Карточки и сетки ---------- */

.grid { display: grid; gap: 16px; }
.grid-stats { grid-template-columns: repeat(auto-fit, minmax(158px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); }

.card {
  background: linear-gradient(180deg, rgba(28, 24, 51, 0.85), rgba(15, 13, 28, 0.85));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  padding: 18px;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 14px;
}
.card-title { font-size: 14px; font-weight: 650; letter-spacing: 0.01em; margin: 0; }
.card-hint { font-size: 12px; color: var(--text-faint); }

.stat {
  position: relative;
  overflow: hidden;
}
.stat::after {
  content: "";
  position: absolute; inset: auto 0 0 0; height: 2px;
  background: linear-gradient(90deg, var(--cyan), transparent);
  opacity: 0.6;
}
.stat-label { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--text-faint); }
.stat-value { font-size: 28px; font-weight: 750; margin-top: 8px; letter-spacing: -0.02em; }
.stat-value.accent { color: var(--cyan); text-shadow: 0 0 22px rgba(41, 247, 255, 0.35); }
.stat-value.warn { color: var(--amber); }
.stat-value.bad { color: var(--red); }
.stat-foot { font-size: 12px; color: var(--text-dim); margin-top: 6px; }

/* ---------- Таблицы ---------- */

.table-wrap { overflow: auto; border-radius: var(--radius-sm); border: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  position: sticky; top: 0; z-index: 1;
  background: rgba(20, 17, 38, 0.98);
  text-align: left; padding: 10px 12px;
  font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--text-faint); font-weight: 600;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
tbody td { padding: 10px 12px; border-bottom: 1px solid rgba(120, 110, 200, 0.09); vertical-align: middle; }
tbody tr { cursor: default; transition: background 100ms ease; }
tbody tr:hover { background: rgba(41, 247, 255, 0.045); }
tbody tr.clickable { cursor: pointer; }
tbody tr.selected { background: rgba(41, 247, 255, 0.1); }
tbody tr:last-child td { border-bottom: none; }

.mono { font-family: var(--mono); font-size: 12px; }
.muted { color: var(--text-dim); }
.faint { color: var(--text-faint); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }

/* ---------- Бейджи ---------- */

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: 99px;
  font-size: 11.5px; font-weight: 600;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge-ok { background: rgba(59, 255, 154, 0.12); color: #7dffbe; border-color: rgba(59, 255, 154, 0.3); }
.badge-warn { background: rgba(255, 210, 59, 0.12); color: #ffe07a; border-color: rgba(255, 210, 59, 0.3); }
.badge-bad { background: rgba(255, 61, 110, 0.14); color: #ff8aa8; border-color: rgba(255, 61, 110, 0.32); }
.badge-info { background: rgba(41, 247, 255, 0.1); color: #8ff8ff; border-color: rgba(41, 247, 255, 0.28); }
.badge-violet { background: rgba(155, 59, 255, 0.14); color: #c79dff; border-color: rgba(155, 59, 255, 0.32); }

/* ---------- Формы и кнопки ---------- */

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar .spacer { flex: 1; }

.input, .select, .textarea {
  background: rgba(9, 7, 18, 0.85);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  color: var(--text);
  outline: none;
  transition: border-color 120ms ease, box-shadow 120ms ease;
  min-width: 0;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: rgba(41, 247, 255, 0.6);
  box-shadow: 0 0 0 3px rgba(41, 247, 255, 0.12);
}
.input::placeholder { color: var(--text-faint); }
.textarea { resize: vertical; min-height: 84px; width: 100%; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: rgba(28, 24, 51, 0.9);
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
  transition: transform 80ms ease, background 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
  white-space: nowrap;
}
.btn:hover { background: rgba(41, 247, 255, 0.1); border-color: rgba(41, 247, 255, 0.4); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(135deg, rgba(41, 247, 255, 0.9), rgba(155, 59, 255, 0.85));
  border-color: transparent; color: #04121a;
  box-shadow: 0 8px 24px rgba(41, 247, 255, 0.22);
}
.btn-primary:hover { box-shadow: 0 10px 30px rgba(41, 247, 255, 0.32); }
.btn-danger { background: rgba(255, 61, 110, 0.16); border-color: rgba(255, 61, 110, 0.45); color: #ff9db4; }
.btn-danger:hover { background: rgba(255, 61, 110, 0.28); }
.btn-ghost { background: transparent; border-color: var(--line); }
.btn-sm { padding: 5px 10px; font-size: 12px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-faint); }

/* ---------- Панель игрока (drawer) ---------- */

.drawer-backdrop {
  position: fixed; inset: 0; background: rgba(4, 3, 10, 0.66);
  backdrop-filter: blur(3px); z-index: 40;
  animation: fadeIn 140ms ease;
}
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(880px, 94vw);
  background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
  border-left: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
  z-index: 41;
  display: flex; flex-direction: column;
  animation: slideIn 180ms cubic-bezier(0.22, 1, 0.36, 1);
}
.drawer-head {
  padding: 18px 22px; border-bottom: 1px solid var(--line);
  display: flex; align-items: flex-start; gap: 14px;
}
.drawer-title { font-size: 18px; font-weight: 700; margin: 0; }
.drawer-sub { color: var(--text-dim); font-size: 12.5px; margin-top: 3px; }
.drawer-body { flex: 1; overflow: auto; padding: 18px 22px 40px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; flex-wrap: wrap; }
.tab {
  padding: 9px 14px; border: none; background: none; color: var(--text-dim);
  cursor: pointer; border-bottom: 2px solid transparent; font-weight: 600; font-size: 13px;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--cyan); border-bottom-color: var(--cyan); }

.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.kv-item { background: rgba(9, 7, 18, 0.6); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; }
.kv-key { font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-faint); }
.kv-val { font-size: 15px; font-weight: 650; margin-top: 4px; }

.item-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.item-card {
  background: rgba(9, 7, 18, 0.6); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 10px 12px; font-size: 12.5px;
}
.item-card .name { font-weight: 650; }
.item-card .meta { color: var(--text-faint); font-size: 11.5px; margin-top: 3px; }

/* ---------- Модалки и тосты ---------- */

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(4, 3, 10, 0.7);
  backdrop-filter: blur(3px); z-index: 60; display: grid; place-items: center;
  animation: fadeIn 120ms ease;
}
.modal {
  width: min(560px, 92vw);
  background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
  animation: popIn 160ms cubic-bezier(0.22, 1, 0.36, 1);
}
.modal-title { margin: 0 0 4px; font-size: 17px; }
.modal-sub { color: var(--text-dim); font-size: 13px; margin-bottom: 16px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

.toasts {
  position: fixed; right: 20px; bottom: 20px; z-index: 80;
  display: flex; flex-direction: column; gap: 10px;
}
.toast {
  min-width: 260px; max-width: 380px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: rgba(20, 17, 38, 0.97);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-soft);
  animation: slideUp 180ms ease;
  font-size: 13px;
}
.toast.ok { border-color: rgba(59, 255, 154, 0.45); }
.toast.err { border-color: rgba(255, 61, 110, 0.5); }

/* ---------- Логин ---------- */

.login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(800px 500px at 50% 0%, rgba(41, 247, 255, 0.10), transparent 60%),
    radial-gradient(700px 400px at 80% 100%, rgba(255, 46, 230, 0.08), transparent 55%);
}
.login-card {
  width: min(400px, 92vw);
  background: linear-gradient(180deg, rgba(28, 24, 51, 0.95), rgba(12, 10, 24, 0.95));
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  padding: 30px 28px;
  box-shadow: var(--shadow);
}
.login-logo { display: flex; justify-content: center; margin-bottom: 18px; }
.login-title { text-align: center; font-size: 20px; font-weight: 750; margin: 0 0 4px; }
.login-sub { text-align: center; color: var(--text-dim); font-size: 13px; margin-bottom: 22px; }
.login-error {
  background: rgba(255, 61, 110, 0.12); border: 1px solid rgba(255, 61, 110, 0.4);
  color: #ff9db4; padding: 9px 12px; border-radius: var(--radius-sm);
  font-size: 12.5px; margin-bottom: 14px;
}

/* ---------- Мелочи ---------- */

.empty { text-align: center; padding: 40px 20px; color: var(--text-faint); }
.empty-icon { font-size: 30px; opacity: 0.5; margin-bottom: 8px; }

.skeleton {
  background: linear-gradient(90deg, rgba(120, 110, 200, 0.08), rgba(120, 110, 200, 0.16), rgba(120, 110, 200, 0.08));
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite linear;
  border-radius: 8px;
}

.pager { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.pager-info { color: var(--text-dim); font-size: 12.5px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px; border-radius: 99px;
  border: 1px solid var(--line-strong); background: rgba(9, 7, 18, 0.6);
  cursor: pointer; font-size: 12.5px; color: var(--text-dim);
}
.chip:hover { border-color: rgba(41, 247, 255, 0.5); color: var(--text); }
.chip.active { background: rgba(41, 247, 255, 0.14); border-color: rgba(41, 247, 255, 0.5); color: #fff; }

.toggle {
  position: relative; width: 46px; height: 26px; border-radius: 99px;
  background: rgba(120, 110, 200, 0.25); border: 1px solid var(--line-strong);
  cursor: pointer; transition: background 140ms ease; flex: none;
}
.toggle::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--text-dim); transition: transform 140ms ease, background 140ms ease;
}
.toggle.on { background: rgba(59, 255, 154, 0.25); border-color: rgba(59, 255, 154, 0.5); }
.toggle.on::after { transform: translateX(20px); background: var(--green); }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideIn { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes slideUp { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes popIn { from { transform: scale(0.96); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .main { padding: 18px 16px 50px; }
  .drawer { width: 100%; }
}
