@import url('https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,400;1,600&display=swap');

/* ==========================================================================
   Apex Real Estate CMS — Admin Panel Design System v2.0
   Modern · Responsive · WCAG 2.2 AA · Pure CSS3 · Poppins Typography
   ========================================================================== */

/* ===================== CSS CUSTOM PROPERTIES ===================== */
:root {
  /* Brand */
  --brand-navy:      #0F2A4A;
  --brand-gold:      #C5A880;

  /* CMS Action Color — Indigo Violet */
  --primary:         #6366F1;
  --primary-hover:   #4F46E5;
  --primary-light:   #EEF2FF;
  --primary-dark:    #3730A3;

  /* Status Colors */
  --success:         #10B981;
  --success-bg:      #ECFDF5;
  --success-border:  #A7F3D0;
  --warning:         #F59E0B;
  --warning-bg:      #FFFBEB;
  --warning-border:  #FDE68A;
  --danger:          #EF4444;
  --danger-bg:       #FEF2F2;
  --danger-border:   #FECACA;
  --info:            #3B82F6;
  --info-bg:         #EFF6FF;
  --info-border:     #BFDBFE;

  /* Surfaces (Light Mode) */
  --bg:              #F1F5F9;
  --surface:         #FFFFFF;
  --surface-alt:     #F8FAFC;
  --surface-hover:   #F1F5F9;
  --border:          #E2E8F0;
  --border-strong:   #CBD5E1;
  --border-focus:    #6366F1;

  /* Text */
  --text:            #0F172A;
  --text-secondary:  #334155;
  --text-muted:      #64748B;
  --text-light:      #94A3B8;
  --text-inverse:    #F8FAFC;

  /* Sidebar */
  --sidebar-width:      260px;
  --sidebar-collapsed:  64px;
  --sidebar-bg:         #0F172A;
  --sidebar-bg2:        #1E293B;
  --sidebar-border:     rgba(255,255,255,0.06);
  --sidebar-text:       #CBD5E1;
  --sidebar-muted:      #64748B;
  --sidebar-active-bg:  rgba(99,102,241,0.15);
  --sidebar-active:     #818CF8;

  /* Layout */
  --topbar-height:   60px;

  /* Shadows */
  --shadow-xs:  0 1px 2px rgba(0,0,0,0.05);
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow:     0 4px 6px -1px rgba(0,0,0,0.08), 0 2px 4px -2px rgba(0,0,0,0.04);
  --shadow-md:  0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);
  --shadow-lg:  0 20px 25px -5px rgba(0,0,0,0.08), 0 8px 10px -6px rgba(0,0,0,0.04);

  /* Radii */
  --radius-xs:  4px;
  --radius-sm:  6px;
  --radius:     10px;
  --radius-md:  12px;
  --radius-lg:  16px;
  --radius-xl:  20px;
  --radius-full: 9999px;

  /* Typography */
  --font:        'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
  --transition:  all 0.18s ease;
  --transition-slow: all 0.3s ease;
}

/* Dark Mode */
[data-theme="dark"] {
  --bg:              #060D1A;
  --surface:         #0F1C2E;
  --surface-alt:     #162034;
  --surface-hover:   #1A2844;
  --border:          #1E3050;
  --border-strong:   #2A3F5F;
  --border-focus:    #818CF8;
  --text:            #F1F5F9;
  --text-secondary:  #CBD5E1;
  --text-muted:      #94A3B8;
  --text-light:      #64748B;
  --sidebar-bg:      #060D1A;
  --sidebar-bg2:     #0B1627;
  --primary-light:   rgba(99,102,241,0.15);
  --success-bg:      rgba(16,185,129,0.12);
  --warning-bg:      rgba(245,158,11,0.12);
  --danger-bg:       rgba(239,68,68,0.12);
  --info-bg:         rgba(59,130,246,0.12);
}

/* ===================== RESET & BASE ===================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background-color: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font-family: inherit; }
svg { flex-shrink: 0; }

/* ===================== SCROLLBAR ===================== */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ===================== LAYOUT SHELL ===================== */
.admin-shell {
  display: flex;
  min-height: 100vh;
}

/* ===================== SIDEBAR ===================== */
.admin-sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg2) 100%);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 200;
  transition: width 0.25s ease, transform 0.3s ease;
  overflow: hidden;
}

.admin-sidebar.collapsed { width: var(--sidebar-collapsed); }
.admin-sidebar.collapsed .nav-label,
.admin-sidebar.collapsed .nav-section-label,
.admin-sidebar.collapsed .sidebar-brand-name,
.admin-sidebar.collapsed .user-info-wrap,
.admin-sidebar.collapsed .nav-badge,
.admin-sidebar.collapsed .sidebar-footer-text { display: none; }
.admin-sidebar.collapsed .nav-item { justify-content: center; padding: 10px; }
.admin-sidebar.collapsed .sidebar-bottom { justify-content: center; }

/* Brand Header */
.sidebar-brand-area {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 16px;
  border-bottom: 1px solid var(--sidebar-border);
  min-height: var(--topbar-height);
  text-decoration: none;
}

.sidebar-logo-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #FFFFFF;
  font-size: 18px;
}

.sidebar-brand-name {
  font-size: 15px;
  font-weight: 700;
  color: #FFFFFF;
  letter-spacing: -0.3px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-brand-tagline {
  font-size: 10px;
  color: var(--sidebar-muted);
  font-weight: 500;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* User mini-profile in sidebar */
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--sidebar-border);
}

.sidebar-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--brand-gold) 0%, #a8854a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--brand-navy);
  flex-shrink: 0;
}

.user-info-wrap { overflow: hidden; }
.sidebar-user-name {
  font-size: 12px;
  font-weight: 600;
  color: #FFFFFF;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  color: var(--primary);
  background: rgba(99,102,241,0.15);
  padding: 1px 7px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 2px;
}

/* Nav scroll area */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 3px; }

.nav-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--sidebar-muted);
  padding: 14px 10px 5px;
  white-space: nowrap;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius);
  color: var(--sidebar-text);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 2px;
  transition: var(--transition);
  white-space: nowrap;
  position: relative;
  cursor: pointer;
  border-left: 3px solid transparent;
}

.nav-item .nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.7;
  transition: opacity 0.15s;
}

.nav-item:hover {
  background: rgba(255,255,255,0.06);
  color: #FFFFFF;
  border-left-color: rgba(255,255,255,0.15);
}

.nav-item:hover .nav-icon { opacity: 1; }

.nav-item.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active);
  font-weight: 600;
  border-left-color: var(--primary);
}

.nav-item.active .nav-icon { opacity: 1; color: var(--sidebar-active); }

.nav-label { flex: 1; }

.nav-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background: rgba(255,255,255,0.1);
  color: var(--sidebar-text);
  white-space: nowrap;
}

.nav-badge.danger { background: var(--danger); color: #fff; }
.nav-badge.warning { background: var(--warning); color: #fff; }

/* Sidebar Bottom */
.sidebar-bottom {
  padding: 12px 16px;
  border-top: 1px solid var(--sidebar-border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-bottom-link {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--sidebar-muted);
  transition: color 0.15s;
}

.sidebar-bottom-link:hover { color: #FFFFFF; }
.sidebar-bottom-link svg { width: 14px; height: 14px; }
.sidebar-footer-text { white-space: nowrap; }

/* ===================== MAIN AREA ===================== */
.admin-main {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  transition: margin-left 0.25s ease;
}

.admin-main.expanded { margin-left: var(--sidebar-collapsed); }

/* ===================== TOPBAR ===================== */
.admin-topbar {
  height: var(--topbar-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: rgba(255,255,255,0.9);
  transition: box-shadow 0.2s;
}

[data-theme="dark"] .admin-topbar { background: rgba(15,28,46,0.9); }
.admin-topbar.scrolled { box-shadow: var(--shadow-sm); }

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

.sidebar-toggle {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
  border: 1px solid var(--border);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: var(--transition);
}

.sidebar-toggle:hover { background: var(--border); color: var(--text); }
.sidebar-toggle svg { width: 16px; height: 16px; }

.page-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
}

.page-breadcrumb .current {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.page-breadcrumb .sep { opacity: 0.4; }

/* Topbar Right */
.topbar-right { display: flex; align-items: center; gap: 8px; }

.topbar-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid var(--border);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: var(--transition);
  position: relative;
}

.topbar-btn:hover { background: var(--surface-alt); color: var(--text); }
.topbar-btn svg { width: 16px; height: 16px; }

.topbar-btn .notif-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--danger);
  border: 1.5px solid var(--surface);
}

.topbar-divider {
  width: 1px;
  height: 22px;
  background: var(--border);
  margin: 0 4px;
}

.topbar-preview-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-light);
  border: 1px solid rgba(99,102,241,0.2);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.topbar-preview-btn:hover { background: rgba(99,102,241,0.15); }
.topbar-preview-btn svg { width: 13px; height: 13px; }

/* User Dropdown */
.user-dropdown-wrap { position: relative; }

.user-topbar-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px 4px 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-alt);
  cursor: pointer;
  transition: var(--transition);
}

.user-topbar-btn:hover { background: var(--border); }

.user-topbar-avatar {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.user-topbar-name {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-caret { width: 14px; height: 14px; color: var(--text-muted); transition: transform 0.2s; }
.user-topbar-btn.open .user-caret { transform: rotate(180deg); }

.user-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  min-width: 200px;
  z-index: 300;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
  transition: opacity 0.15s, transform 0.15s;
  overflow: hidden;
}

.user-dropdown-menu.open { opacity: 1; pointer-events: auto; transform: translateY(0); }

.dropdown-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.dropdown-user-name { font-size: 13px; font-weight: 600; }
.dropdown-user-email { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  font-size: 13px;
  color: var(--text);
  transition: background 0.12s;
  cursor: pointer;
}

.dropdown-item:hover { background: var(--surface-alt); }
.dropdown-item svg { width: 15px; height: 15px; color: var(--text-muted); }
.dropdown-item.danger { color: var(--danger); }
.dropdown-item.danger svg { color: var(--danger); }
.dropdown-item.danger:hover { background: var(--danger-bg); }

.dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* ===================== CONTENT AREA ===================== */
.admin-content {
  flex: 1;
  padding: 24px;
  min-width: 0;
}

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

.page-header-left h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.page-header-left p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

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

/* ===================== ALERTS ===================== */
.alert {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid;
  animation: slideDown 0.25s ease;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.alert svg { width: 16px; height: 16px; flex-shrink: 0; }
.alert-close {
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.15s;
  display: flex;
  color: inherit;
}
.alert-close:hover { opacity: 1; }
.alert-close svg { width: 14px; height: 14px; }

.alert-success { background: var(--success-bg); border-color: var(--success-border); color: #065F46; }
.alert-error   { background: var(--danger-bg);  border-color: var(--danger-border);  color: #991B1B; }
.alert-warning { background: var(--warning-bg); border-color: var(--warning-border); color: #92400E; }
.alert-info    { background: var(--info-bg);    border-color: var(--info-border);    color: #1E40AF; }

/* ===================== CARDS ===================== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
  margin-bottom: 20px;
  overflow: hidden;
  transition: box-shadow 0.2s;
}

.card:hover { box-shadow: var(--shadow-sm); }

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--surface);
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title svg { width: 16px; height: 16px; color: var(--text-muted); }
.card-header-actions { display: flex; align-items: center; gap: 8px; }

.card-body { padding: 20px; }
.card-body-sm { padding: 14px 20px; }

.card-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface-alt);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
}

/* ===================== KPI STAT CARDS ===================== */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  box-shadow: var(--shadow-xs);
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
  overflow: hidden;
}

.kpi-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.kpi-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }

.kpi-card.kpi-indigo::after  { background: var(--primary); }
.kpi-card.kpi-emerald::after { background: var(--success); }
.kpi-card.kpi-amber::after   { background: var(--warning); }
.kpi-card.kpi-rose::after    { background: var(--danger); }
.kpi-card.kpi-sky::after     { background: var(--info); }
.kpi-card.kpi-gold::after    { background: var(--brand-gold); }

.kpi-icon {
  width: 46px;
  height: 46px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.kpi-icon svg { width: 22px; height: 22px; }

.kpi-icon.indigo  { background: rgba(99,102,241,0.12); color: var(--primary); }
.kpi-icon.emerald { background: rgba(16,185,129,0.12); color: var(--success); }
.kpi-icon.amber   { background: rgba(245,158,11,0.12); color: var(--warning); }
.kpi-icon.rose    { background: rgba(239,68,68,0.12);  color: var(--danger); }
.kpi-icon.sky     { background: rgba(59,130,246,0.12); color: var(--info); }
.kpi-icon.gold    { background: rgba(197,168,128,0.15); color: #9A7745; }

.kpi-meta { flex: 1; min-width: 0; }
.kpi-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-muted); margin-bottom: 6px; }
.kpi-value { font-size: 28px; font-weight: 700; color: var(--text); line-height: 1; }
.kpi-sub { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* ===================== GRID HELPERS ===================== */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }

/* ===================== BUTTONS ===================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  text-decoration: none;
  font-family: var(--font);
  line-height: 1;
}

.btn svg { width: 14px; height: 14px; flex-shrink: 0; }

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-sm svg { width: 12px; height: 12px; }
.btn-lg { padding: 12px 24px; font-size: 14px; }

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

.btn-secondary { background: var(--surface-alt); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--border); }

.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-success:hover { background: #059669; }

.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #DC2626; }

.btn-warning { background: var(--warning); color: #fff; border-color: var(--warning); }

.btn-ghost { background: transparent; color: var(--text-muted); border-color: transparent; }
.btn-ghost:hover { background: var(--surface-alt); color: var(--text); }

.btn-outline-primary { background: transparent; color: var(--primary); border-color: var(--primary); }
.btn-outline-primary:hover { background: var(--primary-light); }

.btn:disabled, .btn[disabled] { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

/* ===================== BADGES ===================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--radius-full);
  white-space: nowrap;
  letter-spacing: 0.3px;
}

.badge-dot { width: 5px; height: 5px; border-radius: 50%; flex-shrink: 0; }

.badge-success { background: var(--success-bg); color: #065F46; border: 1px solid var(--success-border); }
.badge-warning { background: var(--warning-bg); color: #92400E; border: 1px solid var(--warning-border); }
.badge-danger  { background: var(--danger-bg);  color: #991B1B; border: 1px solid var(--danger-border); }
.badge-info    { background: var(--info-bg);    color: #1E40AF; border: 1px solid var(--info-border); }
.badge-indigo  { background: var(--primary-light); color: var(--primary); border: 1px solid rgba(99,102,241,0.25); }
.badge-neutral { background: var(--surface-alt); color: var(--text-muted); border: 1px solid var(--border); }
.badge-gold    { background: rgba(197,168,128,0.15); color: #7D5A2C; border: 1px solid rgba(197,168,128,0.3); }

/* ===================== AVATAR ===================== */
.avatar {
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  font-size: 13px;
}

.avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.avatar-md { width: 36px; height: 36px; font-size: 14px; }
.avatar-lg { width: 48px; height: 48px; font-size: 18px; }

.avatar-indigo  { background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%); }
.avatar-emerald { background: linear-gradient(135deg, #10B981 0%, #059669 100%); }
.avatar-amber   { background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%); }
.avatar-rose    { background: linear-gradient(135deg, #F43F5E 0%, #E11D48 100%); }
.avatar-gold    { background: linear-gradient(135deg, var(--brand-gold) 0%, #9A7745 100%); color: var(--brand-navy); }

/* ===================== FORM CONTROLS ===================== */
.form-group { margin-bottom: 18px; }

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
  letter-spacing: 0.2px;
}

.form-label .required { color: var(--danger); margin-left: 2px; }

.form-control,
.form-select {
  width: 100%;
  padding: 9px 12px;
  font-size: 13px;
  font-family: var(--font);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  appearance: none;
}

.form-control::placeholder { color: var(--text-light); }
.form-control:focus,
.form-select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}

.form-control:disabled, .form-select:disabled { background: var(--surface-alt); cursor: not-allowed; opacity: 0.7; }

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%2394A3B8' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
}

textarea.form-control { min-height: 100px; resize: vertical; line-height: 1.6; }

.form-hint { font-size: 11px; color: var(--text-muted); margin-top: 5px; line-height: 1.4; }
.form-error { font-size: 11px; color: var(--danger); margin-top: 5px; font-weight: 500; }
.form-control.is-error { border-color: var(--danger); }
.form-control.is-error:focus { box-shadow: 0 0 0 3px rgba(239,68,68,0.12); }

.form-check {
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
}

.form-check-input {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  accent-color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
}

.form-check-label { font-size: 13px; font-weight: 500; cursor: pointer; }

/* Input group */
.input-group { display: flex; }
.input-group .form-control { border-radius: 0; border-right: none; flex: 1; }
.input-group .form-control:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-group .btn { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

/* Password toggle */
.password-wrap { position: relative; }
.password-wrap .form-control { padding-right: 40px; }
.password-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 2px;
  display: flex;
}
.password-toggle svg { width: 15px; height: 15px; }

/* ===================== TABLES ===================== */
.table-wrap { overflow-x: auto; border-radius: 0 0 var(--radius-md) var(--radius-md); }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table thead tr {
  background: var(--surface-alt);
  border-bottom: 1px solid var(--border);
}

.data-table th {
  padding: 11px 16px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  white-space: nowrap;
  text-align: left;
}

.data-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text);
}

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

.data-table tbody tr:hover td { background: var(--surface-alt); }

.data-table tbody tr[data-href] { cursor: pointer; }

/* Table utilities */
.td-primary { font-weight: 600; }
.td-muted { color: var(--text-muted); font-size: 12px; }
.td-actions { display: flex; align-items: center; gap: 6px; }

/* Empty state in table */
.table-empty {
  padding: 48px;
  text-align: center;
  color: var(--text-muted);
}

.table-empty svg { width: 40px; height: 40px; margin: 0 auto 12px; opacity: 0.3; }
.table-empty p { font-size: 14px; }

/* ===================== QUICK ACTIONS ===================== */
.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.quick-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  transition: var(--transition);
  cursor: pointer;
  border: 1px solid;
  text-decoration: none;
  font-family: var(--font);
}

.quick-action-btn svg { width: 15px; height: 15px; }

.qab-primary   { background: var(--primary); color: #fff; border-color: var(--primary); }
.qab-primary:hover { background: var(--primary-hover); }
.qab-secondary { background: var(--surface-alt); color: var(--text); border-color: var(--border); }
.qab-secondary:hover { background: var(--border); }
.qab-success   { background: var(--success-bg); color: #065F46; border-color: var(--success-border); }
.qab-success:hover { background: #D1FAE5; }

/* ===================== SYSTEM INFO ROW ===================== */
.sys-info-list { list-style: none; }
.sys-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.sys-info-row:last-child { border-bottom: none; }
.sys-info-key { color: var(--text-muted); font-weight: 500; }
.sys-info-val { font-weight: 600; color: var(--text); }

/* ===================== ACTIVITY LOG ROW ===================== */
.activity-log-tag {
  display: inline-block;
  padding: 2px 9px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  background: var(--surface-alt);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

/* ===================== MOBILE OVERLAY ===================== */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 199;
  backdrop-filter: blur(2px);
  animation: fadeIn 0.2s ease;
}

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

.sidebar-overlay.visible { display: block; }

/* ===================== UTILITY ===================== */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-5 { gap: 20px; }
.flex-1 { flex: 1; min-width: 0; }
.flex-wrap { flex-wrap: wrap; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.w-full { width: 100%; }
.opacity-0 { opacity: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }

/* ===================== RESPONSIVE ===================== */
@media (max-width: 1280px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 1024px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .admin-content { padding: 16px; }
}

@media (max-width: 768px) {
  .admin-sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-width) !important;
  }
  .admin-sidebar.mobile-open { transform: translateX(0); }
  .admin-main { margin-left: 0 !important; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .user-topbar-name { display: none; }
  .topbar-preview-btn span { display: none; }
}

@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .admin-content { padding: 12px; }
  .topbar-divider { display: none; }
}

@media print {
  .admin-sidebar, .admin-topbar { display: none !important; }
  .admin-main { margin-left: 0; }
  .card { box-shadow: none; border: 1px solid #ccc; }
}

/* ==========================================================================
   FUTURISTIC CYBER-LUXE REAL ESTATE CMS ENHANCEMENTS (HUD, STATS & GRAPHS)
   ========================================================================== */

:root {
  --neon-indigo: #6366F1;
  --neon-cyan:   #06B6D4;
  --neon-emerald:#10B981;
  --neon-gold:   #F59E0B;
  --neon-rose:   #F43F5E;
  --neon-purple: #A855F7;
  
  --hud-bg-dark: rgba(15, 23, 42, 0.75);
  --hud-glow:    0 0 30px rgba(99, 102, 241, 0.15);
}

/* Glowing Pulse Dots */
.live-pulse {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--neon-emerald);
  box-shadow: 0 0 8px var(--neon-emerald);
  animation: pulse-ring 1.8s cubic-bezier(0.4, 0, 0.6, 1) infinite;
  margin-right: 6px;
  vertical-align: middle;
}

@keyframes pulse-ring {
  0%, 100% { opacity: 1; transform: scale(1); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  50% { opacity: 0.75; transform: scale(1.15); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
}

/* Futuristic HUD Telemetry Banner */
.hud-telemetry-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(90deg, rgba(15, 42, 74, 0.95) 0%, rgba(30, 41, 59, 0.9) 100%);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: var(--radius-md);
  padding: 12px 20px;
  color: #FFFFFF;
  margin-bottom: 24px;
  box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  flex-wrap: wrap;
  gap: 12px;
}

.hud-telemetry-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #94A3B8;
  font-weight: 500;
}
.hud-telemetry-item strong {
  color: #F8FAFC;
  font-weight: 700;
}

/* Futuristic KPI Cards with Glowing Border and Dynamic Sparklines */
.kpi-cyber {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 22px;
  overflow: hidden;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
}

.kpi-cyber::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-start, #6366F1), var(--accent-end, #06B6D4));
  opacity: 0.9;
}

.kpi-cyber:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 30px rgba(99, 102, 241, 0.15);
  border-color: rgba(99, 102, 241, 0.4);
}

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

.kpi-cyber-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.kpi-cyber-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid rgba(99, 102, 241, 0.2);
}

.kpi-cyber-value {
  font-family: var(--font);
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.15;
  margin-bottom: 8px;
}

.kpi-cyber-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  font-size: 12px;
}

.kpi-trend-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 9999px;
}
.kpi-trend-pill.up {
  background: rgba(16, 185, 129, 0.12);
  color: #10B981;
  border: 1px solid rgba(16, 185, 129, 0.25);
}
.kpi-trend-pill.down {
  background: rgba(239, 68, 68, 0.12);
  color: #EF4444;
  border: 1px solid rgba(239, 68, 68, 0.25);
}

/* Futuristic Cyber Graphs & Charts Container */
.cyber-chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.05);
  margin-bottom: 24px;
  position: relative;
}

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

.cyber-chart-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.cyber-chart-controls {
  display: flex;
  gap: 6px;
  background: var(--surface-alt);
  padding: 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.chart-tab-btn {
  background: transparent;
  border: none;
  padding: 6px 14px;
  border-radius: var(--radius-xs);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.chart-tab-btn.active, .chart-tab-btn:hover {
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow-xs);
}

/* Interactive SVG Canvas Charts */
.chart-canvas-wrap {
  width: 100%;
  position: relative;
  min-height: 260px;
}

/* Futuristic Pipeline Funnel */
.funnel-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.funnel-stage-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.funnel-stage-meta {
  width: 140px;
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.funnel-stage-track {
  flex: 1;
  height: 28px;
  background: var(--surface-alt);
  border-radius: var(--radius-xs);
  overflow: hidden;
  border: 1px solid var(--border);
  position: relative;
}

.funnel-stage-fill {
  height: 100%;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  padding-left: 10px;
  font-size: 11px;
  font-weight: 700;
  color: #FFFFFF;
  text-shadow: 0 1px 3px rgba(0,0,0,0.4);
  transition: width 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.funnel-stage-stat {
  width: 90px;
  text-align: right;
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

/* AI Lead Intent Score Badges */
.badge-ai-intent {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.badge-ai-intent.hot {
  background: rgba(244, 63, 94, 0.15);
  color: #F43F5E;
  border: 1px solid rgba(244, 63, 94, 0.35);
  box-shadow: 0 0 10px rgba(244, 63, 94, 0.15);
}
.badge-ai-intent.warm {
  background: rgba(245, 158, 11, 0.15);
  color: #F59E0B;
  border: 1px solid rgba(245, 158, 11, 0.35);
}
.badge-ai-intent.cold {
  background: rgba(100, 116, 139, 0.15);
  color: #64748B;
  border: 1px solid rgba(100, 116, 139, 0.3);
}

/* Command Palette Overlay */
.cmd-palette-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(8px);
  z-index: 9999;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 100px;
}
.cmd-palette-backdrop.open {
  display: flex;
}
.cmd-palette-box {
  width: 92%;
  max-width: 620px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  animation: cmdSlideDown 0.15s ease-out;
}
@keyframes cmdSlideDown {
  from { opacity: 0; transform: translateY(-12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.cmd-palette-input {
  width: 100%;
  padding: 18px 22px;
  font-size: 16px;
  border: none;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  outline: none;
  font-family: inherit;
}
.cmd-palette-results {
  max-height: 380px;
  overflow-y: auto;
  padding: 8px;
}
.cmd-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.12s;
  cursor: pointer;
}
.cmd-item:hover, .cmd-item.selected {
  background: var(--primary-light);
  color: var(--primary);
}
.cmd-item-shortcut {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--surface-alt);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

