.page-auth main {
  min-height: calc(100vh - var(--topbar-h));
}

.auth-wrap {
  min-height: calc(100vh - var(--topbar-h));
  display: grid;
  place-items: center;
  padding: 2.5rem 0;
  position: relative;
  z-index: 1;
}

.auth-shell {
  width: min(920px, 94%);
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-radius: calc(var(--radius) + 2px);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow);
  background: rgba(10, 10, 18, 0.92);
  backdrop-filter: var(--glass);
}

.auth-aside {
  padding: 2.25rem 2rem;
  background:
    radial-gradient(circle at 20% 0%, rgba(239, 68, 68, 0.22), transparent 55%),
    linear-gradient(165deg, #14141f, #0a0a12);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 2rem;
}

.auth-aside h2 {
  margin: 0.75rem 0 0.5rem;
  font-size: 1.65rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.auth-aside p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  max-width: 18rem;
}

.auth-aside-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.65rem;
}

.auth-aside-list li {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: #c8c8d8;
  font-size: 0.88rem;
}

.auth-aside-list li::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
  flex-shrink: 0;
}

.auth-card {
  padding: 2rem 2rem 1.75rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.auth-card h1 {
  margin: 0 0 0.35rem;
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.auth-card .sub {
  color: var(--muted);
  margin: 0 0 1.35rem;
  font-size: 0.92rem;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

.form-group input {
  width: 100%;
  padding: 0.78rem 0.9rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.35);
  color: var(--text);
  font: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input[type="file"] {
  padding: 0.55rem 0.65rem;
}

.form-group input:focus {
  outline: none;
  border-color: rgba(239, 68, 68, 0.55);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12);
}

.alert {
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  font-size: 0.88rem;
}

.alert-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #ffb4b4;
}

.alert-success {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.35);
  color: #86efac;
}

.auth-links {
  margin-top: 1.15rem;
  font-size: 0.88rem;
  color: var(--muted);
  text-align: center;
}

.auth-links a { color: #ff9999; }

.panel-wrap {
  position: relative;
  z-index: 1;
  padding: 2.5rem 0 3.5rem;
}

.panel-hero {
  margin-bottom: 1.75rem;
}

.panel-hero h1 {
  margin: 0 0 0.35rem;
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.panel-hero p {
  margin: 0;
  color: var(--muted);
}

.panel-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.panel-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(165deg, rgba(255,255,255,0.04), rgba(255,255,255,0.01));
  padding: 1.35rem;
  transition: border-color 0.25s, transform 0.25s;
}

.panel-card:hover {
  border-color: var(--border-accent);
  transform: translateY(-2px);
}

.panel-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  margin-bottom: 0.85rem;
  background: var(--accent-dim);
  color: #ff9999;
  font-size: 1.1rem;
}

.panel-card h2 {
  margin: 0 0 0.65rem;
  font-size: 1.05rem;
}

.panel-card p,
.panel-card ol {
  color: var(--muted);
  font-size: 0.9rem;
}

.panel-card ol {
  padding-left: 1.1rem;
  margin: 0;
}

.key-box {
  font-family: var(--mono);
  font-size: 0.95rem;
  padding: 0.85rem;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border);
  word-break: break-all;
  letter-spacing: 0.04em;
}

.key-meta {
  margin-top: 0.75rem;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.7;
}

.nav-user {
  color: var(--muted);
  font-size: 0.88rem;
  margin-right: 0.35rem;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.admin-table th,
.admin-table td {
  border-bottom: 1px solid var(--border);
  padding: 0.55rem 0.35rem;
  text-align: left;
}

.admin-table th { color: var(--muted); font-weight: 600; }

.form-select {
  width: 100%;
  padding: 0.72rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.35);
  color: var(--text);
  font: inherit;
}

.btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.78rem;
}

.loader-switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.loader-switch.is-on {
  border-color: rgba(34, 197, 94, 0.35);
  background: rgba(34, 197, 94, 0.08);
}

.loader-switch.is-off {
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.08);
}

.loader-switch strong {
  color: var(--text);
}

.upload-box {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: var(--radius-sm);
  border: 1px dashed rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.02);
}

.upload-box h3 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
}

.upload-box code {
  font-size: 0.78rem;
  color: #9ecbff;
}

.admin-user-list {
  list-style: none;
  padding: 0;
  margin: 0.75rem 0 0;
}

.admin-user-list li {
  display: flex;
  justify-content: space-between;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
  color: var(--muted);
}

.admin-user-list li span {
  color: #888;
  font-size: 0.78rem;
  text-transform: uppercase;
}

@media (max-width: 768px) {
  .auth-shell {
    grid-template-columns: 1fr;
  }

  .auth-aside {
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 1.5rem;
  }

  .panel-grid {
    grid-template-columns: 1fr;
  }
}

.page-mappings .mappings-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.mappings-toolbar {
  display: flex;
  gap: 0.5rem;
  margin: 1rem 0 0.65rem;
}

.mappings-code {
  margin: 0;
  padding: 1.1rem 1.2rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.45);
  color: #d8d8e8;
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.55;
  max-height: min(70vh, 720px);
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 768px) {
  .page-mappings .mappings-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}
