*,*::before,*::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  background: #0b1226;
  color: #e5e7eb;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ============== Auth page (login) ============== */

body.auth {
  background: radial-gradient(ellipse at top, #1e1b4b 0%, #0b1226 50%, #050816 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.stars, .stars-2, .stars-3 {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-repeat: repeat;
  background-size: 200px 200px;
}
.stars {
  background-image:
    radial-gradient(1px 1px at 20px 30px, #fff, transparent),
    radial-gradient(1px 1px at 60px 80px, rgba(255,255,255,0.7), transparent),
    radial-gradient(1.5px 1.5px at 100px 150px, #fff, transparent),
    radial-gradient(1px 1px at 140px 20px, rgba(255,255,255,0.6), transparent),
    radial-gradient(1px 1px at 180px 100px, #fff, transparent);
  animation: drift 80s linear infinite;
  opacity: 0.7;
}
.stars-2 {
  background-image:
    radial-gradient(1.5px 1.5px at 30px 60px, rgba(167,139,250,0.8), transparent),
    radial-gradient(1px 1px at 90px 120px, #fff, transparent),
    radial-gradient(2px 2px at 150px 50px, rgba(96,165,250,0.7), transparent),
    radial-gradient(1px 1px at 170px 170px, #fff, transparent);
  background-size: 220px 220px;
  animation: drift 120s linear infinite reverse;
  opacity: 0.5;
}
.stars-3 {
  background-image:
    radial-gradient(2px 2px at 50px 100px, rgba(52,211,153,0.7), transparent),
    radial-gradient(1px 1px at 120px 30px, rgba(255,255,255,0.5), transparent);
  background-size: 260px 260px;
  animation: drift 160s linear infinite;
  opacity: 0.4;
}
@keyframes drift {
  from { transform: translateY(0); }
  to { transform: translateY(-200px); }
}

.glow {
  position: fixed;
  top: 40%;
  left: 50%;
  width: 600px;
  height: 600px;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(96, 165, 250, 0.15) 0%, transparent 60%);
  pointer-events: none;
  animation: pulse 6s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 0.7; transform: translate(-50%, -50%) scale(1); }
  50% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
}

.auth-card {
  position: relative;
  z-index: 1;
  background: rgba(15, 18, 38, 0.6);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px;
  padding: 44px 40px 36px;
  width: 100%;
  max-width: 400px;
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.5),
    0 0 80px rgba(96, 165, 250, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  text-align: center;
}

.brand-block {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
  filter: drop-shadow(0 8px 24px rgba(96, 165, 250, 0.35));
}

.rocket {
  animation: float 4s ease-in-out infinite;
  transform-origin: center;
}
@keyframes float {
  0%, 100% { transform: translateY(0) rotate(-3deg); }
  50% { transform: translateY(-10px) rotate(3deg); }
}
.rocket-flame {
  transform-origin: 50px 70px;
  animation: flicker 0.25s ease-in-out infinite alternate;
}
@keyframes flicker {
  from { transform: scaleY(0.85); opacity: 0.9; }
  to { transform: scaleY(1.1); opacity: 1; }
}

.brand-text {
  margin: 0 0 4px;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(120deg, #60a5fa 0%, #a78bfa 50%, #34d399 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand-tag {
  margin: 0 0 28px;
  font-size: 13px;
  color: #64748b;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: left;
}
.auth-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: #94a3b8;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.auth-form input {
  width: 100%;
  padding: 13px 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(11, 18, 38, 0.6);
  color: #fff;
  font-size: 15px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
  text-transform: none;
}
.auth-form input:focus {
  border-color: rgba(96, 165, 250, 0.6);
  background: rgba(11, 18, 38, 0.9);
  box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.15);
}
.auth-form button {
  margin-top: 8px;
  padding: 14px 16px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(120deg, #2563eb 0%, #7c3aed 50%, #10b981 100%);
  background-size: 200% 100%;
  color: white;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: transform 0.1s, background-position 0.4s, box-shadow 0.2s;
  box-shadow: 0 8px 24px rgba(96, 165, 250, 0.25);
}
.auth-form button:hover {
  background-position: 100% 0;
  box-shadow: 0 10px 28px rgba(96, 165, 250, 0.35);
}
.auth-form button:active { transform: translateY(1px); }

.auth-error {
  margin: 16px 0 0;
  min-height: 18px;
  color: #fca5a5;
  font-size: 13px;
  text-align: center;
}

.auth-footer {
  position: fixed;
  bottom: 16px;
  left: 0;
  right: 0;
  text-align: center;
  color: #475569;
  font-size: 12px;
  letter-spacing: 0.08em;
  z-index: 1;
}

/* ============== Internal pages ============== */

.centered {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  min-height: 100vh;
}

body.centered { background: linear-gradient(135deg, #1e1b4b 0%, #0b1226 50%, #050816 100%); }

.card {
  background: rgba(15, 18, 38, 0.7);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 18px;
  padding: 36px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}
.card.wide { max-width: 640px; }

h1 {
  margin: 0 0 8px;
  font-size: 26px;
  font-weight: 700;
  background: linear-gradient(120deg, #60a5fa 0%, #a78bfa 50%, #34d399 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: -0.02em;
}

.brand-row {
  display: flex; align-items: center; gap: 12px;
}
.brand-row .mini-rocket { font-size: 24px; line-height: 1; animation: float 4s ease-in-out infinite; display: inline-block; }

.muted {
  color: #94a3b8;
  margin: 0 0 24px;
  font-size: 14px;
}

form { display: flex; flex-direction: column; gap: 14px; }

label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: #cbd5e1; }

input[type="text"], input[type="password"] {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(11, 18, 38, 0.6);
  color: #fff;
  font-size: 15px;
  outline: none;
  transition: border .15s, box-shadow .15s;
}

input[type="text"].big {
  padding: 16px 18px;
  font-size: 16px;
}

input[type="text"]:focus, input[type="password"]:focus {
  border-color: rgba(96,165,250,0.6);
  box-shadow: 0 0 0 4px rgba(96,165,250,.15);
}

button {
  padding: 12px 16px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(120deg, #2563eb, #7c3aed, #10b981);
  background-size: 200% 100%;
  color: white;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .1s, background-position .4s;
}
button:hover { background-position: 100% 0; }
button:active { transform: scale(.98); }

.error { color: #f87171; margin: 14px 0 0; font-size: 14px; min-height: 18px; }

.shortcuts { margin-top: 30px; padding-top: 24px; border-top: 1px solid rgba(255,255,255,0.08); }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.grid form { margin: 0; }
.grid button {
  width: 100%;
  background: rgba(255,255,255,0.06);
  font-weight: 500;
  font-size: 14px;
}
.grid button:hover { background: rgba(255,255,255,0.12); }

.footer { margin: 28px 0 0; text-align: center; font-size: 13px; }
.footer a { color: #94a3b8; text-decoration: none; }
.footer a:hover { color: #fff; }

.topbar {
  display: flex; justify-content: space-between; align-items: center;
  gap: 16px; margin-bottom: 8px;
}
.topbar h1 { margin: 0; }

.userbar { display: flex; gap: 10px; align-items: center; font-size: 13px; }
.userbar a {
  color: #cbd5e1; text-decoration: none; padding: 4px 10px;
  border-radius: 6px; background: rgba(255,255,255,0.06);
  transition: background .15s;
}
.userbar a:hover { background: rgba(255,255,255,0.14); color: #fff; }

.userchip {
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 13px;
}
.badge {
  display: inline-block;
  background: rgba(96, 165, 250, 0.2);
  color: #93c5fd;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  vertical-align: middle;
}
.badge.admin { background: rgba(239, 68, 68, 0.2); color: #fca5a5; }

h2 { margin: 24px 0 12px; font-size: 16px; font-weight: 600; color: #e5e7eb; }

.flash {
  padding: 10px 12px; border-radius: 8px; margin: 12px 0;
  font-size: 14px;
}
.flash.ok { background: rgba(16, 185, 129, 0.15); color: #6ee7b7; border: 1px solid rgba(16,185,129,0.3); }
.flash.error { background: rgba(239, 68, 68, 0.15); color: #fca5a5; border: 1px solid rgba(239,68,68,0.3); }

table.users {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
  font-size: 14px;
}
table.users th, table.users td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
table.users th {
  font-weight: 600;
  color: #94a3b8;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
table.users td.actions { white-space: nowrap; }

button.small {
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 500;
  background: rgba(255,255,255,0.08);
  margin-right: 4px;
}
button.small:hover { background: rgba(255,255,255,0.18); }
button.small.danger {
  background: rgba(239, 68, 68, 0.25);
  color: #fee2e2;
}
button.small.danger:hover { background: rgba(239, 68, 68, 0.45); }

button.secondary {
  background: rgba(255,255,255,0.08);
  color: #cbd5e1;
}
button.secondary:hover { background: rgba(255,255,255,0.18); }

label.checkbox {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}
label.checkbox input { width: auto; }
