:root {
  --bs-primary: #16a34a;
  --bs-primary-rgb: 22, 163, 74;
  --bs-secondary: #64748b;
  --bs-secondary-rgb: 100, 116, 139;
  --bs-success: #22c55e;
  --bs-success-rgb: 34, 197, 94;
  --bs-info: #0ea5e9;
  --bs-info-rgb: 14, 165, 233;
  --bs-warning: #f59e0b;
  --bs-warning-rgb: 245, 158, 11;
  --bs-danger: #ef4444;
  --bs-danger-rgb: 239, 68, 68;
  --bs-light: #f8fafc;
  --bs-light-rgb: 248, 250, 252;
  --bs-dark: #0f172a;
  --bs-dark-rgb: 15, 23, 42;
  --bs-body-bg: #f8fafc;
  --bs-body-color: #334155;
  --bs-secondary-bg: #ffffff;
  --bs-tertiary-bg: #f1f5f9;
  --bs-border-color: #e2e8f0;
  --bs-link-color: #16a34a;
  --bs-link-hover-color: #15803d;
  --bs-card-bg: #ffffff;
  --bs-card-border-color: #e2e8f0;
  --bs-focus-ring-color: rgba(22,163,74,.25);
  --bs-form-valid-color: #22c55e;
  --bs-form-valid-border-color: #22c55e;
  --bs-border-radius: .75rem;
  --bs-border-radius-lg: 1rem;
  --bs-box-shadow-sm: 0 .125rem .25rem rgba(0,0,0,.05);
  --bs-box-shadow: 0 .5rem 1rem rgba(0,0,0,.08);
  --bs-box-shadow-lg: 0 1rem 3rem rgba(0,0,0,.12);

  --primary: var(--bs-primary);
  --secondary: var(--bs-secondary);
  --accent: var(--bs-primary);
  --success: var(--bs-success);
  --warning: var(--bs-warning);
  --danger: var(--bs-danger);
  --background: var(--bs-body-bg);
  --surface: var(--bs-secondary-bg);
  --border: var(--bs-border-color);
  --muted: #64748b;
  --text: var(--bs-body-color);
  --shadow: var(--bs-box-shadow);
}

body {
  font-family: 'Inter', sans-serif;
  background: radial-gradient(circle at top left, rgba(22, 163, 74, 0.08), transparent 28%), linear-gradient(135deg, #f8fafc 0%, #eefcf4 100%);
  color: var(--text);
  min-height: 100vh;
}

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(circle at top left, rgba(22, 163, 74, 0.16), transparent 32%), linear-gradient(135deg, #f8fafc 0%, #eefcf4 100%);
}

.auth-shell {
  width: 100%;
  max-width: 500px;
}

.auth-card {
  border: 0;
  border-radius: 28px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 24px 55px rgba(15, 99, 68, 0.16);
}

.auth-illustration {
  position: relative;
  min-height: 100%;
  background: linear-gradient(145deg, #0f172a 0%, #14532d 49%, #16a34a 100%);
  color: #fff;
  padding: 2rem;
}

.auth-illustration::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top right, rgba(255,255,255,0.16), transparent 36%);
  pointer-events: none;
}

.auth-brand {
  position: relative;
  z-index: 1;
}

.auth-brand .brand-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0.48rem 0.8rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.16);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid rgba(255,255,255,0.2);
}

.auth-form-panel {
  padding: 2rem;
}

.auth-form-panel .form-control {
  border-radius: 14px;
  padding: 0.8rem 0.95rem;
  border-color: #dbe7dc;
}

.auth-form-panel .form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 0.2rem rgba(22, 163, 74, 0.16);
}

.auth-btn {
  border-radius: 999px;
  padding: 0.8rem 1rem;
  font-weight: 600;
  background: linear-gradient(135deg, var(--primary) 0%, #15803d 100%);
  border: 0;
}

.auth-btn:hover {
  transform: translateY(-1px);
}

.auth-link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

.auth-link:hover {
  color: #15803d;
  text-decoration: underline;
}

.auth-note {
  color: var(--muted);
  font-size: 0.92rem;
}

.sidebar {
    width: 270px;
    min-height: 100vh;
    background: linear-gradient(180deg, var(--primary) 0%, #14532d 100%);
  color: #fff;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1030;
    transition: transform .25s ease;
}

.sidebar.collapsed {
  transform: translateX(-100%);
}

.sidebar .nav-link {
  color: rgba(255, 255, 255, 0.9);
  border-radius: 10px;
  padding: 0.72rem 0.95rem;
  transition: all 0.2s ease;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.sidebar .nav-link i {
  width: 20px;
  text-align: center;
}

.sidebar .nav-link.logout-link {
  margin-top: 1.25rem;
  color: #fecaca;
}

.sidebar .nav-link.logout-link:hover {
  background: rgba(255,255,255,0.12);
  color: #fff;
}

/* .content-wrapper {
  margin-left: 270px;
  min-height: 100vh;
  padding: 1.3rem 1.3rem 2rem;
  transition: margin-left 0.25s ease;
  background: transparent;
} */

.content-wrapper {
    margin-left: 270px;
    min-height: 100vh;
    padding: 1.3rem;
    transition: margin-left .25s ease;
    min-width: 0; /* Important */
}

.content-wrapper.expanded {
  margin-left: 0;
}

.topbar {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 18px;
  box-shadow: 0 10px 24px rgba(15, 99, 68, 0.06);
  margin-bottom: 1rem;
}

.page-header {
  background: linear-gradient(135deg, #ffffff 0%, #f8fdf9 100%);
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: 18px;
  padding: 1.2rem 1.3rem;
  box-shadow: 0 10px 24px rgba(15, 99, 68, 0.05);
}

.hero-banner {
  background: linear-gradient(135deg, #0f172a 0%, #14532d 45%, #16a34a 100%);
  border-radius: 24px;
  padding: 1.5rem;
  color: #fff;
  box-shadow: 0 20px 45px rgba(15, 99, 68, 0.18);
}

.hero-banner .badge-soft {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.18);
  padding: 0.45rem 0.7rem;
  border-radius: 999px;
}

.hero-actions .btn {
  border-radius: 999px;
}

.card {
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: 20px;
  box-shadow: 0 14px 36px rgba(15, 99, 68, 0.08);
  overflow: visible;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 42px rgba(15, 99, 68, 0.1);
}

.card-body {
  padding: 1.2rem 1.25rem;
}

.metric-card {
  position: relative;
  overflow: hidden;
  background: linear-gradient(145deg, #ffffff 0%, #f8fff9 100%);
  border: 1px solid rgba(226, 232, 240, 0.9);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.metric-card::after {
  content: '';
  position: absolute;
  width: 120px;
  height: 120px;
  right: -25px;
  bottom: -25px;
  background: radial-gradient(circle, rgba(22, 163, 74, 0.16) 0%, rgba(22, 163, 74, 0) 70%);
  border-radius: 50%;
}

.metric-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 36px rgba(22, 163, 74, 0.12);
}

.icon-badge {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  font-size: 1.1rem;
}

.table {
  margin-bottom: 0;
  border-collapse: separate;
  border-spacing: 0;
}

.table thead {
  background: linear-gradient(90deg, #f6fdf8 0%, #eefcf4 100%);
}

.table th {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #475569;
  border-bottom: 1px solid rgba(226, 232, 240, 0.95);
}

.table td {
  vertical-align: middle;
  border-bottom: 1px solid rgba(226, 232, 240, 0.8);
}

.table-hover tbody tr:hover {
  background: #f8fff9;
}

.table-responsive {
  overflow: visible;
}

.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
  margin-top: 0.75rem;
  margin-bottom: 0.75rem;
}

.dataTables_wrapper .dataTables_filter input {
  min-width: 220px;
  padding: 0.6rem 0.8rem;
}

.dataTables_wrapper .dataTables_length select {
  min-width: 80px;
  padding: 0.5rem 0.7rem;
}

.btn {
  border-radius: 999px;
  padding: 0.58rem 1rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
  box-shadow: 0 8px 18px rgba(15, 99, 68, 0.06);
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #15803d);
  border-color: var(--accent);
  box-shadow: 0 8px 20px rgba(22,163,74,.16);
}

.btn-outline-primary,
.btn-outline-secondary,
.btn-outline-light {
  background: #fff;
  border-color: #dbe7df;
  color: var(--text);
}

.btn-outline-primary:hover,
.btn-outline-secondary:hover,
.btn-outline-light:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(22, 163, 74, 0.08);
}

.btn-secondary:hover,
.btn-danger:hover,
.btn-success:hover,
.btn-info:hover,
.btn-warning:hover {
  filter: brightness(0.95);
}

.form-control,
.form-select {
  border-radius: 12px;
  min-height: 44px;
  border-color: #d8e4db;
  background: #fcfdfc;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 0.2rem rgba(22, 163, 74, 0.14);
  background: #fff;
}

.form-label {
  margin-bottom: 0.4rem;
  font-weight: 600;
}

.template-card {
  background: #fff;
  transition: all 0.2s ease;
  cursor: pointer;
}

.template-card:hover {
  border-color: var(--accent) !important;
  box-shadow: 0 8px 18px rgba(22,163,74,.12);
  transform: translateY(-1px);
}

.template-card.active {
  border-color: var(--accent) !important;
  background: rgba(22, 163, 74, 0.08);
  box-shadow: 0 10px 22px rgba(22,163,74,.16);
}

.badge {
  border-radius: 999px;
}

.empty-state {
  padding: 2rem;
  border: 1px dashed var(--border);
  border-radius: 14px;
  background: #fcfefc;
  text-align: center;
}

.chart-card {
  min-height: 340px;
}

.chart-shell {
  position: relative;
  height: 240px;
}

.preview-card {
  background: linear-gradient(135deg, #f9fdfb 0%, #eefcf4 100%);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1rem;
}

.preview-logo {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  border: 2px dashed var(--accent);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 0.75rem;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
}

.preview-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sidebar-brand {
  padding: 0.35rem 0.25rem 0.75rem;
}

.sidebar-logo {
  width: 125px;
  height: 55px;
  object-fit: left;
  display: block;
  margin: 0 auto;
}

.profile-avatar {
  width: 92px;
  height: 92px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid rgba(22, 163, 74, 0.2);
  box-shadow: 0 10px 24px rgba(22, 163, 74, 0.16);
}

.chart-canvas {
  height: 240px !important;
}

@media (max-width: 991px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.show {
    transform: translateX(0);
  }

  .content-wrapper {
    margin-left: 0;
  }
}

@media print {
  .sidebar,
  .topbar,
  .btn,
  .dropdown,
  .form-control,
  .dataTables_wrapper {
    display: none !important;
  }

  .content-wrapper {
    margin-left: 0;
  }
}
