:root {
  /* ============================================================
     Color Palette inspired by Modern Vibrant UI (Lector Theme)
     - Sidebar / Brand Accent: Vivid Pink-Magenta Gradient (#f43f8e -> #d946ef)
     - Stat Gradients:
         1. Pink/Magenta (#ec4899 -> #f43f5e)
         2. Purple/Violet (#8b5cf6 -> #6366f1)
         3. Cyan/Blue (#0ea5e9 -> #3b82f6)
         4. Orange/Amber (#f59e0b -> #f97316)
     - Background: Crisp Ultra-light Lavender/Gray (#f8fafc)
     - Text: Deep Charcoal (#1e293b)
     ============================================================ */
  --brand: #e11d48;
  --brand-pink: #e0acc6;
  --brand-purple: #795cbd;
  --brand-gradient-start: #f43f5e;
  --brand-gradient-end: #ec4899;
  --brand-dark: #be123c;
  --brand-light: #fce7f3;
  --brand-soft: #fff1f2;

  --sidebar-w: 245px;
  --body-bg: #f5f6fa;
  --card-bg: #ffffff;
  --text-main: #2d3748;
  --text-muted: #718096;
  --border-subtle: #edf2f7;

  /* Premium soft shadows */
  --card-shadow: 0 4px 20px -2px rgba(112, 144, 176, 0.12);
  --card-shadow-hover: 0 12px 30px -4px rgba(112, 144, 176, 0.22);
  --radius-card: 16px;
  --radius-pill: 9999px;
}

* {
  font-family: 'Sarabun', system-ui, -apple-system, sans-serif;
  box-sizing: border-box;
}

body {
  background: var(--body-bg);
  color: var(--text-main);
  margin: 0;
  -webkit-font-smoothing: antialiased;
}

/* ============================================================
   Navbar (Clean White & Floating Header Style)
   ============================================================ */
.app-navbar {
  background: #ffffff !important;
  border-bottom: 1px solid #eef2f6;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
  z-index: 1020;
}

.app-navbar .navbar-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0;
}

.app-navbar #btnSidebar {
  color: #64748b !important;
  padding: 0.25rem 0.5rem;
  font-size: 1.4rem;
}

.app-navbar .dropdown-toggle {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius-pill);
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #334155 !important;
  font-weight: 500;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.app-navbar .dropdown-toggle:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #0f172a !important;
}

.app-navbar .dropdown-toggle i {
  color: #ec4899;
  font-size: 1.15rem;
  margin-right: 0.35rem;
}

.app-navbar .dropdown-toggle .badge {
  background: linear-gradient(135deg, #f43f5e 0%, #ec4899 100%) !important;
  color: #ffffff !important;
  font-size: 0.75rem;
  padding: 0.25em 0.6em;
  border-radius: var(--radius-pill);
}

.dropdown-menu {
  border: none;
  border-radius: 12px;
  box-shadow: 0 10px 25px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
  padding: 0.5rem;
}

.dropdown-item {
  border-radius: 8px;
  padding: 0.5rem 0.85rem;
  font-size: 0.9rem;
  transition: all 0.15s ease;
}

.dropdown-item:hover {
  background: #fdf2f8;
  color: #e11d48;
}

.dropdown-item.text-danger:hover {
  background: #fee2e2;
  color: #dc2626 !important;
}

/* ============================================================
   App Layout Wrapper
   ============================================================ */
.app-wrap {
  display: flex;
  min-height: calc(100vh - 72px);
}

/* ============================================================
   Sidebar (Clean White with Vibrant Pink/Coral Active Pills)
   ============================================================ */
.app-sidebar {
  width: var(--sidebar-w);
  background: #ffffff;
  border-right: 1px solid #edf2f7;
  padding: 24px 14px;
  flex-shrink: 0;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.02);
}

.app-sidebar .nav {
  gap: 4px;
}

.app-sidebar .nav-link {
  color: #64748b;
  border-radius: 10px;
  padding: 0.7rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  font-size: 0.92rem;
  font-weight: 500;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.app-sidebar .nav-link i {
  font-size: 1.15rem;
  color: #94a3b8;
  transition: all 0.2s ease;
}

.app-sidebar .nav-link:hover {
  color: #e11d48;
  background: #fff1f2;
  transform: translateX(3px);
}

.app-sidebar .nav-link:hover i {
  color: #e11d48;
  transform: scale(1.1);
}

/* Active Item: Gradient Badge with Soft Glow like Dashboard Reference */
.app-sidebar .nav-link.active {
  background: linear-gradient(135deg, #f43f5e 0%, #ec4899 100%) !important;
  color: #ffffff !important;
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(244, 63, 94, 0.35);
}

.app-sidebar .nav-link.active i {
  color: #ffffff !important;
}

.sidebar-user {
  padding: 0.75rem 1rem;
  background: #fff1f2;
  border-radius: 10px;
  margin-bottom: 14px;
  font-weight: 600;
  color: #e11d48;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ============================================================
   Main Layout & Content Area
   ============================================================ */
.app-main {
  flex: 1;
  padding: 28px 36px;
  min-width: 0;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid var(--border-subtle);
}

h2,
h4 {
  font-weight: 700;
  color: #1e293b;
  letter-spacing: -0.3px;
}

/* ============================================================
   Cards & Containers
   ============================================================ */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  overflow: hidden;
}

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

.card-header {
  background-color: #ffffff !important;
  border-bottom: 1px solid #f1f5f9;
  font-weight: 600;
  color: #1e293b;
  padding: 1.1rem 1.4rem;
}

/* ============================================================
   Stat Cards (Dashboard & Summary) - Matching Image Gradients
   ============================================================ */
.stat-card {
  background: #ffffff;
  border: 1px solid rgba(226, 232, 240, 0.8);
  border-radius: var(--radius-card);
  padding: 22px 20px;
  text-align: center;
  box-shadow: var(--card-shadow);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  position: relative;
  overflow: hidden;
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--card-shadow-hover);
}

.stat-num {
  font-size: 2.2rem;
  font-weight: 800;
  background: linear-gradient(135deg, #f43f5e 0%, #a855f7 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.2;
  margin-bottom: 6px;
}

.stat-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: #64748b;
  letter-spacing: 0.2px;
}

/* Special Colorful Stat Cards (4 Gradient variations inspired by mockup) */
.stat-banner {
  border-radius: var(--radius-card);
  padding: 22px 24px;
  color: #ffffff;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 20px -4px rgba(0, 0, 0, 0.15);
  transition: transform 0.25s ease;
}

.stat-banner:hover {
  transform: translateY(-3px);
}

.stat-banner-pink {
  background: linear-gradient(135deg, #f43f5e 0%, #ec4899 100%);
}

.stat-banner-purple {
  background: linear-gradient(135deg, #7c3aed 0%, #6366f1 100%);
}

.stat-banner-blue {
  background: linear-gradient(135deg, #0284c7 0%, #06b6d4 100%);
}

.stat-banner-orange {
  background: linear-gradient(135deg, #f97316 0%, #f59e0b 100%);
}

/* ============================================================
   Tables (Modern Clean Style with Sleek Dark Thead Option)
   ============================================================ */
.table {
  --bs-table-bg: transparent;
  margin-bottom: 0;
  border-color: #f1f5f9;
}

.table thead th {
  background-color: #273043 !important;
  /* Elegant deep slate/navy like image table header */
  color: #ffffff !important;
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  border: none;
  padding: 0.75rem 1rem;
}

.table thead th:first-child {
  border-top-left-radius: 8px;
}

.table thead th:last-child {
  border-top-right-radius: 8px;
}

.table tbody td {
  padding: 0.65rem 1rem;
  vertical-align: middle;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.92rem;
  color: #334155;
}

.table tbody td a:link {
  color: #052043;
  text-decoration: none;
  /* Removes the default underline */
}

.table-hover tbody tr:hover {
  background-color: #faf5ff;
}

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

/* ============================================================
   Buttons & Form Controls
   ============================================================ */
.btn-primary {
  background: linear-gradient(135deg, #f43f5e 0%, #ec4899 100%);
  border-color: #f43f5e;
  box-shadow: 0 4px 12px rgba(244, 63, 94, 0.3);
  font-weight: 600;
  border-radius: 10px;
  transition: all 0.2s ease;
  color: #ffffff;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #e11d48 0%, #db2777 100%);
  border-color: #e11d48;
  box-shadow: 0 6px 16px rgba(244, 63, 94, 0.4);
  transform: translateY(-1px);
  color: #ffffff;
}

.btn {
  border-radius: 10px;
  font-weight: 500;
  padding: 0.48rem 1.05rem;
  transition: all 0.18s ease;
}

.btn-sm {
  border-radius: 7px;
  padding: 0.3rem 0.7rem;
  font-size: 0.85rem;
}

.btn-outline-primary {
  border-color: #f43f5e;
  color: #f43f5e;
}

.btn-outline-primary:hover {
  background: linear-gradient(135deg, #f43f5e 0%, #ec4899 100%);
  border-color: transparent;
  color: #ffffff;
}

.form-control,
.form-select {
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  padding: 0.55rem 0.9rem;
  font-size: 0.93rem;
  background-color: #ffffff;
  color: #1e293b;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus,
.form-select:focus {
  border-color: #ec4899;
  box-shadow: 0 0 0 3px rgba(236, 72, 153, 0.18);
}

/* ============================================================
   Badges (Pill Badges with Rich Soft Tones)
   ============================================================ */
.badge {
  font-weight: 600;
  padding: 0.4em 0.75em;
  border-radius: var(--radius-pill);
  letter-spacing: 0.2px;
  font-size: 0.78rem;
}

.badge.bg-success {
  background-color: #10b981 !important;
}

.badge.bg-warning {
  background-color: #f59e0b !important;
  color: #ffffff !important;
}

.badge.bg-danger {
  background-color: #ef4444 !important;
}

.badge.bg-secondary {
  background-color: #64748b !important;
}

.badge.bg-primary {
  background: linear-gradient(135deg, #f43f5e 0%, #ec4899 100%) !important;
}

/* ============================================================
   Login Page (Guest)
   ============================================================ */
.guest-main {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(135deg, #fce7f3 0%, #f3e8ff 50%, #e0e7ff 100%);
  position: relative;
  overflow: hidden;
}

.guest-main::before {
  content: '';
  position: absolute;
  width: 550px;
  height: 550px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(244, 63, 94, 0.12) 0%, transparent 70%);
  top: -100px;
  right: -100px;
}

.login-box {
  width: 100%;
  max-width: 420px;
  z-index: 1;
}

.login-box .card {
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
  box-shadow: 0 20px 35px -5px rgba(244, 63, 94, 0.12), 0 8px 16px -6px rgba(0, 0, 0, 0.04);
}

/* ============================================================
   Footer
   ============================================================ */
.app-footer {
  text-align: center;
  padding: 18px 24px;
  font-size: 0.85rem;
  color: var(--text-muted);
  background: #ffffff;
  border-top: 1px solid var(--border-subtle);
}

/* ============================================================
   Responsive (Mobile & Tablet)
   ============================================================ */
@media(max-width: 991.98px) {
  .app-sidebar {
    position: fixed;
    top: 72px;
    left: -100%;
    height: calc(100vh - 72px);
    z-index: 1030;
    transition: left 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.12);
  }

  .app-sidebar.show {
    left: 0;
  }

  .app-main {
    padding: 20px 16px;
  }
}