/*
 * ================================================================
 * ABSENSI DIGITAL GENERUS — MASTER STYLESHEET
 * ================================================================
 * Tujuan:
 * - Satu sumber aturan untuk seluruh UI.
 * - Tidak ada override sidebar/header yang berulang-ulang.
 * - Sidebar desktop = fixed + collapsed/expanded.
 * - Sidebar tablet/HP = drawer + overlay.
 * - Header menggunakan grid 3 kolom agar judul selalu stabil.
 * - Dark mode, kiosk mode, print, scanner, portal, dan komponen
 *   pendukung aplikasi tetap dipertahankan.
 *
 * Struktur utama:
 * 01. Variables & base
 * 02. Common components
 * 03. App shell, sidebar & header
 * 04. Responsive layout
 * 05. Kiosk / focus mode
 * 06. Login & portal
 * 07. Scanner / notification / participant UI
 * 08. Feature cards
 * 09. Theme switch
 * 10. Dark mode
 * 11. Print & accessibility
 * ================================================================
 */

/* ================================================================
   01. VARIABLES & BASE
   ================================================================ */
:root {
  --warna-utama: #0f5132;
  --warna-hover: #0a3622;
  --warna-aksen: #d39e00;
  --font-utama: 'Poppins', sans-serif;

  --sidebar-collapsed: 84px;
  --sidebar-expanded: 260px;
  --sidebar-mobile: min(290px, 86vw);
  --app-header-height: 112px;
  --app-border: #e5e7eb;
  --app-surface: rgba(255, 255, 255, 0.98);
  --app-shadow: 0 10px 30px rgba(0, 0, 0, 0.04);
  --app-radius: 12px;
  --app-transition: 0.28s ease;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  font-family: var(--font-utama) !important;
  background-color: #f8f9fa;
  background-image:
    radial-gradient(at 0% 0%, rgba(15, 81, 50, 0.04) 0, transparent 50%),
    radial-gradient(at 100% 100%, rgba(211, 158, 0, 0.05) 0, transparent 50%);
  background-attachment: fixed;
}

/* Scrollbar global */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-thumb {
  background: #adb5bd;
  border-radius: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

input[type="password"]::-ms-reveal,
input[type="password"]::-ms-clear {
  display: none;
}

/* Bootstrap color aliases */
.text-primary {
  color: var(--warna-utama) !important;
}

.bg-primary {
  background-color: var(--warna-utama) !important;
}

.border-primary {
  border-color: var(--warna-utama) !important;
}

.btn-primary {
  background-color: var(--warna-utama) !important;
  border-color: var(--warna-utama) !important;
}

.btn-primary:hover {
  background-color: var(--warna-hover) !important;
  border-color: var(--warna-hover) !important;
}

.btn-outline-primary {
  color: var(--warna-utama) !important;
  border-color: var(--warna-utama) !important;
}

.btn-outline-primary:hover {
  background-color: var(--warna-utama) !important;
  color: #fff !important;
}

.card {
  margin-bottom: 20px;
  border: 1px solid rgba(255, 255, 255, 0.6) !important;
  border-radius: var(--app-radius);
  background: var(--app-surface);
  box-shadow: var(--app-shadow);
}

/* ================================================================
   LOGIN UNIFIED TABS & MODERN INPUTS
   ================================================================ */
.login-toggle-wrapper {
    background-color: rgba(15, 81, 50, 0.08); /* Efek hijau sangat transparan */
    border-radius: 50px;
    padding: 5px;
}

.login-toggle-btn {
    border-radius: 50px;
    font-size: 14px;
    font-weight: 600;
    color: var(--warna-utama);
    transition: all 0.3s ease;
    border: none;
    background: transparent;
    padding: 8px 0;
}

.login-toggle-btn.active {
    background-color: var(--warna-utama);
    color: #fff;
    box-shadow: 0 4px 10px rgba(15, 81, 50, 0.25);
}

.login-toggle-btn:hover:not(.active) {
    background-color: rgba(15, 81, 50, 0.12);
}

.input-login-modern {
    border-radius: 8px !important;
    border: 1px solid #ced4da;
    padding: 10px 14px;
    background-color: #fff;
    font-size: 14.5px;
    box-shadow: none !important;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input-login-modern:focus {
    border-color: var(--warna-utama);
    box-shadow: 0 0 0 3px rgba(15, 81, 50, 0.15) !important;
}

.input-group-modern {
    border-radius: 8px;
    border: 1px solid #ced4da;
    background-color: #fff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input-group-modern:focus-within {
    border-color: var(--warna-utama);
    box-shadow: 0 0 0 3px rgba(15, 81, 50, 0.15);
}

/* Generic action hover */
.btn-aksi-hover {
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.btn-aksi-hover:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1) !important;
}

/* Portal tabs */
#portal-tab .nav-link {
  color: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.4);
  transition: all 0.3s ease;
}

#portal-tab .nav-link:hover {
  background-color: rgba(255, 255, 255, 0.15);
  color: #fff;
}

#portal-tab .nav-link.active {
  background-color: #fff !important;
  color: var(--warna-utama) !important;
  border-color: #fff;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.modal-backdrop.show {
  opacity: 0.8 !important;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  background-color: rgba(15, 81, 50, 0.6) !important;
}

/* ================================================================
   03. APP SHELL, SIDEBAR & HEADER
   ================================================================ */

#mainApp {
  width: 100%;
  min-height: 100vh;
}

#wrapper {
  position: relative;
  display: block;
  width: 100%;
  min-height: 100vh;
}

/* ---------- Sidebar ---------- */
#sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 1040;
  display: flex;
  flex-direction: column;
  width: var(--sidebar-collapsed);
  min-width: var(--sidebar-collapsed);
  max-width: var(--sidebar-collapsed);
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  background: var(--app-surface);
  border-right: 1px solid #dee2e6;
  box-shadow: 4px 0 15px rgba(0, 0, 0, 0.03);
  transition:
    width var(--app-transition),
    min-width var(--app-transition),
    max-width var(--app-transition),
    margin-left var(--app-transition),
    box-shadow var(--app-transition);
}

#sidebar.expanded {
  width: var(--sidebar-expanded);
  min-width: var(--sidebar-expanded);
  max-width: var(--sidebar-expanded);
}

#sidebar::-webkit-scrollbar {
  width: 5px;
}

#sidebar::-webkit-scrollbar-thumb {
  background: rgba(15, 81, 50, 0.3);
  border-radius: 10px;
}

#sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(15, 81, 50, 0.6);
}

.sidebar-header {
  height: 76px;
  min-height: 76px;
  flex: 0 0 76px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 !important;
  border-bottom: 1px solid var(--app-border) !important;
  transition: padding 0.3s ease;
}

#sidebar.expanded .sidebar-header {
  justify-content: flex-start;
  gap: 10px;
  padding: 0 18px !important;
}

#btnToggleSidebar {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px !important;
}

/* ---------- Sidebar navigation ---------- */
#sidebar .nav.nav-pills {
  width: 100%;
  height: auto !important;
  min-height: 0 !important;
  flex: 1 1 0 !important;
  margin-top: 10px !important;
  padding: 0 0 16px;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  scrollbar-width: thin;
}

#sidebar .nav-item {
  width: 100%;
  flex: 0 0 auto;
}

#sidebar .nav-link {
  box-sizing: border-box;
  width: calc(100% - 20px) !important;
  min-height: 46px;
  margin: 3px 10px !important;
  padding: 9px 10px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start;
  gap: 12px;
  overflow: hidden;
  color: #6c757d;
  border: none;
  border-radius: 12px !important;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0.3px;
  transition: all 0.3s ease;
}

#sidebar:not(.expanded) .nav-link {
  width: 50px !important;
  margin-left: auto !important;
  margin-right: auto !important;
  justify-content: center !important;
  gap: 0;
  padding: 9px 0 !important;
}

#sidebar .nav-link:hover {
  background-color: rgba(15, 81, 50, 0.05);
  color: var(--warna-utama);
}

#sidebar .nav-link.active {
  background: linear-gradient(135deg, var(--warna-utama) 0%, #198754 100%) !important;
  color: #fff !important;
  box-shadow: 0 4px 15px rgba(15, 81, 50, 0.25);
}

#sidebar .nav-link.btn-keluar:hover {
  background-color: rgba(220, 53, 69, 0.1) !important;
  color: #dc3545 !important;
}

/* ================================================================
   BOTTOM ACTIONS (TEMA & KELUAR)
   ================================================================ */
.bottom-actions-container {
  width: 100%;
  overflow: hidden;
}

.wrapper-bottom-actions {
  flex-direction: column !important; /* Susun atas-bawah saat mode minimalis (collapsed) */
  gap: 15px !important;
}

.divider-bawah {
  display: none; /* Sembunyikan garis di mode minimalis */
  width: 2px;
  height: 28px;
}

.btn-keluar-icon {
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.btn-keluar-icon:hover {
  color: #dc3545 !important;
  transform: scale(1.1); /* Sedikit membesar saat disorot */
}

/* Saat Sidebar Expand ATAU Mobile Open (Mode Lebar) */
#sidebar.expanded .wrapper-bottom-actions,
#sidebar.mobile-open .wrapper-bottom-actions {
  flex-direction: row !important; /* Susun sejajar secara horizontal */
  justify-content: center !important;
  gap: 20px !important;
}

#sidebar.expanded .divider-bawah,
#sidebar.mobile-open .divider-bawah {
  display: block; /* Tampilkan garis pemisah vertikal */
}

/* Opsional: Efek Hover untuk Dark Mode */
[data-bs-theme="dark"] .btn-keluar-icon:hover {
  color: #ff6b6b !important;
}

.menu-icon {
  width: 26px;
  min-width: 26px !important;
  height: 26px;
  margin: 0 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 1.18rem;
}

/* ---------- Sidebar text / group labels ---------- */
.sidebar-text {
  display: none;
  max-width: 100%;
  margin-top: 1px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 14.5px;
  opacity: 0;
}

#sidebar.expanded .sidebar-text {
  display: inline-block;
  animation: slideFadeIn 0.35s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

#sidebar.expanded .sidebar-text.text-muted.fw-bolder {
  display: block;
  max-width: none;
  padding-left: 22px !important;
  padding-right: 12px !important;
  margin-top: 14px !important;
  margin-bottom: 4px !important;
  overflow: visible;
  text-overflow: clip;
  font-size: 10px !important;
  line-height: 1.2;
  letter-spacing: 1.1px !important;
  opacity: 1;
  animation: none;
}

#sidebar:not(.expanded) .sidebar-text {
  display: none !important;
}

@keyframes slideFadeIn {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

#sidebar .tema-switch-kapsul {
  flex: 0 0 auto;
}

#sidebar .nav-item.border-top {
  border-color: var(--app-border) !important;
}

/* ---------- Sidebar mobile overlay ---------- */
#sidebarOverlay {
  position: fixed;
  inset: 0;
  z-index: 1035;
  display: none;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.5);
}

#sidebarOverlay.show {
  display: block;
}

/* ---------- Main content ---------- */
#page-content-wrapper {
  width: calc(100% - var(--sidebar-collapsed));
  min-height: 100vh;
  margin-left: var(--sidebar-collapsed);
  overflow-x: clip;
  transition: width var(--app-transition), margin-left var(--app-transition);
}

#wrapper.sidebar-expanded #page-content-wrapper {
  width: calc(100% - var(--sidebar-expanded));
  margin-left: var(--sidebar-expanded);
}

#page-content-wrapper > .container-fluid {
  box-sizing: border-box;
  width: 100%;
  max-width: 1800px;
  margin-right: auto;
  margin-left: auto;
}

/* ---------- App header ---------- */
.top-header {
  position: sticky;
  top: 0;
  z-index: 1020;
  box-sizing: border-box;
  display: grid !important;
  width: 100%;
  min-height: var(--app-header-height);
  grid-template-columns: minmax(90px, 1fr) minmax(0, 2fr) minmax(90px, 1fr);
  align-items: center;
  column-gap: 16px;
  padding: 16px 24px;
  background: rgba(255, 255, 255, 0.97);
  border-bottom: 1px solid var(--app-border);
  box-shadow: 0 2px 12px rgba(15, 23, 42, 0.045);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.top-header > div {
  min-width: 0;
}

.top-header > div:first-child {
  justify-content: flex-start !important;
}

.top-header > div:last-child {
  justify-content: flex-end !important;
}

.top-header .logo-img {
  width: auto !important;
  max-width: 58px !important;
  max-height: 58px !important;
  height: auto;
  object-fit: contain;
}

.top-header .header-title-text {
  max-width: 100%;
  margin: 0 !important;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: clamp(18px, 2.35vw, 32px) !important;
  line-height: 1.15 !important;
  letter-spacing: 1.2px !important;
}

#greetingArea {
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  line-height: 1.3;
}

/* ================================================================
   04. RESPONSIVE LAYOUT
   ================================================================ */

/* Tablet + phone: sidebar becomes drawer. */
@media (max-width: 991.98px) {
  /* The sidebar shell stays fixed; only its menu area scrolls. */
  #sidebar {
    overflow: hidden !important;
    touch-action: none;
  }

  #sidebar,
  #sidebar.expanded {
    width: var(--sidebar-mobile) !important;
    min-width: var(--sidebar-mobile) !important;
    max-width: var(--sidebar-mobile) !important;
    height: 100vh;
    height: 100dvh;
    margin-left: -100% !important;
    z-index: 1050;
    box-shadow: 12px 0 35px rgba(15, 23, 42, 0.18);
    transition: margin-left var(--app-transition), box-shadow var(--app-transition);
  }

  #sidebar.mobile-open {
    margin-left: 0 !important;
  }

  #sidebar .sidebar-header,
  #sidebar.expanded .sidebar-header {
    height: 68px !important;
    min-height: 68px !important;
    flex-basis: 68px;
    justify-content: space-between !important;
    padding: 0 16px !important;
  }

  /* Bootstrap .d-md-none hides the close button and hamburger at >=768px.
     The drawer still needs them through tablet width, so restore them here. */
  #sidebar .sidebar-header .btn-close.sidebar-text {
    display: inline-flex !important;
    width: 1em;
    height: 1em;
    margin-top: 0;
    padding: 0.25em;
    opacity: 1 !important;
    animation: none !important;
  }

  .top-header .d-md-none {
    display: inline-flex !important;
  }

  #sidebar .nav.nav-pills {
    margin-top: 8px !important;
    padding-bottom: max(20px, env(safe-area-inset-bottom));
    min-height: 0 !important;
    flex: 1 1 0 !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
  }

  #sidebar .sidebar-text,
  #sidebar:not(.expanded) .sidebar-text,
  #sidebar.mobile-open .sidebar-text {
    display: inline-block !important;
    opacity: 1 !important;
    animation: none !important;
  }

  #sidebar .sidebar-text.text-muted.fw-bolder,
  #sidebar.expanded .sidebar-text.text-muted.fw-bolder {
    display: block !important;
    max-width: none;
    padding-left: 22px !important;
    padding-right: 12px !important;
    margin-top: 14px !important;
    margin-bottom: 4px !important;
    font-size: 10px !important;
    line-height: 1.2;
    letter-spacing: 1.1px !important;
  }

  #sidebar .nav-link,
  #sidebar:not(.expanded) .nav-link,
  #sidebar.mobile-open .nav-link {
    width: calc(100% - 24px) !important;
    min-height: 46px;
    margin: 3px 12px !important;
    padding: 10px 14px !important;
    justify-content: flex-start !important;
    gap: 12px !important;
  }

  #sidebar .menu-icon {
    flex: 0 0 26px;
  }

  #page-content-wrapper,
  #wrapper.sidebar-expanded #page-content-wrapper {
    width: 100% !important;
    margin-left: 0 !important;
  }

  .top-header {
    position: relative;
    min-height: 104px;
    grid-template-columns: 72px minmax(0, 1fr) 54px;
    column-gap: 8px;
    padding: 12px 14px;
  }

  .top-header > div:first-child,
  .top-header > div:last-child {
    width: 100%;
  }

  .top-header > div:first-child {
    gap: 2px !important;
  }

  .top-header .logo-img {
    max-width: 46px !important;
    max-height: 46px !important;
  }

  .top-header .header-title-text {
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
    font-size: clamp(15px, 4.4vw, 22px) !important;
    letter-spacing: 1px !important;
  }

  #greetingArea {
    font-size: 11px !important;
  }

  #page-content-wrapper > .container-fluid {
    padding-top: 16px !important;
  }

  #sidebarOverlay {
    z-index: 1040;
  }
}

/* Small phone */
@media (max-width: 575.98px) {
  .top-header {
    min-height: 96px;
    grid-template-columns: 68px minmax(0, 1fr) 44px;
    column-gap: 6px;
    padding: 10px 9px;
  }

  .top-header .logo-img {
    max-width: 38px !important;
    max-height: 38px !important;
  }

  .top-header .header-title-text {
    font-size: 15px !important;
    letter-spacing: 0.8px !important;
  }

  #greetingArea {
    font-size: 10px !important;
  }

  .top-header .d-md-none {
    margin-right: 2px !important;
    padding-right: 2px !important;
    padding-left: 2px !important;
  }

  #page-content-wrapper > .container-fluid {
    padding-right: 10px !important;
    padding-left: 10px !important;
  }
}

/* Short landscape phone / small-height screens */
@media (max-height: 576px) and (orientation: landscape) {
  html,
  body {
    min-height: 100%;
  }

  #sidebar,
  #sidebar.expanded {
    width: 270px !important;
    min-width: 270px !important;
    max-width: 270px !important;
  }

  #sidebar .sidebar-header,
  #sidebar.expanded .sidebar-header {
    height: 60px !important;
    min-height: 60px !important;
    flex-basis: 60px;
  }

  #sidebar .nav-link,
  #sidebar:not(.expanded) .nav-link,
  #sidebar.mobile-open .nav-link {
    min-height: 40px;
    padding: 8px 18px !important;
    margin: 2px 15px !important;
    font-size: 14px;
  }

  #sidebar .sidebar-text.text-muted.fw-bolder {
    margin-top: 10px !important;
    margin-bottom: 0 !important;
    font-size: 10px !important;
  }

  #sidebar .sidebar-text {
    font-size: 13.5px;
  }

  #sidebar .nav.nav-pills {
    height: calc(100vh - 60px) !important;
    height: calc(100dvh - 60px) !important;
    max-height: calc(100vh - 60px) !important;
    max-height: calc(100dvh - 60px) !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    padding-bottom: max(24px, env(safe-area-inset-bottom));
  }

  .top-header {
    min-height: 72px;
    padding: 8px 12px;
  }

  .top-header .logo-img {
    max-width: 42px !important;
    max-height: 42px !important;
  }

  .top-header .header-title-text {
    font-size: 18px !important;
  }

  #greetingArea {
    font-size: 10px !important;
  }
}

/* ================================================================
   05. KIOSK / FOCUS MODE
   ================================================================ */

body.mode-fokus {
  overflow: hidden !important;
  background-color: #e9ecef;
}

body.mode-fokus #sidebar,
body.mode-fokus .top-header,
body.mode-fokus footer {
  display: none !important;
}

body.mode-fokus #page-content-wrapper {
  width: 100% !important;
  margin-left: 0 !important;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding-top: 10px !important;
  padding-bottom: 10px !important;
}

body.mode-fokus #btnMasukFokus {
  display: none !important;
}

#bannerFokus {
  display: none;
}

body.mode-fokus #bannerFokus {
  display: block;
  animation: fadeInDown 0.5s ease-out;
}

body.mode-fokus .container-fluid {
  padding-top: 0 !important;
  padding-right: 10px !important;
  padding-left: 10px !important;
}

body.mode-fokus .card {
  border-radius: 8px !important;
}

body.mode-fokus .tab-content,
body.mode-fokus #pills-form,
body.mode-fokus #pills-form > .row {
  flex: 1;
  height: 100%;
}

body.mode-fokus #pills-form > .row > div > .card {
  max-height: calc(100vh - 20px);
  display: flex;
  flex-direction: column;
}

body.mode-fokus #wadahDinamisBawah {
  overflow-x: hidden;
  overflow-y: auto;
  padding-right: 5px;
}

body.mode-fokus #listAntrian {
  height: 100% !important;
  flex: 1;
  overflow-y: auto;
}

body.mode-fokus #wrapperPilihKegiatan,
body.mode-fokus #wrapperSubSesi,
body.mode-fokus #wrapperBatasMasuk {
  display: none !important;
}

body.mode-fokus #wrapperSubSesi,
body.mode-fokus #wrapperBatasMasuk {
  width: 50% !important;
  max-width: 50% !important;
  flex: 0 0 50% !important;
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-15px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Scanner form layout */
#teksBannerSesi {
  min-height: 24px;
}

#pills-form .col-xl-7 > .card {
  display: flex;
  flex-direction: column;
}

#wadahDinamisBawah {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

#areaKartuSukses {
  min-height: 260px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

#placeholderScanner {
  padding-top: 0 !important;
}

#placeholderScanner {
  animation: pulseScan 2s ease-in-out infinite;
}

@keyframes pulseScan {
  0% {
    transform: scale(0.95);
    opacity: 0.1;
  }
  50% {
    transform: scale(1.05);
    opacity: 0.25;
  }
  100% {
    transform: scale(0.95);
    opacity: 0.1;
  }
}

/* ================================================================
   06. LOGIN & PORTAL
   ================================================================ */

.login-wrapper {
  min-height: 100vh;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #0f5132 0%, #20c997 100%);
}

.glass-panel {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.login-card {
  border-radius: 20px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
}

.bg-circle {
  position: absolute;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0));
}

#navbarPortal {
  /* Desktop: Bootstrap controls the navigation. */
}

@media (max-width: 991.98px) {
  #navbarPortal {
    margin-top: 15px;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    background-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
  }

  #navbarPortal .nav-link {
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    font-size: 16px;
  }

  #navbarPortal li:nth-last-child(2) .nav-link {
    margin-bottom: 10px;
    border-bottom: none;
  }
}

/* ================================================================
   07. SCANNER / NOTIFICATION / PARTICIPANT UI
   ================================================================ */

#toastModern {
  position: fixed;
  left: 50%;
  bottom: 20px;
  z-index: 9999;
  min-width: 300px;
  padding: 12px 24px;
  visibility: hidden;
  transform: translateX(-50%);
  border-radius: 30px;
  background-color: #198754;
  color: #fff;
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  opacity: 0;
  box-shadow: 0 10px 30px rgba(25, 135, 84, 0.4);
  transition: opacity 0.4s ease, bottom 0.4s ease;
}

#toastModern.show {
  bottom: 50px;
  visibility: visible;
  opacity: 1;
}

/* Floating success card used by camera scanner */
.notif-melayang {
  position: fixed !important;
  top: 25px;
  left: 50%;
  z-index: 10500;
  min-width: 320px;
  transform: translateX(-50%);
  border: 3px solid #198754 !important;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.4) !important;
}

@keyframes dropDownBounce {
  0% {
    opacity: 0;
    transform: translate(-50%, -100px);
  }
  60% {
    opacity: 1;
    transform: translate(-50%, 15px);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

#layarKameraReader video {
  width: 100% !important;
  height: auto !important;
  object-fit: cover !important;
}

/* Participant photo hover */
.foto-container {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 40px;
}

.btn-hapus-foto {
  position: absolute;
  top: -6px;
  right: -8px;
  z-index: 5;
  width: 20px;
  height: 20px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 11px;
  opacity: 0;
  transform: scale(0.5);
  transition: opacity 0.2s ease-in-out, transform 0.2s ease;
}

.foto-container:hover .btn-hapus-foto {
  opacity: 1;
  transform: scale(1);
}

.foto-container img {
  transition: filter 0.2s ease;
}

.foto-container:hover img {
  filter: brightness(0.6);
}

/* Participant table */
#bodyListPeserta tr {
  border-bottom: 1px solid #f8f9fa;
}

#bodyListPeserta tr:hover {
  background-color: rgba(15, 81, 50, 0.03) !important;
}

.table-responsive::-webkit-scrollbar {
  height: 8px;
}

/* Offline indicator */
@keyframes pulse-merah {
  0% {
    box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.8);
  }
  70% {
    box-shadow: 0 0 0 12px rgba(220, 53, 69, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(220, 53, 69, 0);
  }
}

.efek-detak-offline {
  animation: pulse-merah 2s infinite;
}

/* ID card */
.id-card {
  width: 54mm;
  height: 86mm;
  overflow: hidden;
  page-break-inside: avoid;
  background-color: #fff;
  border: 2px solid var(--warna-utama);
}

.id-card canvas {
  max-width: 90%;
  height: auto;
}

/* ================================================================
   08. FEATURE CARDS
   ================================================================ */

.kartu-fitur {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 16px;
  transition:
    transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1),
    box-shadow 0.4s ease;
}

.kartu-fitur:hover {
  transform: translateY(-10px);
  border-color: rgba(15, 81, 50, 0.2);
  box-shadow: 0 20px 40px rgba(15, 81, 50, 0.15) !important;
}

.content-front {
  transition: opacity 0.4s ease, filter 0.4s ease;
}

.kartu-fitur:hover .content-front {
  opacity: 0.05;
  filter: blur(5px);
}

.content-hover {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 10;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  visibility: hidden;
  opacity: 0;
  background: rgba(15, 81, 50, 0.95);
  transition: all 0.4s ease;
}

.kartu-fitur:hover .content-hover {
  visibility: visible;
  opacity: 1;
}

.ss-collage {
  position: relative;
  width: 100%;
  height: 220px;
  transform: translateY(30px);
  transition: transform 0.5s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.kartu-fitur:hover .ss-collage {
  transform: translateY(0);
}

.ss-img {
  position: absolute;
  border: 3px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.5);
  object-fit: cover;
  transition: transform 0.3s ease, border-color 0.3s ease;
}

.ss-img-1 {
  top: 15px;
  left: 5%;
  z-index: 1;
  width: 75%;
  height: auto;
  aspect-ratio: 16 / 9;
  opacity: 0.8;
  transform: rotate(-6deg);
}

.ss-img-2 {
  right: 5%;
  bottom: 20px;
  z-index: 2;
  width: 80%;
  height: auto;
  aspect-ratio: 16 / 9;
  transform: rotate(4deg);
}

.ss-img:hover {
  z-index: 10;
  opacity: 1;
  border-color: rgba(255, 255, 255, 0.9);
  cursor: crosshair;
  transform: scale(1.1) rotate(0deg) !important;
}

/* ================================================================
   09. THEME SWITCH
   ================================================================ */

.tema-switch-kapsul {
  position: relative;
  display: inline-block;
  width: 64px;
  height: 32px;
}

.tema-switch-kapsul input {
  width: 0;
  height: 0;
  opacity: 0;
}

.slider-kapsul {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
  cursor: pointer;
  border-radius: 34px;
  background-color: #e9ecef;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: 0.4s;
}

.slider-kapsul::before {
  position: absolute;
  left: 4px;
  bottom: 4px;
  width: 24px;
  height: 24px;
  content: "";
  z-index: 2;
  border-radius: 50%;
  background-color: #fff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  transition: 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

.tema-switch-kapsul input:checked + .slider-kapsul {
  background-color: #1e293b;
}

.tema-switch-kapsul input:checked + .slider-kapsul::before {
  background-color: var(--warna-utama);
  transform: translateX(32px);
}

.ikon-terang {
  z-index: 1;
  color: #f59e0b;
  font-size: 13px;
}

.ikon-gelap {
  z-index: 1;
  color: #cbd5e1;
  font-size: 13px;
  opacity: 0.7;
}

.tema-switch-kapsul input:checked + .slider-kapsul .ikon-gelap {
  opacity: 1;
}

.tema-switch-kapsul input:checked + .slider-kapsul .ikon-terang {
  opacity: 0.5;
}

/* ================================================================
   10. DARK MODE
   ================================================================ */

[data-bs-theme="dark"] body {
  color: #f8f9fa;
  background-color: #212529;
  background-image: none;
}

[data-bs-theme="dark"] .card,
[data-bs-theme="dark"] #sidebar,
[data-bs-theme="dark"] .top-header,
[data-bs-theme="dark"] .modal-content {
  color: #f8f9fa;
  background: #2b3035 !important;
  border-color: #495057 !important;
}

[data-bs-theme="dark"] .top-header {
  background: rgba(43, 48, 53, 0.97) !important;
  border-bottom-color: #495057 !important;
}

[data-bs-theme="dark"] #sidebar .sidebar-header,
[data-bs-theme="dark"] #sidebar .nav-item.border-top {
  border-color: #495057 !important;
}

[data-bs-theme="dark"] .text-dark {
  color: #f8f9fa !important;
}

[data-bs-theme="dark"] .text-muted {
  color: #adb5bd !important;
}

[data-bs-theme="dark"] .text-secondary {
  color: #ced4da !important;
}

[data-bs-theme="dark"] .bg-light {
  background-color: #343a40 !important;
}

[data-bs-theme="dark"] .bg-white {
  background-color: #2b3035 !important;
}

[data-bs-theme="dark"] input,
[data-bs-theme="dark"] select,
[data-bs-theme="dark"] textarea,
[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select,
[data-bs-theme="dark"] .input-group-text {
  color: #f8f9fa !important;
  background-color: #212529 !important;
  border-color: #495057 !important;
}

[data-bs-theme="dark"] ::placeholder {
  color: #6c757d !important;
  opacity: 1;
}

[data-bs-theme="dark"] .table {
  color: #f8f9fa;
}

[data-bs-theme="dark"] .table-light th,
[data-bs-theme="dark"] .table-light td {
  color: #f8f9fa !important;
  background-color: #343a40 !important;
  border-color: #495057 !important;
}

[data-bs-theme="dark"] .table-hover tbody tr:hover {
  background-color: #212529 !important;
}

[data-bs-theme="dark"] #sidebar .nav-link {
  color: #adb5bd;
}

[data-bs-theme="dark"] #sidebar .nav-link:hover {
  color: #fff;
  background-color: #343a40;
}

[data-bs-theme="dark"] .border-bottom,
[data-bs-theme="dark"] .border-top,
[data-bs-theme="dark"] .border {
  border-color: #495057 !important;
}

/* Dark mode login / dropdown */
[data-bs-theme="dark"] .login-option-card {
  background-color: #212529 !important;
  border-color: #495057 !important;
}

[data-bs-theme="dark"] .login-option-card:hover {
  background-color: #343a40 !important;
  border-color: var(--warna-utama) !important;
}

[data-bs-theme="dark"] .dropdown-menu {
  background-color: #2b3035 !important;
  border-color: #495057 !important;
}

[data-bs-theme="dark"] .dropdown-item {
  color: #f8f9fa !important;
}

[data-bs-theme="dark"] .dropdown-item:hover {
  color: #fff !important;
  background-color: #343a40 !important;
}

/* Dark metric cards */
[data-bs-theme="dark"] .card.bg-primary {
  border: 1px solid rgba(13, 110, 253, 0.4) !important;
  border-bottom: 4px solid #0d6efd !important;
  background-color: rgba(13, 110, 253, 0.1) !important;
}

[data-bs-theme="dark"] .card.bg-success {
  border: 1px solid rgba(25, 135, 84, 0.4) !important;
  border-bottom: 4px solid #198754 !important;
  background-color: rgba(25, 135, 84, 0.1) !important;
}

[data-bs-theme="dark"] .card.bg-info {
  border: 1px solid rgba(13, 202, 240, 0.4) !important;
  border-bottom: 4px solid #0dcaf0 !important;
  background-color: rgba(13, 202, 240, 0.1) !important;
}

[data-bs-theme="dark"] .card.bg-danger {
  border: 1px solid rgba(220, 53, 69, 0.4) !important;
  border-bottom: 4px solid #dc3545 !important;
  background-color: rgba(220, 53, 69, 0.1) !important;
}

[data-bs-theme="dark"] .card.bg-warning {
  border: 1px solid rgba(255, 193, 7, 0.4) !important;
  border-bottom: 4px solid #ffc107 !important;
  background-color: rgba(255, 193, 7, 0.1) !important;
}

[data-bs-theme="dark"] .card.bg-secondary {
  border: 1px solid rgba(108, 117, 125, 0.4) !important;
  border-bottom: 4px solid #6c757d !important;
  background-color: rgba(108, 117, 125, 0.1) !important;
}

[data-bs-theme="dark"] .card.bg-primary h3 {
  color: #6ea8fe !important;
}

[data-bs-theme="dark"] .card.bg-success h3 {
  color: #75b798 !important;
}

[data-bs-theme="dark"] .card.bg-info h3 {
  color: #6edff6 !important;
}

[data-bs-theme="dark"] .card.bg-danger h3 {
  color: #ea868f !important;
}

[data-bs-theme="dark"] .card.bg-warning h3 {
  color: #ffda6a !important;
}

[data-bs-theme="dark"] .card.bg-secondary h3 {
  color: #dee2e6 !important;
}

[data-bs-theme="dark"] .header-title-text {
  color: #20c997 !important;
  text-shadow: 0 0 15px rgba(32, 201, 151, 0.4);
}

[data-bs-theme="dark"] #greetingArea {
  color: #a3cfbb !important;
  text-shadow: 0 0 10px rgba(163, 207, 187, 0.2);
}

[data-bs-theme="dark"] .btn-outline-dark {
  color: #f8f9fa !important;
  border-color: #6c757d !important;
}

[data-bs-theme="dark"] .btn-outline-dark:hover {
  color: #fff !important;
  background-color: #6c757d !important;
}

[data-bs-theme="dark"] #sectionFitur {
  background-color: #212529 !important;
}

[data-bs-theme="dark"] .kartu-fitur {
  background-color: #2b3035 !important;
  border-color: rgba(255, 255, 255, 0.05);
}

[data-bs-theme="dark"] .content-hover {
  background: rgba(33, 37, 41, 0.95);
}

[data-bs-theme="dark"] .kartu-fitur:hover {
  border-color: rgba(32, 201, 151, 0.3);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5) !important;
}

/* ================================================================
   11. PRINT & ACCESSIBILITY
   ================================================================ */

@media print {
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    color-adjust: exact !important;
  }

  body * {
    visibility: hidden;
  }

  #pills-cetak,
  #pills-cetak * {
    visibility: visible;
  }

  #pills-cetak {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    margin: 0;
    padding: 0;
  }

  .d-print-none {
    display: none !important;
  }

  .card {
    border: none !important;
    box-shadow: none !important;
  }

  body {
    background-color: #fff;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

#sidebar .nav.nav-pills, 
.menu-scrollable {
  flex: 1 1 auto !important; /* Fleksibel mengisi sisa ruang */
  height: auto !important;
  min-height: 0 !important; /* Kunci rahasia agar scroll flexbox berfungsi di Safari/Chrome */
  overflow-y: auto !important;
  overflow-x: hidden !important;
  margin-top: 15px !important;
  margin-bottom: 0 !important;
  padding-bottom: 25px !important; /* Spasi ekstra di bawah agar tidak terlalu mepet */
  flex-wrap: nowrap;
  -webkit-overflow-scrolling: touch; /* Scroll halus di perangkat sentuh (iOS/Android) */
}

@media (max-height: 576px) and (orientation: landscape) {
  #sidebar .nav.nav-pills,
  .menu-scrollable {
    height: auto !important;
    max-height: none !important;
    flex: 1 1 auto !important;
  }
}

.menu-scrollable::-webkit-scrollbar {
  width: 4px;
}
.menu-scrollable::-webkit-scrollbar-thumb {
  background: rgba(15, 81, 50, 0.2);
  border-radius: 10px;
}
.menu-scrollable::-webkit-scrollbar-thumb:hover {
  background: rgba(15, 81, 50, 0.6);
}
[data-bs-theme="dark"] .menu-scrollable::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
}
[data-bs-theme="dark"] .menu-scrollable::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* ================================================================
   TOMBOL BANTUAN WHATSAPP (FLOATING ACTION BUTTON)
   ================================================================ */
.wa-floating-btn {
  position: fixed;
  width: 60px;
  height: 60px;
  bottom: 25px;
  right: 25px;
  background-color: #25d366; /* Hijau khas WhatsApp */
  color: #FFF;
  border-radius: 50px;
  text-align: center;
  font-size: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9998; /* Selalu di atas elemen lain, tapi di bawah pop-up error/notif */
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  text-decoration: none;
}

.wa-floating-btn:hover {
  background-color: #128c7e;
  color: #fff;
  transform: scale(1.1) translateY(-5px);
  box-shadow: 0 15px 25px rgba(37, 211, 102, 0.4) !important;
}

body.mode-fokus .wa-floating-btn {
  display: none !important;
}

@media (max-width: 768px) {
  .wa-floating-btn {
    width: 50px;
    height: 50px;
    bottom: 20px;
    right: 20px;
    font-size: 26px;
  }
}

/* ================================================================
   FINAL UI POLISH — E-ABSENSI GENERUS
   Lapisan akhir untuk konsistensi visual tanpa mengubah ID/class
   yang dipakai JavaScript atau alur data aplikasi.
   ================================================================ */

:root {
  --ui-page: #f4f7f5;
  --ui-surface: #ffffff;
  --ui-surface-soft: #f7faf8;
  --ui-text: #18352a;
  --ui-muted: #6b7a73;
  --ui-border: #e4ebe7;
  --ui-radius-sm: 10px;
  --ui-radius-md: 14px;
  --ui-radius-lg: 18px;
  --ui-shadow-sm: 0 2px 10px rgba(15, 81, 50, .045);
  --ui-shadow-md: 0 10px 28px rgba(15, 81, 50, .075);
  --ui-shadow-lg: 0 18px 45px rgba(15, 81, 50, .10);
}

body {
  color: var(--ui-text);
  background-color: var(--ui-page);
}

/* Main application canvas */
#mainApp {
  background:
    radial-gradient(circle at 8% 0%, rgba(15, 81, 50, .035), transparent 30%),
    radial-gradient(circle at 100% 100%, rgba(211, 158, 0, .035), transparent 28%);
}

#page-content-wrapper {
  background: transparent;
}

#page-content-wrapper > .container-fluid {
  padding-top: 22px !important;
  padding-bottom: 32px;
}

/* Desktop sidebar: quieter, more app-like navigation rail */
#sidebar {
  width: 78px;
  min-width: 78px;
  max-width: 78px;
  background: rgba(255, 255, 255, .97);
  border-right-color: #e6ece9;
  box-shadow: 5px 0 22px rgba(15, 81, 50, .045);
}

#sidebar.expanded {
  width: 252px;
  min-width: 252px;
  max-width: 252px;
}

#page-content-wrapper {
  width: calc(100% - 78px);
  margin-left: 78px;
}

#wrapper.sidebar-expanded #page-content-wrapper {
  width: calc(100% - 252px);
  margin-left: 252px;
}

#btnToggleSidebar {
  width: 42px;
  height: 42px;
  border-radius: 11px !important;
  background: #f4f8f6;
}

#btnToggleSidebar:hover {
  background: rgba(15, 81, 50, .09);
  transform: translateY(-1px);
}

#sidebar .nav.nav-pills {
  padding-top: 4px;
}

#sidebar .nav-link {
  min-height: 44px;
  border-radius: 11px !important;
  color: #65736d;
}

#sidebar .nav-link:hover {
  background: #f1f6f3;
  color: var(--warna-utama);
}

#sidebar .nav-link.active {
  background: linear-gradient(135deg, var(--warna-utama), #198754) !important;
  box-shadow: 0 6px 16px rgba(15, 81, 50, .17);
}

#sidebar .nav-link.active .menu-icon {
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.12));
}

/* Header: three stable zones, regardless of logo visibility */
.top-header {
  min-height: 82px;
  grid-template-columns: 120px minmax(0, 1fr) 120px;
  padding: 12px 22px;
  background: rgba(255, 255, 255, .94);
  border-bottom: 1px solid var(--ui-border);
  box-shadow: 0 4px 18px rgba(15, 23, 42, .035);
}

.top-header > div {
  min-height: 54px;
}

.top-header .logo-img {
  max-width: 52px !important;
  max-height: 52px !important;
  border-radius: 12px;
  object-fit: contain;
}

.top-header .header-title-text {
  font-size: clamp(18px, 2.15vw, 30px) !important;
  letter-spacing: .8px !important;
  line-height: 1.1 !important;
}

#greetingArea {
  color: #5d766a !important;
  font-size: 12px !important;
  font-weight: 600 !important;
}

/* General application cards */
#mainApp .card {
  border: 1px solid var(--ui-border) !important;
  border-radius: var(--ui-radius-lg);
  box-shadow: var(--ui-shadow-sm);
}

#mainApp .card.shadow,
#mainApp .card.shadow-sm {
  box-shadow: var(--ui-shadow-md) !important;
}

#mainApp .card:hover {
  border-color: #dce7e1 !important;
}

#mainApp .form-control,
#mainApp .form-select,
#mainApp .input-group-text {
  border-radius: 10px;
}

#mainApp .btn {
  border-radius: 10px;
  transition: transform .18s ease, box-shadow .18s ease, background-color .18s ease;
}

#mainApp .btn:not(:disabled):hover {
  transform: translateY(-1px);
}

#mainApp .btn-primary,
#mainApp .btn-success {
  box-shadow: 0 4px 12px rgba(15, 81, 50, .10);
}

/* Attendance workspace */
#pills-form > .row {
  --bs-gutter-x: 18px;
  --bs-gutter-y: 18px;
}

#pills-form .col-xl-7 > .card,
#pills-form .col-xl-5 > .card {
  min-height: 100%;
}

#listAntrian {
  border: 1px solid var(--ui-border);
  border-radius: 12px;
  background: var(--ui-surface-soft);
  padding: 6px !important;
}

#listAntrian .list-group-item {
  border-radius: 9px !important;
  border: 0;
  margin: 2px 0;
}

#barcodeInput {
  min-height: 52px;
  border-radius: 12px !important;
  background: #fbfdfc;
  box-shadow: inset 0 0 0 1px rgba(15, 81, 50, .035);
}

#barcodeInput:focus {
  box-shadow: 0 0 0 4px rgba(15, 81, 50, .09) !important;
}

#placeholderScanner {
  min-height: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* Floating help button: smaller visual footprint on desktop */
.wa-floating-btn {
  width: 52px;
  height: 52px;
  right: 22px;
  bottom: 22px;
  font-size: 27px;
  box-shadow: 0 8px 20px rgba(37, 211, 102, .18);
}

/* Mobile: compose the app as a drawer + clean content canvas */
@media (max-width: 991.98px) {
  #sidebar,
  #sidebar.expanded {
    width: min(292px, 86vw) !important;
    min-width: min(292px, 86vw) !important;
    max-width: min(292px, 86vw) !important;
  }

  #page-content-wrapper,
  #wrapper.sidebar-expanded #page-content-wrapper {
    width: 100% !important;
    margin-left: 0 !important;
  }

  .top-header {
    min-height: 78px;
    grid-template-columns: 62px minmax(0, 1fr) 52px;
    padding: 10px 13px;
    column-gap: 8px;
  }

  .top-header > div {
    min-height: 52px;
  }

  .top-header .logo-img {
    max-width: 42px !important;
    max-height: 42px !important;
  }

  .top-header .header-title-text {
    font-size: clamp(15px, 4vw, 22px) !important;
    letter-spacing: .55px !important;
  }

  #greetingArea {
    font-size: 10px !important;
  }

  #page-content-wrapper > .container-fluid {
    padding-top: 14px !important;
    padding-bottom: 24px;
  }
}

@media (max-width: 575.98px) {
  .top-header {
    min-height: 72px;
    grid-template-columns: 50px minmax(0, 1fr) 38px;
    padding: 8px 9px;
  }

  .top-header .logo-img {
    max-width: 34px !important;
    max-height: 34px !important;
    border-radius: 9px;
  }

  .top-header .header-title-text {
    font-size: 14px !important;
    letter-spacing: .35px !important;
  }

  #greetingArea {
    font-size: 9px !important;
  }

  #pills-form > .row {
    --bs-gutter-x: 10px;
    --bs-gutter-y: 10px;
  }

  #mainApp .card {
    border-radius: 14px;
  }

  .wa-floating-btn {
    width: 48px;
    height: 48px;
    right: 16px;
    bottom: 16px;
    font-size: 24px;
  }
}

/* Dark mode matching the same visual hierarchy */
[data-bs-theme="dark"] {
  --ui-page: #171b19;
  --ui-surface: #252b28;
  --ui-surface-soft: #202522;
  --ui-text: #edf4f0;
  --ui-muted: #aebbb5;
  --ui-border: #39423e;
}

[data-bs-theme="dark"] #mainApp {
  background: #171b19;
}

[data-bs-theme="dark"] #sidebar,
[data-bs-theme="dark"] .top-header {
  border-color: var(--ui-border) !important;
}

[data-bs-theme="dark"] #btnToggleSidebar,
[data-bs-theme="dark"] #sidebar .nav-link:hover {
  background: #303833;
}

[data-bs-theme="dark"] #greetingArea {
  color: #a3cfbb !important;
}

[data-bs-theme="dark"] #barcodeInput {
  background: #1d221f;
}

[data-bs-theme="dark"] #listAntrian {
  background: #202522;
  border-color: var(--ui-border);
}

/* Accessibility: keep keyboard focus visible */
#mainApp button:focus-visible,
#mainApp a:focus-visible,
#mainApp input:focus-visible,
#mainApp select:focus-visible,
#mainApp textarea:focus-visible {
  outline: 3px solid rgba(25, 135, 84, .24);
  outline-offset: 2px;
}

.top-header.offline-pending {
  background: rgba(255, 243, 205, 0.96) !important;
  border-bottom-color: #ffecb5 !important;
}

[data-bs-theme="dark"] .top-header.offline-pending {
  background: rgba(102, 77, 3, 0.45) !important;
  border-bottom-color: #997404 !important;
}

/* Konsistensi Dark Mode untuk Area Visual Dasbor, Portal Keluarga & Modal */
[data-bs-theme="dark"] #areaVisualDasbor,
[data-bs-theme="dark"] #kartuCetakGenerus,
[data-bs-theme="dark"] #generusPortalScreen {
  background-color: var(--ui-surface) !important;
  color: var(--ui-text) !important;
}

[data-bs-theme="dark"] #generusPortalScreen {
  background-color: var(--ui-page) !important;
}

[data-bs-theme="dark"] #kardTop5 .col-md-6:first-child {
  border-right-color: var(--ui-border) !important;
}

/* Perapian Antarmuka Bawaan html5-qrcode */
#layarKameraReader {
  border: none !important;
}

#layarKameraReader__dashboard_section_csr button,
#layarKameraReader__dashboard_section_swaplink {
  border-radius: 8px !important;
  padding: 6px 14px !important;
  font-weight: 600 !important;
  font-size: 13px !important;
  border: 1px solid var(--warna-utama) !important;
  background-color: var(--warna-utama) !important;
  color: #fff !important;
  margin: 4px 2px !important;
  text-decoration: none !important;
}

#layarKameraReader__dashboard_section_csr select {
  border-radius: 8px !important;
  padding: 6px 10px !important;
  font-size: 13px !important;
  margin-bottom: 6px !important;
  max-width: 90% !important;
}

/* Nonaktifkan jebakan hover gambar pada layar sentuh (HP/Tablet) */
@media (hover: none) and (pointer: coarse) {
  .kartu-fitur:hover {
    transform: none;
  }
  .kartu-fitur:hover .content-front {
    opacity: 1;
    filter: none;
  }
  .kartu-fitur:hover .content-hover {
    visibility: hidden;
    opacity: 0;
  }
}

.top-header .logo-img {
  width: auto !important;
  height: auto !important;
  max-width: 110px !important;
  max-height: 48px !important;
  object-fit: contain !important;
  border-radius: 8px;
}

.logo-portal-img {
  width: auto;
  height: auto;
  max-width: 160px;
  max-height: 54px;
  object-fit: contain;
  border-radius: 8px;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.15));
}

.logo-fokus-img {
  width: auto;
  height: auto;
  max-width: 90px;
  max-height: 46px;
  object-fit: contain;
}

@media (max-width: 575.98px) {
  .top-header .logo-img {
    max-width: 64px !important;
    max-height: 34px !important;
  }
  .logo-portal-img {
    max-width: 120px;
    max-height: 42px;
  }
}