/* ===== Design tokens ===== */
:root {
  --sa-bg: #070B14;
  --sa-surface: #0D1321;
  --sa-elevated: #151C2F;
  --sa-border: rgba(148, 163, 184, 0.12);
  --sa-border-strong: rgba(148, 163, 184, 0.22);
  --sa-primary: #6366F1;
  --sa-primary-2: #8B5CF6;
  --sa-cyan: #06B6D4;
  --sa-emerald: #10B981;
  --sa-amber: #F59E0B;
  --sa-rose: #F43F5E;
  --sa-teal: #14B8A6;
  --sa-text: #F1F5F9;
  --sa-muted: #94A3B8;
  --sa-gradient: linear-gradient(135deg, #6366F1 0%, #8B5CF6 55%, #06B6D4 100%);
  --sa-gradient-soft: linear-gradient(135deg, rgba(99, 102, 241, 0.25) 0%, rgba(139, 92, 246, 0.18) 100%);
  --sa-radius: 12px;
  --sa-radius-lg: 16px;
  --sa-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
  --sa-shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.45);
  --sa-font-display: "Plus Jakarta Sans", Inter, system-ui, sans-serif;
  --sa-font-body: Inter, system-ui, -apple-system, sans-serif;
  --sa-sidebar-w: 260px;
  --sa-input-h: 40px;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--sa-font-body);
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, rgba(99, 102, 241, 0.22), transparent 55%),
    radial-gradient(ellipse 60% 40% at 90% 0%, rgba(139, 92, 246, 0.12), transparent 50%),
    var(--sa-bg);
  background-attachment: fixed;
  color: var(--sa-text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, .brand, .sa-page-title, .sa-metric-value {
  font-family: var(--sa-font-display);
}

.layout {
  display: grid;
  grid-template-columns: var(--sa-sidebar-w) 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: rgba(13, 19, 33, 0.92);
  backdrop-filter: blur(16px);
  border-right: 1px solid var(--sa-border);
  padding: 18px 14px;
  z-index: 40;
  overflow-y: auto;
}

.brand {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
}

.sa-brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: #1E293B;
  border: 1px solid rgba(148, 163, 184, 0.22);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #E2E8F0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}

.sa-brand-mark--sm {
  width: 28px;
  height: 28px;
  border-radius: 8px;
}

.sa-brand-svg {
  display: block;
}

.muted { color: var(--sa-muted); font-size: 13px; }
.danger { color: #fda4af; }
.hidden { display: none !important; }

.main {
  padding: 24px 28px 40px;
  min-width: 0;
}

.card {
  background: var(--sa-surface);
  border: 1px solid var(--sa-border);
  border-radius: var(--sa-radius-lg);
  padding: 18px 20px;
  margin-bottom: 16px;
  box-shadow: var(--sa-shadow);
}

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

/* ===== Forms & buttons ===== */
input, select, button, textarea {
  border-radius: 10px;
  border: 1px solid var(--sa-border-strong);
  background: var(--sa-elevated);
  color: var(--sa-text);
  padding: 0 14px;
  font-family: inherit;
  font-size: 14px;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

input, select, textarea {
  min-height: var(--sa-input-h);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.25);
}

textarea { padding: 10px 14px; min-height: 80px; resize: vertical; }

input:focus, select:focus, textarea:focus, button:focus-visible {
  outline: none;
  border-color: var(--sa-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}

button {
  min-height: var(--sa-input-h);
  background: var(--sa-gradient);
  border: none;
  cursor: pointer;
  font-weight: 650;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
}

button:hover { filter: brightness(1.08); }
button:active { transform: translateY(1px); }

button.secondary,
.btn-secondary {
  background: rgba(148, 163, 184, 0.12);
  border: 1px solid var(--sa-border-strong);
  color: var(--sa-text);
  filter: none;
}

button.secondary:hover,
.btn-secondary:hover {
  background: rgba(148, 163, 184, 0.2);
  filter: none;
}

.btn-ghost,
button.btn-ghost {
  background: transparent;
  border: 1px solid var(--sa-border);
  color: var(--sa-muted);
  filter: none;
}

.btn-ghost:hover {
  color: var(--sa-text);
  background: rgba(148, 163, 184, 0.1);
  filter: none;
}

.btn-danger,
button.btn-danger {
  background: linear-gradient(135deg, #e11d48, #be123c);
}

.btn-sm,
button.btn-sm {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
  border-radius: 8px;
}

.btn-primary {
  background: var(--sa-gradient);
  color: #fff;
  border: none;
}

/* ===== Tables ===== */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

th, td {
  border-bottom: 1px solid var(--sa-border);
  padding: 12px 10px;
  text-align: left;
}

th {
  color: var(--sa-muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(15, 23, 42, 0.5);
}

tbody tr {
  transition: background 0.12s;
}

tbody tr:hover {
  background: rgba(99, 102, 241, 0.06);
}

.sa-table-wrap {
  border: 1px solid var(--sa-border);
  border-radius: var(--sa-radius);
  overflow: auto;
  max-height: min(60vh, 640px);
}

.sa-table-wrap thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--sa-elevated);
}

.sa-table-wrap .sa-col-check { width: 40px; }
.sa-table-wrap .sa-col-balance { text-align: right; font-variant-numeric: tabular-nums; }
.sa-td-balance { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.sa-td-id {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  color: var(--sa-muted);
  margin-top: 2px;
}
.sa-site-cell { display: flex; align-items: flex-start; gap: 8px; }

.status-pill {
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 650;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.status-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.85;
}

.status-active { background: rgba(16, 185, 129, 0.15); color: #6ee7b7; }
.status-suspended { background: rgba(244, 63, 94, 0.15); color: #fda4af; }
.status-archived { background: rgba(148, 163, 184, 0.15); color: #cbd5e1; }
.status-sub { background: rgba(99, 102, 241, 0.18); color: #c7d2fe; }

.sa-health {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-top: 4px;
  flex-shrink: 0;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.06);
}

.sa-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  margin: 2px 3px 2px 0;
  background: rgba(148, 163, 184, 0.15);
  color: var(--sa-muted);
}

.sa-chip-warning {
  background: rgba(245, 158, 11, 0.18);
  color: #fcd34d;
}

.sa-chip-danger {
  background: rgba(244, 63, 94, 0.18);
  color: #fda4af;
}

/* ===== Sidebar ===== */
.sa-sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 16px;
}

.sa-sidebar-toggle {
  display: none;
  padding: 8px 10px;
  min-height: 36px;
}

.sa-user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--sa-radius);
  background: var(--sa-elevated);
  border: 1px solid var(--sa-border);
  margin-bottom: 16px;
}

.sa-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--sa-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
  color: #fff;
  flex-shrink: 0;
}

.sa-user-meta { min-width: 0; flex: 1; }
.sa-user-email {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
}

.sa-role-pill {
  display: inline-flex;
  margin-top: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sa-role-owner { background: rgba(245, 158, 11, 0.2); color: #fcd34d; }
.sa-role-billing { background: rgba(6, 182, 212, 0.2); color: #67e8f9; }
.sa-role-support { background: rgba(16, 185, 129, 0.2); color: #6ee7b7; }

.sa-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.sa-nav-group { margin-bottom: 12px; }

.sa-nav-group-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--sa-muted);
  padding: 6px 12px 6px;
  opacity: 0.75;
}

.sa-nav-btn {
  text-align: left;
  background: transparent;
  color: #cbd5e1;
  border: 1px solid transparent;
  padding: 9px 12px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
  min-height: 40px;
  filter: none !important;
  box-shadow: none !important;
}

.sa-nav-btn i {
  width: 18px;
  text-align: center;
  opacity: 0.85;
  font-size: 13px;
}

.sa-nav-btn:hover {
  background: rgba(148, 163, 184, 0.08);
  color: var(--sa-text);
}

.sa-nav-btn.active {
  background: var(--sa-gradient-soft);
  color: #e0e7ff;
  border-color: transparent;
}

.sa-nav-btn.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 4px 4px 0;
  background: var(--sa-gradient);
}

.sa-nav-btn.active i { opacity: 1; color: #a5b4fc; }

.sa-badge {
  margin-left: auto;
  background: var(--sa-rose);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  min-width: 18px;
  text-align: center;
  animation: saPulseBadge 1.6s ease-in-out infinite;
}

@keyframes saPulseBadge {
  0%, 100% { box-shadow: 0 0 0 0 rgba(244, 63, 94, 0.5); }
  50% { box-shadow: 0 0 0 5px rgba(244, 63, 94, 0); }
}

.sa-sidebar-footer {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--sa-border);
}

.sa-sidebar-footer #app-logout-btn {
  width: 100%;
}

/* ===== Page header ===== */
.sa-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.sa-page-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.sa-page-subtitle {
  margin: 4px 0 0;
  color: var(--sa-muted);
  font-size: 13px;
}

.sa-page-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

/* ===== Metrics ===== */
.sa-metric-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}

.sa-metric-card {
  background: var(--sa-surface);
  border: 1px solid var(--sa-border);
  border-radius: var(--sa-radius-lg);
  padding: 16px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--sa-shadow);
  transition: transform 0.15s, border-color 0.15s;
}

.sa-metric-card:hover {
  border-color: var(--sa-border-strong);
  transform: translateY(-1px);
}

.sa-metric-card::after {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 2px;
  background: var(--metric-accent, var(--sa-primary));
  opacity: 0.7;
}

.sa-metric-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.sa-metric-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: #fff;
  background: var(--metric-accent, var(--sa-primary));
  box-shadow: 0 4px 12px color-mix(in srgb, var(--metric-accent, var(--sa-primary)) 40%, transparent);
}

.sa-metric-card[data-accent="indigo"] { --metric-accent: #6366F1; }
.sa-metric-card[data-accent="emerald"] { --metric-accent: #10B981; }
.sa-metric-card[data-accent="rose"] { --metric-accent: #F43F5E; }
.sa-metric-card[data-accent="amber"] { --metric-accent: #F59E0B; }
.sa-metric-card[data-accent="violet"] { --metric-accent: #8B5CF6; }
.sa-metric-card[data-accent="cyan"] { --metric-accent: #06B6D4; }
.sa-metric-card[data-accent="teal"] { --metric-accent: #14B8A6; }

.sa-metric-card.is-pulse .sa-metric-icon {
  animation: saPulseBadge 1.4s ease-in-out infinite;
}

.sa-metric-label {
  margin: 0;
  color: var(--sa-muted);
  font-size: 12px;
  font-weight: 600;
}

.sa-metric-value {
  margin: 0;
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

/* ===== Charts ===== */
.sa-charts-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 16px;
}

.sa-chart-card {
  background: var(--sa-surface);
  border: 1px solid var(--sa-border);
  border-radius: var(--sa-radius-lg);
  padding: 16px;
  box-shadow: var(--sa-shadow);
  min-height: 260px;
  display: flex;
  flex-direction: column;
}

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

.sa-chart-header h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
}

.sa-period-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
}

.sa-chart-body {
  flex: 1;
  position: relative;
  min-height: 180px;
}

.sa-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  padding: 28px 16px;
  color: var(--sa-muted);
  min-height: 160px;
}

.sa-empty-state i {
  font-size: 28px;
  opacity: 0.45;
  background: var(--sa-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.sa-empty-state p {
  margin: 0;
  font-size: 13px;
  max-width: 220px;
  line-height: 1.4;
}

.sa-empty { text-align: center; padding: 28px !important; }

.sa-card-title {
  margin: 0 0 14px;
  font-size: 15px;
  font-weight: 700;
}

/* ===== Toolbar / tenants ===== */
.sa-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
}

.sa-search-wrap {
  position: relative;
  flex: 1;
  min-width: 180px;
}

.sa-search-wrap i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--sa-muted);
  font-size: 13px;
  pointer-events: none;
}

.sa-search-wrap input {
  width: 100%;
  padding-left: 36px;
}

.sa-toolbar select {
  min-width: 120px;
}

.sa-bulk-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 12px 14px;
  margin: 0 0 14px;
  background: var(--sa-elevated);
  border-radius: var(--sa-radius);
  border: 1px solid var(--sa-border);
  border-top: 2px solid transparent;
  border-image: var(--sa-gradient) 1;
  position: sticky;
  top: 0;
  z-index: 5;
}

.sa-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 16px;
}

.sa-page-indicator {
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--sa-elevated);
  border: 1px solid var(--sa-border);
  font-size: 12px;
  font-weight: 600;
  color: var(--sa-muted);
}

.sa-pagination button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  filter: none;
}

/* ===== Plans ===== */
.sa-plans-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.sa-plan-card {
  border: 1px solid var(--sa-border);
  border-radius: var(--sa-radius);
  padding: 14px;
  background: var(--sa-elevated);
}

.sa-plan-card h4 {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #a5b4fc;
  font-size: 12px;
}

.sa-plan-card label {
  display: block;
  font-size: 12px;
  color: var(--sa-muted);
  margin-bottom: 8px;
}

.sa-plan-card input[type="text"],
.sa-plan-card input[type="number"] {
  width: 100%;
  margin-top: 4px;
}

.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: var(--sa-text);
}

/* ===== Drawer ===== */
.sa-drawer {
  position: fixed;
  inset: 0;
  z-index: 100;
}

.sa-drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.65);
  backdrop-filter: blur(4px);
  animation: saFadeIn 0.2s ease;
}

.sa-drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: min(480px, 100%);
  height: 100%;
  background: var(--sa-surface);
  border-left: 1px solid var(--sa-border);
  padding: 18px;
  overflow: auto;
  box-shadow: var(--sa-shadow-lg);
  animation: saSlideIn 0.28s ease;
}

@keyframes saFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes saSlideIn {
  from { transform: translateX(24px); opacity: 0.6; }
  to { transform: translateX(0); opacity: 1; }
}

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

.sa-drawer-header h3 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
}

.sa-drawer-section {
  border: 1px solid var(--sa-border);
  border-radius: var(--sa-radius);
  background: var(--sa-elevated);
  margin-bottom: 12px;
  overflow: hidden;
}

.sa-drawer-section summary,
.sa-drawer-section-title {
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--sa-muted);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sa-drawer-section summary::-webkit-details-marker { display: none; }

.sa-drawer-section-body {
  padding: 0 14px 14px;
}

.sa-drawer-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 14px;
  -webkit-overflow-scrolling: touch;
}

.sa-drawer-actions > * {
  flex-shrink: 0;
}

.sa-drawer-summary {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.sa-stat-tile {
  background: var(--sa-elevated);
  border: 1px solid var(--sa-border);
  border-radius: 10px;
  padding: 10px 12px;
}

.sa-stat-tile span {
  display: block;
  font-size: 11px;
  color: var(--sa-muted);
  margin-bottom: 4px;
}

.sa-stat-tile strong {
  font-size: 14px;
  font-weight: 700;
}

.sa-usage {
  margin: 8px 0;
  font-size: 13px;
}

.sa-usage-track {
  height: 6px;
  background: rgba(148, 163, 184, 0.15);
  border-radius: 999px;
  margin-top: 4px;
  overflow: hidden;
}

.sa-usage-fill {
  height: 100%;
  background: var(--sa-gradient);
  border-radius: 999px;
}

.sa-tx-list {
  padding-left: 18px;
  font-size: 13px;
  color: #cbd5e1;
  margin: 0;
}

.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-link-btn {
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  min-height: 32px;
  border-radius: 8px;
  background: rgba(148, 163, 184, 0.12);
  border: 1px solid var(--sa-border-strong);
  color: var(--sa-text);
  text-decoration: none;
  font-weight: 600;
  font-size: 12px;
}

/* ===== Login ===== */
.sa-login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.sa-login-card {
  width: 100%;
  max-width: 400px;
  background: rgba(13, 19, 33, 0.85);
  backdrop-filter: blur(20px);
  border: 1px solid var(--sa-border);
  border-radius: 20px;
  padding: 32px 28px;
  box-shadow: var(--sa-shadow-lg);
}

.sa-login-brand {
  text-align: center;
  margin-bottom: 24px;
}

.sa-login-brand .sa-brand-mark {
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  display: flex;
  background: #0F172A;
  border: 1px solid rgba(148, 163, 184, 0.28);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    0 8px 20px rgba(0, 0, 0, 0.35);
}

.sa-login-brand .sa-brand-svg {
  width: 22px;
  height: 22px;
  color: #CBD5E1;
}

.sa-login-brand h2 {
  margin: 0 0 6px;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--sa-text);
  letter-spacing: -0.02em;
}

.sa-login-card .sa-field {
  margin-bottom: 12px;
}

.sa-login-card .sa-field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--sa-muted);
  margin-bottom: 6px;
}

.sa-login-card input {
  width: 100%;
}

.sa-login-card #login-btn {
  width: 100%;
  margin-top: 8px;
  min-height: 44px;
}

/* ===== Dark wizard ===== */
.sa-create-card {
  background: transparent;
  border: none;
  padding: 0;
  box-shadow: none;
}

.sa-wizard {
  max-width: 640px;
  background: var(--sa-surface);
  color: var(--sa-text);
  border-radius: var(--sa-radius-lg);
  box-shadow: var(--sa-shadow-lg);
  overflow: hidden;
  border: 1px solid var(--sa-border);
}

.sa-wizard-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--sa-border);
}

.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: var(--sa-text);
}

.sa-wiz-step-indicator {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--sa-muted);
  white-space: nowrap;
}

.sa-wiz-progress-track {
  margin-top: 1rem;
  height: 6px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.15);
  overflow: hidden;
}

.sa-wiz-progress-fill {
  height: 100%;
  width: 25%;
  border-radius: 999px;
  background: var(--sa-gradient);
  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-title {
  margin: 0 0 0.5rem;
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--sa-text);
}

.sa-wiz-welcome-text {
  margin: 0;
  color: var(--sa-muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

.sa-wiz-panel-title {
  margin: 0 0 1rem;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--sa-text);
}

.sa-wiz-field { margin-bottom: 1rem; }

.sa-wiz-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--sa-muted);
  margin-bottom: 0.35rem;
}

.sa-wiz-input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.7rem 1rem;
  font-size: 1rem;
  border: 1px solid var(--sa-border-strong);
  border-radius: 0.75rem;
  background: var(--sa-elevated);
  color: var(--sa-text);
  min-height: var(--sa-input-h);
}

.sa-wiz-input:focus {
  outline: none;
  border-color: var(--sa-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}

.sa-wiz-input.sa-wiz-invalid { border-color: var(--sa-rose); }

.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;
}

.sa-wiz-spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(99, 102, 241, 0.2);
  border-left-color: var(--sa-primary);
  border-radius: 50%;
  animation: saSpin 0.8s linear infinite;
}

@keyframes saSpin {
  to { transform: rotate(360deg); }
}

.sa-wiz-error {
  min-height: 1.25rem;
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
  color: #fda4af;
}

.sa-wiz-sub-preview {
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
}

.sa-wiz-next-btn:disabled,
.sa-wiz-busy {
  opacity: 0.65;
  cursor: wait;
}

.sa-create-success {
  margin-top: 4px;
  padding: 18px 16px;
  border: 1px solid #c7d2fe;
  border-radius: 14px;
  background: #eef2ff;
}

.sa-create-success-title {
  margin: 0 0 6px;
  font-size: 1.15rem;
  color: #312e81;
}

.sa-create-success-meta {
  display: grid;
  gap: 8px;
  margin: 0 0 14px;
}

.sa-create-success-meta div {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 8px;
  align-items: baseline;
}

.sa-create-success-meta dt {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.sa-create-success-meta dd {
  margin: 0;
  font-size: 0.92rem;
  color: #1e293b;
  word-break: break-all;
}

.sa-create-credentials {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid #c7d2fe;
  border-radius: 12px;
  background: #eef2ff;
}

.sa-wiz-row-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 0.35rem;
}

.sa-wiz-linkish {
  background: none !important;
  border: none !important;
  padding: 0 !important;
  min-height: auto !important;
  font-size: 0.8rem;
  font-weight: 700;
  color: #a5b4fc !important;
  cursor: pointer;
  text-decoration: underline;
  filter: none !important;
  box-shadow: none !important;
}

.sa-wiz-preview { margin-top: 0.5rem; }

.sa-wiz-preview img {
  max-height: 120px;
  max-width: 100%;
  border-radius: 8px;
  border: 1px solid var(--sa-border);
}

.sa-wizard-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 1.25rem 1.5rem;
  background: var(--sa-elevated);
  border-top: 1px solid var(--sa-border);
}

.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-create-msg {
  margin-top: 12px;
  padding: 0 4px;
}

/* ===== Toasts ===== */
.sa-toast-host {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.sa-toast {
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 650;
  box-shadow: var(--sa-shadow-lg);
  max-width: 340px;
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
  animation: saToastIn 0.28s ease;
  border: 1px solid var(--sa-border);
}

.sa-toast i { font-size: 14px; flex-shrink: 0; }

@keyframes saToastIn {
  from { opacity: 0; transform: translateX(16px); }
  to { opacity: 1; transform: translateX(0); }
}

.sa-toast-ok {
  background: rgba(6, 78, 59, 0.95);
  color: #a7f3d0;
  border-color: rgba(16, 185, 129, 0.35);
}

.sa-toast-err {
  background: rgba(127, 29, 29, 0.95);
  color: #fecaca;
  border-color: rgba(244, 63, 94, 0.35);
}

/* ===== Skeleton ===== */
.sa-skeleton {
  background: linear-gradient(
    90deg,
    rgba(148, 163, 184, 0.08) 0%,
    rgba(148, 163, 184, 0.18) 50%,
    rgba(148, 163, 184, 0.08) 100%
  );
  background-size: 200% 100%;
  animation: saShimmer 1.2s ease-in-out infinite;
  border-radius: 8px;
  color: transparent !important;
  pointer-events: none;
  user-select: none;
}

@keyframes saShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.sa-metric-card.sa-skeleton-loading .sa-metric-value {
  min-height: 1.55rem;
  border-radius: 6px;
}

/* ===== Mobile / overlay ===== */
.sa-sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.6);
  z-index: 35;
  backdrop-filter: blur(2px);
}

body.sa-sidebar-open .sa-sidebar-backdrop {
  display: block;
}

@media (max-width: 1100px) {
  .sa-metric-grid { grid-template-columns: repeat(2, 1fr); }
  .sa-charts-grid { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .sa-metric-grid { grid-template-columns: 1fr; }
}

@media (max-width: 800px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: min(280px, 86vw);
    transform: translateX(-105%);
    transition: transform 0.28s ease;
    z-index: 50;
    height: 100vh;
  }

  body.sa-sidebar-open .sidebar {
    transform: translateX(0);
  }

  .sa-sidebar-toggle {
    display: inline-flex !important;
  }

  .main {
    padding: 16px;
    padding-top: 60px;
  }

  .sa-mobile-bar:not(.hidden) {
    display: flex !important;
  }

  .sa-toolbar select {
    flex: 1 1 140px;
  }
}

.sa-mobile-bar {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
  padding: 10px 14px;
  background: rgba(13, 19, 33, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--sa-border);
  align-items: center;
  gap: 10px;
}

.sa-mobile-bar .brand {
  font-size: 1rem;
}

.sa-pager { margin-top: 12px; align-items: center; }

.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; }
