:root {
  --bg: #08111f;
  --bg-soft: #111b31;
  --panel: rgba(10, 16, 31, 0.84);
  --panel-border: rgba(255, 255, 255, 0.08);
  --text: #f2f6ff;
  --muted: #9db0d1;
  --accent: #4dd6a2;
  --accent-strong: #1dbb83;
  --danger: #ff6b6b;
  --warning: #ffc857;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.38);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body.admin-page {
  margin: 0;
  color: var(--text);
  font-family: "Segoe UI", Arial, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(77, 214, 162, 0.16), transparent 34%),
    radial-gradient(circle at top right, rgba(77, 120, 255, 0.2), transparent 30%),
    linear-gradient(180deg, #07101f 0%, #050a13 100%);
}

.ambient {
  position: fixed;
  inset: auto;
  border-radius: 999px;
  filter: blur(20px);
  pointer-events: none;
  opacity: 0.9;
}

.ambient-a {
  width: 18rem;
  height: 18rem;
  left: -6rem;
  top: 6rem;
  background: rgba(77, 214, 162, 0.22);
}

.ambient-b {
  width: 24rem;
  height: 24rem;
  right: -10rem;
  top: 18rem;
  background: rgba(255, 200, 87, 0.16);
}

.admin-shell {
  position: relative;
  z-index: 1;
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.hero-card,
.panel-card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.hero-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: end;
  border-radius: var(--radius-xl);
  padding: 30px;
  margin-bottom: 22px;
}

.eyebrow,
.section-kicker {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.74rem;
  color: var(--accent);
  font-weight: 700;
}

.hero-copy h1,
.section-head h2 {
  margin: 0;
  line-height: 1.08;
}

.hero-copy h1 {
  font-size: clamp(2rem, 4vw, 3.6rem);
  max-width: 12ch;
}

.hero-text,
.section-head p,
.section-head-inline p {
  color: var(--muted);
  margin: 12px 0 0;
  max-width: 62ch;
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(92px, 1fr));
  gap: 12px;
}

.hero-side {
  display: grid;
  gap: 12px;
}

.profile-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border-radius: 18px;
  padding: 12px 14px;
  background: linear-gradient(180deg, rgba(15, 27, 52, 0.95), rgba(10, 17, 33, 0.95));
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.profile-avatar {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-weight: 800;
  color: #032117;
  background: linear-gradient(180deg, #72efc2 0%, #45d5a3 100%);
  box-shadow: 0 8px 20px rgba(69, 213, 163, 0.3);
}

.profile-text {
  display: grid;
  gap: 2px;
}

.profile-text small {
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.profile-text strong {
  font-size: 1rem;
  line-height: 1.2;
}

.profile-text span {
  color: #bdeedc;
  font-size: 0.82rem;
  font-weight: 700;
}

.button-logout {
  padding: 9px 13px;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
}

.metric-card {
  min-width: 110px;
  padding: 18px 16px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(14, 23, 43, 0.96), rgba(10, 17, 31, 0.96));
  border: 1px solid rgba(255, 255, 255, 0.07);
  text-align: center;
}

.metric-card span {
  display: block;
  font-size: 1.9rem;
  font-weight: 800;
}

.metric-card small {
  color: var(--muted);
}

.panel-card {
  border-radius: var(--radius-lg);
  padding: 22px;
}

.hidden {
  display: none !important;
}

/* Notification Popup */
.notification-popup {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 9999;
  animation: slideInUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.notification-popup.hidden {
  animation: slideOutDown 0.3s ease-in forwards;
}

@keyframes slideInUp {
  from {
    transform: translateY(120px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes slideOutDown {
  from {
    transform: translateY(0);
    opacity: 1;
  }
  to {
    transform: translateY(120px);
    opacity: 0;
  }
}

.notification-content {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: linear-gradient(135deg, rgba(13, 20, 38, 0.95) 0%, rgba(20, 30, 50, 0.95) 100%);
  border: 1px solid rgba(77, 214, 162, 0.3);
  border-radius: 16px;
  padding: 1.25rem 1.5rem;
  backdrop-filter: blur(10px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  max-width: 420px;
  min-width: 300px;
}

.notification-content.success {
  border-color: rgba(77, 214, 162, 0.5);
  background: linear-gradient(135deg, rgba(13, 38, 30, 0.95) 0%, rgba(13, 30, 25, 0.95) 100%);
}

.notification-content.error {
  border-color: rgba(255, 107, 107, 0.5);
  background: linear-gradient(135deg, rgba(38, 13, 13, 0.95) 0%, rgba(30, 13, 13, 0.95) 100%);
}

.notification-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 1.5rem;
  font-weight: bold;
  flex-shrink: 0;
  background: rgba(77, 214, 162, 0.2);
  color: #4dd6a2;
}

.notification-content.error .notification-icon {
  background: rgba(255, 107, 107, 0.2);
  color: #ff6b6b;
}

.notification-text {
  flex: 1;
}

.notification-text h3 {
  margin: 0 0 0.25rem 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.notification-text p {
  margin: 0;
  font-size: 0.875rem;
  color: var(--muted);
}

.notification-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.notification-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

@media (max-width: 640px) {
  .notification-popup {
    bottom: 1rem;
    right: 1rem;
    left: 1rem;
  }
  
  .notification-content {
    min-width: auto;
    max-width: none;
  }
}

.auth-card {
  max-width: 560px;
  margin: 0 auto;
}

.auth-form,
.stack-form {
  display: grid;
  gap: 16px;
}

.auth-form label,
.stack-form label {
  display: grid;
  gap: 8px;
}

.auth-form span,
.stack-form span {
  font-size: 0.92rem;
  color: var(--muted);
  font-weight: 600;
}

input,
select,
button {
  font: inherit;
}

input,
select {
  width: 100%;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(4, 9, 18, 0.82);
  color: var(--text);
  padding: 14px 16px;
  outline: none;
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

input:focus,
select:focus {
  border-color: rgba(77, 214, 162, 0.65);
  box-shadow: 0 0 0 4px rgba(77, 214, 162, 0.15);
}

input[type="color"] {
  padding: 8px;
  height: 52px;
}

.button {
  border: 0;
  border-radius: 14px;
  padding: 14px 18px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button-primary {
  color: #062014;
  background: linear-gradient(180deg, #74f0c4 0%, #42d39f 100%);
  box-shadow: 0 12px 26px rgba(66, 211, 159, 0.28);
}

.button-secondary {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.button-danger {
  color: #fff;
  background: linear-gradient(180deg, #ff7d7d 0%, #ff5d5d 100%);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.app-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.table-card {
  grid-column: 1 / -1;
}

.section-head {
  margin-bottom: 18px;
}

.section-head-inline {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.form-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.form-grid.single-row {
  grid-template-columns: minmax(0, 1.7fr) minmax(110px, 0.7fr);
}

.wide-field {
  min-width: 0;
}

.table-wrap {
  overflow-x: auto;
}

  .profile-card {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .button-logout {
    grid-column: 1 / -1;
    width: 100%;
  }

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
}

th,
td {
  padding: 14px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  text-align: left;
  vertical-align: middle;
}

th {
  color: #dce7ff;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

td {
  color: #eef3ff;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 0.82rem;
  font-weight: 700;
}

.badge-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.badge-success {
  background: rgba(77, 214, 162, 0.16);
  color: #bff3df;
}

.badge-muted {
  color: #d4deee;
}

.badge-warning {
  background: rgba(255, 200, 87, 0.14);
  color: #ffe2a2;
}

.badge-danger {
  background: rgba(255, 107, 107, 0.14);
  color: #ffb1b1;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.swatch {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  display: inline-block;
  vertical-align: middle;
}

.muted {
  color: var(--muted);
}

.empty-state {
  color: var(--muted);
}

@media (max-width: 980px) {
  .hero-card,
  .hero-side,
  .app-grid,
  .form-grid,
  .form-grid.single-row {
    grid-template-columns: 1fr;
  }

  .hero-card {
    align-items: start;
  }

  .section-head-inline {
    align-items: start;
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  .admin-shell {
    width: min(100% - 18px, 1240px);
    padding-top: 16px;
  }

  .hero-card,
  .panel-card {
    padding: 18px;
  }

  .hero-metrics {
    grid-template-columns: 1fr;
  }
}