/* ============================================================
   Galaxy Admin Portal — Stripe-sandbox style (light, flat, monochrome)
   All .adm-* class names are kept stable so admin.js continues to work.
   ============================================================ */

:root {
  --adm-bg:           #f6f8fb;
  --adm-surface:      #ffffff;
  --adm-surface-hov:  #f8fafc;
  --adm-text-1:       #1a1f36;     /* headlines */
  --adm-text-2:       #425466;     /* body */
  --adm-text-3:       #8792a2;     /* muted */
  --adm-text-4:       #b1b9c4;     /* hint */
  --adm-border:       #e6eaee;     /* card / table borders */
  --adm-border-2:     #d4dae0;     /* inputs */
  --adm-link:         #635bff;     /* Stripe purple-blue */
  --adm-link-hover:   #4a44e0;
  --adm-link-soft-bg: rgba(99,91,255,0.08);
  --adm-success-bg:   #d7f7e3;
  --adm-success-fg:   #006908;
  --adm-warn-bg:      #fef3d8;
  --adm-warn-fg:      #7a4f01;
  --adm-error-bg:     #ffe3e3;
  --adm-error-fg:     #b91c1c;
  --adm-radius:       8px;
  --adm-radius-lg:    12px;
  --adm-shadow:       0 1px 3px rgba(15,23,42,0.05);
  --adm-shadow-pop:   0 8px 24px rgba(15,23,42,0.08);
}

/* Force light styling regardless of any cached gx_theme value */
html[data-theme="dark"] body,
html[data-theme="light"] body,
body {
  background: var(--adm-bg);
  color: var(--adm-text-2);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  margin: 0;
  font-feature-settings: 'cv02', 'cv03', 'cv11';
}
* { box-sizing: border-box; }

/* ── Top notice banner (Stripe sandbox style) ────────────────── */
.adm-topbar {
  background: #0a0e27;
  color: #c5cae3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 11px 24px;
  font-size: 13px;
  font-weight: 500;
}
.adm-topbar-left { display: inline-flex; align-items: center; gap: 14px; min-width: 0; }
.adm-topbar-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  color: #e6eaf5;
}
.adm-topbar-msg { color: #c5cae3; opacity: 0.85; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adm-topbar-btn {
  display: inline-flex; align-items: center;
  background: #fff;
  color: #1a1f36;
  border: 1px solid #fff;
  font-weight: 600;
  font-size: 13px;
  padding: 7px 14px;
  border-radius: 7px;
  text-decoration: none;
  flex-shrink: 0;
}
.adm-topbar-btn:hover { background: #f2f3f7; }
@media (max-width: 720px) { .adm-topbar-msg { display: none; } }

/* ── Layout shell ─────────────────────────────────────────────── */
.adm-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: calc(100vh - 44px);
}
@media (max-width: 1023px) { .adm-layout { grid-template-columns: 1fr; } }

/* ── Sidebar ──────────────────────────────────────────────────── */
.adm-sidebar {
  background: var(--adm-surface);
  border-right: 1px solid var(--adm-border);
  padding: 12px 12px 18px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: calc(100vh - 44px);
  overflow-y: auto;
}
@media (max-width: 1023px) {
  .adm-sidebar {
    position: fixed;
    top: 44px; left: 0;
    width: 260px;
    z-index: 60;
    transform: translateX(-100%);
    transition: transform .2s ease;
    box-shadow: var(--adm-shadow-pop);
  }
  .adm-sidebar.open { transform: translateX(0); }
}

.adm-sidebar-top {
  padding: 6px 8px 14px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--adm-border);
}
.adm-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 4px;
  border-radius: var(--adm-radius);
  font-size: 14px;
  font-weight: 600;
  color: var(--adm-text-1);
  cursor: pointer;
  transition: background .15s;
}
.adm-logo:hover { background: var(--adm-surface-hov); }
.adm-logo > i { color: var(--adm-text-3); }
.adm-logo > span { display: inline-flex; flex-direction: column; gap: 0; line-height: 1.2; }
.adm-logo-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--adm-link);
  background: var(--adm-link-soft-bg);
  padding: 2px 6px;
  border-radius: 4px;
  margin-top: 2px;
  width: fit-content;
}

.adm-nav { display: flex; flex-direction: column; gap: 1px; flex: 1; margin-top: 4px; }
.adm-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--adm-text-2);
  text-decoration: none;
  cursor: pointer;
  transition: background .12s, color .12s;
}
.adm-nav-item > i { color: var(--adm-text-3); flex-shrink: 0; }
.adm-nav-item:hover { background: var(--adm-surface-hov); color: var(--adm-text-1); }
.adm-nav-item.active { background: #f0f1ff; color: var(--adm-link); }
.adm-nav-item.active > i { color: var(--adm-link); }

.adm-nav-badge {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  color: var(--adm-text-3);
  background: var(--adm-bg);
  padding: 1px 7px;
  border-radius: 99px;
  border: 1px solid var(--adm-border);
}
.adm-nav-item.active .adm-nav-badge { background: #fff; border-color: #d6d8ff; color: var(--adm-link); }

.adm-nav-status {
  margin-left: auto;
  font-size: 10px;
  line-height: 1;
  color: #f59e0b;
}
.adm-nav-status.ok    { color: #16a34a; }
.adm-nav-status.warn  { color: #d97706; }
.adm-nav-status.error { color: #dc2626; }

.adm-sidebar-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 8px 4px;
  margin-top: 8px;
  border-top: 1px solid var(--adm-border);
}
.adm-admin-row { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.adm-admin-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, #635bff, #8b5cf6);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.adm-admin-info { min-width: 0; }
.adm-admin-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--adm-text-1);
  line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.adm-admin-email {
  font-size: 11px;
  color: var(--adm-text-3);
  line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.adm-signout {
  background: transparent;
  border: 1px solid var(--adm-border);
  color: var(--adm-text-3);
  padding: 6px;
  border-radius: 6px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .12s, color .12s, border-color .12s;
}
.adm-signout:hover { background: var(--adm-surface-hov); color: var(--adm-text-1); border-color: var(--adm-border-2); }

/* ── Main column ──────────────────────────────────────────────── */
.adm-main { min-width: 0; padding: 0; background: var(--adm-bg); }

.adm-utility-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 28px;
  background: var(--adm-surface);
  border-bottom: 1px solid var(--adm-border);
  position: sticky;
  top: 0;
  z-index: 30;
}
.adm-utility-search { flex: 1; max-width: 480px; position: relative; }
.adm-utility-search input {
  width: 100%;
  border: 1px solid var(--adm-border);
  background: var(--adm-bg);
  border-radius: 8px;
  padding: 8px 14px 8px 36px;
  font-size: 13px;
  color: var(--adm-text-1);
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.adm-utility-search input::placeholder { color: var(--adm-text-3); }
.adm-utility-search input:focus {
  outline: none;
  background: #fff;
  border-color: var(--adm-link);
  box-shadow: 0 0 0 3px var(--adm-link-soft-bg);
}
.adm-utility-search-icon {
  position: absolute;
  left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--adm-text-3);
  pointer-events: none;
}

.adm-utility-actions { display: inline-flex; gap: 4px; align-items: center; }
.adm-utility-icon-btn {
  background: transparent;
  border: none;
  color: var(--adm-text-3);
  width: 32px; height: 32px;
  border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background .12s, color .12s;
}
.adm-utility-icon-btn:hover { background: var(--adm-surface-hov); color: var(--adm-text-1); }
.adm-utility-create-btn {
  background: var(--adm-link);
  color: #fff;
  border: none;
  width: 32px; height: 32px;
  border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  margin-left: 6px;
  transition: background .12s;
}
.adm-utility-create-btn:hover { background: var(--adm-link-hover); }

.adm-hamburger {
  background: transparent;
  border: 1px solid var(--adm-border);
  border-radius: 6px;
  padding: 6px;
  display: none;
  color: var(--adm-text-2);
  cursor: pointer;
}
@media (max-width: 1023px) { .adm-hamburger { display: inline-flex; } }

.adm-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 32px 28px 18px;
}
.adm-header-titleblock { min-width: 0; flex: 1; }
.adm-page-title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--adm-text-1);
  margin: 0;
}
.adm-page-subtitle {
  font-size: 14px;
  color: var(--adm-text-3);
  margin: 6px 0 0;
  line-height: 1.5;
}
.adm-header-actions { display: inline-flex; align-items: center; gap: 10px; flex-shrink: 0; padding-top: 4px; }
.adm-live-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--adm-success-bg);
  color: var(--adm-success-fg);
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
}
.adm-live-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--adm-success-fg);
  animation: adm-pulse 1.6s ease-in-out infinite;
}
@keyframes adm-pulse { 0%,100% { opacity: 1; } 50% { opacity: .4; } }
/* Shown instead of green when Supabase has no reachable users yet, so the
   admin never mistakes the built-in demo dataset for real activity. */
.adm-live-chip-demo { background: var(--adm-warn-bg); color: var(--adm-warn-fg); }
.adm-live-chip-demo .adm-live-dot { background: var(--adm-warn-fg); }
.adm-updated-text { font-size: 12px; color: var(--adm-text-3); }

/* ── Sections ─────────────────────────────────────────────────── */
.adm-section { display: none; padding: 0 28px 60px; }
.adm-section.active { display: block; }
@media (max-width: 640px) {
  .adm-header        { padding: 24px 18px 14px; }
  .adm-section       { padding: 0 18px 48px; }
  .adm-utility-bar   { padding: 10px 18px; }
}

.adm-section-subhead {
  margin: 32px 0 14px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--adm-border);
  padding-bottom: 10px;
}
.adm-section-subhead-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--adm-text-1);
  margin: 0;
}
.adm-section-subhead-link {
  font-size: 13px;
  font-weight: 500;
  color: var(--adm-link);
  text-decoration: none;
}
.adm-section-subhead-link:hover { color: var(--adm-link-hover); text-decoration: underline; }

/* ── Stat cards ───────────────────────────────────────────────── */
.adm-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.adm-stat-card {
  background: var(--adm-surface);
  border: 1px solid var(--adm-border);
  border-radius: var(--adm-radius);
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: border-color .15s, box-shadow .15s;
}
.adm-stat-card:hover { border-color: var(--adm-border-2); box-shadow: var(--adm-shadow); }
.adm-stat-icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.adm-stat-val {
  font-size: 22px;
  font-weight: 700;
  color: var(--adm-text-1);
  letter-spacing: -0.01em;
  line-height: 1.1;
}
.adm-stat-lbl {
  font-size: 12px;
  color: var(--adm-text-3);
  margin-top: 3px;
}

/* ── Card / data card ─────────────────────────────────────────── */
.adm-card {
  background: var(--adm-surface);
  border: 1px solid var(--adm-border);
  border-radius: var(--adm-radius);
  padding: 20px 22px;
}
.adm-card-head {
  font-size: 14px;
  font-weight: 600;
  color: var(--adm-text-1);
  margin: 0 0 14px;
  display: flex; align-items: center; gap: 8px;
}

/* ── Two-column row (charts / breakdowns) ─────────────────────── */
.adm-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 980px) { .adm-two-col { grid-template-columns: 1fr; } }
.adm-charts-row { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; }
@media (max-width: 980px) { .adm-charts-row { grid-template-columns: 1fr; } }
.adm-chart-box { width: 100%; height: 240px; position: relative; }

/* ── User table ───────────────────────────────────────────────── */
.adm-table-wrap {
  background: var(--adm-surface);
  border: 1px solid var(--adm-border);
  border-radius: var(--adm-radius);
  overflow: hidden;
}
.adm-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.adm-table thead th {
  background: var(--adm-bg);
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--adm-text-3);
  padding: 12px 18px;
  border-bottom: 1px solid var(--adm-border);
  white-space: nowrap;
}
.adm-table tbody td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--adm-border);
  color: var(--adm-text-2);
  vertical-align: middle;
}
.adm-table tbody tr:last-child td { border-bottom: none; }
.adm-table tbody tr { cursor: pointer; transition: background .12s; }
.adm-table tbody tr:hover { background: var(--adm-surface-hov); }
.adm-table .adm-cell-name {
  display: flex; align-items: center; gap: 10px;
  color: var(--adm-text-1);
  font-weight: 600;
}
.adm-table .adm-cell-name-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-size: 11px; font-weight: 700;
  flex-shrink: 0;
}

.adm-plan-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.adm-plan-pill.starter { background: #eef0f4; color: #4a5567; }
.adm-plan-pill.pro     { background: #f0f1ff; color: var(--adm-link); }
.adm-plan-pill.elite   { background: var(--adm-warn-bg); color: var(--adm-warn-fg); }

/* ── User detail modal ────────────────────────────────────────── */
.adm-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.45);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  z-index: 200;
  animation: fade-in .15s;
}
.adm-modal-overlay.hidden { display: none; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.adm-modal-box {
  position: relative;
  background: var(--adm-surface);
  border: 1px solid var(--adm-border);
  border-radius: var(--adm-radius-lg);
  padding: 28px;
  max-width: 720px;
  width: 100%;
  max-height: calc(100vh - 60px);
  overflow-y: auto;
  box-shadow: var(--adm-shadow-pop);
}
.adm-modal-close {
  position: absolute;
  top: 16px; right: 16px;
  width: 30px; height: 30px;
  background: transparent;
  border: none;
  color: var(--adm-text-3);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.adm-modal-close:hover { background: var(--adm-surface-hov); color: var(--adm-text-1); }

.adm-modal-head { display: flex; align-items: center; gap: 18px; margin-bottom: 22px; padding-right: 40px; }
.adm-modal-avatar {
  width: 56px; height: 56px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 22px; font-weight: 700;
  flex-shrink: 0;
}
.adm-modal-identity { min-width: 0; }
.adm-modal-name  { font-size: 18px; font-weight: 700; color: var(--adm-text-1); margin-bottom: 4px; }
.adm-modal-email { font-size: 13px; color: var(--adm-text-3); margin-bottom: 8px; }

.adm-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}
.adm-info-cell {
  background: var(--adm-bg);
  border: 1px solid var(--adm-border);
  padding: 12px 14px;
  border-radius: var(--adm-radius);
}
.adm-info-lbl {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--adm-text-3);
  margin-bottom: 4px;
}
.adm-info-val { font-size: 14px; font-weight: 600; color: var(--adm-text-1); }

.adm-modal-section { margin-bottom: 22px; }
.adm-section-title { font-size: 13px; font-weight: 600; color: var(--adm-text-1); margin: 0 0 10px; }
.adm-docs-row { display: flex; gap: 8px; flex-wrap: wrap; }

.adm-app-chips {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}
.adm-app-chip {
  background: var(--adm-bg);
  border: 1px solid var(--adm-border);
  border-radius: var(--adm-radius);
  padding: 12px 14px;
}
.adm-app-chip-num { font-size: 22px; font-weight: 700; color: var(--adm-text-1); line-height: 1.05; }
.adm-app-chip-lbl { font-size: 11px; color: var(--adm-text-3); margin-top: 4px; }
@media (max-width: 480px) { .adm-app-chips { grid-template-columns: repeat(2, 1fr); } }

.adm-filter-tabs {
  display: inline-flex;
  background: var(--adm-bg);
  border: 1px solid var(--adm-border);
  border-radius: 8px;
  padding: 3px;
}
.adm-ftab {
  background: transparent;
  border: none;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--adm-text-3);
  border-radius: 5px;
  cursor: pointer;
  transition: background .12s, color .12s;
}
.adm-ftab:hover { color: var(--adm-text-1); }
.adm-ftab.active { background: var(--adm-surface); color: var(--adm-text-1); box-shadow: var(--adm-shadow); }

.adm-user-chart-box { width: 100%; height: 200px; }

/* ── Stripe Webhooks section ──────────────────────────────────── */
.adm-webhook-grid {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 18px;
  align-items: start;
}
@media (max-width: 1100px) { .adm-webhook-grid { grid-template-columns: 1fr; } }

.adm-webhook-status-card { padding: 22px; }
.adm-status-list { display: flex; flex-direction: column; gap: 8px; }
.adm-status-row {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 14px;
  align-items: center;
  padding: 12px 14px;
  background: var(--adm-bg);
  border: 1px solid var(--adm-border);
  border-radius: var(--adm-radius);
}
.adm-status-row[data-state="ok"]    { background: var(--adm-success-bg); border-color: #c8f3d4; }
.adm-status-row[data-state="warn"]  { background: var(--adm-warn-bg);    border-color: #fde9b3; }
.adm-status-row[data-state="error"] { background: var(--adm-error-bg);   border-color: #f9c7c7; }

.adm-status-pill {
  display: inline-flex;
  align-items: center; justify-content: center;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}
.adm-status-pill.loading { background: #e8ecf0; color: var(--adm-text-3); }
.adm-status-pill.ok      { background: #c8f3d4; color: var(--adm-success-fg); }
.adm-status-pill.warn    { background: #fde9b3; color: var(--adm-warn-fg); }
.adm-status-pill.error   { background: #f9c7c7; color: var(--adm-error-fg); }
.adm-status-label { font-size: 13px; font-weight: 600; color: var(--adm-text-1); }
.adm-status-sub   { font-size: 11px; color: var(--adm-text-3); margin-top: 2px; line-height: 1.45; }

.adm-webhook-last {
  margin-top: 14px;
  font-size: 12px;
  color: var(--adm-text-3);
  padding: 10px 12px;
  background: var(--adm-bg);
  border-radius: 6px;
  border-left: 3px solid var(--adm-link);
}

.adm-steps { padding-left: 18px; margin: 0; }
.adm-steps li {
  font-size: 13px;
  color: var(--adm-text-2);
  line-height: 1.6;
  padding: 8px 0;
  border-bottom: 1px solid var(--adm-border);
}
.adm-steps li:last-child { border-bottom: none; }
.adm-steps li strong { color: var(--adm-text-1); font-weight: 600; }
.adm-steps li code {
  font-size: 11px;
  background: var(--adm-bg);
  padding: 1px 6px;
  border-radius: 4px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  color: var(--adm-text-1);
  border: 1px solid var(--adm-border);
}
.adm-step-link {
  display: inline-block;
  margin-left: 8px;
  font-size: 12px;
  color: var(--adm-link);
  text-decoration: none;
  font-weight: 600;
}
.adm-step-link:hover { color: var(--adm-link-hover); text-decoration: underline; }

.adm-copy-row {
  display: flex; align-items: center; gap: 8px;
  background: var(--adm-bg);
  border: 1px solid var(--adm-border);
  padding: 8px 12px;
  border-radius: 6px;
  margin-top: 6px;
}
.adm-copy-row code {
  flex: 1;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11.5px;
  color: var(--adm-text-1);
  word-break: break-all;
  background: transparent; border: none; padding: 0;
}
.adm-copy-btn {
  padding: 4px 10px;
  background: var(--adm-surface);
  color: var(--adm-link);
  border: 1px solid var(--adm-border);
  border-radius: 5px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background .12s, border-color .12s;
  white-space: nowrap;
}
.adm-copy-btn:hover  { background: var(--adm-link-soft-bg); border-color: #c2c0ff; }
.adm-copy-btn.copied { background: var(--adm-success-bg); color: var(--adm-success-fg); border-color: #c8f3d4; }

.adm-input-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--adm-text-3);
  margin-bottom: 6px;
}
.adm-input {
  width: 100%;
  background: var(--adm-surface);
  border: 1px solid var(--adm-border);
  border-radius: 6px;
  padding: 9px 12px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12.5px;
  color: var(--adm-text-1);
  transition: border-color .15s, box-shadow .15s;
}
.adm-input:focus {
  outline: none;
  border-color: var(--adm-link);
  box-shadow: 0 0 0 3px var(--adm-link-soft-bg);
}
.adm-input-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px;
  color: var(--adm-text-3);
  margin-top: 6px;
  cursor: pointer;
  user-select: none;
}

.adm-primary-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px;
  background: var(--adm-link);
  border: none;
  border-radius: 6px;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .12s;
}
.adm-primary-btn:hover { background: var(--adm-link-hover); }
.adm-secondary-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px;
  background: var(--adm-surface);
  border: 1px solid var(--adm-border);
  border-radius: 6px;
  color: var(--adm-text-2);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
}
.adm-secondary-btn:hover { background: var(--adm-surface-hov); color: var(--adm-text-1); border-color: var(--adm-border-2); }

/* ── Emails composer ── */
.adm-input-prose { font-family: 'Inter', -apple-system, system-ui, sans-serif; font-size: 13.5px; }
.adm-textarea { resize: vertical; min-height: 160px; line-height: 1.55; }
.adm-tpl-row { display: flex; flex-wrap: wrap; gap: 8px; }
.adm-tpl-btn {
  font-size: 12.5px;
  font-weight: 600;
  padding: 7px 13px;
  border-radius: 99px;
  border: 1px solid var(--adm-border);
  background: var(--adm-surface);
  color: var(--adm-text-2);
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.adm-tpl-btn:hover { background: var(--adm-surface-hov); border-color: var(--adm-border-2); color: var(--adm-text-1); }

.adm-snippet-wrap { margin-top: 18px; }
.adm-snippet-head {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px;
  color: var(--adm-text-2);
  margin-bottom: 6px;
}
.adm-snippet-head code {
  background: var(--adm-bg);
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid var(--adm-border);
  font-size: 11px;
}
.adm-snippet {
  background: #1a1f36;
  border: 1px solid #1a1f36;
  border-radius: 6px;
  padding: 14px 16px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px;
  color: #e6eaf5;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 220px;
  overflow: auto;
  line-height: 1.55;
}
.adm-snippet-hint {
  font-size: 11px;
  color: var(--adm-text-3);
  margin: 8px 0 0;
}

/* ── Floating bottom-right cluster ────────────────────────────── */
.adm-floating-cluster {
  position: fixed;
  bottom: 18px;
  right: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 100;
}
.adm-floating-btn {
  width: 32px; height: 32px;
  background: var(--adm-surface);
  border: 1px solid var(--adm-border);
  border-radius: 6px;
  color: var(--adm-text-3);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  box-shadow: var(--adm-shadow);
  transition: background .12s, color .12s, transform .12s;
}
.adm-floating-btn:hover { background: var(--adm-surface-hov); color: var(--adm-text-1); transform: translateY(-1px); }
@media (max-width: 720px) { .adm-floating-cluster { display: none; } }

/* Legacy inline search hidden — the utility-bar replaces it */
.adm-search-wrap, .adm-search-input, .adm-search-icon { display: none; }

/* ── Toast container (admin uses the global one) ──────────────── */
.toast-container { position: fixed; bottom: 64px; right: 18px; z-index: 110; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--adm-text-1);
  color: #fff;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  box-shadow: var(--adm-shadow-pop);
  display: flex; align-items: center; gap: 8px;
  min-width: 220px;
}
.toast.success { background: #066147; }
.toast.error   { background: #99202b; }
.toast.info    { background: var(--adm-text-1); }

/* ============================================================
   Patches — classes referenced from admin.js / admin.html that
   the Stripe-style rewrite didn't ship. Keeps the same JS happy
   without forcing renderer changes.
   ============================================================ */

/* Table header bar above the user table (search row, etc.) */
.adm-tbl-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--adm-border);
}

/* Plan pill legacy class names — pill-starter / pill-pro / pill-elite */
.adm-plan-pill.pill-starter { background: #eef0f4; color: #4a5567; }
.adm-plan-pill.pill-pro     { background: #f0f1ff; color: var(--adm-link); }
.adm-plan-pill.pill-elite   { background: var(--adm-warn-bg); color: var(--adm-warn-fg); }

/* Round avatar pill used inside user rows */
.adm-row-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  margin-right: 10px;
  flex-shrink: 0;
  vertical-align: middle;
}

/* ── Revenue: plan breakdown rows ─────────────────────────── */
.adm-rev-row {
  display: grid;
  grid-template-columns: 80px 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--adm-border);
}
.adm-rev-row:last-child { border-bottom: none; }
.adm-rev-row .adm-plan-pill { padding: 3px 10px; }
.adm-rev-bar-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.adm-progress-bar {
  flex: 1;
  height: 6px;
  background: var(--adm-bg);
  border-radius: 99px;
  overflow: hidden;
  border: 1px solid var(--adm-border);
}
.adm-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--adm-link), #8b5cf6);
  border-radius: 99px;
  transition: width .8s cubic-bezier(.4,0,.2,1);
}
.adm-rev-pct {
  font-size: 12px;
  font-weight: 600;
  color: var(--adm-text-3);
  min-width: 38px;
  text-align: right;
}
.adm-rev-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  white-space: nowrap;
}
.adm-rev-meta > span:first-child { font-weight: 700; color: var(--adm-text-1); font-size: 14px; }
.adm-rev-meta > span:last-child  { font-size: 11px; color: var(--adm-text-3); }

@media (max-width: 640px) {
  .adm-rev-row { grid-template-columns: 70px 1fr; }
  .adm-rev-meta { grid-column: 1 / -1; align-items: flex-start; padding-left: 84px; }
}

/* ── Activity feed (Overview) ─────────────────────────────── */
.adm-activity-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--adm-border);
}
.adm-activity-item:last-child { border-bottom: none; }
.adm-activity-icon {
  flex-shrink: 0;
  width: 28px; height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--adm-link-soft-bg);
  color: var(--adm-link);
}
.adm-activity-body { flex: 1; min-width: 0; }
.adm-activity-text { font-size: 13px; color: var(--adm-text-2); line-height: 1.45; }
.adm-activity-text strong { color: var(--adm-text-1); font-weight: 600; }
.adm-activity-time { font-size: 11px; color: var(--adm-text-3); margin-top: 2px; }

/* ── Top-users list ───────────────────────────────────────── */
.adm-top-user-item {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--adm-border);
}
.adm-top-user-item:last-child { border-bottom: none; }
.adm-top-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px; height: 24px;
  border-radius: 6px;
  background: var(--adm-bg);
  border: 1px solid var(--adm-border);
  font-size: 11px;
  font-weight: 700;
  color: var(--adm-text-3);
}
.adm-top-user-item:nth-child(1) .adm-top-rank { background: #fde9b3; color: var(--adm-warn-fg); border-color: #f9d77a; }
.adm-top-user-info { min-width: 0; }
.adm-top-user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--adm-text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.adm-top-user-bar {
  height: 4px;
  background: var(--adm-bg);
  border-radius: 99px;
  margin-top: 4px;
  overflow: hidden;
  border: 1px solid var(--adm-border);
}
.adm-top-user-bar > span {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--adm-link), #8b5cf6);
  border-radius: 99px;
}
.adm-top-user-count {
  font-size: 13px;
  font-weight: 700;
  color: var(--adm-text-1);
}

/* ── Document pills (user modal) ──────────────────────────── */
.adm-doc-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--adm-bg);
  border: 1px solid var(--adm-border);
  border-radius: 6px;
  font-size: 12px;
  color: var(--adm-text-2);
}
.adm-doc-icon { color: var(--adm-text-3); }
.adm-doc-name { color: var(--adm-text-1); font-weight: 500; }
.adm-doc-status {
  margin-left: auto;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.adm-doc-status.uploaded { color: var(--adm-success-fg); }
.adm-doc-status.missing  { color: var(--adm-text-3); }

/* ── Chips inside user modal app stats ────────────────────── */
.adm-chip {
  background: var(--adm-bg);
  border: 1px solid var(--adm-border);
  border-radius: var(--adm-radius);
  padding: 12px 14px;
}
.adm-chip-val { font-size: 22px; font-weight: 700; color: var(--adm-text-1); line-height: 1.05; }
.adm-chip-lbl { font-size: 11px; color: var(--adm-text-3); margin-top: 4px; }

/* ── Delete user action (new) ─────────────────────────────── */
.adm-row-actions {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  justify-content: flex-end;
}
.adm-row-action-btn {
  background: transparent;
  border: none;
  color: var(--adm-text-3);
  width: 28px; height: 28px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .12s, color .12s;
}
.adm-row-action-btn:hover { background: var(--adm-surface-hov); color: var(--adm-text-1); }
.adm-row-action-btn.danger:hover { background: var(--adm-error-bg); color: var(--adm-error-fg); }

/* ── Bell + Quick-actions popovers (top utility bar) ──────────── */
.adm-bell-btn { position: relative; }
.adm-bell-dot {
  position: absolute;
  top: 6px; right: 6px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--adm-link);
  border: 2px solid var(--adm-surface);
  display: none;
}
.adm-bell-dot.show { display: block; }

.adm-popover {
  position: absolute;
  right: 28px;
  top: 54px;
  min-width: 260px;
  max-width: 340px;
  background: var(--adm-surface);
  border: 1px solid var(--adm-border);
  border-radius: 10px;
  box-shadow: var(--adm-shadow-pop);
  z-index: 50;
  padding: 6px;
  animation: adm-pop-in .12s ease-out;
}
.adm-popover.hidden { display: none; }
@keyframes adm-pop-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.adm-popover-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px 6px;
  font-size: 12px;
  color: var(--adm-text-1);
  font-weight: 600;
}
.adm-popover-link {
  color: var(--adm-link);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
}
.adm-popover-link:hover { color: var(--adm-link-hover); }

.adm-popover-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  background: transparent;
  border: none;
  color: var(--adm-text-1);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  border-radius: 6px;
  text-decoration: none;
  transition: background .12s;
}
.adm-popover-item > i { color: var(--adm-text-3); flex-shrink: 0; }
.adm-popover-item:hover { background: var(--adm-surface-hov); }
.adm-popover-divider {
  height: 1px;
  background: var(--adm-border);
  margin: 4px 4px;
}

.adm-bell-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 6px;
}
.adm-bell-row + .adm-bell-row { border-top: 1px solid var(--adm-border); border-radius: 0; }
.adm-bell-icon {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--adm-link-soft-bg);
  color: var(--adm-link);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}
.adm-bell-text { flex: 1; min-width: 0; font-size: 12.5px; color: var(--adm-text-1); line-height: 1.45; }
.adm-bell-time { font-size: 10.5px; color: var(--adm-text-3); margin-top: 2px; }
.adm-bell-empty {
  padding: 16px 12px;
  text-align: center;
  color: var(--adm-text-3);
  font-size: 12px;
}

/* ── Help modal sections ──────────────────────────────────────── */
.adm-help-section { margin-bottom: 18px; }
.adm-help-section:last-child { margin-bottom: 0; }
.adm-help-section h4 {
  font-size: 13px;
  font-weight: 700;
  color: var(--adm-text-1);
  margin: 0 0 6px;
}
.adm-help-section p {
  font-size: 13px;
  color: var(--adm-text-2);
  margin: 0 0 6px;
  line-height: 1.55;
}
.adm-help-section code {
  font-size: 12px;
  background: var(--adm-bg);
  border: 1px solid var(--adm-border);
  border-radius: 4px;
  padding: 1px 6px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}

/* Floating cluster removed — class now no-op */
.adm-floating-cluster, .adm-floating-btn { display: none !important; }
