:root {
  --base-950: #08090d;
  --base-900: #0d0f16;
  --base-850: #12141d;
  --base-800: #171a25;
  --base-750: #1c202c;
  --base-700: #232838;
  --base-600: #323950;
  --base-500: #4a5273;
  --base-400: #6b7396;
  --base-300: #9aa1c0;
  --base-200: #c4c9de;
  --base-100: #e4e6f1;

  --accent-600: #4f46e5;
  --accent-500: #6366f1;
  --accent-400: #818cf8;

  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #38bdf8;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: ui-sans-serif, "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--base-950);
  color: var(--base-100);
  -webkit-font-smoothing: antialiased;
}

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-bottom: 1px solid var(--base-700);
  background: rgba(13, 15, 22, 0.85);
}
.brand { font-weight: 700; letter-spacing: 0.04em; color: var(--base-100); font-size: 14px; }
.brand:hover { text-decoration: none; }
.topbar-user { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--base-300); }
.avatar { width: 28px; height: 28px; border-radius: 999px; }

.page { max-width: 1100px; margin: 0 auto; padding: 32px 24px 64px; }

h1 { font-size: 22px; margin: 0 0 4px; color: var(--base-100); }
h2 { font-size: 16px; margin: 0; color: var(--base-100); }
p { line-height: 1.5; }
.muted { color: var(--base-400); }
.small { font-size: 13px; }

.card {
  border: 1px solid var(--base-700);
  background: rgba(18, 20, 29, 0.7);
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 18px;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--base-700);
  margin: -18px -18px 14px;
  padding: 14px 18px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 8px;
  border: 1px solid var(--base-600);
  background: var(--base-750);
  color: var(--base-100);
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { background: var(--base-700); text-decoration: none; }
.btn-primary { background: var(--accent-600); border-color: var(--accent-600); color: #fff; }
.btn-primary:hover { background: var(--accent-500); }
.btn-danger { background: rgba(239, 68, 68, 0.15); border-color: rgba(239, 68, 68, 0.3); color: #fca5a5; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--base-300); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

label { display: block; font-size: 12px; color: var(--base-300); margin-bottom: 4px; font-weight: 500; }
input[type=text], input[type=email], input[type=number], input[type=password], select, textarea {
  width: 100%;
  background: var(--base-900);
  border: 1px solid var(--base-600);
  border-radius: 8px;
  color: var(--base-100);
  padding: 9px 12px;
  font-size: 14px;
  margin-bottom: 14px;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent-500);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}
.stacked-form { display: flex; flex-direction: column; }
.inline-form { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.inline-form > div { margin-bottom: 14px; }
.field-sm input, .field-sm select { width: 160px; }

.alert { border-radius: 10px; padding: 12px 14px; margin-bottom: 16px; font-size: 14px; border: 1px solid; }
.alert-success { background: rgba(34, 197, 94, 0.1); border-color: rgba(34, 197, 94, 0.3); color: #86efac; }
.alert-error { background: rgba(239, 68, 68, 0.1); border-color: rgba(239, 68, 68, 0.3); color: #fca5a5; }
.alert-info { background: rgba(56, 189, 248, 0.1); border-color: rgba(56, 189, 248, 0.3); color: #7dd3fc; }

.badge { display: inline-flex; align-items: center; border-radius: 6px; padding: 2px 8px; font-size: 12px; font-weight: 500; background: var(--base-700); color: var(--base-200); }
.badge-success { background: rgba(34, 197, 94, 0.15); color: #86efac; }
.badge-danger { background: rgba(239, 68, 68, 0.15); color: #fca5a5; }
.badge-warning { background: rgba(245, 158, 11, 0.15); color: #fcd34d; }
.badge-info { background: rgba(56, 189, 248, 0.15); color: #7dd3fc; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--base-400); padding: 8px 10px; border-bottom: 1px solid var(--base-700); }
td { padding: 10px; border-bottom: 1px solid var(--base-800); vertical-align: middle; }
tr:last-child td { border-bottom: none; }

.auth-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card {
  max-width: 420px;
  width: 100%;
  border: 1px solid var(--base-700);
  background: rgba(18, 20, 29, 0.8);
  border-radius: 16px;
  padding: 32px;
  text-align: center;
}
.auth-card h1 { margin-bottom: 10px; }
.auth-card .btn { width: 100%; justify-content: center; padding: 12px; font-size: 15px; margin-top: 12px; }
.logo-mark { font-size: 13px; letter-spacing: 0.08em; color: var(--base-400); margin-bottom: 24px; font-weight: 700; }

code { background: var(--base-900); border: 1px solid var(--base-700); border-radius: 4px; padding: 1px 6px; font-size: 13px; }

/* Panel shell (server admin panel) */
.panel-shell { display: flex; min-height: calc(100vh - 57px); }
.panel-sidebar { width: 220px; flex-shrink: 0; border-right: 1px solid var(--base-700); padding: 18px 10px; }
.panel-sidebar a {
  display: block;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--base-300);
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 2px;
}
.panel-sidebar a:hover { background: var(--base-800); text-decoration: none; color: var(--base-100); }
.panel-sidebar a.active { background: rgba(99, 102, 241, 0.15); color: var(--accent-400); }
.panel-main { flex: 1; padding: 24px 28px; max-width: 1100px; }

.empty-state { text-align: center; padding: 48px 0; color: var(--base-400); font-size: 14px; }
.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid var(--base-600); border-top-color: var(--accent-400); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.toast-stack { position: fixed; top: 16px; right: 16px; z-index: 100; display: flex; flex-direction: column; gap: 8px; width: 320px; }
.toast { border-radius: 10px; padding: 12px 14px; font-size: 14px; border: 1px solid; background: rgba(18, 20, 29, 0.95); box-shadow: 0 10px 30px rgba(0,0,0,0.4); }
.toast-success { border-color: rgba(34, 197, 94, 0.3); color: #86efac; }
.toast-danger { border-color: rgba(239, 68, 68, 0.3); color: #fca5a5; }
.toast-info { border-color: rgba(56, 189, 248, 0.3); color: #7dd3fc; }

.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); display: flex; align-items: center; justify-content: center; z-index: 200; padding: 16px; }
.modal-box { width: 100%; max-width: 420px; background: var(--base-850); border: 1px solid var(--base-700); border-radius: 14px; padding: 20px; max-height: 85vh; overflow-y: auto; }

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stat-card { border: 1px solid var(--base-700); background: rgba(18, 20, 29, 0.7); border-radius: 12px; padding: 14px; }
.stat-card .label { font-size: 11px; text-transform: uppercase; color: var(--base-400); letter-spacing: 0.04em; }
.stat-card .value { font-size: 22px; font-weight: 600; margin-top: 4px; }

.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--base-200); padding: 4px 0; }
.checkbox-group h4 { font-size: 11px; text-transform: uppercase; color: var(--base-500); margin: 14px 0 4px; }
