:root {
  --bg: #0a0f1a;
  --panel: rgba(17, 24, 39, 0.86);
  --panel-2: #111827;
  --line: rgba(148, 163, 184, 0.18);
  --text: #e5e7eb;
  --muted: #94a3b8;
  --blue: #3b82f6;
  --green: #22c55e;
  --red: #ef4444;
  --amber: #f59e0b;
  --radius: 14px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(59, 130, 246, 0.16), transparent 34rem),
    linear-gradient(135deg, #090d16 0%, #0d1321 45%, #070b12 100%);
  color: var(--text);
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
.page { max-width: 1320px; margin: 0 auto; padding: 22px; }
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}
.brand { display: flex; align-items: center; gap: 12px; font-weight: 800; letter-spacing: .01em; }
.brand img { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; }
.nav-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 20px 50px rgba(0,0,0,.24);
}
.grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(320px, .75fr); gap: 20px; }
.stack { display: grid; gap: 20px; }
.row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.row-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
h1, h2, h3 { margin: 0; }
h1 { font-size: 1.35rem; }
h2 { font-size: 1.05rem; margin-bottom: 14px; }
.sub { color: var(--muted); font-size: .9rem; margin-top: 4px; }
label { display: block; color: var(--muted); font-size: .78rem; font-weight: 650; margin-bottom: 6px; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(2, 6, 23, .58);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  outline: none;
  font: inherit;
}
textarea { min-height: 420px; resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { border-color: rgba(59, 130, 246, .7); box-shadow: 0 0 0 3px rgba(59,130,246,.18); }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 750;
  cursor: pointer;
  background: rgba(148,163,184,.12);
  color: var(--text);
}
.btn.primary { background: var(--blue); color: white; }
.btn.green { background: rgba(34,197,94,.16); color: #86efac; border-color: rgba(34,197,94,.25); }
.btn.red { background: rgba(239,68,68,.16); color: #fca5a5; border-color: rgba(239,68,68,.25); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
button.is-loading,
.btn.is-loading,
.submit-btn.is-loading,
.cancel-btn.is-loading,
.btn-primary.is-loading,
.btn-secondary.is-loading,
.btn-success.is-loading,
.btn-danger.is-loading {
  pointer-events: none;
  opacity: .78;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
button.is-loading::before,
.btn.is-loading::before,
.submit-btn.is-loading::before,
.cancel-btn.is-loading::before,
.btn-primary.is-loading::before,
.btn-secondary.is-loading::before,
.btn-success.is-loading::before,
.btn-danger.is-loading::before {
  content: "";
  width: 1em;
  height: 1em;
  border-radius: 999px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  flex: 0 0 auto;
  animation: panelSpin .7s linear infinite;
}
@keyframes panelSpin {
  to { transform: rotate(360deg); }
}
.alert {
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  background: rgba(59,130,246,.12);
}
.alert.success { border-color: rgba(34,197,94,.3); background: rgba(34,197,94,.11); }
.alert.error { border-color: rgba(239,68,68,.3); background: rgba(239,68,68,.11); }
.alert.flash-toast {
  position: fixed;
  top: 18px;
  right: 22px;
  z-index: 1000;
  width: min(430px, calc(100vw - 28px));
  margin: 0;
  box-shadow: 0 22px 70px rgba(0,0,0,.42);
  animation: panelToastIn .24s ease-out both;
}
@keyframes panelToastIn {
  from { opacity: 0; transform: translate(18px, -10px) scale(.98); }
  to { opacity: 1; transform: translate(0, 0) scale(1); }
}
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.stat { padding: 14px; border-radius: 12px; background: rgba(15,23,42,.72); border: 1px solid var(--line); }
.stat .num { font-size: 1.5rem; font-weight: 850; }
.stat .cap { color: var(--muted); font-size: .78rem; margin-top: 2px; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: .86rem; }
th, td { padding: 11px 12px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { color: var(--muted); background: rgba(15,23,42,.8); font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; }
tr:last-child td { border-bottom: 0; }
.badge { display: inline-flex; padding: 4px 9px; border-radius: 999px; font-size: .72rem; font-weight: 800; background: rgba(59,130,246,.16); color: #93c5fd; }
.badge.green { background: rgba(34,197,94,.14); color: #86efac; }
.badge.amber { background: rgba(245,158,11,.14); color: #fcd34d; }
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: min(420px, 100%); }
.custom-alert {
  position: fixed;
  left: 50%;
  top: 7%;
  transform: translate(-50%, -50%);
  z-index: 999;
  min-width: 280px;
  max-width: 420px;
  width: min(92vw, 420px);
  padding: 16px;
  text-align: center;
  border-radius: 18px;
  background-image: linear-gradient(120deg, #7c3aed 0%, #2563eb 100%);
  box-shadow: 0 24px 80px rgba(0, 0, 0, .45);
  transition: opacity .3s ease-in-out;
}
.custom-alert-text {
  display: block;
  color: #fff;
  font-weight: 800;
  margin-bottom: 12px;
}
.custom-alert-close {
  border: 0;
  border-radius: 8px;
  padding: 7px 22px;
  cursor: pointer;
  background: #f59e0b;
  color: #111827;
  font-weight: 850;
}
.hint { color: var(--muted); font-size: .8rem; margin-top: 6px; }
.codebox {
  min-height: 44px;
  max-height: 220px;
  overflow: auto;
  white-space: pre-wrap;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(2, 6, 23, .72);
  color: #bfdbfe;
  padding: 10px;
}
.hidden-field { display: none; }
@media (max-width: 900px) {
  .grid, .row, .row-3, .stats { grid-template-columns: 1fr; }
  .page { padding: 14px; }
}
