/* ============================================================
   AURA DIAMONDS - Premium Diamond Portal Design System
   Version 2.0 - Full Sidebar Layout
   ============================================================ */

/* Google Fonts: Inter + Outfit */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

/* ---- CSS Variables ---- */
:root {
  --font-heading: 'Outfit', 'Inter', -apple-system, sans-serif;
  --font-body: 'Inter', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Premium Blue-Slate Dark Palette */
  --bg-primary:  #080c14;
  --bg-sidebar:  #0d1220;
  --bg-card:     rgba(15, 23, 42, 0.75);
  --bg-card-solid: #0f1729;
  --bg-header:   #0d1220;
  --bg-input:    rgba(10, 17, 35, 0.6);
  --bg-hover:    rgba(255,255,255,0.04);
  --bg-active:   rgba(59,130,246,0.12);

  --text-primary:   #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted:     #64748b;

  --primary:       #3b82f6;
  --primary-hover: #2563eb;
  --primary-dark:  #1d4ed8;
  --primary-glow:  rgba(59,130,246,0.3);
  --primary-subtle: rgba(59,130,246,0.1);

  --success:       #10b981;
  --success-bg:    rgba(16,185,129,0.1);
  --success-glow:  rgba(16,185,129,0.25);

  --warning:       #f59e0b;
  --warning-bg:    rgba(245,158,11,0.1);

  --danger:        #ef4444;
  --danger-bg:     rgba(239,68,68,0.1);

  --info:          #06b6d4;
  --info-bg:       rgba(6,182,212,0.1);

  --purple:        #8b5cf6;
  --purple-bg:     rgba(139,92,246,0.1);

  --border-color:  rgba(255,255,255,0.07);
  --border-hover:  rgba(255,255,255,0.14);
  --border-active: rgba(59,130,246,0.4);

  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  --shadow-sm:  0 1px 3px rgba(0,0,0,0.3);
  --shadow-md:  0 4px 16px rgba(0,0,0,0.35);
  --shadow-lg:  0 16px 40px rgba(0,0,0,0.5);
  --shadow-xl:  0 32px 64px rgba(0,0,0,0.6);

  --sidebar-width: 240px;
  --sidebar-collapsed: 64px;
  --topbar-height: 0px;
  
  --transition-fast: 0.15s ease;
  --transition-base: 0.22s cubic-bezier(0.4,0,0.2,1);
  --transition-spring: 0.35s cubic-bezier(0.34,1.56,0.64,1);
}

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

body, html {
  margin: 0; padding: 0;
  width: 100%; height: 100%;
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  overflow-x: hidden;
}

svg.brand-icon {
  width: 28px !important;
  height: 28px !important;
  min-width: 28px !important;
  min-height: 28px !important;
  display: inline-block;
}

svg.login-logo {
  width: 48px !important;
  height: 48px !important;
  display: block;
}

svg:not([width]) {
  max-width: 24px;
  max-height: 24px;
}

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

.hidden { display: none !important; }

/* Animated Fast Preloader Overlay */
.aura-loader-overlay {
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  background: rgba(8, 12, 20, 0.92);
  backdrop-filter: blur(12px);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.aura-loader-overlay.hidden-loader {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.aura-spinner-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.aura-spinner-icon {
  animation: auraSpin 1.4s cubic-bezier(0.68, -0.55, 0.27, 1.55) infinite;
  filter: drop-shadow(0 0 12px rgba(59, 130, 246, 0.6));
}

.aura-spinner-text {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.5px;
}

@keyframes auraSpin {
  0% { transform: rotate(0deg) scale(0.95); }
  50% { transform: rotate(180deg) scale(1.1); }
  100% { transform: rotate(360deg) scale(0.95); }
}

/* ============================================================
   SHORTCODE WRAPPER (full-page)
   ============================================================ */
.wp-shortcode-container {
  box-sizing: border-box;
  font-family: var(--font-body);
  color: var(--text-primary);
  line-height: 1.5;
}

.wp-shortcode-container *,
.wp-shortcode-container *::before,
.wp-shortcode-container *::after { box-sizing: border-box; }

.wp-shortcode-container.full-page-sim {
  width: 100vw;
  height: 100vh;
  display: flex;
  overflow: hidden;
}

/* ============================================================
   APP SHELL — Sidebar + Content
   ============================================================ */
.app-shell {
  display: flex;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.app-sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  height: 100%;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  z-index: 100;
  transition: width var(--transition-base), min-width var(--transition-base);
  flex-shrink: 0;
}

/* Sidebar Logo / Brand */
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 1.5rem 1.25rem 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  text-decoration: none;
  flex-shrink: 0;
  overflow: hidden;
}

.sidebar-logo-icon {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--primary) 0%, #6366f1 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 16px var(--primary-glow);
}

.sidebar-logo-icon svg {
  width: 20px;
  height: 20px;
  color: #fff;
  stroke: #fff;
}

.sidebar-logo-text {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-logo-name {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-primary);
  white-space: nowrap;
  background: linear-gradient(135deg, #fff 0%, #94a3b8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 0.3px;
}

.sidebar-logo-sub {
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* Sidebar Navigation Sections */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.75rem 0;
}

.sidebar-section {
  padding: 0 0.75rem;
  margin-bottom: 0.5rem;
}

.sidebar-section-label {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 0.75rem 0.5rem 0.35rem 0.5rem;
  white-space: nowrap;
  overflow: hidden;
}

/* Sidebar Nav Item */
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0.65rem 0.75rem;
  margin-bottom: 2px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-base);
  border: 1px solid transparent;
  white-space: nowrap;
  overflow: hidden;
  position: relative;
}

.nav-item:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.nav-item.active {
  color: var(--primary);
  background: var(--bg-active);
  border-color: rgba(59,130,246,0.2);
  font-weight: 600;
}

.nav-item.active .nav-icon svg {
  stroke: var(--primary);
}

.nav-icon {
  width: 20px;
  min-width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-icon svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  transition: stroke var(--transition-base);
}

.nav-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-badge {
  margin-left: auto;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 99px;
  background: var(--primary-subtle);
  color: var(--primary);
  white-space: nowrap;
}

.sidebar-divider {
  height: 1px;
  background: var(--border-color);
  margin: 0.5rem 1.25rem;
}

/* Sidebar Footer: User info */
.sidebar-footer {
  padding: 0.75rem;
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition-base);
  overflow: hidden;
}

.sidebar-user:hover { background: var(--bg-hover); }

.sidebar-avatar {
  width: 34px;
  min-width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, #6366f1 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  box-shadow: 0 0 10px var(--primary-glow);
}

.sidebar-user-info {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.sidebar-user-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 0.7rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.sidebar-logout-btn {
  width: 28px;
  min-width: 28px;
  height: 28px;
  border-radius: var(--radius-xs);
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-base);
  text-decoration: none;
}

.sidebar-logout-btn:hover {
  background: var(--danger-bg);
  border-color: rgba(239,68,68,0.3);
  color: var(--danger);
}

.sidebar-logout-btn svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
}

/* ============================================================
   MAIN CONTENT AREA
   ============================================================ */
.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  background: radial-gradient(ellipse at top right, rgba(59,130,246,0.04) 0%, transparent 60%),
              radial-gradient(ellipse at bottom left, rgba(99,102,241,0.03) 0%, transparent 50%),
              var(--bg-primary);
}

/* Top mini-bar inside content area */
.app-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 2rem;
  border-bottom: 1px solid var(--border-color);
  background: rgba(13,18,32,0.6);
  backdrop-filter: blur(12px);
  flex-shrink: 0;
  gap: 1rem;
}

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

.topbar-breadcrumb .crumb-current {
  color: var(--text-primary);
  font-weight: 600;
}

.topbar-breadcrumb .crumb-sep {
  opacity: 0.4;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.topbar-page-title {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* Content Scrollable Zone */
.app-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

.admin-tab-content {
  padding: 2rem;
  animation: fadeSlideIn 0.25s var(--transition-base) forwards;
}

.admin-tab-content.hidden {
  display: none !important;
}

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

/* ============================================================
   TYPOGRAPHY
   ============================================================ */
.page-header {
  margin-bottom: 2rem;
}

.page-title {
  font-family: var(--font-heading);
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 0.35rem 0;
  line-height: 1.25;
}

.page-subtitle {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin: 0;
}

/* ============================================================
   CARDS & WIDGETS
   ============================================================ */
.widget-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.75rem;
  transition: border-color var(--transition-base);
}

.widget-card:hover {
  border-color: var(--border-hover);
}

.widget-card h3 {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 1.25rem 0;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 8px;
}

.widget-body {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--stat-color, var(--primary)), transparent);
  opacity: 0;
  transition: opacity var(--transition-base);
}

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

.stat-card:hover::before { opacity: 1; }

.stat-icon {
  width: 48px;
  min-width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.icon-blue { background: var(--info-bg); color: var(--info); }
.icon-green { background: var(--success-bg); color: var(--success); }
.icon-purple { background: var(--purple-bg); color: var(--purple); }
.icon-orange { background: var(--warning-bg); color: var(--warning); }

.stat-data { display: flex; flex-direction: column; }

.stat-value {
  font-family: var(--font-heading);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.5px;
  margin-top: 3px;
}

/* Dashboard Widgets Grid */
.dashboard-widgets {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 1100px) {
  .dashboard-widgets { grid-template-columns: 1fr 1fr; }
}

/* Activity items */
.activities-compact {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.activity-compact-item {
  padding: 0.85rem 1rem;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 3px;
  transition: background var(--transition-fast);
}

.activity-compact-item:hover { background: rgba(255,255,255,0.04); }

.activity-compact-meta {
  display: flex;
  justify-content: space-between;
  color: var(--text-muted);
  font-size: 0.78rem;
}

.activity-compact-meta strong { color: var(--text-primary); }

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0.2rem 0.55rem;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  white-space: nowrap;
}

.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger  { background: var(--danger-bg);  color: var(--danger);  }
.badge-info    { background: var(--info-bg);     color: var(--info);    }
.badge-primary { background: var(--primary-subtle); color: var(--primary); }
.badge-secondary { background: rgba(255,255,255,0.07); color: var(--text-secondary); }

/* Role badge in sidebar */
#role-badge {
  font-size: 0.65rem;
  padding: 0.15rem 0.45rem;
}

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

.btn svg { width: 15px; height: 15px; stroke: currentColor; flex-shrink: 0; }

.btn-primary {
  background: var(--primary);
  color: #fff !important;
  box-shadow: 0 2px 10px var(--primary-glow);
}
.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 16px var(--primary-glow);
  transform: translateY(-1px);
}

.btn-success {
  background: var(--success);
  color: #fff !important;
  box-shadow: 0 2px 10px var(--success-glow);
}
.btn-success:hover {
  filter: brightness(1.1);
  box-shadow: 0 4px 16px var(--success-glow);
  transform: translateY(-1px);
}

.btn-danger {
  background: var(--danger);
  color: #fff !important;
}
.btn-danger:hover { filter: brightness(1.1); transform: translateY(-1px); }

.btn-secondary {
  background: rgba(255,255,255,0.06);
  border-color: var(--border-color);
  color: var(--text-primary);
}
.btn-secondary:hover {
  background: rgba(255,255,255,0.1);
  border-color: var(--border-hover);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border-color);
  color: var(--text-secondary);
}
.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.btn-sm {
  padding: 0.4rem 0.85rem;
  font-size: 0.8rem;
}
.btn-sm svg { width: 13px; height: 13px; }

.btn-icon { padding: 0.6rem; }
.btn-icon.btn-sm { padding: 0.4rem; }

/* ============================================================
   FORM CONTROLS
   ============================================================ */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group.full-width { grid-column: 1 / -1; }

.form-group label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.3px;
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 0.65rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.9rem;
  transition: all var(--transition-base);
  width: 100%;
}

.form-group input::placeholder,
.form-group select::placeholder,
.form-group textarea::placeholder {
  color: var(--text-muted);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  background: rgba(10,17,35,0.9);
  box-shadow: 0 0 0 3px var(--primary-subtle);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* ============================================================
   TABLE STYLES
   ============================================================ */
.table-controls-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.table-controls-header h3 {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 700;
  margin: 0;
  color: var(--text-primary);
}

.filters-card-bar {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
  width: 100%;
  margin-bottom: 1.5rem;
}

.filter-item-wrapper {
  flex: 1;
  min-width: 130px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.filter-search-wrapper { flex: 2; min-width: 200px; }

.filter-item-wrapper label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.filter-item-wrapper input,
.filter-item-wrapper select {
  width: 100%;
  padding: 0.55rem 0.9rem;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.875rem;
  transition: all var(--transition-base);
}

.filter-item-wrapper input:focus,
.filter-item-wrapper select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-subtle);
}

.filter-btn-wrapper {
  display: flex;
  align-items: flex-end;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: rgba(0,0,0,0.15);
}

.wp-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0;
  font-size: 0.875rem;
}

.wp-table th {
  padding: 0.85rem 1rem;
  text-align: left;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.6px;
  background: rgba(0,0,0,0.2);
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.wp-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
  color: var(--text-primary);
}

.wp-table tbody tr {
  transition: background var(--transition-fast);
}

.wp-table tbody tr:hover {
  background: rgba(255,255,255,0.025);
}

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

/* ============================================================
   MODALS
   ============================================================ */
.modal-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  background: rgba(8,12,20,0.85);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 2rem;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.modal-overlay.hidden {
  display: flex !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.modal-overlay.hidden .details-card {
  transform: scale(0.95) translateY(16px);
}

.details-card {
  background: var(--bg-card-solid);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-xl);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 860px;
  height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(1) translateY(0);
  transition: transform var(--transition-spring);
}

.modal-header {
  padding: 1.25rem 1.75rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.modal-header h2 {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 700;
  margin: 0;
}

.close-btn {
  background: var(--bg-hover);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-xs);
  font-size: 1.3rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: all var(--transition-base);
}

.close-btn:hover {
  background: var(--danger-bg);
  border-color: rgba(239,68,68,0.3);
  color: var(--danger);
}

.modal-tabs {
  display: flex;
  background: rgba(0,0,0,0.2);
  padding: 4px;
  gap: 3px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
  overflow-x: auto;
}

.tab-btn {
  flex: 1;
  padding: 0.55rem 1rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.8rem;
  cursor: pointer;
  border-radius: var(--radius-xs);
  transition: all var(--transition-base);
  white-space: nowrap;
}

.tab-btn:hover { color: var(--text-primary); background: rgba(255,255,255,0.05); }

.tab-btn.active {
  color: #fff;
  background: var(--primary);
  box-shadow: 0 2px 8px var(--primary-glow);
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.75rem;
}

.modal-tab-pane { display: none; }
.modal-tab-pane.active {
  display: block;
  animation: fadeSlideIn 0.2s ease forwards;
}

/* ============================================================
   DETAIL GRID (in modals)
   ============================================================ */
.details-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
}

.info-item { display: flex; flex-direction: column; gap: 5px; }
.info-item.full-width { grid-column: 1 / -1; }

.info-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.6px;
}

.info-value {
  font-size: 0.9rem;
  color: var(--text-primary);
  font-weight: 500;
  word-break: break-word;
}

.info-value.text-block {
  line-height: 1.6;
  white-space: pre-line;
  background: rgba(0,0,0,0.15);
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  font-size: 0.875rem;
}

.divider {
  height: 1px;
  background: var(--border-color);
  margin: 0.5rem 0;
}

/* ============================================================
   NOTES & MESSAGING
   ============================================================ */
.notes-management-pane {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

@media (min-width: 700px) {
  .notes-management-pane { grid-template-columns: 1.1fr 1.9fr; }
}

.notes-editor h4, .notes-history h4 {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 700;
  margin-top: 0;
  margin-bottom: 1rem;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.5rem;
}

.notes-editor textarea { height: 120px; resize: vertical; }

.notes-list-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 460px;
  overflow-y: auto;
  padding-right: 4px;
}

.note-item-card {
  background: rgba(0,0,0,0.15);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color var(--transition-fast);
}

.note-item-card:hover { border-color: var(--border-hover); }

.note-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.note-content-text {
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--text-primary);
  white-space: pre-line;
}

.note-footer { display: flex; justify-content: flex-end; margin-top: 2px; }

/* ============================================================
   AUDIT / ACTIVITY TABLE
   ============================================================ */
.audit-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.audit-controls h3 {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 700;
  margin: 0;
}

/* ============================================================
   USER DISPLAY (legacy compat)
   ============================================================ */
.user-display {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #6366f1);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.875rem;
}

.username-text {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text-primary);
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  min-height: 100vh;
  background: radial-gradient(ellipse at center top, rgba(59,130,246,0.1) 0%, transparent 50%),
              var(--bg-primary);
  padding: 2rem;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 2.75rem;
  box-shadow: var(--shadow-xl);
  animation: scaleUpCard 0.4s var(--transition-spring);
}

@keyframes scaleUpCard {
  from { opacity: 0; transform: scale(0.94) translateY(16px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.login-header {
  text-align: center;
  margin-bottom: 2rem;
}

.login-logo {
  width: 52px; height: 52px;
  margin: 0 auto 1rem auto;
  background: linear-gradient(135deg, var(--primary), #6366f1);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 24px var(--primary-glow);
}

.login-logo svg { width: 28px; height: 28px; stroke: #fff; }

.login-header h1 {
  font-family: var(--font-heading);
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0 0 0.4rem 0;
}

.login-header p {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin: 0;
}

.login-error {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid rgba(239,68,68,0.2);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 1.25rem;
  font-weight: 500;
  text-align: center;
  animation: shakeError 0.35s ease;
}

@keyframes shakeError {
  0%,100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

/* ============================================================
   WA SETTINGS / TEMPLATES
   ============================================================ */
.wa-templates-section {
  margin-top: 1.75rem;
  border-top: 1px solid var(--border-color);
  padding-top: 1.75rem;
}

.template-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 1rem;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  margin-bottom: 0.75rem;
  gap: 1rem;
  transition: border-color var(--transition-fast);
}

.template-item:hover { border-color: var(--border-hover); }

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

.template-name-badge {
  font-family: var(--font-mono);
  background: var(--primary-subtle);
  color: var(--primary);
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-xs);
  font-size: 0.8rem;
  margin-right: 0.4rem;
  font-weight: 600;
}

.template-lang-badge {
  background: rgba(255,255,255,0.07);
  color: var(--text-secondary);
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-xs);
  font-size: 0.75rem;
  font-weight: 600;
}

.template-text-content {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.5rem;
  white-space: pre-wrap;
}

.template-delete-btn {
  background: var(--danger);
  color: #fff;
  border: none;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-xs);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 600;
  transition: opacity 0.2s, transform 0.1s;
  flex-shrink: 0;
}

.template-delete-btn:hover { opacity: 0.85; transform: scale(0.97); }

.add-template-box {
  margin-top: 1.5rem;
  padding: 1.25rem;
  background: rgba(0,0,0,0.15);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-sm);
}

/* ============================================================
   ADMIN WELCOME
   ============================================================ */
.admin-welcome {
  margin-bottom: 2rem;
}

.admin-welcome h2 {
  font-family: var(--font-heading);
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 0.4rem 0;
}

.admin-welcome p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin: 0;
}

/* ============================================================
   LEGACY COMPAT CLASSES
   ============================================================ */
/* ============================================================
   TOP NAVBAR STYLING (.wp-portal-header-info)
   ============================================================ */
.wp-portal-header-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-color);
  padding: 0.75rem 1.75rem;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 500;
  flex-wrap: wrap;
  gap: 1rem;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.brand-text {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 800;
  background: linear-gradient(135deg, #ffffff 0%, #93c5fd 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.3px;
}

.navbar-menu {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.navbar-menu .nav-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.2s ease;
  background: transparent;
  border: 1px solid transparent;
}

.navbar-menu .nav-item:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
  border-color: var(--border-color);
}

.navbar-menu .nav-item.active {
  color: #ffffff;
  background: var(--primary);
  font-weight: 600;
  box-shadow: 0 0 12px var(--primary-glow);
  border-color: var(--primary-hover);
}

.user-display {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.04);
  padding: 0.35rem 0.75rem;
  border-radius: 99px;
  border: 1px solid var(--border-color);
}

.user-display .avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-display .username-text {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.admin-layout {
  display: contents;
}

.admin-content {
  /* Absorbed into .app-content */
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  .app-sidebar {
    position: fixed;
    z-index: 999;
    transform: translateX(-100%);
    transition: transform var(--transition-base), width var(--transition-base);
    width: var(--sidebar-width) !important;
  }

  .app-sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 32px rgba(0,0,0,0.5);
  }

  .mobile-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 998;
  }

  .mobile-overlay.hidden { display: none !important; }

  .app-topbar {
    padding: 0.75rem 1rem;
  }

  .admin-tab-content { padding: 1.25rem; }
}

@media (max-width: 580px) {
  .details-card {
    width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
    margin: 0;
    border: none;
  }
  .modal-overlay { padding: 0; }
  .modal-tabs { overflow-x: auto; white-space: nowrap; }
  .tab-btn { flex: none; padding: 0.55rem 1rem; }
  .filters-card-bar { flex-direction: column; }
  .filter-item-wrapper { width: 100%; min-width: 0; }
  .form-row { grid-template-columns: 1fr; }
}

/* ============================================================
   UTILITY
   ============================================================ */
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-info { color: var(--info); }

.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.gap-sm { gap: 0.5rem; }

.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }

/* Sidebar Toggle Hamburger (Desktop & Mobile) */
.topbar-hamburger {
  display: flex !important;
  background: none;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--transition-base);
}

.topbar-hamburger:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.topbar-hamburger svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
}

/* Collapsed Sidebar on Desktop */
@media (min-width: 901px) {
  .app-sidebar.collapsed {
    width: var(--sidebar-collapsed, 68px) !important;
    min-width: var(--sidebar-collapsed, 68px) !important;
  }
  .app-sidebar.collapsed .sidebar-logo-text,
  .app-sidebar.collapsed .nav-label,
  .app-sidebar.collapsed .sidebar-section-label,
  .app-sidebar.collapsed .sidebar-user-info {
    display: none !important;
  }
  .app-sidebar.collapsed .sidebar-section {
    padding: 0 0.4rem;
  }
  .app-sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 0.75rem 0;
  }
  .app-sidebar.collapsed .sidebar-logo {
    justify-content: center;
    padding: 1rem 0;
  }
  .app-sidebar.collapsed .sidebar-user {
    justify-content: center;
    padding: 0.75rem 0;
  }
}

/* ============================================================
   ADVANCED FULL-WEBSITE RESPONSIVE SUITE
   ============================================================ */

/* Tablet & Intermediate Screens (max-width: 1024px) */
@media (max-width: 1024px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 1rem !important;
  }

  .filters-card-bar {
    gap: 0.85rem !important;
  }

  .filter-search-wrapper {
    flex: 1 1 100% !important;
  }

  .filter-item-wrapper {
    flex: 1 1 calc(50% - 0.5rem) !important;
    min-width: 140px !important;
  }

  .filter-btn-wrapper {
    flex: 1 1 100% !important;
    justify-content: flex-end;
  }
}

/* Mobile Screens (max-width: 768px) */
@media (max-width: 768px) {
  .app-main {
    padding: 0 !important;
  }

  .admin-tab-content {
    padding: 1rem !important;
  }

  .stats-grid {
    grid-template-columns: 1fr !important;
    gap: 0.85rem !important;
  }

  .filters-card-bar {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.75rem !important;
    padding: 1rem !important;
  }

  .filter-item-wrapper {
    width: 100% !important;
    flex: none !important;
  }

  .filter-item-wrapper select,
  .filter-item-wrapper input {
    width: 100% !important;
    box-sizing: border-border !important;
  }

  .filter-btn-wrapper {
    width: 100% !important;
  }

  .filter-btn-wrapper button {
    width: 100% !important;
  }

  .table-responsive {
    border-radius: var(--radius-sm) !important;
    margin: 0.5rem 0 !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  .wp-table th, 
  .wp-table td {
    padding: 0.75rem 0.65rem !important;
    font-size: 0.82rem !important;
    white-space: nowrap !important;
  }

  .pagination-bar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.85rem !important;
    text-align: center !important;
    padding: 1rem !important;
  }

  .pagination-per-page,
  .pagination-info {
    justify-content: center !important;
  }

  .pagination-controls {
    justify-content: center !important;
    width: 100% !important;
  }

  /* Modal Sheets on Mobile */
  .details-card,
  #whatsapp-modal > div {
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100vh !important;
    max-height: 100vh !important;
    border-radius: 0 !important;
    margin: 0 !important;
    border: none !important;
  }

  .details-modal-header,
  .modal-header {
    padding: 1rem 1.25rem !important;
  }

  .details-modal-body,
  .modal-body {
    padding: 1rem 1.25rem !important;
    max-height: calc(100vh - 120px) !important;
    overflow-y: auto !important;
  }

  .detail-field-group {
    grid-template-columns: 1fr !important;
    gap: 0.75rem !important;
  }

  .topbar-title {
    font-size: 1.05rem !important;
  }

  .user-display .username-text {
    display: none !important;
  }
}

/* Extra Small Phones (max-width: 480px) */
@media (max-width: 480px) {
  .app-topbar {
    padding: 0.65rem 0.85rem !important;
  }

  .topbar-hamburger {
    width: 32px !important;
    height: 32px !important;
  }

  .btn {
    padding: 0.45rem 0.75rem !important;
    font-size: 0.8rem !important;
  }

  .pagination-controls button {
    padding: 0.4rem 0.6rem !important;
    font-size: 0.78rem !important;
  }
}
