/* ─────────────────────────────────────────────────────────────
   Neurobot Admin Panel — dark, compact, data-dense
   ───────────────────────────────────────────────────────────── */

:root {
  --bg: #0b0d12;
  --bg-2: #11141b;
  --bg-3: #161a23;
  --bg-hover: #1c2230;
  --border: #232835;
  --border-strong: #2f3647;
  --text: #e6e8ef;
  --text-dim: #9aa1b3;
  --text-muted: #6b7388;
  --accent: #6c8dff;
  --accent-hover: #8ba6ff;
  --success: #4ade80;
  --warn: #facc15;
  --danger: #f87171;
  --purple: #a78bfa;
  --teal: #2dd4bf;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.03), 0 8px 24px rgba(0, 0, 0, 0.35);

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter",
    "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}

* {
  box-sizing: border-box;
}

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

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

button,
input,
textarea,
select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: transparent;
}

input,
textarea,
select {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  color: var(--text);
  outline: none;
  transition: border-color 0.12s;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
}

textarea {
  resize: vertical;
  min-height: 80px;
  font-family: inherit;
}

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

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

.sidebar {
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  padding: 20px 14px;
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.sidebar h1 {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 4px 0;
  padding: 0 8px;
}

.sidebar .brand-sub {
  font-size: 12px;
  color: var(--text-muted);
  padding: 0 8px 20px 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-weight: 500;
  user-select: none;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.nav-item.active {
  background: var(--bg-3);
  color: var(--text);
  border-left: 2px solid var(--accent);
  padding-left: 10px;
}

.nav-item .icon {
  width: 16px;
  height: 16px;
  stroke-width: 2;
  flex-shrink: 0;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.logout-btn {
  color: var(--text-muted);
  font-size: 12px;
  text-align: left;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
}
.logout-btn:hover {
  color: var(--danger);
  background: var(--bg-hover);
}

.main {
  padding: 28px 36px;
  max-width: 1400px;
  width: 100%;
}

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

.page-title {
  font-size: 22px;
  font-weight: 600;
  margin: 0;
}

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

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

.card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}

.card-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin: 0 0 14px 0;
  font-weight: 600;
}

.grid {
  display: grid;
  gap: 16px;
}
.grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* ── Stat tiles ─────────────────────────────────────────── */

.stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: linear-gradient(180deg, var(--bg-2), var(--bg-3));
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 600;
}

.stat-value {
  font-size: 22px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.stat-sub {
  font-size: 12px;
  color: var(--text-dim);
}

.stat.accent .stat-value {
  color: var(--accent);
}
.stat.success .stat-value {
  color: var(--success);
}
.stat.warn .stat-value {
  color: var(--warn);
}
.stat.danger .stat-value {
  color: var(--danger);
}
.stat.purple .stat-value {
  color: var(--purple);
}

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

.table-wrap {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead {
  background: var(--bg-3);
}

th,
td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

th {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

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

tbody tr {
  transition: background 0.1s;
}

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

tbody tr.clickable {
  cursor: pointer;
}

td.num,
th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-family: var(--mono);
}

.empty-state {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
}

/* ── Pills / tags ──────────────────────────────────────── */

.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: var(--bg-3);
  color: var(--text-dim);
}

.pill.charge {
  background: rgba(248, 113, 113, 0.12);
  color: var(--danger);
}
.pill.topup {
  background: rgba(74, 222, 128, 0.12);
  color: var(--success);
}
.pill.bonus {
  background: rgba(167, 139, 250, 0.15);
  color: var(--purple);
}
.pill.refund {
  background: rgba(250, 204, 21, 0.15);
  color: var(--warn);
}

.pill.ok {
  background: rgba(74, 222, 128, 0.12);
  color: var(--success);
}
.pill.off {
  background: rgba(107, 115, 136, 0.25);
  color: var(--text-muted);
}
.pill.blocked {
  background: rgba(248, 113, 113, 0.12);
  color: var(--danger);
}

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

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 13px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text);
  transition: all 0.12s;
  white-space: nowrap;
}

.btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #0b0d12;
}
.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-danger {
  color: var(--danger);
}
.btn-danger:hover {
  background: rgba(248, 113, 113, 0.12);
  border-color: var(--danger);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

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

.form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.form-row label {
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.form-row .hint {
  font-size: 11px;
  color: var(--text-muted);
}

.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  align-items: center;
  margin-top: 18px;
}

.form-inline {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 14px;
}

.filters input,
.filters select {
  min-width: 140px;
}
.filters input.search {
  min-width: 260px;
}

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

.login-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  background:
    radial-gradient(1200px 600px at 20% 10%, rgba(108, 141, 255, 0.08), transparent 60%),
    radial-gradient(1000px 500px at 80% 100%, rgba(167, 139, 250, 0.06), transparent 60%),
    var(--bg);
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 34px 30px;
  box-shadow: var(--shadow);
}

.login-card h1 {
  margin: 0 0 6px 0;
  font-size: 22px;
}

.login-card p {
  margin: 0 0 24px 0;
  color: var(--text-muted);
  font-size: 13px;
}

.login-card .full-btn {
  width: 100%;
  justify-content: center;
  padding: 11px;
  margin-top: 8px;
}

.login-error {
  color: var(--danger);
  font-size: 12px;
  margin-top: 8px;
  min-height: 16px;
}

/* ── User detail ────────────────────────────────────────── */

.user-header {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 18px 20px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 18px;
}

.avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--bg-3);
  border: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 600;
  color: var(--text-muted);
  overflow: hidden;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-meta .name {
  font-size: 18px;
  font-weight: 600;
}

.user-meta .sub {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 4px;
  font-family: var(--mono);
}

.user-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

/* ── Chart ──────────────────────────────────────────────── */

.chart-wrap {
  padding: 4px 0;
}

.chart-svg {
  width: 100%;
  height: 220px;
  display: block;
}

.chart-legend {
  display: flex;
  gap: 14px;
  font-size: 12px;
  margin-top: 8px;
  color: var(--text-dim);
  flex-wrap: wrap;
}

.chart-legend .dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  vertical-align: middle;
  margin-right: 5px;
}

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

#toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-3);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 11px 16px;
  border-radius: 8px;
  font-size: 13px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  max-width: 360px;
  z-index: 1000;
}

#toast.show {
  opacity: 1;
  transform: translateY(0);
}

#toast.error {
  border-color: var(--danger);
  color: var(--danger);
}

#toast.success {
  border-color: var(--success);
  color: var(--success);
}

/* ── Modal ──────────────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  padding: 24px;
  animation: fade 0.15s;
}

@keyframes fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow);
}

.modal h2 {
  font-size: 17px;
  margin: 0 0 6px 0;
}

.modal .modal-sub {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 18px;
}

/* ── Pagination ─────────────────────────────────────────── */

.pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  color: var(--text-muted);
  font-size: 12px;
}

.pager-controls {
  display: flex;
  gap: 6px;
}

/* ── Model cards ────────────────────────────────────────── */

.model-card {
  display: grid;
  grid-template-columns: 60px 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 14px 18px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.12s;
  cursor: pointer;
}

.model-card:hover {
  border-color: var(--border-strong);
}

.model-logo {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  background: var(--bg-3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--text-muted);
  overflow: hidden;
  font-size: 20px;
}
.model-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.model-info .title {
  font-weight: 600;
  font-size: 15px;
}

.model-info .meta {
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 3px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.model-info .meta .mono {
  font-family: var(--mono);
}

/* ── Logo preview in editor ────────────────────────────── */

.logo-preview {
  width: 80px;
  height: 80px;
  background: var(--bg-3);
  border: 1px dashed var(--border-strong);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  overflow: hidden;
  font-size: 11px;
  text-align: center;
  padding: 4px;
}

.logo-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* ── Utility ────────────────────────────────────────────── */

.flex-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.space-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.muted {
  color: var(--text-muted);
}
.dim {
  color: var(--text-dim);
}
.mono {
  font-family: var(--mono);
}
.mt-0 {
  margin-top: 0;
}
.mb-0 {
  margin-bottom: 0;
}
.mb-1 {
  margin-bottom: 8px;
}
.mb-2 {
  margin-bottom: 16px;
}
.mb-3 {
  margin-bottom: 24px;
}
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mono-lg {
  font-family: var(--mono);
  font-size: 15px;
}
.text-right {
  text-align: right;
}

.loading {
  padding: 40px;
  text-align: center;
  color: var(--text-muted);
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.kv {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 10px 14px;
  font-size: 13px;
}
.kv dt {
  color: var(--text-muted);
  font-weight: 500;
}
.kv dd {
  margin: 0;
  font-family: var(--mono);
  word-break: break-word;
}

/* ── Responsive ─────────────────────────────────────────── */

@media (max-width: 900px) {
  .shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    overflow-x: auto;
    padding: 10px;
  }
  .sidebar h1,
  .brand-sub,
  .sidebar-footer {
    display: none;
  }
  .nav {
    flex-direction: row;
  }
  .nav-item {
    white-space: nowrap;
  }
  .main {
    padding: 18px;
  }
  .grid-4,
  .grid-3,
  .grid-2,
  .two-col {
    grid-template-columns: 1fr;
  }
  .kv {
    grid-template-columns: 1fr;
  }
}
