/* ============================================================
   AUTH.CSS — Login page + Admin panel styles
   SupportBot Multi-Tenant SaaS
   ============================================================ */

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

:root {
  --font: 'Inter', system-ui, sans-serif;
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --owner-color: #7c3aed;
  --admin-color: #0369a1;
  --agent-color: #059669;
  --danger: #dc2626;
  --danger-bg: #fee2e2;
  --success: #10b981;
  --success-bg: #dcfce7;
  --warn: #f59e0b;
  --surface: #f8fafc;
  --border: #e5e7eb;
  --text: #111827;
  --text-2: #374151;
  --text-muted: #6b7280;
  --text-dim: #9ca3af;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
}

body { font-family: var(--font); color: var(--text); background: var(--surface); }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.auth-body { min-height: 100vh; background: #f0f2f5; }

.auth-page {
  display: flex;
  min-height: 100vh;
}

/* ── Brand panel (left) ───────────────────────────────────── */
.auth-brand {
  flex: 0 0 420px;
  background: linear-gradient(160deg, #1a2332 0%, #1e3a5f 50%, #1a2332 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 40px;
  position: relative;
  overflow: hidden;
}

.auth-brand::before {
  content: '';
  position: absolute;
  top: -80px; right: -80px;
  width: 300px; height: 300px;
  border-radius: 50%;
  background: rgba(99,102,241,0.12);
  pointer-events: none;
}

.auth-brand::after {
  content: '';
  position: absolute;
  bottom: -60px; left: -60px;
  width: 200px; height: 200px;
  border-radius: 50%;
  background: rgba(52,211,153,0.1);
  pointer-events: none;
}

.auth-brand-inner { position: relative; z-index: 1; width: 100%; }

.auth-logo {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 48px;
}

.auth-logo-icon {
  width: 48px; height: 48px;
  background: linear-gradient(135deg, #6366f1, #34d399);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  color: white;
  flex-shrink: 0;
}

.auth-logo-text { display: flex; flex-direction: column; }
.auth-logo-name {
  font-size: 22px;
  font-weight: 800;
  color: white;
  letter-spacing: -0.5px;
  line-height: 1;
}
.auth-logo-tag {
  font-size: 11px;
  color: #34d399;
  font-weight: 500;
  margin-top: 3px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.auth-brand-copy { margin-bottom: 40px; }
.auth-brand-copy h1 {
  font-size: 26px;
  font-weight: 800;
  color: white;
  line-height: 1.3;
  letter-spacing: -0.5px;
  margin-bottom: 14px;
}
.auth-brand-copy p {
  font-size: 14px;
  color: #94a3b8;
  line-height: 1.6;
}

.auth-feature-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 40px;
}

.auth-feat {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13.5px;
  color: #e2e8f0;
}

.auth-feat i {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: rgba(255,255,255,0.08);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  color: #34d399;
  flex-shrink: 0;
}

.auth-brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  color: #64748b;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 20px;
  padding: 6px 14px;
}

/* ── Auth main (right panel) ──────────────────────────────── */
.auth-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  overflow-y: auto;
}

.auth-card {
  background: white;
  border-radius: 20px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.08), 0 1px 4px rgba(0,0,0,0.04);
  width: 100%;
  max-width: 440px;
  overflow: hidden;
}

/* ── Tabs ──────────────────────────────────────────────────── */
.auth-tabs {
  display: flex;
  border-bottom: 1.5px solid var(--border);
}

.auth-tab {
  flex: 1;
  padding: 16px 12px;
  background: none;
  border: none;
  font-size: 13.5px;
  font-family: var(--font);
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: color 0.15s, box-shadow 0.15s;
  border-bottom: 2.5px solid transparent;
  margin-bottom: -1.5px;
}

.auth-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.auth-tab:not(.active):hover { color: var(--text-2); background: #f9fafb; }

/* ── Panel ─────────────────────────────────────────────────── */
.auth-panel { display: none; padding: 28px; }
.auth-panel.active { display: block; }

.auth-panel-header { margin-bottom: 24px; }
.auth-panel-header h2 {
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 4px;
}
.auth-panel-header p { font-size: 13.5px; color: var(--text-muted); }

/* ── Fields ────────────────────────────────────────────────── */
.auth-field { margin-bottom: 16px; }

.auth-field > label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 6px;
}

.auth-field > label i { color: var(--text-dim); font-size: 11px; }

.auth-input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 14px;
  font-family: var(--font);
  color: var(--text);
  background: #fafafa;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.auth-input:focus {
  border-color: var(--primary);
  background: white;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}

/* password wrapper */
.auth-pw-wrap { position: relative; }
.auth-pw-wrap .auth-input { padding-right: 42px; }
.auth-pw-toggle {
  position: absolute;
  right: 10px; top: 50%;
  transform: translateY(-50%);
  background: none; border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 13px;
  padding: 4px;
  transition: color 0.13s;
}
.auth-pw-toggle:hover { color: var(--primary); }

/* company select */
.auth-company-select-wrap { position: relative; }
.auth-select {
  width: 100%;
  padding: 10px 36px 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 14px;
  font-family: var(--font);
  color: var(--text);
  background: #fafafa;
  outline: none;
  appearance: none;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.auth-select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,0.12); }
.auth-select-arrow {
  position: absolute;
  right: 12px; top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--text-dim);
  font-size: 11px;
}

/* divider label */
.auth-divider-label {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  border-top: 1.5px solid var(--border);
  padding-top: 16px;
  margin: 8px 0 16px;
}

/* ── Buttons ───────────────────────────────────────────────── */
.auth-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: var(--r-sm);
  border: none;
  font-size: 14px;
  font-family: var(--font);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.auth-btn-primary {
  width: 100%;
  background: var(--primary);
  color: white;
  margin-top: 4px;
}
.auth-btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(99,102,241,0.35); }
.auth-btn-primary:active { transform: none; box-shadow: none; }
.auth-btn-primary:disabled { opacity: 0.65; cursor: not-allowed; transform: none; }

/* ── Notice / hints ────────────────────────────────────────── */
.auth-notice {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: var(--r-sm);
  padding: 10px 14px;
  font-size: 13px;
  color: #1e40af;
  margin-top: 16px;
}
.auth-notice a { color: var(--primary); font-weight: 600; text-decoration: none; }
.auth-notice a:hover { text-decoration: underline; }

.auth-switch-link {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 14px;
}
.auth-switch-link a { color: var(--primary); font-weight: 600; text-decoration: none; }
.auth-switch-link a:hover { text-decoration: underline; }

/* ── Toast ─────────────────────────────────────────────────── */
.auth-toast {
  border-radius: var(--r-sm);
  padding: 11px 16px;
  font-size: 13.5px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 28px 20px;
  animation: toastIn 0.2s ease;
}

.auth-toast.hidden { display: none; }
.auth-toast.error   { background: #fee2e2; color: #991b1b; }
.auth-toast.success { background: #dcfce7; color: #166534; }
.auth-toast.info    { background: #dbeafe; color: #1e40af; }

@keyframes toastIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* ── Demo hint block ───────────────────────────────────────── */
.auth-demo-hint {
  background: #fffbeb;
  border: 1.5px solid #fde68a;
  border-radius: var(--r-md);
  padding: 14px 16px;
  margin-top: 20px;
}

.auth-demo-title {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #92400e;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
}

.auth-demo-rows { display: flex; flex-direction: column; gap: 7px; }

.auth-demo-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.auth-demo-row code {
  font-size: 12px;
  background: rgba(0,0,0,0.06);
  border-radius: 4px;
  padding: 2px 7px;
  font-family: 'Courier New', monospace;
  color: #374151;
}

.auth-demo-fill {
  margin-left: auto;
  padding: 3px 10px;
  background: #fef3c7;
  border: 1px solid #fde68a;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 600;
  color: #92400e;
  cursor: pointer;
  font-family: var(--font);
  transition: background 0.12s;
}
.auth-demo-fill:hover { background: #fde68a; }

/* ── Role badges ───────────────────────────────────────────── */
.role-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.role-owner      { background: #ede9fe; color: #5b21b6; }
.role-admin       { background: #dbeafe; color: #1e40af; }
.role-agent       { background: #d1fae5; color: #065f46; }
.role-superadmin  { background: #fee2e2; color: #991b1b; }

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 768px) {
  .auth-brand { display: none; }
  .auth-main { padding: 20px 16px; }
  .auth-card { border-radius: 16px; }
}

/* ============================================================
   SIMPLIFIED LOGIN CARD  (new email-only login.html)
   ============================================================ */

/* Wider card variant — no tabs, single form */
.auth-card-simple {
  max-width: 400px;
  border-radius: 20px;
}

/* Top section: logo + heading */
.auth-card-top {
  text-align: center;
  padding: 32px 28px 20px;
  border-bottom: 1.5px solid var(--border);
}

.auth-card-logo {
  width: 56px; height: 56px;
  background: linear-gradient(135deg, #6366f1, #34d399);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: white;
  margin: 0 auto 14px;
}

.auth-card-top h2 {
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 4px;
}

.auth-card-top p {
  font-size: 13.5px;
  color: var(--text-muted);
}

/* Body section */
.auth-card-body {
  padding: 24px 28px;
}

/* Company chip — shown after email blur detection */
.auth-company-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f0fdf4;
  border: 1.5px solid #bbf7d0;
  border-radius: 8px;
  padding: 9px 13px;
  font-size: 13px;
  font-weight: 600;
  color: #166534;
  margin-bottom: 14px;
  animation: toastIn 0.18s ease;
}

.auth-company-chip.hidden { display: none; }

.auth-company-chip i {
  font-size: 13px;
  color: #16a34a;
  flex-shrink: 0;
}

.auth-company-chip.auth-company-chip-sa {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

.auth-company-chip.auth-company-chip-sa i { color: #dc2626; }

/* Footer / platform link */
.auth-card-footer {
  padding: 12px 28px 18px;
  border-top: 1px solid #f3f4f6;
  text-align: center;
}

.auth-sa-link {
  font-size: 12px;
  color: var(--text-dim);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color 0.13s;
}

.auth-sa-link:hover { color: var(--danger); }

/* ============================================================
   SUPERADMIN PAGE EXTRAS
   ============================================================ */

/* Red accent topbar for superadmin */
.sa-topbar {
  background: linear-gradient(135deg, #1a0a0a 0%, #2d1111 100%);
  border-bottom-color: #4a1515;
}

.sa-topbar-badge {
  color: #fca5a5 !important;
  font-weight: 600;
}

.sa-avatar {
  background: linear-gradient(135deg, #dc2626, #9b1c1c) !important;
}

/* Platform stats strip (company panel) */
.sa-platform-stats {
  display: flex;
  gap: 14px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.sa-pstat {
  background: white;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 14px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 90px;
  flex: 1;
}

.sa-pstat span {
  font-size: 26px;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}

.sa-pstat label {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Companies list */
.sa-companies-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Company card */
.sa-company-card {
  background: white;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  transition: box-shadow 0.15s, border-color 0.15s;
}

.sa-company-card:hover {
  box-shadow: 0 2px 16px rgba(0,0,0,0.07);
  border-color: #c7d2fe;
}

.sa-cc-left {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  flex: 1;
  min-width: 0;
}

.sa-cc-avatar {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, #6366f1, #34d399);
  color: white;
  font-size: 20px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sa-cc-info { flex: 1; min-width: 0; }

.sa-cc-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 3px;
}

.sa-cc-owner {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 5px;
}

.sa-cc-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 11.5px;
  color: var(--text-muted);
}

.sa-cc-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.sa-acc-id {
  font-size: 11px;
  font-family: monospace;
  color: var(--text-dim);
  background: #f3f4f6;
  padding: 3px 8px;
  border-radius: 5px;
}

/* Company detail modal */
.sa-company-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 4px;
}

.sa-meta-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sa-meta-row label {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.sa-meta-row code {
  font-size: 12px;
  font-family: monospace;
  color: var(--text-2);
  background: #e5e7eb;
  border-radius: 4px;
  padding: 2px 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sa-url-link {
  font-size: 12px;
  color: var(--primary);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.sa-url-link:hover { text-decoration: underline; }

.sa-modal-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  border-top: 1px solid var(--border);
  padding-top: 14px;
  margin-bottom: 12px;
}

.sa-modal-section-label:first-child {
  border-top: none;
  padding-top: 0;
}

/* Sidebar mini stats */
.sa-stat-mini {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.sa-stat-mini-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-muted);
  font-weight: 500;
}

.sa-stat-mini-row i {
  width: 14px;
  text-align: center;
  color: var(--primary);
  font-size: 11px;
}

/* User search box in panel header */
.sa-user-search-wrap {
  position: relative;
  width: 240px;
}

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

/* ============================================================
   TOPBAR USER CHIP  (index.html)
   ============================================================ */
.topbar-user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 24px;
  padding: 4px 12px 4px 5px;
}

.topbar-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #34d399);
  color: white;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.topbar-user-info {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.topbar-user-name {
  font-size: 12.5px;
  font-weight: 600;
  color: white;
}

.topbar-user-role {
  font-size: 10.5px;
  color: #94a3b8;
}

/* ============================================================
   ADMIN PANEL  (admin.html)
   ============================================================ */
.admin-body {
  min-height: 100vh;
  background: #f0f2f5;
  font-family: var(--font);
  color: var(--text);
}

/* ── Top bar ───────────────────────────────────────────────── */
.adm-topbar {
  height: 56px;
  background: #1a2332;
  border-bottom: 1px solid #253044;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky; top: 0; z-index: 100;
}

.adm-topbar-left { display: flex; align-items: center; gap: 16px; }

.adm-logo {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 16px;
  font-weight: 800;
  color: white;
  text-decoration: none;
  letter-spacing: -0.3px;
}
.adm-logo i { color: #34d399; font-size: 18px; }

.adm-topbar-divider {
  width: 1px; height: 22px;
  background: #253044;
  flex-shrink: 0;
}

.adm-topbar-section {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: #94a3b8;
  font-weight: 500;
}

.adm-topbar-right { display: flex; align-items: center; gap: 10px; }

.adm-user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 22px;
  padding: 4px 12px 4px 5px;
}

.adm-user-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #34d399);
  color: white;
  font-size: 12px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.adm-user-info { display: flex; flex-direction: column; line-height: 1.2; }
.adm-user-name { font-size: 12.5px; font-weight: 600; color: white; }
.adm-user-role { font-size: 10.5px; color: #94a3b8; }

.adm-topbtn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 7px;
  font-size: 12.5px;
  font-family: var(--font);
  font-weight: 500;
  color: #cbd5e1;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
}
.adm-topbtn:hover { background: rgba(255,255,255,0.14); color: white; }
.adm-topbtn-danger { color: #fca5a5; }
.adm-topbtn-danger:hover { background: #fee2e2; color: #991b1b; border-color: #fca5a5; }

/* ── Layout ────────────────────────────────────────────────── */
.adm-layout {
  display: flex;
  min-height: calc(100vh - 56px);
}

/* ── Sidebar ───────────────────────────────────────────────── */
.adm-sidebar {
  width: 220px;
  flex-shrink: 0;
  background: white;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 16px 0;
}

.adm-sidenav { flex: 1; display: flex; flex-direction: column; gap: 2px; padding: 0 10px; }

.adm-snav-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 12px;
  background: none;
  border: none;
  border-radius: 8px;
  font-size: 13.5px;
  font-family: var(--font);
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  text-align: left;
  transition: all 0.13s;
}
.adm-snav-btn:hover { background: #f3f4f6; color: var(--text); }
.adm-snav-btn.active { background: #ede9fe; color: #5b21b6; font-weight: 600; }
.adm-snav-btn i { width: 16px; text-align: center; }

.adm-sidebar-footer { padding: 16px 12px 8px; border-top: 1px solid var(--border); }
.adm-sidebar-link {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-muted);
  text-decoration: none;
  padding: 8px 10px;
  border-radius: 7px;
  transition: all 0.13s;
}
.adm-sidebar-link:hover { background: #f3f4f6; color: var(--text); }

/* ── Content ───────────────────────────────────────────────── */
.adm-content { flex: 1; padding: 28px 32px; overflow-y: auto; }

.adm-panel { display: none; }
.adm-panel.active { display: block; }

.adm-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.adm-panel-header h1 {
  font-size: 22px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
}
.adm-panel-header h1 i { color: var(--primary); font-size: 20px; }
.adm-panel-header p { font-size: 13px; color: var(--text-muted); margin-top: 3px; }

/* ── Buttons (admin) ───────────────────────────────────────── */
.adm-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: 8px;
  border: none;
  font-size: 13.5px;
  font-family: var(--font);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.adm-btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none !important; }

.adm-btn-primary { background: var(--primary); color: white; }
.adm-btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(99,102,241,0.3); }

.adm-btn-ghost { background: white; color: var(--text-2); border: 1.5px solid var(--border); }
.adm-btn-ghost:hover { background: #f3f4f6; }

.adm-btn-danger { background: var(--danger); color: white; }
.adm-btn-danger:hover { background: #b91c1c; transform: translateY(-1px); }

.adm-btn-emulate { background: #0f766e; color: white; }
.adm-btn-emulate:hover { background: #0d6460; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(15,118,110,0.35); }

/* ── Role tabs ─────────────────────────────────────────────── */
.adm-role-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.adm-rtab {
  padding: 6px 16px;
  background: white;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  font-size: 12.5px;
  font-family: var(--font);
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.13s;
}
.adm-rtab:hover { border-color: var(--primary); color: var(--primary); }
.adm-rtab.active { background: var(--primary); border-color: var(--primary); color: white; }

/* ── User cards grid ───────────────────────────────────────── */
.adm-users-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 14px;
}

.adm-user-card {
  background: white;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  transition: box-shadow 0.15s, border-color 0.15s;
}
.adm-user-card:hover { box-shadow: 0 2px 12px rgba(0,0,0,0.07); border-color: #d1d5db; }
.adm-user-card-self  { border-color: #c7d2fe; background: #eef2ff; }
.adm-user-card-inactive { opacity: 0.65; }

.adm-uc-avatar {
  width: 44px; height: 44px;
  border-radius: 12px;
  font-size: 18px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.adm-uc-info { flex: 1; min-width: 0; }
.adm-uc-name { font-size: 14.5px; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 6px; }
.adm-uc-email { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }
.adm-uc-date  { font-size: 11px; color: var(--text-dim); }

.adm-self-tag {
  font-size: 10px;
  font-weight: 700;
  background: #c7d2fe;
  color: #3730a3;
  border-radius: 4px;
  padding: 1px 6px;
  text-transform: uppercase;
}

.adm-role-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
}

.adm-status-badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
}
.status-active   { background: #dcfce7; color: #166534; }
.status-inactive { background: #f3f4f6; color: #9ca3af; }

.adm-uc-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.adm-icon-btn {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  background: #f3f4f6;
  border: none;
  border-radius: 7px;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.13s;
}
.adm-icon-btn:hover { background: #e5e7eb; color: var(--text); }
.adm-icon-btn-danger:hover { background: #fee2e2; color: var(--danger); }

/* ── Empty + loading ───────────────────────────────────────── */
.adm-empty {
  grid-column: 1/-1;
  text-align: center;
  padding: 48px 20px;
  color: var(--text-dim);
}
.adm-empty i { font-size: 36px; margin-bottom: 12px; display: block; }
.adm-empty p { font-size: 14px; }

.adm-loading {
  grid-column: 1/-1;
  text-align: center;
  padding: 48px 20px;
  color: var(--text-dim);
  font-size: 14px;
}

/* ── Analytics stats ───────────────────────────────────────── */
.adm-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.adm-stat-card {
  background: white;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.adm-stat-icon {
  width: 44px; height: 44px;
  border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.adm-stat-num {
  font-size: 26px;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}
.adm-stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
}

/* ── Chart cards ───────────────────────────────────────────── */
.adm-chart-card, .adm-table-card {
  background: white;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 20px 22px;
  margin-bottom: 20px;
}

.adm-chart-title, .adm-table-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}
.adm-chart-title i, .adm-table-title i { color: var(--primary); }

.adm-chart-wrap { position: relative; }

/* ── Table ─────────────────────────────────────────────────── */
.adm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.adm-table th {
  text-align: left;
  padding: 9px 12px;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-dim);
  border-bottom: 1.5px solid var(--border);
}

.adm-table td {
  padding: 11px 12px;
  border-bottom: 1px solid #f3f4f6;
  color: var(--text-2);
}

.adm-table tr:last-child td { border-bottom: none; }
.adm-table tbody tr:hover { background: #fafafa; }

/* ── Settings panels ───────────────────────────────────────── */
.adm-settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
}

.adm-settings-card {
  background: white;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 22px;
}

.adm-settings-card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
}

.adm-settings-danger { border-color: #fecaca; background: #fff5f5; }
.adm-settings-danger p { font-size: 13px; color: #991b1b; line-height: 1.6; margin-bottom: 16px; }

/* ── Input / Select / Fields (admin) ───────────────────────── */
.adm-field { margin-bottom: 14px; }

.adm-field > label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 6px;
}

.adm-input {
  width: 100%;
  padding: 9px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 13.5px;
  font-family: var(--font);
  color: var(--text);
  background: #fafafa;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.adm-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,0.12); background: white; }
.adm-input[readonly] { background: #f3f4f6; color: var(--text-muted); cursor: default; }

.adm-select {
  padding: 9px 32px 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 13.5px;
  font-family: var(--font);
  color: var(--text);
  background: #fafafa;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%239ca3af' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s;
}
.adm-select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,0.12); }

.adm-readonly-tag {
  font-size: 10px;
  font-weight: 500;
  background: #f3f4f6;
  color: var(--text-dim);
  border-radius: 4px;
  padding: 1px 6px;
  margin-left: 4px;
}

.adm-field-hint {
  font-size: 11.5px;
  color: var(--text-dim);
  margin-top: 5px;
  display: block;
  line-height: 1.5;
}

.adm-copy-row {
  display: flex;
  gap: 8px;
}

.adm-copy-btn {
  padding: 9px 13px;
  background: #f3f4f6;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.13s;
  font-family: var(--font);
  display: flex;
  align-items: center;
  gap: 6px;
}
.adm-copy-btn:hover { background: #e5e7eb; color: var(--text); }
.adm-copy-btn-lg { padding: 9px 18px; font-weight: 600; }

/* ── Chatbot URL card ──────────────────────────────────────── */
.adm-url-card {
  background: white;
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 32px;
  max-width: 600px;
  text-align: center;
}

.adm-url-icon {
  font-size: 40px;
  margin-bottom: 14px;
  color: var(--primary);
}

.adm-url-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 12px;
}

.adm-url-row { justify-content: center; max-width: 500px; margin: 0 auto; }
.adm-url-row .adm-input { text-align: left; font-family: monospace; font-size: 12px; }

.adm-url-hint {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 16px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  text-align: left;
  background: #f0f9ff;
  border-radius: 8px;
  padding: 10px 14px;
  border: 1px solid #bae6fd;
}

/* ── Toggle (active/inactive switch) ──────────────────────── */
.adm-toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  color: var(--text-2);
  font-weight: 500;
}

.adm-toggle { position: relative; display: inline-block; width: 40px; height: 22px; }
.adm-toggle input { opacity: 0; width: 0; height: 0; }
.adm-toggle-track {
  position: absolute; inset: 0;
  background: #e5e7eb;
  border-radius: 11px;
  cursor: pointer;
  transition: background 0.2s;
}
.adm-toggle-track::after {
  content: '';
  position: absolute;
  left: 3px; top: 3px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  transition: transform 0.2s;
}
.adm-toggle input:checked + .adm-toggle-track { background: var(--success); }
.adm-toggle input:checked + .adm-toggle-track::after { transform: translateX(18px); }

/* ── Modals ────────────────────────────────────────────────── */
.adm-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: fadeInOverlay 0.18s ease;
}
.adm-modal-overlay.hidden { display: none; }

@keyframes fadeInOverlay { from{opacity:0} to{opacity:1} }

.adm-modal {
  background: white;
  border-radius: 16px;
  width: 100%;
  max-width: 460px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.18);
  animation: modalIn 0.2s ease;
  overflow: hidden;
}
.adm-modal-sm { max-width: 380px; }

@keyframes modalIn { from{opacity:0;transform:translateY(12px)scale(0.97)} to{opacity:1;transform:none} }

.adm-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 22px 16px;
  border-bottom: 1.5px solid var(--border);
}
.adm-modal-header h3 {
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.adm-modal-close {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  background: #f3f4f6;
  border: none; border-radius: 7px;
  font-size: 14px; color: var(--text-muted);
  cursor: pointer;
  transition: all 0.13s;
}
.adm-modal-close:hover { background: #e5e7eb; color: var(--text); }

.adm-modal-body { padding: 20px 22px; }
.adm-modal-body p { font-size: 13.5px; color: var(--text-2); line-height: 1.6; }

.adm-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 22px 20px;
  border-top: 1.5px solid var(--border);
}

/* ── Global toast ──────────────────────────────────────────── */
.adm-toast {
  position: fixed;
  bottom: 24px; right: 24px;
  min-width: 240px;
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
  z-index: 2000;
  animation: toastSlideIn 0.22s ease;
}
.adm-toast.hidden { display: none; }
.adm-toast.success { background: #dcfce7; color: #166534; }
.adm-toast.error   { background: #fee2e2; color: #991b1b; }
.adm-toast.info    { background: #dbeafe; color: #1e40af; }

@keyframes toastSlideIn { from{opacity:0;transform:translateY(10px)} to{opacity:1;transform:none} }

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 900px) {
  .adm-sidebar { width: 180px; }
  .adm-content { padding: 20px 18px; }
}

@media (max-width: 640px) {
  .adm-layout  { flex-direction: column; }
  .adm-sidebar { width: 100%; padding: 8px; border-right: none; border-bottom: 1px solid var(--border); }
  .adm-sidenav { flex-direction: row; gap: 4px; overflow-x: auto; }
  .adm-snav-btn { padding: 8px 12px; font-size: 12px; white-space: nowrap; flex-shrink: 0; }
  .adm-users-grid { grid-template-columns: 1fr; }
  .adm-stats-grid { grid-template-columns: repeat(2,1fr); }
}
