:root {
  --bg: #0b0e18;
  --bg-2: #101425;
  --panel: #151a2e;
  --panel-2: #1c2238;
  --panel-3: #232a45;
  --line: #2b3352;
  --text: #eef1f8;
  --muted: #9aa3bf;
  --accent: #e6007e;
  --accent-2: #7b5cff;
  --accent-soft: rgba(230, 0, 126, 0.14);
  --ok: #2ecc71;
  --warn: #f0a92e;
  --danger: #ef5350;
  --radius: 14px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

h1, h2, h3, h4 { margin: 0 0 8px; font-weight: 650; letter-spacing: -0.01em; }
p { margin: 0 0 10px; }

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  font-size: 20px;
}
.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font-size: 19px;
  font-weight: 900;
  letter-spacing: 0;
  box-shadow: 0 8px 20px rgba(230, 0, 126, 0.35);
}
.brand small {
  display: block;
  font-size: 10px;
  letter-spacing: 0.22em;
  color: var(--muted);
  font-weight: 600;
}

.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.hidden { display: none !important; }
.center { text-align: center; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }

/* ---------- buttons ---------- */
.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 10px;
  padding: 9px 15px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.05s ease;
  white-space: nowrap;
}
.btn:hover { background: var(--panel-3); border-color: #3a446a; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: 0;
  color: #fff;
  box-shadow: 0 8px 20px rgba(230, 0, 126, 0.25);
}
.btn-primary:hover { filter: brightness(1.08); background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.btn-ghost { background: transparent; }
.btn-danger { background: rgba(239, 83, 80, 0.14); border-color: rgba(239, 83, 80, 0.4); color: #ffb3b1; }
.btn-danger:hover { background: rgba(239, 83, 80, 0.24); }
.btn-sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn-icon { padding: 8px; width: 36px; height: 36px; }

/* ---------- forms ---------- */
label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin: 0 0 6px; }
input, textarea, select {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(123, 92, 255, 0.18);
}
textarea { resize: vertical; min-height: 90px; line-height: 1.5; }
select { cursor: pointer; }
.field { margin-bottom: 14px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 760px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
.hint { font-size: 12px; color: var(--muted); margin-top: 5px; }
.error-text { color: #ff8d8b; font-size: 13px; min-height: 18px; margin-top: 8px; }

/* ---------- cards / tables ---------- */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}
.card h3 { font-size: 16px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); background: var(--bg-2); }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: rgba(255, 255, 255, 0.02); }
.empty { padding: 26px; text-align: center; color: var(--muted); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 650;
  background: var(--panel-3);
  color: var(--text);
  border: 1px solid var(--line);
  white-space: nowrap;
}
.badge.ok { background: rgba(46, 204, 113, 0.13); border-color: rgba(46, 204, 113, 0.35); color: #7ee2a8; }
.badge.warn { background: rgba(240, 169, 46, 0.13); border-color: rgba(240, 169, 46, 0.35); color: #ffd08a; }
.badge.danger { background: rgba(239, 83, 80, 0.13); border-color: rgba(239, 83, 80, 0.35); color: #ffa8a6; }
.badge.info { background: rgba(123, 92, 255, 0.15); border-color: rgba(123, 92, 255, 0.35); color: #bdb0ff; }

/* ---------- modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 6, 12, 0.72);
  backdrop-filter: blur(3px);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 100;
  animation: fadeIn 0.12s ease;
}
.modal {
  width: min(680px, 100%);
  max-height: min(88vh, 900px);
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 22px;
  animation: popIn 0.14s ease;
}
.modal h3 { margin-bottom: 4px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.modal.wide { width: min(980px, 100%); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: translateY(6px) scale(0.99); } to { opacity: 1; transform: none; } }

/* ---------- toast ---------- */
#toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 200;
  max-width: min(380px, calc(100vw - 36px));
}
.toast {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent-2);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 14px;
  box-shadow: var(--shadow);
  animation: slideIn 0.18s ease;
}
.toast.ok { border-left-color: var(--ok); }
.toast.error { border-left-color: var(--danger); }
@keyframes slideIn { from { opacity: 0; transform: translateX(12px); } to { opacity: 1; transform: none; } }

/* ---------- login ---------- */
.login-body {
  min-height: 100%;
  background:
    radial-gradient(900px 500px at 12% 8%, rgba(230, 0, 126, 0.18), transparent 60%),
    radial-gradient(700px 500px at 88% 92%, rgba(123, 92, 255, 0.2), transparent 60%),
    var(--bg);
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-shell {
  width: min(1040px, 100%);
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 40px;
  align-items: center;
}
.login-brand h1 {
  font-size: clamp(30px, 4vw, 46px);
  line-height: 1.1;
  margin: 22px 0 14px;
}
.login-brand p { color: var(--muted); font-size: 16px; max-width: 460px; }
.login-points { list-style: none; padding: 0; margin: 26px 0 0; display: grid; gap: 10px; }
.login-points li { color: var(--muted); font-size: 14px; display: flex; gap: 10px; align-items: center; }
.login-points li::before {
  content: "";
  width: 7px; height: 7px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  flex: 0 0 auto;
}
.login-card { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 30px; box-shadow: var(--shadow); }
.login-card h2 { font-size: 22px; margin-bottom: 4px; }
.login-card .sub { color: var(--muted); font-size: 14px; margin-bottom: 22px; }
.login-foot { margin-top: 18px; font-size: 12px; color: var(--muted); text-align: center; }
@media (max-width: 860px) {
  .login-shell { grid-template-columns: 1fr; gap: 26px; }
  .login-brand { text-align: center; }
  .login-brand .brand { justify-content: center; }
  .login-brand p { margin: 0 auto; }
  .login-points { max-width: 360px; margin: 20px auto 0; }
}

/* ---------- misc ---------- */
.spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.scroll-thin { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.scroll-thin::-webkit-scrollbar { width: 8px; height: 8px; }
.scroll-thin::-webkit-scrollbar-thumb { background: var(--line); border-radius: 8px; }
