: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;
  --muted: #56497f;
  --danger: #e11d74;
  --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);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  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;
}

.page-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.main-content {
  flex: 1;
}

.container {
  width: min(100%, 80rem);
  margin: 0 auto;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

.fixed {
  position: fixed;
}

.top-0 { top: 0; }
.left-0 { left: 0; }
.right-0 { right: 0; }
.z-10 { z-index: 10; }
.z-20 { z-index: 20; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-1 { flex: 1 1 0%; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.text-sm { font-size: 0.875rem; }
.text-2xl { font-size: 1.5rem; }
.font-semibold { font-weight: 600; }
.tracking-tight { letter-spacing: -0.02em; }
.min-h-screen { min-height: 100vh; }
.mx-auto { margin-left: auto; margin-right: auto; }
.px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
.py-8 { padding-top: 2rem; padding-bottom: 2rem; }
.space-y-6 > * + * { margin-top: 1.5rem; }

.page-stack {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

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

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

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

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

.geist-input {
  width: 100%;
  font-size: 0.8125rem;
  border-radius: 0.9rem;
  padding: 0.6rem 0.85rem;
  outline: none;
  border: 1px solid rgba(139, 92, 246, 0.14);
  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);
  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,
.geist-button-outline,
.geist-button-danger,
button {
  border: none;
  cursor: pointer;
  font-family: inherit;
}

.geist-button,
button:not(.secondary):not(.danger):not(.geist-button-outline):not(.geist-button-danger):not(.nav-action-btn):not(.modal-close) {
  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: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  box-shadow: 0 14px 28px rgba(99, 102, 241, 0.24);
}

.geist-button:hover,
button:not(.secondary):not(.danger):not(.geist-button-outline):not(.geist-button-danger):not(.nav-action-btn):not(.modal-close):hover {
  opacity: 0.98;
  transform: translateY(-2px);
  box-shadow: 0 18px 36px rgba(99, 102, 241, 0.32);
}

.geist-button-outline,
button.secondary,
.modal-close,
.nav-action-btn {
  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: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.geist-button-outline:hover,
button.secondary:hover,
.modal-close:hover,
.nav-action-btn: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-danger,
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: inline-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,
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);
  max-width: 80rem;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-link {
  color: var(--fg);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

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

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

.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-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.page-hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.page-title,
h2.page-title,
h1.page-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.page-subtitle {
  margin: 0.25rem 0 0;
  font-size: 0.875rem;
  color: var(--accents-4);
}

.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.1);
  color: #5b43c3;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 10px;
}

.section-divider {
  height: 1px;
  background: var(--border);
}

.panel-card,
.logs-card,
.config-section,
.manage-panel,
.card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 24px;
  box-shadow: var(--panel-shadow);
}

.panel-card {
  overflow: hidden;
}

.panel-card-header {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}

.panel-card-body {
  padding: 18px;
}

.panel-title {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
}

.panel-subtitle {
  margin: 6px 0 0;
  font-size: 12px;
  line-height: 1.6;
  color: var(--accents-4);
}

.toolbar,
.toolbar-row,
.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.toolbar-row {
  justify-content: space-between;
}

.toolbar-dropdown {
  position: relative;
}

.toolbar-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 180px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(139, 92, 246, 0.12);
  border-radius: 18px;
  box-shadow: 0 20px 45px rgba(91, 54, 161, 0.14);
  backdrop-filter: blur(18px);
  padding: 8px;
  z-index: 30;
}

.toolbar-menu.hidden {
  display: none;
}

.filter-tabs {
  display: flex;
  align-items: center;
  gap: 16px;
  overflow-x: auto;
}

.tab-item {
  border: 0;
  background: transparent;
  color: var(--accents-4);
  padding: 0 0 10px;
  border-radius: 0;
  border-bottom: 2px solid transparent;
}

.tab-item.active {
  color: var(--fg);
  border-color: #7c3aed;
}

.badge,
.badge-count,
.status-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.badge,
.badge-count {
  background: rgba(99, 102, 241, 0.12);
  color: #4f46e5;
}

.badge-green,
.badge.active,
.status-chip.completed {
  background: rgba(16, 185, 129, 0.14);
  color: #047857;
}

.badge-orange,
.badge.cooling,
.status-chip.pending,
.status-chip.uploading,
.status-chip.submitting,
.status-chip.processing,
.status-chip.probing {
  background: rgba(245, 158, 11, 0.14);
  color: #b45309;
}

.badge-red,
.badge.disabled,
.badge.expired,
.badge.challenged,
.status-chip.failed,
.status-chip.cancelled {
  background: rgba(244, 63, 94, 0.14);
  color: #be123c;
}

.stats-grid,
.summary-grid,
.grid-2,
.form-grid,
.split-layout {
  display: grid;
  gap: 14px;
}

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

.summary-grid,
.grid-2,
.form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.split-layout {
  grid-template-columns: minmax(0, 1fr) minmax(300px, 0.72fr);
  align-items: start;
}

.form-full {
  grid-column: 1 / -1;
}

.stat-card,
.summary-item,
.card,
.config-field {
  padding: 14px 16px;
}

.stat-value,
.summary-item-value {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.1;
}

.stat-label,
.summary-item-label,
.detail-label,
.muted,
.table-note,
.meta-strip,
.table-meta,
.inline-feedback,
.detail-value {
  font-size: 12px;
  line-height: 1.6;
}

.stat-label,
.summary-item-label,
.detail-label,
.muted,
.table-note,
.meta-strip,
.table-meta {
  color: var(--accents-5);
}

.summary-item-value,
.detail-value {
  margin-top: 6px;
  color: var(--accents-7);
  font-size: 14px;
  font-weight: 500;
  word-break: break-word;
}

.detail-list,
.stack-tight {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.inline-feedback,
.meta-strip {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid rgba(139, 92, 246, 0.12);
  background: linear-gradient(180deg, rgba(247, 243, 255, 0.9), rgba(255, 255, 255, 0.96));
}

.inline-feedback.success {
  border-color: rgba(16, 185, 129, 0.22);
  color: #047857;
}

.inline-feedback.error {
  border-color: rgba(244, 63, 94, 0.22);
  color: #be123c;
}

label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accents-7);
}

input,
textarea,
select {
  font-family: inherit;
}

input:not([type="checkbox"]),
textarea,
select {
  width: 100%;
  font-size: 0.8125rem;
  border-radius: 0.9rem;
  padding: 0.6rem 0.85rem;
  outline: none;
  border: 1px solid rgba(139, 92, 246, 0.14);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  background: rgba(255, 255, 255, 0.96);
  color: var(--accents-7);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

input:not([type="checkbox"]):focus,
textarea:focus,
select:focus {
  border-color: rgba(139, 92, 246, 0.72);
  box-shadow: var(--focus-ring);
}

textarea {
  min-height: 120px;
  resize: vertical;
}

.table-wrap,
.logs-table-wrap {
  margin-top: 16px;
  overflow: auto;
  border-radius: 18px;
  border: 1px solid rgba(139, 92, 246, 0.1);
  background: rgba(255, 255, 255, 0.88);
}

table,
.geist-table,
.logs-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

thead th,
th,
.geist-table th,
.logs-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: linear-gradient(135deg, #8b5cf6, #6366f1 56%, #4f46e5);
  color: rgba(255, 255, 255, 0.96);
  font-weight: 700;
  font-size: 12px;
  text-align: left;
}

th,
td,
.geist-table th,
.geist-table td,
.logs-table th,
.logs-table td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(139, 92, 246, 0.08);
  vertical-align: top;
  font-size: 12px;
}

tbody tr:nth-child(even) td,
.geist-table tbody tr:nth-child(even) td,
.logs-table tbody tr:nth-child(even) td {
  background: rgba(249, 247, 255, 0.92);
}

tbody tr:hover td,
.geist-table tbody tr:hover td,
.logs-table tbody tr:hover td {
  background: rgba(243, 238, 255, 0.96);
}

.compact-table th,
.compact-table td {
  padding-top: 10px;
  padding-bottom: 10px;
}

.empty-state,
.table-empty,
.logs-table-empty {
  color: var(--accents-4);
  font-size: 12px;
  padding: 32px 0;
  text-align: center;
}

.hidden {
  display: none !important;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.28);
  z-index: 60;
}

.modal-content {
  width: min(720px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 22px;
  box-shadow: 0 24px 60px rgba(71, 48, 128, 0.24);
  padding: 22px;
}

.modal-md {
  width: min(640px, calc(100vw - 32px));
}

.modal-lg {
  width: min(920px, calc(100vw - 32px));
}

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

.modal-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.modal-body,
.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-actions {
  flex-direction: row;
  justify-content: flex-end;
  margin-top: 18px;
}

.log-box {
  min-height: 180px;
  max-height: 360px;
  overflow-y: auto;
  white-space: pre-wrap;
  background: #0f172a;
  color: #e5e7eb;
  border-radius: 16px;
  padding: 12px;
  font-family: 'Geist Mono', monospace;
  font-size: 12px;
}

@media (max-width: 1024px) {
  .stats-grid,
  .summary-grid,
  .grid-2,
  .form-grid,
  .split-layout {
    grid-template-columns: 1fr;
  }

  .admin-nav-inner {
    padding: 0 1rem;
  }

  .container {
    padding-left: 1rem;
    padding-right: 1rem;
  }

}
