/* ============================================
   GREENBOX Admin Portal - Modern Stylesheet
   Ultra-modern glassmorphism + green elegance
   ============================================ */

/* ---------- CSS Variables ---------- */
:root {
  --primary: #2E7D32;
  --primary-light: #4CAF50;
  --primary-dark: #1B5E20;
  --primary-50: #E8F5E9;
  --primary-100: #C8E6C9;
  --primary-200: #A5D6A7;
  --primary-glow: rgba(46, 125, 50, 0.25);
  --secondary: #558B2F;
  --accent: #00C853;

  --bg: #F0F4F0;
  --bg-subtle: #F7FAF7;
  --surface: #FFFFFF;
  --surface-elevated: #FFFFFF;
  --text: #1A2E1A;
  --text-secondary: #4A6B4A;
  --text-light: #7A9A7A;
  --text-muted: #9CB09C;
  --border: #D4E5D4;
  --border-light: #E8F0E8;
  --border-subtle: #F0F5F0;

  --danger: #D32F2F;
  --danger-light: #FFEBEE;
  --danger-50: rgba(211, 47, 47, 0.08);
  --warning: #EF6C00;
  --warning-light: #FFF3E0;
  --warning-50: rgba(239, 108, 0, 0.08);
  --info: #1565C0;
  --info-light: #E3F2FD;
  --info-50: rgba(21, 101, 192, 0.08);
  --success: #2E7D32;
  --success-light: #E8F5E9;
  --success-50: rgba(46, 125, 50, 0.08);
  --purple: #6A1B9A;
  --purple-light: #F3E5F5;

  --sidebar-width: 272px;
  --sidebar-collapsed: 72px;
  --header-height: 68px;
  --radius: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-sm: 0 2px 6px rgba(0,0,0,0.06);
  --shadow: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-md: 0 8px 24px rgba(0,0,0,0.1);
  --shadow-lg: 0 16px 48px rgba(0,0,0,0.12);
  --shadow-xl: 0 24px 64px rgba(0,0,0,0.14);
  --shadow-green: 0 4px 16px rgba(46, 125, 50, 0.2);
  --shadow-green-lg: 0 8px 32px rgba(46, 125, 50, 0.25);

  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(255, 255, 255, 0.3);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);

  --transition-fast: 0.15s ease;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  --bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 14px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition);
}
a:hover { color: var(--primary-dark); }

img { max-width: 100%; height: auto; }

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
  letter-spacing: -0.02em;
}
h1 { font-size: 1.75rem; font-weight: 700; }
h2 { font-size: 1.5rem; font-weight: 700; }
h3 { font-size: 1.2rem; }
h4 { font-size: 1.05rem; }

/* ---------- Typography ---------- */
.text-muted { color: var(--text-secondary); }
.text-light { color: var(--text-light); }
.text-primary { color: var(--primary); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-purple { color: var(--purple); }
.text-small { font-size: 0.82rem; }
.text-xs { font-size: 0.75rem; }
.text-center { text-align: center; }
.font-mono { font-family: 'JetBrains Mono', 'Fira Code', monospace; font-size: 0.85em; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

/* ---------- Login Page ---------- */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #0d3b0d 0%, #1B5E20 30%, #2E7D32 60%, #43A047 100%);
  padding: 1rem;
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 30% 70%, rgba(76, 175, 80, 0.15) 0%, transparent 50%),
              radial-gradient(circle at 70% 30%, rgba(0, 200, 83, 0.1) 0%, transparent 50%);
  animation: floatGradient 20s ease-in-out infinite;
}

.login-page::after {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  opacity: 0.5;
}

.login-container {
  position: relative;
  z-index: 1;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-radius: var(--radius-xl);
  border: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.25), 0 0 1px rgba(255, 255, 255, 0.5) inset;
  width: 100%;
  max-width: 440px;
  padding: 3rem 2.5rem;
  animation: fadeInUp 0.6s var(--bounce);
}

.login-logo {
  text-align: center;
  margin-bottom: 2.5rem;
}

.login-logo img {
  width: 80px;
  height: 80px;
  object-fit: contain;
  margin-bottom: 1rem;
  filter: drop-shadow(0 4px 12px rgba(46, 125, 50, 0.3));
  animation: pulse-subtle 3s ease-in-out infinite;
}

.login-logo h1 {
  font-size: 1.85rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary-dark), var(--primary-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
}

.login-logo p {
  color: var(--text-secondary);
  margin-top: 0.25rem;
  font-size: 0.9rem;
  font-weight: 400;
}

.login-form .form-group {
  margin-bottom: 1.25rem;
}

.login-form label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.4rem;
  color: var(--text);
  font-size: 0.88rem;
}

.login-form .input-wrapper {
  position: relative;
}

.login-form .input-wrapper i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  width: 18px;
  height: 18px;
  pointer-events: none;
  transition: color var(--transition);
}

.login-form input[type="text"],
.login-form input[type="password"],
.login-form input[type="email"] {
  width: 100%;
  padding: 0.8rem 0.85rem 0.8rem 2.85rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-family: inherit;
  transition: all var(--transition);
  outline: none;
  background: rgba(255, 255, 255, 0.8);
  color: var(--text);
}

.login-form input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-glow);
  background: var(--surface);
}

.login-form input:focus + i,
.login-form .input-wrapper:focus-within i {
  color: var(--primary);
}

.login-error {
  background: var(--danger-light);
  color: var(--danger);
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
  margin-bottom: 1rem;
  display: none;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid rgba(211, 47, 47, 0.15);
  animation: shake 0.4s ease;
}
.login-error.show { display: flex; }

.login-forgot {
  display: block;
  text-align: right;
  font-size: 0.82rem;
  color: var(--primary);
  font-weight: 500;
  margin-top: -0.5rem;
  margin-bottom: 1.25rem;
  transition: color var(--transition);
}
.login-forgot:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

.password-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-light);
  padding: 4px;
  border-radius: 4px;
  transition: all var(--transition);
}
.password-toggle:hover {
  color: var(--text);
  background: var(--border-light);
}
.password-toggle i { width: 18px; height: 18px; }

.login-footer {
  text-align: center;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-light);
}

.login-footer p {
  font-size: 0.8rem;
  color: var(--text-light);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1.25rem;
  border: none;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  outline: none;
  text-decoration: none;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(rgba(255,255,255,0.1), transparent);
  opacity: 0;
  transition: opacity var(--transition);
}
.btn:hover::after { opacity: 1; }

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

.btn i {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  box-shadow: 0 2px 8px rgba(46, 125, 50, 0.3);
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: var(--shadow-green);
}
.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow-xs);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--bg-subtle);
  border-color: var(--text-light);
  box-shadow: var(--shadow-sm);
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger), #E53935);
  color: white;
  box-shadow: 0 2px 8px rgba(211, 47, 47, 0.3);
}
.btn-danger:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(211, 47, 47, 0.3);
}

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 1.5px solid var(--primary);
}
.btn-outline:hover:not(:disabled) {
  background: var(--primary-50);
  box-shadow: 0 2px 8px var(--primary-glow);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--bg);
  color: var(--text);
}
.btn-ghost::after { display: none; }

.btn-sm {
  padding: 0.4rem 0.85rem;
  font-size: 0.8rem;
  border-radius: 8px;
}
.btn-sm i { width: 15px; height: 15px; }

.btn-lg {
  padding: 0.9rem 1.75rem;
  font-size: 1rem;
  border-radius: var(--radius-lg);
}

.btn-block {
  display: flex;
  width: 100%;
}

.btn-icon {
  padding: 0.5rem;
  border-radius: 8px;
}

/* ---------- Layout ---------- */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--sidebar-width);
  background: linear-gradient(180deg, #FFFFFF 0%, #FAFCFA 100%);
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform 0.3s var(--transition);
  box-shadow: 2px 0 12px rgba(0, 0, 0, 0.03);
}

.sidebar-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sidebar-logo {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
}

.sidebar-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 10px;
}

.sidebar-brand h2 {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--primary-dark);
  line-height: 1.2;
  letter-spacing: -0.5px;
}

.sidebar-brand span {
  font-size: 0.68rem;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-weight: 500;
}

.sidebar-nav {
  flex: 1;
  padding: 0.75rem 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.sidebar-nav .nav-section {
  padding: 0.75rem 1.5rem 0.35rem;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-light);
  font-weight: 600;
  margin-top: 0.5rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1.5rem;
  margin: 2px 0.75rem;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.88rem;
  transition: all var(--transition);
  border-radius: var(--radius);
  cursor: pointer;
  position: relative;
}

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

.nav-item.active {
  background: linear-gradient(135deg, var(--primary-50), rgba(46, 125, 50, 0.12));
  color: var(--primary);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(46, 125, 50, 0.15);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--primary);
  border-radius: 0 3px 3px 0;
}

.nav-item i {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  opacity: 0.85;
}
.nav-item.active i { opacity: 1; }

.nav-item .badge-count {
  margin-left: auto;
  background: var(--primary);
  color: white;
  font-size: 0.68rem;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  font-weight: 600;
  min-width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-light);
  background: var(--bg-subtle);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.sidebar-user .avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-50), var(--primary-100));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-weight: 700;
  font-size: 0.82rem;
  flex-shrink: 0;
  border: 2px solid var(--primary-200);
}

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

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

.sidebar-user .user-role {
  font-size: 0.72rem;
  color: var(--text-light);
  text-transform: capitalize;
}

/* ---------- Main Content ---------- */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  background: var(--bg);
}

.content-header {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light);
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.content-header h1 {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

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

.content-body {
  padding: 1.75rem 2rem;
}

/* ---------- Mobile menu toggle ---------- */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  color: var(--text);
  border-radius: 8px;
  transition: background var(--transition);
}
.menu-toggle:hover { background: var(--bg); }
.menu-toggle i { width: 24px; height: 24px; }

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 99;
  transition: opacity var(--transition);
}

/* ---------- Stats Cards ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  margin-bottom: 1.75rem;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

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

.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}
.stat-card:hover::before { opacity: 1; }

.stat-card .stat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.stat-card .stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--transition);
}
.stat-card:hover .stat-icon { transform: scale(1.05); }

.stat-card .stat-icon i {
  width: 24px;
  height: 24px;
}

.stat-card .stat-icon.green {
  background: linear-gradient(135deg, var(--primary-50), var(--primary-100));
  color: var(--primary);
}
.stat-card .stat-icon.blue {
  background: linear-gradient(135deg, var(--info-light), #BBDEFB);
  color: var(--info);
}
.stat-card .stat-icon.yellow {
  background: linear-gradient(135deg, var(--warning-light), #FFE0B2);
  color: var(--warning);
}
.stat-card .stat-icon.red {
  background: linear-gradient(135deg, var(--danger-light), #FFCDD2);
  color: var(--danger);
}
.stat-card .stat-icon.purple {
  background: linear-gradient(135deg, var(--purple-light), #E1BEE7);
  color: var(--purple);
}

.stat-card .stat-value {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
  margin-bottom: 0.3rem;
  letter-spacing: -0.02em;
}

.stat-card .stat-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.stat-card .stat-change {
  font-size: 0.75rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  margin-top: 0.5rem;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-full);
}
.stat-card .stat-change.up {
  color: var(--success);
  background: var(--success-light);
}
.stat-card .stat-change.down {
  color: var(--danger);
  background: var(--danger-light);
}

/* ---------- Cards & Panels ---------- */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  overflow: hidden;
  transition: box-shadow var(--transition);
}
.card:hover { box-shadow: var(--shadow); }

.card-header {
  padding: 1.15rem 1.5rem;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-subtle);
}

.card-header h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.card-body {
  padding: 1.5rem;
}

.card-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-light);
  background: var(--bg-subtle);
}

/* ---------- Glass Card ---------- */
.glass-card {
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-lg);
  box-shadow: var(--glass-shadow);
}

/* ---------- Charts ---------- */
.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.75rem;
}

.charts-grid-3 {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.75rem;
}

.chart-container {
  position: relative;
  height: 280px;
  padding: 1rem;
}

/* ---------- Tables ---------- */
.table-container {
  overflow-x: auto;
  scrollbar-width: thin;
}

table {
  width: 100%;
  border-collapse: collapse;
}

table thead {
  background: var(--bg-subtle);
}

table th {
  padding: 0.85rem 1.25rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-secondary);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
  user-select: none;
}

table td {
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.88rem;
  color: var(--text);
  vertical-align: middle;
}

table tbody tr {
  transition: all var(--transition-fast);
}

table tbody tr:nth-child(even) {
  background: var(--bg-subtle);
}

table tbody tr:hover {
  background: var(--primary-50);
}

table tbody tr.clickable {
  cursor: pointer;
}

table tbody tr.clickable:hover {
  background: rgba(46, 125, 50, 0.08);
}

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.7rem;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.badge-success {
  background: var(--success-light);
  color: var(--success);
}
.badge-warning {
  background: var(--warning-light);
  color: var(--warning);
}
.badge-danger {
  background: var(--danger-light);
  color: var(--danger);
}
.badge-info {
  background: var(--info-light);
  color: var(--info);
}
.badge-neutral {
  background: var(--bg);
  color: var(--text-secondary);
}
.badge-purple {
  background: var(--purple-light);
  color: var(--purple);
}
.badge-green {
  background: var(--success-light);
  color: var(--success);
}

.badge i { width: 12px; height: 12px; }

/* ---------- Role Badges ---------- */
.role-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.role-badge.role-field_agent {
  background: var(--success-light);
  color: var(--success);
}
.role-badge.role-agent {
  background: var(--info-light);
  color: var(--info);
}
.role-badge.role-administrator {
  background: var(--purple-light);
  color: var(--purple);
}

/* ---------- Forms ---------- */
.form-group {
  margin-bottom: 1.15rem;
}

.form-group label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.4rem;
  color: var(--text);
  font-size: 0.88rem;
}

.form-control {
  width: 100%;
  padding: 0.65rem 0.9rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.9rem;
  transition: all var(--transition);
  outline: none;
  background: var(--surface);
  color: var(--text);
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-glow);
}

.form-control::placeholder {
  color: var(--text-muted);
}

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%234A6B4A' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.5rem;
  cursor: pointer;
}

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

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.form-help {
  font-size: 0.78rem;
  color: var(--text-light);
  margin-top: 0.25rem;
}

/* ---------- Search & Filters ---------- */
.toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 250px;
}

.search-box i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  width: 18px;
  height: 18px;
  pointer-events: none;
  transition: color var(--transition);
}

.search-box input {
  width: 100%;
  padding: 0.65rem 0.9rem 0.65rem 2.65rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.88rem;
  outline: none;
  transition: all var(--transition);
  background: var(--surface);
}

.search-box input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-glow);
}
.search-box input:focus + i,
.search-box:focus-within i { color: var(--primary); }

.filter-group {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.filter-group select {
  padding: 0.65rem 2.25rem 0.65rem 0.85rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.82rem;
  outline: none;
  background: var(--surface);
  color: var(--text);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%234A6B4A' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  cursor: pointer;
  transition: all var(--transition);
}

.filter-group select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-glow);
}

/* ---------- Pagination ---------- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0;
  gap: 1rem;
  flex-wrap: wrap;
}

.pagination-info {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.pagination-controls button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text);
  transition: all var(--transition);
}

.pagination-controls button:hover:not(:disabled) {
  background: var(--primary-50);
  border-color: var(--primary);
  color: var(--primary);
}

.pagination-controls button.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
  box-shadow: 0 2px 6px rgba(46, 125, 50, 0.3);
}

.pagination-controls button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.pagination-controls button i {
  width: 16px;
  height: 16px;
}

/* ---------- Detail Page ---------- */
.detail-header {
  display: flex;
  align-items: flex-start;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.detail-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-50), var(--primary-100));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--primary);
  flex-shrink: 0;
  border: 3px solid var(--primary-200);
}

.detail-info { flex: 1; }

.detail-info h2 {
  font-size: 1.4rem;
  margin-bottom: 0.25rem;
}

.detail-info .meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 0.5rem;
}

.detail-info .meta-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}
.detail-info .meta-item i { width: 16px; height: 16px; }

.detail-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.detail-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.25rem;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.info-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.info-item .info-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-light);
  font-weight: 600;
}
.info-item .info-value {
  font-size: 0.95rem;
  color: var(--text);
  font-weight: 500;
}

/* ---------- Empty State ---------- */
.empty-state {
  text-align: center;
  padding: 3.5rem 2rem;
  color: var(--text-secondary);
}

.empty-state i {
  width: 56px;
  height: 56px;
  color: var(--text-muted);
  margin-bottom: 1rem;
  opacity: 0.6;
}

.empty-state h3 {
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
  font-size: 1.1rem;
}

.empty-state p {
  font-size: 0.88rem;
  color: var(--text-light);
  max-width: 360px;
  margin: 0 auto;
}

/* ---------- Loading ---------- */
.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.spinner-sm {
  width: 18px;
  height: 18px;
  border-width: 2px;
}

.loading-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 1rem;
  padding: 3.5rem;
  color: var(--text-secondary);
  font-size: 0.88rem;
}

.skeleton {
  background: linear-gradient(90deg, var(--border-light) 25%, #e8e8e8 50%, var(--border-light) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 6px;
}
.skeleton-text { height: 14px; margin-bottom: 0.5rem; }
.skeleton-title { height: 22px; width: 60%; margin-bottom: 0.75rem; }
.skeleton-card { height: 120px; border-radius: var(--radius); }

/* ---------- Toast Notifications ---------- */
.toast-container {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  pointer-events: none;
}

.toast {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 320px;
  max-width: 480px;
  border-left: 4px solid var(--primary);
  animation: slideInRight 0.35s var(--bounce);
  pointer-events: auto;
  backdrop-filter: blur(8px);
}

.toast.toast-success { border-left-color: var(--success); }
.toast.toast-error { border-left-color: var(--danger); }
.toast.toast-warning { border-left-color: var(--warning); }
.toast.toast-info { border-left-color: var(--info); }

.toast .toast-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}
.toast.toast-success .toast-icon { color: var(--success); }
.toast.toast-error .toast-icon { color: var(--danger); }
.toast.toast-warning .toast-icon { color: var(--warning); }
.toast.toast-info .toast-icon { color: var(--info); }

.toast .toast-message {
  flex: 1;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
}

.toast .toast-close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  color: var(--text-light);
  border-radius: 6px;
  transition: all var(--transition);
}
.toast .toast-close:hover {
  color: var(--text);
  background: var(--bg);
}
.toast .toast-close i { width: 16px; height: 16px; }

.toast.toast-exit {
  animation: slideOutRight 0.3s ease forwards;
}

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition);
}

.modal-backdrop.show {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.92) translateY(20px);
  transition: transform var(--transition);
}

.modal-backdrop.show .modal {
  transform: scale(1) translateY(0);
}

.modal-header {
  padding: 1.25rem 1.75rem;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-subtle);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
}

.modal-body {
  padding: 1.5rem 1.75rem;
}

.modal-footer {
  padding: 1.15rem 1.75rem;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  background: var(--bg-subtle);
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

/* ---------- Sync Status ---------- */
.sync-stats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.sync-stat-card {
  text-align: center;
  padding: 1.25rem;
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-xs);
  transition: all var(--transition);
}
.sync-stat-card:hover {
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}
.sync-stat-card .count {
  font-size: 1.75rem;
  font-weight: 800;
  margin-bottom: 0.25rem;
}
.sync-stat-card .label {
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.auto-refresh-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.toggle-switch {
  position: relative;
  width: 42px;
  height: 24px;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: background var(--transition);
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: white;
  top: 3px;
  left: 3px;
  transition: transform var(--transition);
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.toggle-switch input:checked + .toggle-slider {
  background: var(--primary);
}
.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(18px);
}

/* ---------- Quick Actions ---------- */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.quick-action-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem;
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  color: var(--text);
}
.quick-action-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}
.quick-action-card .action-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-50);
  color: var(--primary);
  flex-shrink: 0;
}
.quick-action-card .action-icon i {
  width: 22px;
  height: 22px;
}
.quick-action-card .action-text h4 {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.1rem;
}
.quick-action-card .action-text p {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

/* ---------- Timeline ---------- */
.timeline {
  position: relative;
  padding-left: 1.75rem;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, var(--primary-200), var(--border-light));
  border-radius: 2px;
}
.timeline-item {
  position: relative;
  padding-bottom: 1.25rem;
  padding-left: 1.25rem;
}
.timeline-item::before {
  content: '';
  position: absolute;
  left: -1.75rem;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--primary);
  border: 3px solid var(--primary-100);
  margin-left: -5px;
}
.timeline-item .timeline-date {
  font-size: 0.72rem;
  color: var(--text-light);
  margin-bottom: 0.2rem;
  font-weight: 500;
}
.timeline-item .timeline-content {
  font-size: 0.85rem;
  color: var(--text);
}

/* ---------- Tree View ---------- */
.tree-view {
  padding: 0.5rem 0;
}

.tree-node {
  margin-left: 0;
}
.tree-node .tree-node {
  margin-left: 1.75rem;
}

.tree-node-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius);
  transition: all var(--transition-fast);
}
.tree-node-header:hover {
  background: var(--primary-50);
}

.tree-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: 6px;
  color: var(--text-secondary);
  transition: all var(--transition);
  flex-shrink: 0;
}
.tree-toggle:hover {
  background: var(--border-light);
  color: var(--primary);
}
.tree-toggle i {
  width: 16px;
  height: 16px;
  transition: transform 0.2s ease;
}
.tree-toggle.expanded i {
  transform: rotate(90deg);
}
.tree-toggle.invisible {
  visibility: hidden;
}

.tree-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.tree-label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
}

.tree-count {
  font-size: 0.7rem;
  background: var(--border-light);
  color: var(--text-secondary);
  padding: 0.1rem 0.5rem;
  border-radius: var(--radius-full);
  font-weight: 600;
}

.tree-actions {
  margin-left: auto;
  display: flex;
  gap: 0.15rem;
  opacity: 0;
  transition: opacity var(--transition-fast);
}
.tree-node-header:hover .tree-actions {
  opacity: 1;
}

.tree-children { overflow: hidden; }
.tree-children.hidden { display: none; }

.tree-region > .tree-node-header .tree-icon { color: var(--primary-dark); }
.tree-district > .tree-node-header .tree-icon { color: var(--info); }
.tree-ward > .tree-node-header .tree-icon { color: var(--warning); }
.tree-village > .tree-node-header .tree-icon { color: var(--text-secondary); }

/* ---------- Settings Tabs ---------- */
.settings-tabs {
  display: flex;
  gap: 0.25rem;
  border-bottom: 2px solid var(--border);
  padding-bottom: 0;
}
.settings-tab {
  padding: 0.65rem 1.25rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  border-radius: var(--radius) var(--radius) 0 0;
}
.settings-tab:hover {
  color: var(--primary);
  background: var(--primary-50);
}
.settings-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}
.settings-panel { display: none; }
.settings-panel.active { display: block; }

/* ---------- Integration Items ---------- */
.integration-item {
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--border-light);
}
.integration-item:last-child { border-bottom: none; padding-bottom: 0; }
.integration-item:first-child { padding-top: 0; }
.integration-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}
.integration-info h4 {
  font-size: 1rem;
  margin-bottom: 0.15rem;
}
.integration-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border-light);
}

/* ---------- Status Dot ---------- */
.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  background: var(--text-light);
}
.status-dot.status-connected {
  background: var(--success);
  box-shadow: 0 0 8px rgba(46, 125, 50, 0.5);
  animation: pulse-dot 2s ease-in-out infinite;
}
.status-dot.status-disconnected {
  background: var(--danger);
  box-shadow: 0 0 8px rgba(211, 47, 47, 0.4);
}

/* ---------- Checkbox Grid ---------- */
.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.5rem;
  padding: 0.5rem 0;
}
.checkbox-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text);
  cursor: pointer;
  padding: 0.4rem 0.5rem;
  border-radius: var(--radius);
  transition: background var(--transition);
}
.checkbox-item:hover { background: var(--bg); }
.checkbox-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

/* ---------- Animations ---------- */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

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

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

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

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

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  50% { transform: translateX(6px); }
  75% { transform: translateX(-3px); }
}

@keyframes floatGradient {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  33% { transform: translate(2%, -2%) rotate(1deg); }
  66% { transform: translate(-1%, 1%) rotate(-1deg); }
}

@keyframes pulse-subtle {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.03); }
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

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

/* ---------- Utility ---------- */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-xs { gap: 0.25rem; }
.gap-sm { gap: 0.5rem; }
.gap-md { gap: 1rem; }
.gap-lg { gap: 1.5rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.ml-auto { margin-left: auto; }
.hidden { display: none !important; }
.w-full { width: 100%; }
.truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .charts-grid-3 { grid-template-columns: 1fr 1fr; }
  .sync-stats { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 992px) {
  .detail-grid { grid-template-columns: 1fr; }
  .charts-grid { grid-template-columns: 1fr; }
  .charts-grid-3 { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-overlay.show {
    display: block;
  }
  .menu-toggle {
    display: block;
  }
  .main-content {
    margin-left: 0;
  }
  .content-header {
    padding: 0.75rem 1rem;
  }
  .content-body {
    padding: 1rem;
  }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .sync-stats { grid-template-columns: repeat(2, 1fr); }
  .detail-header { flex-direction: column; }
  .detail-actions { align-self: stretch; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .search-box { min-width: unset; }
  .filter-group { flex-wrap: wrap; }
  .info-grid { grid-template-columns: 1fr; }
  .tree-node .tree-node { margin-left: 1rem; }
  .tree-actions { opacity: 1; }
  .quick-actions { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .sync-stats { grid-template-columns: 1fr; }
  .pagination { flex-direction: column; text-align: center; }
  .login-container { padding: 2rem 1.5rem; }
  .modal { margin: 0.5rem; max-height: 95vh; }
}

/* ---------- Print ---------- */
@media print {
  .sidebar, .menu-toggle, .sidebar-overlay,
  .content-header, .toast-container,
  .btn, .pagination-controls { display: none !important; }
  .main-content { margin-left: 0; }
  .content-body { padding: 0; }
  body { background: white; }
  .card { box-shadow: none; border: 1px solid #ccc; }
  table th, table td { border: 1px solid #ccc; }
}
