

.admin-body {
  background: #f1f4f8;
  color: #142232;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  min-height: 100vh;
}

.admin-layout {
  display: flex;
  min-height: 100vh;
}

.admin-sidebar {
  width: 260px;
  background: #0b1523;
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.admin-sidebar-header {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: #ffffff;
}

.admin-brand-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #1f77c4, #0f4b82);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.1rem;
  color: #fff;
  box-shadow: 0 2px 8px rgba(31, 119, 196, 0.35);
}

.admin-brand-text {
  display: flex;
  flex-direction: column;
}

.admin-brand-title {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

.admin-brand-badge {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #38bdf8;
  margin-top: 2px;
}

.admin-nav {
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.admin-nav-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #64748b;
  padding: 12px 12px 6px;
}

.admin-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  color: #94a3b8;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 150ms ease;
}

.admin-nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
}

.admin-nav-item.active {
  background: #1763a6;
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(23, 99, 166, 0.4);
}

.admin-nav-item svg {
  flex-shrink: 0;
  opacity: 0.85;
}

.admin-nav-item.active svg {
  opacity: 1;
}

.admin-sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.admin-user-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 6px;
  font-size: 0.82rem;
}

.admin-user-avatar {
  width: 28px;
  height: 28px;
  background: #244266;
  color: #e2e8f0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.75rem;
}

.admin-user-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.admin-user-name {
  font-weight: 600;
  color: #f1f5f9;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.admin-user-role {
  font-size: 0.7rem;
  color: #94a3b8;
}

.admin-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

.admin-topbar {
  background: #ffffff;
  border-bottom: 1px solid #dfe5ec;
  padding: 16px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 20;
}

.admin-topbar-title-wrap {
  display: flex;
  flex-direction: column;
}

.admin-topbar-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: #0f1d2e;
  margin: 0;
  letter-spacing: -0.01em;
}

.admin-topbar-sub {
  font-size: 0.85rem;
  color: #596b7e;
  margin-top: 2px;
}

.admin-topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-content {
  padding: 32px;
  max-width: 1360px;
  width: 100%;
  box-sizing: border-box;
  margin: 0 auto;
}

.admin-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.admin-kpi-card {
  background: #ffffff;
  border: 1px solid #dfe5ec;
  border-radius: 14px;
  padding: 22px 24px;
  box-shadow: 0 1px 3px rgba(15, 29, 46, 0.04);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.admin-kpi-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: #1763a6;
}

.admin-kpi-card.kpi-purple::before { background: #7c3aed; }
.admin-kpi-card.kpi-emerald::before { background: #059669; }
.admin-kpi-card.kpi-amber::before { background: #d97706; }

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

.admin-kpi-label {
  font-size: 0.84rem;
  font-weight: 600;
  color: #596b7e;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.admin-kpi-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: #f1f7fc;
  color: #1763a6;
  display: flex;
  align-items: center;
  justify-content: center;
}

.admin-kpi-value {
  font-size: 2.1rem;
  font-weight: 800;
  color: #0f1d2e;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.admin-kpi-meta {
  font-size: 0.82rem;
  color: #64748b;
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.admin-panel {
  background: #ffffff;
  border: 1px solid #dfe5ec;
  border-radius: 14px;
  box-shadow: 0 1px 3px rgba(15, 29, 46, 0.04);
  margin-bottom: 32px;
  overflow: hidden;
}

.admin-panel-header {
  padding: 20px 24px;
  border-bottom: 1px solid #edf2f7;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.admin-panel-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #0f1d2e;
  margin: 0;
}

.admin-panel-sub {
  font-size: 0.84rem;
  color: #64748b;
  margin-top: 3px;
}

.admin-table-wrap {
  overflow-x: auto;
}

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

.admin-table th {
  background: #f8fafc;
  color: #475569;
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 12px 20px;
  border-bottom: 1px solid #e2e8f0;
  white-space: nowrap;
}

.admin-table td {
  padding: 14px 20px;
  border-bottom: 1px solid #edf2f7;
  color: #1e293b;
  vertical-align: middle;
}

.admin-table tr:hover td {
  background: #f8fbfe;
}

.admin-table tr:last-child td {
  border-bottom: none;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.pill-active, .pill-paid {
  background: #dcfce7;
  color: #15803d;
}

.pill-trialing {
  background: #e0f2fe;
  color: #0369a1;
}

.pill-disabled, .pill-expired, .pill-canceled {
  background: #fee2e2;
  color: #b91c1c;
}

.pill-interactive {
  background: #f3e8ff;
  color: #7e22ce;
}

.pill-direct {
  background: #f1f5f9;
  color: #475569;
}

.switch-label {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  cursor: pointer;
}

.switch-label input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #cbd5e1;
  transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 24px;
}

.switch-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.switch-label input:checked + .switch-slider {
  background-color: #059669;
}

.switch-label input:checked + .switch-slider:before {
  transform: translateX(20px);
}

.btn-admin-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #1763a6;
  color: #ffffff;
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: all 150ms ease;
  box-shadow: 0 1px 2px rgba(23, 99, 166, 0.2);
}

.btn-admin-primary:hover {
  background: #124e83;
}

.btn-admin-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  color: #1e293b;
  padding: 9px 16px;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  border: 1px solid #cbd5e1;
  cursor: pointer;
  text-decoration: none;
  transition: all 150ms ease;
}

.btn-admin-secondary:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}

.btn-admin-danger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #fee2e2;
  color: #b91c1c;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.84rem;
  font-weight: 600;
  border: 1px solid #fca5a5;
  cursor: pointer;
  text-decoration: none;
}

.btn-admin-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
  border-radius: 6px;
}

.admin-form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  padding: 24px;
}

.admin-form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

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

.admin-form-label {
  font-size: 0.86rem;
  font-weight: 600;
  color: #1e293b;
}

.admin-form-help {
  font-size: 0.78rem;
  color: #64748b;
  margin-top: 2px;
}

.admin-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.92rem;
  font-family: inherit;
  color: #0f172a;
  box-sizing: border-box;
  background: #ffffff;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.admin-input:focus {
  outline: none;
  border-color: #1763a6;
  box-shadow: 0 0 0 3px rgba(23, 99, 166, 0.15);
}

.admin-textarea-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.88rem;
  line-height: 1.6;
  background: #fcfdfe;
}

.admin-form-actions {
  padding: 18px 24px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.admin-modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.admin-modal-overlay.active {
  display: flex;
}

.admin-modal {
  background: #ffffff;
  border-radius: 16px;
  width: min(840px, 100%);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  animation: modalPop 200ms ease;
}

@keyframes modalPop {
  from { transform: scale(0.96); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.admin-modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.admin-modal-body {
  padding: 24px;
  overflow-y: auto;
  font-size: 0.92rem;
  line-height: 1.6;
}

.admin-modal-footer {
  padding: 16px 24px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  display: flex;
  justify-content: flex-end;
}

.admin-code-block {
  background: #0f172a;
  color: #e2e8f0;
  padding: 16px;
  border-radius: 8px;
  font-family: ui-monospace, Menlo, monospace;
  font-size: 0.84rem;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.admin-login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 30%, #173252 0%, #08111d 100%);
  padding: 20px;
}

.admin-login-card {
  width: min(440px, 100%);
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.35);
  padding: 40px;
  box-sizing: border-box;
}

.admin-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #0f172a;
  color: #ffffff;
  padding: 14px 20px;
  border-radius: 10px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.2);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.9rem;
  z-index: 1000;
  transform: translateY(100px);
  opacity: 0;
  transition: all 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

.admin-toast.show {
  transform: translateY(0);
  opacity: 1;
}

@media (max-width: 900px) {
  .admin-layout {
    flex-direction: column;
  }
  .admin-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }
  .admin-topbar {
    padding: 16px 20px;
  }
  .admin-content {
    padding: 20px 16px;
  }
  .admin-form-grid {
    grid-template-columns: 1fr;
  }
}
