:root {
  color-scheme: dark;
  --bg: #090812;
  --panel: rgba(18, 16, 31, 0.92);
  --panel-soft: rgba(29, 25, 48, 0.92);
  --panel-border: rgba(140, 111, 255, 0.16);
  --sidebar: rgba(13, 12, 23, 0.96);
  --text: #f5f2ff;
  --muted: #a49abc;
  --accent: linear-gradient(135deg, #764bff 0%, #8f67ff 48%, #3ecfff 100%);
  --good: #88e98d;
  --danger: #ff748f;
  --warning: #ffcc78;
  --shadow: 0 26px 60px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: "SF Pro Display", "Inter", system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(108, 66, 255, 0.18), transparent 28%),
    radial-gradient(circle at top right, rgba(61, 205, 255, 0.16), transparent 26%),
    linear-gradient(180deg, #0c0b16 0%, #090812 100%);
}

.admin-app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 320px 1fr;
}

.sidebar {
  padding: 28px 20px;
  background: var(--sidebar);
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  gap: 22px;
  position: sticky;
  top: 0;
  min-height: 100vh;
}

.sidebar-brand h1,
.hero-card h2,
.dashboard-topbar h2,
.panel-head h3 {
  margin: 0;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 12px;
}

.sidebar-brand {
  display: grid;
  gap: 8px;
}

.brand-avatar,
.sidebar-profile-avatar,
.profile-chip-avatar,
.profile-card-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-weight: 800;
  letter-spacing: 0.04em;
  background: linear-gradient(135deg, rgba(118, 75, 255, 0.28), rgba(62, 207, 255, 0.24));
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.brand-avatar {
  width: 56px;
  height: 56px;
  font-size: 18px;
}

.environment-switcher,
.screen-nav {
  display: grid;
  gap: 10px;
}

.environment-switcher a,
button {
  appearance: none;
  border: 0;
  border-radius: 16px;
  padding: 13px 16px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  text-align: left;
  background: rgba(255, 255, 255, 0.07);
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.environment-switcher a.active,
.screen-nav button.active,
.primary-button {
  background: var(--accent);
}

.environment-switcher a:hover,
.screen-nav button:hover,
button:hover {
  transform: translateY(-1px);
}

.nav-button {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid transparent;
}

.nav-button.active {
  box-shadow: 0 12px 30px rgba(111, 92, 255, 0.26);
}

.sidebar-footer {
  margin-top: auto;
  display: block;
}

.sidebar-value,
.muted,
.status {
  margin: 0;
  color: var(--muted);
}

.content-shell {
  padding: 28px 32px;
}

.login-view,
.dashboard {
  display: grid;
  gap: 22px;
}

.hero-card,
.panel {
  padding: 24px;
  border-radius: 24px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.hero-card {
  background:
    radial-gradient(circle at top right, rgba(87, 202, 255, 0.14), transparent 24%),
    radial-gradient(circle at top left, rgba(124, 84, 255, 0.14), transparent 30%),
    var(--panel-soft);
}

.dashboard-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding-bottom: 12px;
}

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-size: 14px;
}

.environment-switcher {
  display: inline-grid;
  grid-auto-flow: column;
  gap: 6px;
  padding: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.environment-switcher a {
  min-width: 116px;
  padding: 10px 14px;
  border-radius: 999px;
  text-align: center;
  font-size: 14px;
}

.environment-switcher a:not(.active) {
  background: transparent;
}

.badge-env {
  color: var(--text);
}

.badge-admin {
  min-width: 0;
  justify-content: center;
}

.badge-admin-name {
  color: var(--text);
}

.profile-chip {
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 12px;
  align-items: center;
  min-width: 260px;
  padding: 10px 12px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.profile-chip-avatar {
  width: 46px;
  height: 46px;
  font-size: 14px;
}

.profile-chip-copy {
  display: grid;
  gap: 6px;
}

.profile-chip-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}

.form-grid,
.toolbar {
  display: grid;
  gap: 14px;
}

.split-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(320px, 0.9fr);
  gap: 22px;
}

.admins-layout {
  grid-template-columns: minmax(0, 1.5fr) minmax(320px, 0.85fr);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
}

.stack-layout {
  display: grid;
  gap: 22px;
}

.stat-card {
  padding: 18px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(18px);
}

.stat-card h3,
.stat-card p {
  margin: 0;
}

.stat-card h3 {
  margin-top: 10px;
  font-size: 30px;
}

label {
  display: grid;
  gap: 8px;
}

input,
select,
textarea {
  width: 100%;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(8, 8, 16, 0.34);
  color: var(--text);
  padding: 14px 16px;
  font: inherit;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.checkbox-row input {
  width: 18px;
  height: 18px;
  padding: 0;
}

.ghost-button {
  background: rgba(255, 255, 255, 0.06);
}

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

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 13px 14px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  vertical-align: top;
}

thead th {
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

.audit-details {
  max-width: 360px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.profile-layout {
  grid-template-columns: minmax(320px, 0.95fr) minmax(0, 1.05fr);
}

.profile-card {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 16px;
  align-items: center;
  min-height: 148px;
  padding: 20px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.profile-card-avatar {
  width: 88px;
  height: 88px;
  font-size: 26px;
}

.profile-card-copy {
  display: grid;
  gap: 8px;
}

.status-ok {
  color: var(--good);
}

.status-error {
  color: var(--danger);
}

.status-warning {
  color: var(--warning);
}

.section-hidden {
  display: none !important;
}

@media (max-width: 1200px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .admin-app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    position: static;
    min-height: 0;
  }

  .split-layout,
  .admins-layout {
    grid-template-columns: 1fr;
  }

  .profile-layout {
    grid-template-columns: 1fr;
  }

  .dashboard-topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-meta {
    width: 100%;
    justify-content: stretch;
  }

  .environment-switcher {
    width: 100%;
    grid-auto-flow: row;
  }

  .environment-switcher a {
    min-width: 0;
  }

  .profile-chip {
    width: 100%;
    min-width: 0;
  }
}

@media (max-width: 720px) {
  .content-shell,
  .sidebar {
    padding: 18px;
  }

  .dashboard-topbar,
  .panel-head {
    flex-direction: column;
    align-items: stretch;
  }

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