:root {
  --bg: #f5efff;
  --bg-soft: #fbf8ff;
  --fg: #1f1147;
  --accents-1: #ece5fb;
  --accents-2: #b6a9df;
  --accents-3: #9687c5;
  --accents-4: #74679d;
  --accents-5: #56497f;
  --accents-6: #3b2f61;
  --accents-7: #26174f;
  --border: rgba(127, 91, 201, 0.2);
  --success: #4f46e5;
  --error: #e11d74;
  --warning: #f5a623;
  --radius: 6px;
  --brand-start: #8b5cf6;
  --brand-mid: #6366f1;
  --brand-end: #38bdf8;
  --brand-gradient: linear-gradient(135deg, var(--brand-start), var(--brand-mid) 54%, var(--brand-end));
  --panel-shadow: 0 20px 48px rgba(91, 54, 161, 0.12);
  --focus-ring: 0 0 0 4px rgba(139, 92, 246, 0.16);
}

body {
  font-family: 'Geist Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
}

body.admin-page {
  min-height: 100vh;
  background:
    radial-gradient(1200px 560px at top left, rgba(196, 181, 253, 0.45), transparent 60%),
    radial-gradient(900px 520px at top right, rgba(191, 219, 254, 0.35), transparent 54%),
    linear-gradient(180deg, #f8f4ff 0%, #f2edff 48%, #f8f6ff 100%);
}

#app-header {
  height: 56px;
}

.font-mono {
  font-family: 'Geist Mono', monospace;
}

.table-empty {
  color: var(--accents-4);
  font-size: 12px;
  font-weight: 400;
  padding: 48px 0;
  text-align: center;
}

td.table-empty {
  height: auto;
}

.fade-in {
  animation: fadeIn 0.5s ease-out forwards;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in-centered {
  animation: fadeInCentered 0.5s ease-out forwards;
}

@keyframes fadeInCentered {
  from {
    opacity: 0;
    transform: translate(-50%, 10px);
  }

  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

.geist-input {
  width: 100%;
  font-size: 0.8125rem;
  border-radius: 0.9rem;
  padding: 0.6rem 0.85rem;
  outline: none;
  border: 1px solid transparent;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, transform 0.2s ease;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(139, 92, 246, 0.14);
  color: var(--accents-7);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.geist-input:focus {
  border-color: rgba(139, 92, 246, 0.72);
  box-shadow: var(--focus-ring);
}

.geist-input:disabled {
  background: #f5f5f5;
  color: var(--accents-4);
  cursor: not-allowed;
}

.geist-input::placeholder {
  color: var(--accents-3);
}

.geist-button {
  height: 36px;
  font-size: 0.875rem;
  font-weight: 600;
  background: var(--brand-gradient);
  color: #fff;
  border-radius: 0.9rem;
  padding: 0 1rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  box-shadow: 0 14px 28px rgba(99, 102, 241, 0.24);
}

.geist-button:hover {
  opacity: 0.98;
  transform: translateY(-2px);
  box-shadow: 0 18px 36px rgba(99, 102, 241, 0.32);
}

.geist-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.geist-button-outline {
  height: 36px;
  font-size: 0.875rem;
  font-weight: 500;
  background-color: rgba(255, 255, 255, 0.72);
  color: var(--accents-6);
  border: 1px solid rgba(139, 92, 246, 0.16);
  border-radius: 0.9rem;
  padding: 0 1rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease, color 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.geist-button-outline:hover {
  border-color: rgba(139, 92, 246, 0.4);
  color: var(--accents-7);
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(139, 92, 246, 0.12);
}

.geist-button-outline:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.geist-button-danger {
  height: 36px;
  font-size: 0.875rem;
  font-weight: 500;
  background: linear-gradient(135deg, #f43f5e, #ec4899);
  color: #fff;
  border-radius: 0.9rem;
  padding: 0 1rem;
  transition: opacity 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  box-shadow: 0 14px 28px rgba(236, 72, 153, 0.22);
}

.geist-button-danger:hover {
  opacity: 0.98;
  transform: translateY(-2px);
  box-shadow: 0 18px 36px rgba(236, 72, 153, 0.28);
}

.admin-nav {
  padding: 14px 18px 0;
}

.admin-nav-inner {
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.52);
  border-radius: 22px;
  box-shadow: 0 20px 40px rgba(94, 72, 155, 0.12);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.geist-button-danger:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.nav-link {
  color: var(--accents-4);
  transition: color 0.2s ease;
  position: relative;
  padding-bottom: 2px;
}

.nav-link:hover {
  color: var(--fg);
}

.nav-link.active {
  color: #7c3aed;
  font-weight: 600;
}

.nav-link.active::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -6px;
  height: 2px;
  border-radius: 999px;
  background: var(--brand-gradient);
}

.nav-group {
  position: relative;
}

.nav-group-trigger {
  background: transparent;
  border: 0;
  padding: 0;
  font: inherit;
  cursor: pointer;
}

.nav-group-menu {
  position: absolute;
  top: 100%;
  left: -8px;
  margin-top: 8px;
  min-width: 140px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  z-index: 20;
}

.nav-group:hover .nav-group-menu,
.nav-group:focus-within .nav-group-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.nav-group-menu .nav-link {
  padding: 6px 10px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  color: var(--accents-5);
}

.nav-group-menu .nav-link:hover {
  background: #f5f5f5;
  color: var(--fg);
}

.nav-group-menu .nav-link.active {
  background: #f0f0f0;
  color: var(--fg);
  font-weight: 500;
}

.nav-badge {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--accents-5);
  background: #f7f7f7;
  border: 1px solid var(--border);
  white-space: nowrap;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-action-btn {
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(139, 92, 246, 0.16);
  background: rgba(255, 255, 255, 0.84);
  font-size: 11px;
  font-weight: 600;
  color: var(--accents-5);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.nav-action-btn:hover {
  border-color: rgba(139, 92, 246, 0.36);
  color: #5b21b6;
  box-shadow: 0 10px 24px rgba(139, 92, 246, 0.12);
}

.nav-action-btn.storage-ready {
  background: #ecfdf3;
  border-color: #a7f3d0;
  color: #047857;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: inherit;
  text-decoration: none;
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.github-icon {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.app-footer {
  position: fixed;
  right: 16px;
  left: auto;
  bottom: 12px;
  color: var(--accents-4);
  font-size: 12px;
  background: transparent;
  text-align: right;
  z-index: 10;
}

.app-footer a {
  color: inherit;
  transition: color 0.15s;
}

.app-footer a:hover {
  color: var(--fg);
}

.stat-card {
  background: #fff;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 20px;
  padding: 18px 20px;
  box-shadow: var(--panel-shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 24px 52px rgba(91, 54, 161, 0.18);
}

.stat-value {
  font-size: 20px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.stat-label {
  font-size: 12px;
  color: var(--accents-4);
  margin-top: 2px;
}

.manage-panel {
  box-shadow: var(--panel-shadow);
  border-color: rgba(255, 255, 255, 0.78) !important;
}

* {
  scrollbar-width: thin;
  scrollbar-color: rgba(139, 92, 246, 0.7) rgba(255, 255, 255, 0.45);
}

*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

*::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.55);
  border-radius: 999px;
}

*::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(167, 139, 250, 0.95), rgba(99, 102, 241, 0.95));
  border-radius: 999px;
}

@media (max-width: 768px) {
  .admin-nav {
    padding: 10px 12px 0;
  }

  .admin-nav-inner {
    border-radius: 18px;
  }
}
