body {
  margin: 0;
  font-family: Inter, Arial, sans-serif;
  background: #0b1020;
  color: #e5e7eb;
}
.layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}
.sidebar {
  background: #111827;
  border-right: 1px solid #1f2937;
  padding: 20px;
}
.brand {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 14px;
}
.muted {
  color: #9ca3af;
  font-size: 13px;
}
.main {
  padding: 20px;
}
.card {
  background: #111827;
  border: 1px solid #1f2937;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 14px;
}
.row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
input, select, button, textarea {
  border-radius: 8px;
  border: 1px solid #374151;
  background: #0f172a;
  color: #e5e7eb;
  padding: 10px;
}
button {
  background: #4f46e5;
  border: none;
  cursor: pointer;
  font-weight: 600;
}
button.secondary {
  background: #374151;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
th, td {
  border-bottom: 1px solid #1f2937;
  padding: 10px 8px;
  text-align: left;
}
th {
  color: #9ca3af;
  font-weight: 600;
}
.status-pill {
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 12px;
  display: inline-block;
}
.status-active { background: #064e3b; color: #6ee7b7; }
.status-suspended { background: #7f1d1d; color: #fca5a5; }
.hidden { display: none !important; }
.danger { color: #fca5a5; }
.sidebar-nav {
  margin: 0 0 12px;
}
.sidebar-link {
  color: #a5b4fc;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}
.sidebar-link:hover {
  text-decoration: underline;
}

/* --- Create-site wizard (light card, setup/index style) --- */
.sa-create-card {
  background: transparent;
  border: none;
  padding: 0;
}
.sa-wizard {
  max-width: 640px;
  background: #fff;
  color: #0f172a;
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  border: 1px solid #1f2937;
}
.sa-wizard-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid #e2e8f0;
}
.sa-wizard-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.sa-wizard-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 800;
  color: #0f172a;
}
.sa-wiz-step-indicator {
  font-size: 0.875rem;
  font-weight: 600;
  color: #64748b;
  white-space: nowrap;
}
.sa-wiz-progress-track {
  margin-top: 1rem;
  height: 6px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}
.sa-wiz-progress-fill {
  height: 100%;
  width: 25%;
  border-radius: 999px;
  background: #4f46e5;
  transition: width 0.35s ease;
}
.sa-wizard-body {
  padding: 1.5rem 1.75rem 1.25rem;
}
.sa-wizard-panel {
  display: none;
  animation: saWizFade 0.35s ease;
}
.sa-wizard-panel.active {
  display: block;
}
@keyframes saWizFade {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.sa-wiz-welcome {
  text-align: center;
  padding: 0.5rem 0 0.25rem;
}
.sa-wiz-welcome-icon {
  display: block;
  margin: 0 auto 1rem;
}
.sa-wiz-welcome-title {
  margin: 0 0 0.5rem;
  font-size: 1.75rem;
  font-weight: 800;
  color: #0f172a;
}
.sa-wiz-welcome-text {
  margin: 0;
  color: #64748b;
  font-size: 0.95rem;
  line-height: 1.5;
}
.sa-wiz-panel-title {
  margin: 0 0 1rem;
  font-size: 1.15rem;
  font-weight: 800;
  color: #0f172a;
}
.sa-wiz-muted {
  margin: 0 0 1rem;
  color: #64748b;
  font-size: 0.9rem;
  line-height: 1.45;
}
.sa-wiz-field {
  margin-bottom: 1rem;
}
.sa-wiz-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #334155;
  margin-bottom: 0.35rem;
}
.sa-wiz-hint {
  margin: 0.35rem 0 0;
  font-size: 0.75rem;
  color: #94a3b8;
}
.sa-wiz-input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  border: 2px solid #e5e7eb;
  border-radius: 0.75rem;
  background: #f9fafb;
  color: #0f172a;
}
.sa-wiz-input:focus {
  outline: none;
  border-color: #4f46e5;
  background: #fff;
}
.sa-wiz-input.sa-wiz-invalid {
  border-color: #ef4444;
}
.sa-wiz-input-with-status {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sa-wiz-input-with-status .sa-wiz-input {
  flex: 1;
  min-width: 0;
}
.sa-wiz-map-status {
  flex-shrink: 0;
  min-width: 1.5rem;
  text-align: center;
  font-size: 1.1rem;
  line-height: 1;
}
.sa-wiz-spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(79, 70, 229, 0.2);
  border-left-color: #4f46e5;
  border-radius: 50%;
  animation: saSpin 0.8s linear infinite;
  vertical-align: middle;
}
@keyframes saSpin {
  to { transform: rotate(360deg); }
}
.sa-wiz-error {
  min-height: 1.25rem;
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
  color: #dc2626;
}
.sa-wiz-row-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 0.35rem;
}
.sa-wiz-linkish {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.8rem;
  font-weight: 700;
  color: #4f46e5;
  cursor: pointer;
  text-decoration: underline;
}
.sa-wiz-preview {
  margin-top: 0.5rem;
}
.sa-wiz-preview img {
  max-height: 120px;
  max-width: 100%;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}
.sa-wizard-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 1.25rem 1.5rem;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
}
.sa-wiz-footer-btn {
  padding: 0.65rem 1.25rem;
  border-radius: 10px;
  font-weight: 700;
}
.sa-wiz-next-btn {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.sa-wizard-footer button.secondary {
  background: #e2e8f0;
  color: #334155;
}
.sa-wizard-footer button.secondary:hover {
  background: #cbd5e1;
}
.sa-create-msg {
  margin-top: 12px;
  padding: 0 4px;
}

/* SaaS control plane */
.sa-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sa-nav-btn {
  text-align: left;
  background: transparent;
  color: #cbd5e1;
  border: 1px solid transparent;
  padding: 10px 12px;
  border-radius: 8px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}
.sa-nav-btn:hover {
  background: #1f2937;
}
.sa-nav-btn.active {
  background: #312e81;
  border-color: #4f46e5;
  color: #e0e7ff;
}
.sa-badge {
  margin-left: auto;
  background: #b91c1c;
  color: #fff;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 999px;
}
.sa-page-title {
  margin: 0 0 16px;
  font-size: 1.35rem;
}
.sa-metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.sa-metric-card {
  background: #111827;
  border: 1px solid #1f2937;
  border-radius: 12px;
  padding: 14px;
}
.sa-metric-label {
  margin: 0;
  color: #9ca3af;
  font-size: 12px;
}
.sa-metric-value {
  margin: 6px 0 0;
  font-size: 1.4rem;
  font-weight: 700;
}
.sa-plans-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}
.sa-plan-card {
  border: 1px solid #374151;
  border-radius: 10px;
  padding: 12px;
  background: #0f172a;
}
.sa-plan-card h4 {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #a5b4fc;
}
.sa-plan-card label {
  display: block;
  font-size: 12px;
  color: #9ca3af;
  margin-bottom: 8px;
}
.sa-plan-card input[type="text"],
.sa-plan-card input[type="number"] {
  width: 100%;
  margin-top: 4px;
  box-sizing: border-box;
}
.sa-feat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.sa-feat-row label {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  color: #e5e7eb;
}
.status-sub {
  background: #1e3a8a;
  color: #bfdbfe;
}
.sa-drawer {
  position: fixed;
  inset: 0;
  z-index: 100;
}
.sa-drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}
.sa-drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: min(420px, 100%);
  height: 100%;
  background: #0f172a;
  border-left: 1px solid #1f2937;
  padding: 16px;
  overflow: auto;
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.4);
}
.sa-drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.sa-drawer-header h3 {
  margin: 0;
}
.sa-usage {
  margin: 8px 0;
  font-size: 13px;
}
.sa-usage-track {
  height: 6px;
  background: #1f2937;
  border-radius: 999px;
  margin-top: 4px;
  overflow: hidden;
}
.sa-usage-fill {
  height: 100%;
  background: #6366f1;
}
.sa-tx-list {
  padding-left: 18px;
  font-size: 13px;
  color: #cbd5e1;
}
.status-archived { background: #374151; color: #d1d5db; }
.sa-health {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}
.sa-bulk-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 10px;
  margin: 10px 0;
  background: #1e293b;
  border-radius: 8px;
  border: 1px solid #334155;
}
.sa-pager { margin-top: 12px; align-items: center; }
.sa-charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}
.sa-toast-host {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sa-toast {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  max-width: 320px;
}
.sa-toast-ok { background: #065f46; color: #a7f3d0; }
.sa-toast-err { background: #7f1d1d; color: #fecaca; }
.sa-drawer-form label {
  display: block;
  margin: 6px 0;
  font-size: 13px;
}
.sa-drawer-form input[type="text"],
.sa-drawer-form input[type="number"],
.sa-drawer-form input:not([type]) {
  width: 100%;
  margin-top: 4px;
}
.sa-drawer-actions { margin-bottom: 12px; }
.sa-link-btn {
  display: inline-flex;
  align-items: center;
  padding: 10px;
  border-radius: 8px;
  background: #374151;
  color: #e5e7eb;
  text-decoration: none;
  font-weight: 600;
  font-size: 13px;
}
.sa-empty { text-align: center; padding: 20px !important; }
.sa-sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.sa-sidebar-toggle { display: none; padding: 8px 10px; }
body.sa-sidebar-collapsed .sidebar .sa-nav,
body.sa-sidebar-collapsed .sidebar #whoami,
body.sa-sidebar-collapsed .sidebar #whoami-role,
body.sa-sidebar-collapsed .sidebar #app-logout-btn {
  display: none !important;
}
@media (max-width: 800px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .sidebar {
    border-right: none;
    border-bottom: 1px solid #1f2937;
  }
  .sa-nav {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .sa-sidebar-toggle { display: inline-flex; }
}
