@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@500;600;700;800&display=swap');

:root {
  --bg-dark: #09090b;
  --bg-card: #141416;
  --bg-card-hover: #1f1f22;
  --primary: #000000;
  --secondary: #27272a;
  --accent: #FFD51C;
  --accent-hover: #FFDF4D;
  --gold: #FFD51C;
  --text-main: #fafafa;
  --text-muted: #a1a1aa;
  --border: #27272a;
  --radius: 12px;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.5);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.5), 0 2px 4px -2px rgb(0 0 0 / 0.5);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.7), 0 4px 6px -4px rgb(0 0 0 / 0.7);
  --shadow-glow: 0 0 20px rgba(255, 213, 28, 0.15);
  --glass-bg: rgba(20, 20, 22, 0.75);
  --glass-border: rgba(255, 255, 255, 0.05);
  --sidebar-width: 260px;
}

[data-theme="light"] {
  --bg-dark: #f4f4f5;
  --bg-card: #ffffff;
  --bg-card-hover: #fafafa;
  --secondary: #e4e4e7;
  --accent: #FFD51C;
  --accent-hover: #FFDF4D;
  --gold: #FFD51C;
  --text-main: #18181b;
  --text-muted: #18181b;
  --border: #d4d4d8;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.05);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.05);
  --shadow-glow: 0 0 20px rgba(255, 213, 28, 0.15);
  --glass-bg: rgba(255, 255, 255, 0.85);
  --glass-border: rgba(0, 0, 0, 0.08);
}

/* Light mode: fix form-control backgrounds */
[data-theme="light"] .form-control {
  background-color: #ffffff;
  border-color: #d4d4d8;
}

[data-theme="light"] .form-control:focus {
  background-color: #ffffff;
}

/* Light mode: fix table row hover */
[data-theme="light"] tbody tr:hover {
  background-color: rgba(0, 0, 0, 0.03);
}

/* Light mode: fix pagination hover */
[data-theme="light"] .pagination li.page-item a.page-link:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

/* Light mode: fix badge secondary */
[data-theme="light"] .badge.bg-secondary {
  background-color: rgba(0, 0, 0, 0.08);
  color: #18181b;
  border: 1px solid rgba(0, 0, 0, 0.15);
}

/* Pastikan elemen sidebar dan topbar tetap berwarna gelap (dark mode lock) */
.sidebar,
.topbar {
  --primary: #000000;
  --secondary: #27272a;
  --text-main: #fafafa;
  --text-muted: #a1a1aa;
  --border: #27272a;
  --accent: #FFD51C;
  --accent-hover: #FFDF4D;
  --glass-bg: rgba(20, 20, 22, 0.75);
  --glass-border: rgba(255, 255, 255, 0.05);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.3s ease, color 0.3s ease;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: 'Outfit', sans-serif;
  letter-spacing: -0.02em;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--accent-hover);
}

.text-gold {
  color: var(--accent);
}

.bg-gold {
  background-color: var(--accent);
  color: #000;
}

/* ===================== */
/*        Cards          */
/* ===================== */
.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: var(--shadow-md);
  transition: background-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(255, 213, 28, 0.2);
}

/* ===================== */
/*       Buttons         */
/* ===================== */
.btn svg {
  pointer-events: none;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 1.25rem;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  text-align: center;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  gap: 0.5rem;
  font-size: 0.95rem;
  white-space: nowrap;
  flex-shrink: 1;
  min-width: 0;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background-color: var(--accent);
  color: #000;
  box-shadow: 0 4px 10px rgba(255, 213, 28, 0.2);
}

.btn-primary:hover {
  background-color: var(--accent-hover);
  box-shadow: 0 6px 15px rgba(255, 213, 28, 0.3);
}

.btn-outline {
  background-color: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.btn-outline:hover {
  background-color: var(--secondary);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-soft-primary, .btn-outline-primary {
  background-color: rgba(234, 179, 8, 0.15) !important;
  color: var(--accent) !important;
  border: 1px solid rgba(234, 179, 8, 0.3) !important;
}
.btn-soft-primary:hover, .btn-outline-primary:hover {
  background-color: rgba(234, 179, 8, 0.25) !important;
  border-color: rgba(234, 179, 8, 0.5) !important;
}

.btn-soft-danger, .btn-outline-danger {
  background-color: rgba(239, 68, 68, 0.15) !important;
  color: #ef4444 !important;
  border: 1px solid rgba(239, 68, 68, 0.3) !important;
}
.btn-soft-danger:hover, .btn-outline-danger:hover {
  background-color: rgba(239, 68, 68, 0.25) !important;
  border-color: rgba(239, 68, 68, 0.5) !important;
}

.btn-soft-success, .btn-outline-success {
  background-color: rgba(16, 185, 129, 0.15) !important;
  color: #10b981 !important;
  border: 1px solid rgba(16, 185, 129, 0.3) !important;
}
.btn-soft-success:hover, .btn-outline-success:hover {
  background-color: rgba(16, 185, 129, 0.25) !important;
  border-color: rgba(16, 185, 129, 0.5) !important;
}

.btn-soft-info, .btn-outline-info {
  background-color: rgba(59, 130, 246, 0.15) !important;
  color: #3b82f6 !important;
  border: 1px solid rgba(59, 130, 246, 0.3) !important;
}
.btn-soft-info:hover, .btn-outline-info:hover {
  background-color: rgba(59, 130, 246, 0.25) !important;
  border-color: rgba(59, 130, 246, 0.5) !important;
}

.btn-soft-warning, .btn-outline-warning {
  background-color: rgba(245, 158, 11, 0.15) !important;
  color: #f59e0b !important;
  border: 1px solid rgba(245, 158, 11, 0.3) !important;
}
.btn-soft-warning:hover, .btn-outline-warning:hover {
  background-color: rgba(245, 158, 11, 0.25) !important;
  border-color: rgba(245, 158, 11, 0.5) !important;
}

/* ===================== */
/*     Form Elements     */
/* ===================== */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
}

.form-control {
  width: 100%;
  padding: 0.85rem 1rem;
  background-color: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.95rem;
  transition: all 0.2s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 213, 28, 0.15);
  background-color: rgba(0, 0, 0, 0.4);
}

select.form-control option {
  background-color: var(--bg-card);
  color: var(--text-main);
}

.form-control::placeholder {
  color: #52525b;
}

/* ===================== */
/*    Layout Wrapper     */
/* ===================== */
.wrapper {
  display: flex;
  min-height: 100vh;
}

/* ===================== */
/*       Sidebar         */
/* ===================== */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--primary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
  overflow-y: auto;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.sidebar-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  position: relative;
}

.sidebar-nav {
  flex: 1;
  padding: 1.5rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.nav-item {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  color: var(--text-muted);
  border-radius: 8px;
  transition: all 0.2s ease;
  font-weight: 500;
}

.nav-item:hover {
  color: var(--text-main);
  background-color: rgba(255, 255, 255, 0.05);
}

.nav-item.active {
  color: var(--accent);
  background-color: rgba(255, 213, 28, 0.1);
  font-weight: 600;
}

/* Nav Dropdown (collapsible sub-menu) */
.nav-dropdown {
  margin: 0;
}

.nav-dropdown .nav-dropdown-items {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.nav-dropdown.open .nav-dropdown-items {
  max-height: 300px;
}

.nav-dropdown .dropdown-arrow {
  transition: transform 0.3s ease;
  opacity: 0.5;
}

.nav-dropdown.open .dropdown-arrow {
  transform: rotate(180deg);
  opacity: 1;
}

.nav-sub-item {
  padding-left: 2.75rem !important;
  font-size: 0.9em;
  border-left: 2px solid rgba(255, 215, 0, 0.15);
  margin-left: 1.25rem;
  border-radius: 0 8px 8px 0 !important;
}

/* ===================== */
/*    Main Content       */
/* ===================== */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  margin-left: var(--sidebar-width);
}

/* ===================== */
/*       Topbar          */
/* ===================== */
.topbar {
  height: 70px;
  background-color: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 40;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.content-body {
  padding: 2.5rem;
  padding-top: 2rem;
  flex: 1;
  overflow-y: auto;
  position: relative;
  z-index: 1;
}

/* ===================== */
/*       Tables          */
/* ===================== */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 1rem;
  text-align: left;
  border: 1px solid var(--border);
}

td {
  text-transform: uppercase;
  font-size: clamp(0.75rem, 0.65rem + 0.35vw, 0.88rem);
}

th {
  background-color: var(--gold);
  color: #000;
  font-weight: 600;
  font-size: clamp(0.7rem, 0.6rem + 0.3vw, 0.8rem);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: center !important;
}

tbody tr {
  transition: background-color 0.2s ease;
}

tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.02);
}

/* ===================== */
/*        Badge          */
/* ===================== */
.badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge.bg-gold {
  background-color: var(--accent);
  color: #000;
  border: none;
  font-weight: 700;
}

.badge.bg-secondary {
  background-color: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.badge.bg-success {
  background-color: #10B981;
  color: #fff;
  border: none;
}

.badge.bg-danger {
  background-color: #EF4444;
  color: #fff;
  border: none;
}

.badge.bg-primary {
  background-color: #3B82F6;
  color: #fff;
  border: none;
}

.badge.bg-warning {
  background-color: #F59E0B;
  color: #fff;
  border: none;
}

/* ===================== */
/*    Utility Classes    */
/* ===================== */
.d-flex {
  display: flex;
}

.justify-content-between {
  justify-content: space-between;
}

.align-items-center {
  align-items: center;
}

.mt-1 {
  margin-top: 0.25rem;
}

.mt-2 {
  margin-top: 0.5rem;
}

.mt-3 {
  margin-top: 1rem;
}

.mt-4 {
  margin-top: 1.5rem;
}

.mt-5 {
  margin-top: 2.5rem;
}

.mb-1 {
  margin-bottom: 0.25rem;
}

.mb-2 {
  margin-bottom: 0.5rem;
}

.mb-3 {
  margin-bottom: 1rem;
}

.mb-4 {
  margin-bottom: 1.5rem;
}

.mb-5 {
  margin-bottom: 2.5rem;
}

.gap-2 {
  gap: 0.5rem;
}

.gap-3 {
  gap: 1rem;
}

.gap-4 {
  gap: 1.5rem;
}

.w-100 {
  width: 100%;
}

.text-center {
  text-align: center;
}

.text-muted {
  color: var(--text-muted);
}

/* ===================== */
/*     Pagination        */
/* ===================== */
.pagination {
  display: flex;
  list-style: none;
  padding: 0;
  margin: 0;
  gap: 5px;
  flex-wrap: wrap;
}

.pagination li.page-item {
  display: inline-block;
}

.pagination li.page-item a.page-link,
.pagination li.page-item span.page-link {
  display: inline-block;
  padding: 6px 12px;
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-main);
  border-radius: 4px;
  text-decoration: none;
  transition: all 0.2s;
}

.pagination li.page-item a.page-link:hover {
  background-color: rgba(255, 255, 255, 0.05);
  border-color: var(--accent);
}

.pagination li.page-item.disabled span.page-link {
  background-color: transparent;
  color: #666;
  border-color: rgba(255, 255, 255, 0.1);
}

/* Fix Laravel Default Bootstrap 5 Pagination Wrappers */
nav.d-flex .d-sm-none {
  display: none !important;
  /* Sembunyikan tombol Previous/Next ganda versi mobile */
}

nav.d-flex .d-none {
  display: flex !important;
  justify-content: center;
  /* Posisikan ke tengah */
  width: 100%;
}

nav.d-flex .d-none>div:first-child {
  display: none !important;
  /* Sembunyikan teks "Showing 1 to 10 of 15 results" jika tidak diinginkan */
}

.pagination li.page-item.active span.page-link {
  background-color: var(--accent);
  color: #000;
  border-color: var(--accent);
  font-weight: bold;
}

.pagination li.page-item.disabled span.page-link {
  color: var(--text-muted);
  cursor: not-allowed;
  opacity: 0.5;
}

/* ===================== */
/*  Hamburger & Overlay  */
/*  HIDDEN on desktop    */
/* ===================== */
.mobile-menu-btn svg {
  pointer-events: none;
}

.mobile-menu-btn {
  display: none;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-main);
  font-size: 1.3rem;
  cursor: pointer;
  padding: 0.35rem 0.5rem;
  border-radius: 8px;
  transition: all 0.2s;
  line-height: 1;
  align-items: center;
  justify-content: center;
}

.mobile-menu-btn:hover {
  background-color: var(--secondary);
  border-color: var(--text-muted);
}

.sidebar-close-btn {
  display: none;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: var(--text-main);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background-color 0.2s;
  position: absolute;
  right: 15px;
}

.sidebar-close-btn:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

.mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 99;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.mobile-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

/* ===================== */
/*     Typography        */
/* ===================== */
h2 {
  font-size: 1.75rem;
  color: var(--text-main);
}

.content-body h2 {
  font-size: 1.5rem;
  color: #000;
  background-color: var(--accent);
  display: block;
  width: 100%;
  flex: 1;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-weight: 800;
  font-family: 'Outfit', sans-serif;
  letter-spacing: -0.02em;
  margin-bottom: 0;
  text-transform: uppercase;
}

.content-body .d-flex>h2:not(:last-child) {
  margin-right: 1rem;
}

h3 {
  font-size: 1.25rem;
  color: var(--text-main);
  font-weight: 600;
}

/* Spinner and Loading States */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
  margin-right: 4px;
}

.btn-loading {
  pointer-events: none;
  opacity: 0.7;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ================================================================ */
/*             SMALL LAPTOP RESPONSIVE (≤1280px) SAFETY             */
/* ================================================================ */
@media (max-width: 1280px) {

  /* Card bounds & overflow protection */
  .card {
    overflow-x: hidden;
  }

  /* Table horizontal scroll safety */
  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  table:not(.table-excel) {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    min-width: 0;
  }

  /* Header button groups wrap safety */
  .d-flex.justify-content-between.align-items-center.mb-4,
  .d-flex.justify-content-between.align-items-center.mb-3,
  .d-flex.justify-content-between.align-items-center.mb-2,
  .d-flex.justify-content-between.align-items-center {
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  /* Table action buttons wrap safety */
  td .d-flex,
  td>div[style*="display: flex"],
  td>div[style*="display:flex"] {
    flex-wrap: wrap !important;
    gap: 4px;
  }

  td .btn {
    flex: 0 1 auto;
    min-width: 0;
    white-space: nowrap;
  }

  /* Form flex containers wrap safety */
  form.d-flex,
  [style*="display: flex"][style*="justify-content: flex-end"],
  [style*="display:flex"][style*="justify-content:flex-end"],
  [style*="display: flex"][style*="gap: 10px"],
  [style*="display:flex"][style*="gap: 10px"] {
    flex-wrap: wrap;
  }

  /* Neutralize aggressive inline min-widths */
  [style*="min-width: 300px"],
  [style*="min-width: 250px"],
  [style*="min-width: 200px"],
  [style*="min-width: 180px"] {
    min-width: 0 !important;
  }
}

/* ================================================================ */
/*                   TABLET RESPONSIVE (≤1024px)                     */
/* ================================================================ */
@media (max-width: 1024px) {

  /* --- Forms stay on one row, children shrink instead of wrapping --- */
  form.d-flex {
    flex-wrap: nowrap !important;
  }

  form.d-flex>div {
    flex: 1 1 auto !important;
    min-width: 0;
  }

  form.d-flex .form-control,
  form.d-flex select,
  form.d-flex input,
  form.d-flex button {
    min-width: 0;
  }

  form.d-flex .form-control,
  form.d-flex select.form-control {
    width: 100%;
  }

  form[style*="grid"] {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr)) !important;
  }

  /* --- Fix button groups in tables: keep one row, shrink buttons --- */
  td .d-flex,
  td>div[style*="display: flex"],
  td>div[style*="display:flex"] {
    flex-wrap: nowrap !important;
    justify-content: center;
  }

  td .d-flex.flex-column {
    flex-direction: row !important;
  }

  td .btn {
    flex: 0 1 auto;
    white-space: nowrap;
    min-width: 0;
    text-align: center;
    justify-content: center;
    font-size: 0.72rem;
    padding: 0.3rem 0.55rem;
  }

  /* Page headers — keep title + buttons on one row, shrink */
  .d-flex.justify-content-between.align-items-center.mb-4,
  .d-flex.justify-content-between.align-items-center.mb-3,
  .d-flex.justify-content-between.align-items-center.mb-2,
  .d-flex.justify-content-between.align-items-center {
    flex-direction: row;
    align-items: center !important;
    flex-wrap: nowrap;
    gap: 0.5rem;
  }

  /* Title shrinks instead of pushing buttons off-screen */
  .d-flex.justify-content-between.align-items-center>h2 {
    flex: 1 1 auto;
    min-width: 0;
    width: auto !important;
    font-size: clamp(1rem, 2vw + 0.6rem, 1.5rem);
    padding: 0.45rem 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Auto-fit/fill inline grids keep multiple columns (shrink, not stack) */
  [style*="repeat(auto-fit"],
  [style*="repeat(auto-fill"] {
    grid-template-columns: repeat(auto-fit, minmax(min(170px, 100%), 1fr)) !important;
    gap: 0.75rem !important;
  }

  /* Font scaling */
  h2 {
    font-size: 1.4rem;
  }

  h3 {
    font-size: 1.15rem;
  }

  /* Card and content bounds */
  .card {
    padding: 1.25rem;
    overflow-x: hidden;
  }

  /* Content body padding & wrap rules */
  .content-body {
    padding: 1.75rem;
  }

  .content-body .d-flex.gap-2,
  .content-body .d-flex.gap-3 {
    flex-wrap: nowrap;
    overflow-x: auto;
  }

  /* Topbar greeting truncation & auto height */
  .topbar {
    height: auto;
    min-height: 70px;
  }

  .topbar-greeting {
    font-size: 0.85rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: calc(100vw - 200px);
  }

  /* Filter forms — keep one row, children shrink */
  form.d-flex.gap-2,
  form.d-flex.align-items-center.gap-2 {
    flex-wrap: nowrap;
  }

  form.d-flex.gap-2>*,
  form.d-flex.align-items-center.gap-2>* {
    flex: 1 1 auto;
    min-width: 0;
  }

  /* Form button bars & flex containers — wrap without strict gap conditions */
  [style*="display: flex"][style*="justify-content: flex-end"],
  [style*="display:flex"][style*="justify-content:flex-end"] {
    flex-wrap: wrap;
  }

  [style*="display: flex"][style*="justify-content: flex-end"]>*,
  [style*="display:flex"][style*="justify-content:flex-end"]>* {
    flex: 0 1 auto;
    min-width: 0;
  }

  [style*="display: flex"][style*="gap: 10px"],
  [style*="display:flex"][style*="gap: 10px"] {
    flex-wrap: wrap;
  }

  /* Min-width neutralization on tablets/small laptops */
  [style*="min-width: 300px"],
  [style*="min-width: 250px"],
  [style*="min-width: 200px"],
  [style*="min-width: 180px"],
  [style*="min-width: 0"] {
    min-width: 0 !important;
  }

  /* Topbar inner — keep on one row, buttons shrink */
  .topbar .d-flex.align-items-center.justify-content-between {
    flex-wrap: nowrap;
    gap: 0.5rem;
  }

  /* Tablet: table horizontal scroll */
  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  table:not(.table-excel) {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    min-width: 0;
  }

  table[style*="min-width"] {
    min-width: 0 !important;
  }

  /* --- Buttons shrink on small screens (override inline padding in blades) --- */
  .btn:not(.btn-sm) {
    font-size: 0.8rem !important;
    padding: 0.4rem 0.85rem !important;
  }

  .topbar .btn {
    font-size: 0.75rem !important;
    padding: 0.32rem 0.7rem !important;
  }
}

/* ================================================================ */
/*                    MOBILE RESPONSIVE (≤768px)                     */
/* ================================================================ */
@media (max-width: 768px) {

  /* --- Layout --- */
  .wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
  }

  .main-content {
    margin-left: 0;
    width: 100%;
  }

  /* Catch card headers without mb-4 that didn't match the tablet rule */
  .d-flex.justify-content-between.align-items-center.mb-3,
  .d-flex.justify-content-between.align-items-center.mb-2 {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 0.5rem;
  }

  /* Search inputs — prevent overflow */
  input[type="search"],
  input[style*="width: 250px"] {
    max-width: 100% !important;
    width: 100% !important;
  }

  /* Force filter forms to stack cleanly on mobile */
  form.d-flex,
  form.d-flex.gap-2,
  form.d-flex.gap-3,
  form[style*="grid"] {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 1rem !important;
    /* uniform gap */
  }

  form.d-flex>*,
  form[style*="grid"]>* {
    width: 100% !important;
    flex: none !important;
  }

  form.d-flex .form-control,
  form.d-flex .form-select,
  form[style*="grid"] .form-control,
  form[style*="grid"] .form-select {
    width: 100% !important;
  }

  /* Topbar right-side buttons — allow wrapping */
  .topbar .d-flex.justify-content-between>.d-flex {
    flex-wrap: wrap;
    gap: 0.25rem;
  }

  /* Role-revert banner — stack on mobile */
  [style*="Mode Manager Aktif"] {
    flex-direction: column;
    text-align: center;
  }

  /* --- Hamburger Button: SHOW --- */
  .mobile-menu-btn {
    display: flex;
  }

  /* --- Sidebar: HIDDEN off-screen --- */
  .sidebar {
    position: fixed;
    top: 0;
    left: -300px;
    width: 280px;
    height: 100vh;
    height: 100dvh;
    z-index: 200;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: none;
  }

  .sidebar.show {
    left: 0;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.7);
  }

  /* --- Close button inside sidebar: SHOW --- */
  .sidebar-close-btn {
    display: flex;
  }

  /* --- Overlay: enable --- */
  .mobile-overlay {
    display: block;
    z-index: 199;
  }

  /* --- Topbar --- */
  .topbar {
    height: auto;
    min-height: 56px;
    padding: 0.65rem 1rem;
  }

  .topbar-greeting {
    font-size: 0.85rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: calc(100vw - 180px);
  }

  /* --- Content --- */
  .content-body {
    padding: 1rem;
  }

  .card {
    padding: 1.25rem;
  }

  h2 {
    font-size: 1.35rem;
  }

  h3 {
    font-size: 1.1rem;
  }

  /* --- Page header stacking --- */
  .d-flex.justify-content-between.align-items-center.mb-4 {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 0.75rem;
  }

  /* --- Force grid single column --- */
  [style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
  }

  /* --- Fix card max-width on mobile --- */
  .card[style*="max-width"] {
    max-width: 100% !important;
  }

  /* --- Profil layout vertical stacking --- */
  [style*="gap: 2rem"][style*="flex-wrap"] {
    flex-direction: column !important;
    align-items: center !important;
  }

  [style*="min-width: 300px"],
  [style*="min-width: 250px"],
  [style*="min-width: 200px"],
  [style*="min-width: 180px"],
  [style*="min-width: 0"] {
    min-width: 0 !important;
    width: 100% !important;
  }

  /* --- Form filter wrap (evaluasi/manager) --- */
  form.d-flex.gap-3 {
    flex-direction: column;
    align-items: stretch !important;
  }

  form.d-flex.gap-3>div {
    width: 100%;
  }

  form.d-flex.gap-3 select.form-control {
    width: 100% !important;
  }

  /* --- Legend row wrap --- */
  [style*="display: flex"][style*="gap: 15px"],
  [style*="display:flex"][style*="gap: 15px"],
  [style*="font-size: 12px"][style*="display: flex"][style*="gap: 15px"] {
    flex-wrap: wrap;
    gap: 8px !important;
  }

  /* --- QR reader full width --- */
  #reader {
    max-width: 100% !important;
  }

  /* --- Modal konfirmasi --- */
  #modalKonfirmasi>div {
    width: 92% !important;
    max-width: 340px !important;
  }

  /* --- Tables responsive --- */
  .table-container {
    margin-left: -1rem;
    margin-right: -1rem;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }

  table {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    font-size: 0.85rem;
  }

  td,
  th {
    white-space: nowrap;
    padding: 0.75rem;
  }

  /* --- Action buttons full width --- */
  .btn-print,
  .btn.btn-primary[onclick] {
    width: 100%;
    justify-content: center;
  }

  /* --- Kartu peserta --- */
  .kartu-wrapper {
    padding: 1rem !important;
  }

  .kartu-container {
    transform: scale(0.95);
    transform-origin: top center;
  }

  /* --- Chart canvas --- */
  canvas {
    max-width: 100% !important;
  }

  /* --- Table excel (evaluasi) --- */
  .table-excel {
    font-size: 11px !important;
  }

  .table-excel th,
  .table-excel td {
    padding: 6px 8px !important;
  }
}

/* ================================================================ */
/*                EXTRA SMALL SCREENS (≤480px)                       */
/* ================================================================ */
@media (max-width: 480px) {
  .topbar {
    padding: 0.5rem 0.75rem;
  }

  .topbar-greeting {
    font-size: 0.8rem;
    max-width: calc(100vw - 150px);
  }

  .content-body {
    padding: 0.75rem;
  }

  .card {
    padding: 1rem;
  }

  h2 {
    font-size: 1.2rem;
  }

  h3 {
    font-size: 1rem;
  }

  /* Quick action buttons stack */
  [style*="display: flex"][style*="gap: 1rem"][style*="flex-wrap: wrap"] {
    flex-direction: column;
  }

  [style*="display: flex"][style*="gap: 1rem"][style*="flex-wrap: wrap"] .btn {
    width: 100%;
    justify-content: center;
  }
}

/* ===================== */
/*    Inventaris         */
/* ===================== */
.inventaris-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 15px;
  margin-bottom: 25px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 15px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.stat-card h3 {
  margin: 0 0 10px 0;
  font-size: 16px;
  color: var(--text-main);
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
  font-size: 13px;
  color: var(--text-muted);
}

.stat-row strong {
  color: var(--text-main);
}

.table-inventaris th {
  font-size: 12px;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.05) !important;
  color: #f8fafc !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
}

.table-inventaris td {
  font-size: 13px;
  vertical-align: middle;
}

.form-control-sm {
  height: calc(1.5em + 0.5rem + 2px);
  padding: 0.25rem 0.5rem;
  font-size: 0.875rem;
  line-height: 1.5;
  border-radius: 0.2rem;
  background-color: var(--bg-dark);
  color: var(--text-main);
  border: 1px solid var(--border);
}

/* Inventaris Mobile Card View (Point 6) */
@media (max-width: 768px) {

  .table-peserta,
  .table-peserta thead,
  .table-peserta tbody,
  .table-peserta th,
  .table-peserta td,
  .table-peserta tr {
    display: block;
  }

  .table-peserta thead {
    display: none;
    /* Hide headers */
  }

  .table-peserta tr {
    margin-bottom: 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background-color: var(--bg-card);
    padding: 0.5rem;
  }

  .table-peserta td {
    border: none !important;
    position: relative;
    padding-left: 50% !important;
    text-align: right !important;
    min-height: 2.5rem;
    display: flex;
    justify-content: flex-end;
    align-items: center;
  }

  .table-peserta td::before {
    content: attr(data-label);
    position: absolute;
    left: 10px;
    width: 45%;
    padding-right: 10px;
    white-space: nowrap;
    text-align: left;
    font-weight: 600;
    color: var(--text-muted);
  }
}

/* ================================================================ */
/*             BOOTSTRAP & UTILITY COMPATIBILITY (P3)               */
/* ================================================================ */
.row {
  display: flex;
  flex-wrap: wrap;
  margin-right: -12px;
  margin-left: -12px;
}

.col-12 {
  flex: 0 0 100%;
  max-width: 100%;
  padding-right: 12px;
  padding-left: 12px;
}

.col-md-6 {
  flex: 0 0 50%;
  max-width: 50%;
  padding-right: 12px;
  padding-left: 12px;
}

@media (max-width: 768px) {
  .col-md-6 {
    flex: 0 0 100% !important;
    max-width: 100% !important;
  }
}

.h-100 {
  height: 100% !important;
}

.btn-danger {
  background-color: #ef4444 !important;
  color: #fff !important;
  box-shadow: 0 4px 10px rgba(239, 68, 68, 0.25);
}

.btn-danger:hover {
  background-color: #dc2626 !important;
  box-shadow: 0 6px 15px rgba(239, 68, 68, 0.35);
  color: #fff !important;
}

.btn-warning {
  background-color: #f59e0b !important;
  color: #000 !important;
  box-shadow: 0 4px 10px rgba(245, 158, 11, 0.25);
}

.btn-warning:hover {
  background-color: #d97706 !important;
  box-shadow: 0 6px 15px rgba(245, 158, 11, 0.35);
  color: #000 !important;
}

.btn-success {
  background-color: #10b981 !important;
  color: #fff !important;
  box-shadow: 0 4px 10px rgba(16, 185, 129, 0.25);
}

.btn-success:hover {
  background-color: #059669 !important;
  box-shadow: 0 6px 15px rgba(16, 185, 129, 0.35);
  color: #fff !important;
}

.alert {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  font-weight: 500;
  border: 1px solid transparent;
}

.alert-success {
  background-color: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.3);
}

.alert-danger {
  background-color: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.3);
}

.form-select {
  display: block;
  width: 100%;
  padding: 0.6rem 2.25rem 0.6rem 0.75rem;
  font-size: 0.95rem;
  font-weight: 400;
  line-height: 1.5;
  color: var(--text-main);
  background-color: var(--bg-dark);
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23ffffff' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 16px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  appearance: none;
}

.form-select:focus {
  border-color: var(--accent);
  outline: none;
}

.ms-1 {
  margin-left: 0.25rem !important;
}

.me-1 {
  margin-right: 0.25rem !important;
}

.gap-1 {
  gap: 0.25rem !important;
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1050;
  overflow-x: hidden;
  overflow-y: auto;
  outline: 0;
  background-color: rgba(0, 0, 0, 0.6);
}

.modal-dialog {
  position: relative;
  width: auto;
  margin: 1.75rem auto;
  max-width: 500px;
}

.modal-content {
  position: relative;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  outline: 0;
  color: var(--text-main);
  padding: 1.5rem;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.7);
  max-width: 500px;
  margin: 5% auto;
}

/* ================================================================ */
/*           CALENDAR ICON & KEUANGAN FILTER TOOLBAR LAYOUT         */
/* ================================================================ */

/* Universal calendar icon via background-image (works on all browsers) */
input[type="date"],
input[type="month"],
input[type="datetime-local"] {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23eab308' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 18px 18px;
  padding-right: 38px !important;
}

/* Webkit: keep native picker clickable but make it transparent overlay */
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="month"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator {
  opacity: 0;
  cursor: pointer;
  width: 28px;
  height: 28px;
  position: absolute;
  right: 4px;
}

/* Make input position relative for the absolute indicator */
input[type="date"],
input[type="month"],
input[type="datetime-local"] {
  position: relative;
}

.filter-toolbar-container {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.filter-date-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: nowrap;
}

.filter-action-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* MOBILE OVERRIDES KEUANGAN */
@media (max-width: 768px) {
    .filter-date-group {
        flex-wrap: wrap !important;
    }
    .filter-date-group input {
        min-width: 0;
        width: 100%;
    }
}
