:root {
  color-scheme: dark;
  --bg-base: #0c1a2e;
  --bg-deep: #08111f;
  --surface: #1e3658;
  --surface-2: #243f68;
  --surface-3: #2c4d7a;
  --border: rgba(255, 255, 255, 0.18);
  --text: #e8eef8;
  --text-muted: #8fa3c4;
  --accent: #ec483b;
  --accent-2: #f0a500;
  --ring: rgba(236, 72, 59, 0.45);
  --ok: #22c55e;
  --error: #ff5757;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", "Trebuchet MS", Verdana, sans-serif;
  background:
    radial-gradient(1200px 700px at -10% -10%, rgba(44, 77, 122, 0.5) 0%, rgba(44, 77, 122, 0) 62%),
    radial-gradient(900px 520px at 110% 10%, rgba(236, 72, 59, 0.18) 0%, rgba(236, 72, 59, 0) 62%),
    linear-gradient(145deg, var(--bg-base) 0%, #102745 34%, #112f4f 65%, var(--bg-deep) 100%);
  color: var(--text);
  display: grid;
  place-items: center;
  padding: 24px;
  overflow-x: hidden;
}

body::before,
body::after {
  content: "";
  position: fixed;
  z-index: 0;
  pointer-events: none;
}

body::before {
  width: 320px;
  height: 320px;
  right: -70px;
  top: -70px;
  border-radius: 45% 55% 60% 40%;
  background: radial-gradient(circle at 30% 30%, rgba(240, 165, 0, 0.45), rgba(240, 165, 0, 0));
  filter: blur(8px);
}

body::after {
  width: 420px;
  height: 420px;
  left: -160px;
  bottom: -180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(44, 77, 122, 0.65), rgba(44, 77, 122, 0));
}

.auth-shell {
  width: 100%;
  max-width: 520px;
  position: relative;
  z-index: 1;
}

.auth-shell.admin-shell {
  max-width: 1080px;
}

.auth-card {
  border-radius: 18px;
  padding: 30px;
  background: linear-gradient(165deg, rgba(30, 54, 88, 0.9), rgba(16, 39, 69, 0.82));
  border: 1px solid var(--border);
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

body.auth-login .auth-card {
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.06));
  border: 1px solid rgba(255, 255, 255, 0.34);
  backdrop-filter: blur(14px) saturate(1.1);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
  box-shadow:
    0 26px 64px rgba(0, 0, 0, 0.48),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.auth-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(236, 72, 59, 0.16);
  border: 1px solid rgba(236, 72, 59, 0.35);
  color: #ffd1cc;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
}

h1 {
  margin: 14px 0 0;
  color: var(--text);
  font-size: 1.88rem;
  line-height: 1.1;
  letter-spacing: 0.3px;
}

.auth-subtitle {
  margin: 10px 0 24px;
  color: var(--text-muted);
  font-size: 0.98rem;
}

.auth-form {
  display: grid;
  gap: 10px;
}

.auth-form label {
  margin-top: 6px;
  font-weight: 600;
  color: var(--text);
  font-size: 0.9rem;
}

.auth-form input,
.auth-form select {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 11px;
  padding: 12px 13px;
  font-size: 0.98rem;
  color: var(--text);
  background: rgba(12, 26, 46, 0.45);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.auth-form input::placeholder {
  color: #9ab0d1;
}

.auth-form input:focus,
.auth-form select:focus {
  outline: none;
  border-color: rgba(236, 72, 59, 0.65);
  box-shadow: 0 0 0 4px var(--ring);
  background: rgba(12, 26, 46, 0.62);
}

.auth-form button,
.btn-inline {
  margin-top: 14px;
  border: 0;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 12px 14px;
  cursor: pointer;
  transition: transform 0.2s ease, filter 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 8px 20px rgba(236, 72, 59, 0.34);
}

.auth-form button:hover,
.btn-inline:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

.auth-form button:active,
.btn-inline:active {
  transform: translateY(0);
}

.auth-form button:disabled,
.btn-inline:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.auth-message {
  min-height: 24px;
  margin: 14px 0 6px;
  color: #ffd2cf;
  font-weight: 600;
  font-size: 0.92rem;
}

.auth-message.is-success {
  color: #b8f6c6;
}

.auth-link {
  margin: 2px 0 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.auth-link a,
.back-link {
  color: #ffc2ba;
  font-weight: 700;
  text-decoration: none;
}

.auth-link a:hover,
.back-link:hover {
  text-decoration: underline;
}

.admin-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.admin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.sync-panel {
  margin: 12px 0 20px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  background: rgba(10, 21, 37, 0.46);
}

.sync-panel h3,
.users-heading {
  margin: 0 0 8px;
  color: var(--text);
}

.sync-panel p {
  margin: 0 0 10px;
  color: var(--text-muted);
}

.sync-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
}

.sync-summary {
  margin-top: 10px;
  padding: 10px;
  border-radius: 10px;
  background: rgba(12, 26, 46, 0.48);
  border: 1px dashed rgba(255, 255, 255, 0.15);
  font-size: 0.9rem;
  color: var(--text);
  white-space: pre-line;
}

.users-table-wrap {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.users-table {
  width: 100%;
  border-collapse: collapse;
  background: rgba(10, 21, 37, 0.28);
}

.users-table th,
.users-table td {
  border-bottom: 1px solid rgba(255, 255, 255, 0.11);
  padding: 11px;
  text-align: left;
  white-space: nowrap;
  color: var(--text);
}

.users-table th {
  font-size: 0.82rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

@media (max-width: 720px) {
  .auth-card {
    padding: 22px;
  }

  .admin-grid,
  .sync-actions {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 1.58rem;
  }
}
