:root {
  /* Color Palette - Modern & Premium */
  --primary: #4f46e5;
  --primary-gradient: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
  --secondary: #db2777;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;

  /* Neutrals */
  --dark: #0f172a;
  --text-main: #334155;
  --text-muted: #64748b;
  --light: #f8fafc;
  --white: #ffffff;
  --border: #e2e8f0;

  /* Dimensions */
  --sidebar-width: 280px;
  --header-height: 70px;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg:
    0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-primary: 0 4px 14px 0 rgba(79, 70, 229, 0.3);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  outline: none;
}

body {
  font-family: "Inter", sans-serif;
  background: var(--light);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

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

.app-container {
  display: flex;
  min-height: 100vh;
  width: 100%;
  overflow-x: clip;
}

/* === SIDEBAR STYLING === */
.sidebar {
  width: var(--sidebar-width);
  background: #1e1b4b; /* Deep Indigo */
  color: var(--white);
  position: fixed;
  left: 0;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 1050;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), width 0.3s ease;
}

/* Custom Scrollbar for Sidebar */
.sidebar::-webkit-scrollbar {
  width: 5px;
}
.sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.sidebar-header {
  padding: 20px 24px;
  background: rgba(0, 0, 0, 0.1);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-close-btn {
  display: none;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  width: 36px;
  height: 36px;
  color: var(--white);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.2s ease;
}

.sidebar-close-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

.sidebar-logo {
  font-size: 24px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--white);
  letter-spacing: -0.5px;
}

.sidebar-logo i {
  color: #818cf8;
  font-size: 28px;
}

.sidebar-user {
  margin-top: 24px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-user-name {
  font-weight: 600;
  font-size: 14px;
}

.sidebar-user-role {
  font-size: 12px;
  opacity: 0.6;
  margin-top: 2px;
}

.sidebar-menu {
  padding: 16px;
  flex: 1;
}

.menu-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.4);
  margin: 20px 12px 10px;
  font-weight: 700;
}

.menu-item {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  transition: all 0.2s ease;
  border-radius: 8px;
  margin-bottom: 4px;
  font-size: 14px;
  font-weight: 500;
}

.menu-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--white);
  transform: translateX(4px);
}

.menu-item.active {
  background: var(--primary);
  color: var(--white);
  box-shadow: var(--shadow-primary);
  font-weight: 600;
}

.menu-item i {
  width: 20px;
  text-align: center;
  font-size: 16px;
}

/* Submenu */
.menu-item-group {
  margin-bottom: 4px;
}

.submenu {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
  padding-left: 12px;
  margin-top: 2px;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  margin-left: 22px;
}

.submenu.show {
  max-height: 500px;
}

.submenu .menu-item {
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 2px;
}

.submenu .menu-item::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  margin-right: 8px;
}

.submenu .menu-item:hover::before,
.submenu .menu-item.active::before {
  background: var(--white);
}

/* === MAIN CONTENT === */
.main-content {
  margin-left: var(--sidebar-width);
  width: calc(100% - var(--sidebar-width));
  max-width: calc(100% - var(--sidebar-width));
  min-width: 0;
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 0 32px;
  height: var(--header-height);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  right: 0;
  z-index: 1030;
  transition: left 0.3s ease;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.topbar-title h1 {
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  font-weight: 700;
  color: var(--dark);
  margin: 0;
}

.topbar-actions {
  display: flex;
  gap: 16px;
  align-items: center;
}

.content-wrapper {
  padding: calc(var(--header-height) + 24px) 32px 32px 32px;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
  min-width: 0;
}

/* === UI COMPONENTS === */
.card {
  background: var(--white);
  border-radius: 16px;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
  border: 1px solid #e2e8f0;
  margin-bottom: 24px;
  position: relative;
  transition: all 0.2s ease;
}

.card:not(:has(.card-body)):not(:has(.table)):not(:has(.card-header)):not(.p-0) {
  padding: 24px;
}

.card-body {
  padding: 24px;
}

.card-header {
  padding: 20px 24px;
  background: transparent;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
}

.card-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--dark);
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
}

/* Utility Typography & Helpers */
.font-size-xs { font-size: 0.75rem !important; }
.font-size-sm { font-size: 0.875rem !important; }
.font-size-md { font-size: 0.9375rem !important; }
.font-size-lg { font-size: 1.125rem !important; }
.font-size-xl { font-size: 1.25rem !important; }
.font-size-2xl { font-size: 1.5rem !important; }
.font-size-3xl { font-size: 1.875rem !important; }

.text-nowrap { white-space: nowrap !important; }
.rounded-xl { border-radius: 16px !important; }
.rounded-2xl { border-radius: 20px !important; }
.border-soft { border: 1px solid #e2e8f0 !important; }
.shadow-subtle { box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05) !important; }
.shadow-hover { transition: all 0.2s ease; }
.shadow-hover:hover { transform: translateY(-2px); box-shadow: 0 10px 20px -3px rgba(0, 0, 0, 0.08) !important; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  border: none;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
  border-radius: 8px;
}

.btn-primary {
  background: var(--primary-gradient);
  color: var(--white);
  box-shadow: 0 4px 6px rgba(79, 70, 229, 0.2);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 12px rgba(79, 70, 229, 0.3);
}

.btn-secondary {
  background: var(--white);
  color: var(--text-main);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--light);
  border-color: #cbd5e1;
}

.btn-danger {
  background: var(--danger);
  color: white;
}

/* Forms */
.form-label {
  display: block;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 8px;
  font-size: 14px;
}

.form-control {
  width: 100%;
  padding: 10px 16px; /* Adjusted padding for better vertical centering */
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.5; /* Explicit line-height */
  background: var(--white);
  transition: all 0.2s;
  font-family: inherit;
  min-height: 46px; /* Ensure minimum height */
  display: flex; /* Helps with alignment in some browsers */
  align-items: center;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-control::placeholder {
  color: #94a3b8;
}

.form-control:disabled {
  background-color: #f1f5f9;
  cursor: not-allowed;
}

select.form-control {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 1.5em 1.5em;
  padding-right: 2.5rem;
  appearance: none;
  height: auto !important; /* Force auto height to prevent cut-off */
  padding-top: 10px;
  padding-bottom: 10px;
}

/* Grid System Utility */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

/* Base Toggle & Overlay Styles */
.menu-toggle {
  display: none;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 40px;
  height: 40px;
  min-width: 40px;
  align-items: center;
  justify-content: center;
  color: var(--text-main);
  font-size: 16px;
  cursor: pointer;
  margin-right: 12px;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.menu-toggle:hover {
  background: #f1f5f9;
  color: var(--primary);
  border-color: #cbd5e1;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1040;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.sidebar-overlay.show {
  display: block;
  opacity: 1;
}

/* Tablet & Mobile Breakpoint (< 992px) */
@media (max-width: 991.98px) {
  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .sidebar {
    transform: translateX(-100%);
    box-shadow: none;
    max-width: 82vw;
  }
  .sidebar.show {
    transform: translateX(0);
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
  }
  .sidebar-close-btn {
    display: inline-flex !important;
  }
  .main-content {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }
  .content-wrapper {
    padding: calc(60px + 16px) 16px calc(85px + env(safe-area-inset-bottom, 16px)) 16px !important;
    max-width: 100%;
    min-width: 0;
  }
  .content-wrapper > .container-fluid,
  .content-wrapper .container-fluid {
    padding-left: 0 !important;
    padding-right: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }
  .content-wrapper .row {
    margin-left: 0 !important;
    margin-right: 0 !important;
  }
  .topbar {
    left: 0 !important;
    right: 0 !important;
    padding: 0 16px;
    height: 60px;
  }
  .topbar-title h1 {
    font-size: clamp(1rem, 4vw, 1.25rem);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 78vw;
    font-weight: 700;
  }
  .menu-toggle {
    display: none !important;
  }

  /* Responsive Cards */
  .card {
    padding: 0;
    margin-bottom: 16px;
    border-radius: 14px;
    overflow: hidden;
  }
  .card-body {
    padding: 16px;
  }
  .card-body.p-0 {
    padding: 0 !important;
  }
  .card-header {
    padding: 14px 16px;
    flex-wrap: wrap;
    gap: 10px;
  }

  /* Universal Page Header Stacking on Tablet & Mobile */
  .page-header-flex,
  div[style*="justify-content: space-between"]:has(h1),
  div[style*="justify-content: space-between"]:has(h2),
  div[style*="justify-content: space-between"]:has(h3),
  div[style*="justify-content: space-between"]:has(.btn) {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 12px !important;
  }

  .page-header-flex > a.btn,
  .page-header-flex > button.btn,
  div[style*="justify-content: space-between"]:has(h1) > a.btn,
  div[style*="justify-content: space-between"]:has(h2) > a.btn,
  div[style*="justify-content: space-between"]:has(h3) > a.btn,
  div[style*="justify-content: space-between"]:has(h1) > button.btn,
  div[style*="justify-content: space-between"]:has(h2) > button.btn,
  div[style*="justify-content: space-between"]:has(h3) > button.btn {
    align-self: stretch !important;
    width: 100% !important;
    justify-content: center !important;
  }

  /* Isolated Table Scroll */
  .table-responsive {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    margin-bottom: 16px;
  }
  .table-modern thead th,
  .table-modern tbody td {
    padding: 12px 14px;
    font-size: 0.8125rem;
  }

  /* Metric & Banner Tablet Tuning */
  .stat-card,
  .stat-card-modern {
    padding: 18px 16px;
  }
  .hero-welcome-banner {
    padding: 24px 20px;
    border-radius: 16px;
  }
  .hero-welcome-banner h1,
  .hero-welcome-banner h2 {
    font-size: clamp(1.2rem, 4vw, 1.6rem) !important;
    line-height: 1.25 !important;
  }
}

/* Small Screen & Smartphone Breakpoint (< 576px) */
@media (max-width: 575.98px) {
  body {
    font-size: 13.5px;
  }
  .content-wrapper {
    padding: calc(56px + 12px) 10px 20px 10px !important;
  }
  .topbar {
    left: 0 !important;
    right: 0 !important;
    padding: 0 12px;
    height: 56px;
  }
  .topbar-title h1 {
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
  }
  .topbar-actions {
    gap: 8px;
  }
  .hero-welcome-banner {
    padding: 18px 14px;
    margin-bottom: 16px;
    border-radius: 14px;
  }
  .hero-welcome-banner h1,
  .hero-welcome-banner h2 {
    font-size: clamp(1.1rem, 4.5vw, 1.35rem) !important;
    line-height: 1.25 !important;
    word-break: break-word;
    overflow-wrap: break-word;
    margin-bottom: 6px !important;
  }
  .hero-welcome-banner p {
    font-size: clamp(0.78rem, 3vw, 0.875rem) !important;
    line-height: 1.4 !important;
  }
  .hero-welcome-banner .hero-badge {
    font-size: clamp(0.68rem, 2.5vw, 0.78rem) !important;
    padding: 3px 8px !important;
  }
  .action-tile {
    padding: 12px 14px;
  }
  .stat-main-row {
    gap: 10px;
    margin: 8px 0;
  }
  .stat-icon {
    width: 44px;
    height: 44px;
    font-size: 18px;
  }
  .stat-value {
    font-size: 22px;
  }

  /* Buttons & Inputs Mobile-Friendly */
  .btn {
    min-height: 40px;
    padding: 8px 14px;
    font-size: 0.85rem;
  }
  .btn-sm {
    min-height: 34px;
    padding: 6px 10px;
    font-size: 0.8rem;
  }
  .form-control {
    font-size: 15px; /* Prevent aggressive iOS auto-zoom */
    min-height: 42px;
    padding: 8px 12px;
  }

  /* Modal Optimization on Mobile */
  .modal-dialog {
    margin: 0.5rem auto;
    max-width: calc(100% - 1rem);
  }
  .modal-content {
    border-radius: 14px;
  }
  .modal-body {
    padding: 14px;
  }
}

/* Ultra-Compact Screens (< 380px, e.g. 318px Galaxy Fold cover) */
@media (max-width: 380px) {
  body {
    font-size: 13px;
  }
  .content-wrapper {
    padding: calc(52px + 10px) 6px 16px 6px !important;
  }
  .topbar {
    height: 52px !important;
    padding: 0 8px !important;
  }
  .topbar-title h1 {
    font-size: 0.96rem !important;
    max-width: 75vw !important;
    font-weight: 700 !important;
  }
  .menu-toggle {
    display: none !important;
  }
  .hero-welcome-banner {
    padding: 12px 10px !important;
    border-radius: 12px !important;
  }
  .hero-welcome-banner h1,
  .hero-welcome-banner h2 {
    font-size: 1.05rem !important;
  }
  .hero-badge {
    font-size: 10px !important;
    padding: 2px 6px !important;
  }
  .stat-card-modern,
  .stat-card {
    padding: 12px 8px !important;
  }
  .stat-modern-val {
    font-size: 1.35rem !important;
  }
  .card {
    padding: 0 !important;
    border-radius: 12px !important;
    overflow: hidden;
  }
  .card-body {
    padding: 12px 10px !important;
  }
  .card-body.p-0 {
    padding: 0 !important;
  }
  .btn {
    font-size: 0.78rem !important;
    padding: 6px 10px !important;
  }
}

/* Tables */
.table-responsive {
  display: block;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 16px;
  border-radius: 10px;
}
.table-responsive::-webkit-scrollbar {
  height: 6px;
}
.table-responsive::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 4px;
}
.table-responsive::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
.table-responsive::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

/* Responsive Utilities */
.d-none {
  display: none !important;
}
.d-block {
  display: block !important;
}

@media (min-width: 769px) {
  .d-md-none {
    display: none !important;
  }
  .d-md-block {
    display: block !important;
  }
  .d-md-flex {
    display: flex !important;
  }
}

@media (max-width: 768px) {
  .d-sm-none {
    display: none !important;
  }
  .d-sm-block {
    display: block !important;
  }

  /* Mobile Card Styles */
  .mobile-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-sm);
  }

  .mobile-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f1f5f9;
  }

  .mobile-card-row {
    margin-bottom: 8px;
    font-size: 14px;
  }

  .mobile-card-label {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    margin-bottom: 2px;
  }

  .mobile-card-value {
    color: var(--dark);
  }
}

/* Tables */
.table-th-desktop {
  text-align: left;
  padding: 16px;
  border-bottom: 2px solid var(--border);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

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

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

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
}

.badge-primary {
  background: #e0e7ff;
  color: #4338ca;
}
.badge-success {
  background: #d1fae5;
  color: #065f46;
}
.badge-warning {
  background: #fef3c7;
  color: #92400e;
}
.badge-danger {
  background: #fee2e2;
  color: #991b1b;
}
.badge-info {
  background: #dbeafe;
  color: #1e40af;
}
.badge-secondary {
  background: #e2e8f0;
  color: #475569;
}
.badge-purple {
  background: #f3e8ff;
  color: #7c3aed;
}
.badge-soft-primary {
  background: #eef2ff !important;
  color: #4f46e5 !important;
}
.badge-soft-success {
  background: #ecfdf5 !important;
  color: #059669 !important;
}
.badge-soft-warning {
  background: #fffbeb !important;
  color: #d97706 !important;
}
.badge-soft-danger {
  background: #fef2f2 !important;
  color: #dc2626 !important;
}
.badge-soft-info {
  background: #f0f9ff !important;
  color: #0284c7 !important;
}
.badge-soft-purple {
  background: #f5f3ff !important;
  color: #7c3aed !important;
}

/* Alerts */
.alert {
  padding: 14px 16px;
  border-radius: 12px;
  margin-bottom: 20px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
}
.alert > i,
.alert > .fas,
.alert > .far,
.alert > .bi,
.alert > svg {
  flex-shrink: 0;
  margin-top: 2px;
  font-size: 1.15em;
}
.alert > div,
.alert > p,
.alert > span {
  flex: 1;
  min-width: 0;
}
.alert-success {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #bbf7d0;
}
.alert-danger {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}
.alert-info {
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #93c5fd;
}

/* === PROFILE PAGE STYLES === */
.profile-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 24px;
  align-items: start;
}
.profile-card-sticky {
  padding: 0;
  overflow: hidden;
  position: sticky;
  top: 24px;
}
.responsive-input-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.mb-30 {
  margin-bottom: 30px;
}
.mb-24 {
  margin-bottom: 24px;
}

/* Mobile Breakpoint for Profile */
@media (max-width: 991px) {
  .profile-grid {
    grid-template-columns: 1fr; /* Stack vertically */
  }
  .profile-card-sticky {
    position: static; /* Remove sticky on mobile */
  }

  .responsive-input-grid {
    grid-template-columns: 1fr; /* Stack inputs vertically */
    gap: 16px;
  }
}

/* === CLASS SELECTION PAGE STYLES === */
.class-item:hover {
  background: #eef2ff !important;
  border-color: #e0e7ff !important;
}

.class-item.active {
  background: #e0e7ff !important;
  border-color: var(--primary) !important;
}

.class-item.active .check-circle {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
}

.class-item.active .check-circle i {
  opacity: 1 !important;
  transform: scale(1) !important;
}

.class-item.active span {
  color: var(--primary-dark) !important;
}

/* === STATS CARDS === */
/* === STATS CARDS === */
.stat-card {
  display: flex;
  flex-direction: column; /* Stack vertically for centered layout */
  align-items: center; /* Center horizontally */
  justify-content: center;
  text-align: center;
  padding: 24px;
  border-left-width: 4px; /* Keep accent */
  border-left-style: solid;
  transition:
    transform 0.2s,
    box-shadow 0.2s;
  height: 100%;
}

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

/* Container for Icon + Value */
.stat-main-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin: 12px 0;
  width: 100%;
}

.stat-content {
  width: 100%; /* Ensure content takes full width */
}

.stat-title {
  font-size: 13px; /* Slightly larger for center title */
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0px; /* Spacing handled by row margin */
}

.stat-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--dark);
  line-height: 1;
}

.stat-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 0px;
  font-weight: 500;
}

.stat-icon {
  width: 52px; /* Slightly smaller to balance with text */
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
  margin: 0; /* Margins handled by gap in parent */
  opacity: 1; /* Full opacity */
}

/* Feature/Action Cards */
.action-card {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 24px;
  transition: all 0.2s;
  text-decoration: none;
  height: 100%;
  border: 1px solid transparent;
}

.action-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  background: #f8fafc;
}

.action-icon {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.action-title {
  color: var(--dark);
  font-size: 17px;
  margin-bottom: 6px;
  font-weight: 700;
  line-height: 1.3;
}

.action-desc {
  color: var(--text-muted);
  font-size: 14px;
  margin: 0;
  line-height: 1.5;
}

/* === MODERN DASHBOARD & PAGE ENHANCEMENTS (AI DESIGN SYSTEM) === */
.hero-welcome-banner {
  background: linear-gradient(135deg, #312e81 0%, #4338ca 50%, #6366f1 100%);
  border-radius: 20px;
  padding: 32px;
  color: #ffffff;
  margin-bottom: 28px;
  box-shadow: 0 10px 25px -5px rgba(67, 56, 202, 0.25);
  position: relative;
  overflow: hidden;
}

.hero-welcome-banner::after {
  content: '';
  position: absolute;
  right: -30px;
  bottom: -30px;
  width: 240px;
  height: 240px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.16) 0%, rgba(255, 255, 255, 0) 70%);
  border-radius: 50%;
  pointer-events: none;
}

.hero-welcome-banner .hero-badge {
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 30px;
  padding: 6px 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #ffffff;
}

/* Modern Metric Cards */
.stat-card-modern {
  background: #ffffff;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  padding: 24px;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  height: 100%;
}

.stat-card-modern:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 20px -3px rgba(0, 0, 0, 0.08);
  border-color: #cbd5e1;
}

.stat-icon-modern {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.stat-icon-indigo { background: #eef2ff; color: #4f46e5; }
.stat-icon-emerald { background: #ecfdf5; color: #059669; }
.stat-icon-amber { background: #fffbeb; color: #d97706; }
.stat-icon-purple { background: #f5f3ff; color: #7c3aed; }
.stat-icon-rose { background: #fff1f2; color: #e11d48; }

.stat-modern-val {
  font-size: 1.875rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.stat-modern-label {
  font-size: 0.8125rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.stat-modern-sub {
  font-size: 0.8125rem;
  color: #94a3b8;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Quick Action Tiles */
.action-tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}

.action-tile {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 20px 22px;
  display: flex;
  align-items: center;
  gap: 16px;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.03);
}

.action-tile:hover {
  transform: translateY(-2px);
  border-color: #6366f1;
  box-shadow: 0 8px 16px -2px rgba(99, 102, 241, 0.12);
  text-decoration: none;
  color: inherit;
}

.action-tile-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.action-tile-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 2px;
}

.action-tile:hover .action-tile-title {
  color: #4f46e5;
}

.action-tile-desc {
  font-size: 0.8125rem;
  color: #64748b;
  margin: 0;
  line-height: 1.4;
}

.action-tile-arrow {
  margin-left: auto;
  color: #cbd5e1;
  font-size: 14px;
  transition: transform 0.2s ease, color 0.2s ease;
}

.action-tile:hover .action-tile-arrow {
  color: #4f46e5;
  transform: translateX(4px);
}

/* Modern Tables */
.table-modern {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.table-modern thead th {
  background: #f8fafc;
  color: #64748b;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 14px 20px;
  border-bottom: 1px solid #e2e8f0;
  white-space: nowrap;
}

.table-modern tbody tr {
  transition: background-color 0.15s ease;
}

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

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

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

/* === CBT EXAM & TEST ROOM RESPONSIVE STYLES === */
.garuda-exam-header {
  transition: padding 0.2s ease;
}

@media (max-width: 768px) {
  .garuda-exam-header {
    padding: 0.65rem 0.85rem !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
  }
  .garuda-clock-box {
    font-size: 0.95rem !important;
    padding: 4px 10px !important;
  }
  .question-card-garuda {
    padding: 1.25rem 1rem !important;
    min-height: auto !important;
    margin-bottom: 1.25rem !important;
    border-radius: 12px !important;
  }
  .cbt-nav-bottom {
    flex-direction: column-reverse !important;
    gap: 10px !important;
    align-items: stretch !important;
  }
  .cbt-nav-bottom .btn,
  .cbt-nav-bottom > div {
    width: 100% !important;
  }
  .cbt-nav-bottom .btn {
    min-height: 44px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
  .q-number-box {
    width: 44px !important;
    height: 44px !important;
    font-size: 1rem !important;
  }
}

/* === ADMIN & DEVELOPER MODULES MOBILE RESPONSIVE STYLES === */
.dev-hero-banner {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #334155 100%);
  color: white;
  padding: clamp(16px, 3.5vw, 32px);
  border-radius: 16px;
  margin-bottom: 24px;
  box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.4);
  position: relative;
  overflow: hidden;
}

.dev-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.backup-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 20px;
}

.settings-container {
  background: white;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  padding: clamp(14px, 3vw, 24px);
}

.settings-main-grid {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 32px;
}

.settings-form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.settings-form-row-2-unequal {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.settings-form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.settings-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.settings-two-col-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

@media (max-width: 991.98px) {
  .settings-main-grid {
    grid-template-columns: 1fr !important;
    gap: 24px !important;
  }
}

@media (max-width: 767.98px) {
  .settings-form-row-2,
  .settings-form-row-2-unequal,
  .settings-form-row-3 {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }
  .backup-cards-grid {
    grid-template-columns: 1fr !important;
  }
}

/* Custom Settings Tabbed Interface (Sticky & Horizontal Scroll Ala Panduan) */
.custom-settings-nav-wrapper {
  position: sticky;
  top: 70px;
  z-index: 1020;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  padding: 8px 12px;
  border-radius: 16px;
  margin-bottom: 24px;
  border: 1px solid rgba(226, 232, 240, 0.9);
  box-shadow: 0 4px 15px -3px rgba(15, 23, 42, 0.05);
}

.custom-settings-nav {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  gap: 8px;
  margin-bottom: 0;
  padding: 2px;
  border: none;
  background: transparent;
}

.custom-settings-nav::-webkit-scrollbar {
  display: none;
}

.custom-settings-nav .nav-item {
  flex: 0 0 auto;
}

.custom-settings-nav .nav-link {
  color: #475569;
  font-weight: 600;
  font-size: 0.84rem;
  padding: 8px 16px;
  border-radius: 20px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid #e2e8f0;
  background: #ffffff;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  white-space: nowrap;
}

.custom-settings-nav .nav-link:hover {
  color: #1e293b;
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.custom-settings-nav .nav-link.active {
  color: #ffffff !important;
  background: #4f46e5 !important;
  border-color: #4f46e5 !important;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25) !important;
}

.custom-settings-nav .nav-link.active i {
  color: #ffffff !important;
}

@media (max-width: 768px) {
  .custom-settings-nav-wrapper {
    top: 60px;
    border-radius: 0;
    margin-left: -16px;
    margin-right: -16px;
    padding: 8px 14px;
    border-left: none;
    border-right: none;
  }
}

.settings-card {
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  background: #ffffff;
  overflow: hidden;
  margin-bottom: 24px;
}

.settings-card-header {
  padding: 16px 20px;
  background: #ffffff;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ==========================================================================
   MOBILE FLOATING BOTTOM APP DOCK (ALA SHOPEE / SUPER APP)
   ========================================================================== */
.mobile-bottom-dock {
  display: none;
}

@media (max-width: 768px) {
  .mobile-bottom-dock {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(62px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-top: 1px solid rgba(226, 232, 240, 0.9);
    box-shadow: 0 -4px 25px rgba(15, 23, 42, 0.08);
    z-index: 1040;
    align-items: center;
    justify-content: space-around;
  }

  .mobile-dock-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    height: 100%;
    color: #64748b;
    text-decoration: none !important;
    font-size: 10.5px;
    font-weight: 600;
    position: relative;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    padding: 6px 0;
    -webkit-tap-highlight-color: transparent;
    cursor: pointer;
    background: transparent;
    border: none;
  }

  .mobile-dock-item i {
    font-size: 19px;
    margin-bottom: 3px;
    transition: transform 0.2s ease, color 0.2s ease;
  }

  .mobile-dock-item:active {
    transform: scale(0.92);
  }

  .mobile-dock-item.active {
    color: #4f46e5;
  }

  .mobile-dock-item.active i {
    transform: translateY(-2px);
    color: #4f46e5;
  }

  .mobile-dock-badge {
    position: absolute;
    top: 5px;
    right: calc(50% - 20px);
    font-size: 8.5px;
    font-weight: 800;
    padding: 1px 5px;
    border-radius: 6px;
    color: white;
    line-height: 1.1;
  }

  @media (max-width: 360px) {
    .mobile-dock-item {
      font-size: 9.5px;
      padding: 4px 0;
    }
    .mobile-dock-item i {
      font-size: 17px;
      margin-bottom: 2px;
    }
    .mobile-dock-badge {
      top: 3px;
      font-size: 7.5px;
      padding: 0.5px 3.5px;
    }
  }

  .sidebar {
    padding-bottom: 95px !important;
  }

  /* Slide-up Bottom Sheet Modal */
  .modal-bottom-sheet .modal-dialog {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    margin: 0;
    max-width: 100%;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .modal-bottom-sheet.show .modal-dialog {
    transform: translateY(0);
  }

  .modal-bottom-sheet .modal-content {
    border-radius: 24px 24px 0 0;
    border: none;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.2);
    max-height: 88vh;
    overflow-y: auto;
  }

  .modal-bottom-sheet-handle {
    width: 44px;
    height: 5px;
    border-radius: 10px;
    background: #cbd5e1;
    margin: 10px auto 4px auto;
  }
}




