@import url("https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700&family=Inter:wght@400;500;600&display=swap");

:root {
  --primary-color: #6366f1; /* Vibrant Indigo */
  --primary-hover: #4f46e5;
  --accent-color: #10b981;  /* Emerald */
  --secondary-color: #ec4899; /* Vibrant Pink */
  --danger-color: #ef4444; /* Red - FIX: tambah var ini karena dipakai di banyak tempat */
  --bg-gradient-start: #e0e7ff; 
  --bg-gradient-end: #fce7f3; 
  --glass-bg: rgba(255, 255, 255, 0.65);
  --glass-border: rgba(255, 255, 255, 0.6);
  --glass-shadow: 0 10px 40px 0 rgba(99, 102, 241, 0.15);
  --text-dark: #1e293b;
  --text-muted: #64748b;
  --border-color: rgba(0,0,0,0.08);
  --card-radius: 20px;
  --transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);

  /* Sistem Gradien Dinamis - Semua bersumber dari 4 warna di Pengaturan */
  --gradient-primary: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  --gradient-hover: linear-gradient(135deg, var(--primary-hover) 0%, var(--accent-color) 100%);
  --gradient-sidebar: linear-gradient(180deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  --gradient-accent: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
  --gradient-text: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Inter", sans-serif;
  background: linear-gradient(
    135deg,
    var(--bg-gradient-start) 0%,
    var(--bg-gradient-end) 50%,
    #f3e8ff 100%
  );
  background-size: 200% 200%;
  animation: gradientBG 15s ease infinite;
  color: var(--text-dark);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

@keyframes gradientBG {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: "Outfit", sans-serif;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* Glassmorphism Classes */
.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--card-radius);
}

/* Layout */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  width: 100%;
}

.header {
  padding: 20px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.brand {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-color);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand span {
  color: var(--text-dark);
}

/* Nav */
.nav-links {
  display: flex;
  gap: 20px;
  align-items: center;
}

.nav-links a {
  text-decoration: none;
  color: var(--text-dark);
  font-weight: 500;
  transition: var(--transition);
}

.nav-links a:hover {
  color: var(--primary-color);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 24px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  outline: none;
  text-decoration: none;
  font-family: "Inter", sans-serif;
}

.btn-primary {
  background: var(--gradient-primary);
  color: white;
  box-shadow: 0 4px 15px 0 rgba(0, 0, 0, 0.15);
}

.btn-primary:hover {
  background: var(--gradient-hover);
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.22);
}

.btn-outline {
  background: transparent;
  color: var(--primary-color);
  border: 2px solid var(--primary-color);
}

.btn-outline:hover {
  background: var(--primary-color);
  color: white;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.85rem;
}

.btn-danger {
  background: #ef4444;
  color: white;
  box-shadow: 0 4px 14px 0 rgba(239, 68, 68, 0.39);
}

.btn-danger:hover {
  background: #dc2626;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.23);
}

.btn-info {
  background: #0ea5e9;
  color: white;
  box-shadow: 0 4px 14px 0 rgba(14, 165, 233, 0.39);
}

.btn-info:hover {
  background: #0284c7;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(14, 165, 233, 0.23);
}

.detail-panel {
  background: rgba(255, 255, 255, 0.5);
  border-radius: 12px;
  padding: 20px;
  border: 1px solid rgba(0,0,0,0.05);
}

.grid-2-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

/* Form Groups inside Grid */
.grid-2-col .form-group {
  margin-bottom: 0;
}

/* Hero Section */
.hero {
  padding: 100px 0;
  text-align: center;
}

.hero h1 {
  font-size: 3.5rem;
  margin-bottom: 20px;
  background: var(--gradient-text);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero p {
  font-size: 1.2rem;
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto 40px;
  line-height: 1.6;
}

/* Cards */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
  margin-top: 40px;
}

.card {
  padding: 24px;
  transition: var(--transition);
}

/* News Cards */
.news-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-top: 20px;
}

.news-card {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid var(--glass-border);
  border-radius: var(--card-radius);
  overflow: hidden;
  transition: var(--transition);
  cursor: pointer;
  height: 135px; /* Fixed height to prevent image stretching */
}

.news-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  background: rgba(255, 255, 255, 0.9);
}

.news-img {
  width: 160px;
  flex-shrink: 0;
  height: 100%;
  object-fit: cover;
  border-right: 1px solid rgba(0,0,0,0.05);
}

.news-content {
  padding: 14px 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.news-content h4 {
  font-size: 1.15rem;
  margin-bottom: 8px;
  color: var(--text-dark);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.news-date {
  font-size: 0.82rem;
  color: var(--primary-color);
  margin-bottom: 12px;
  font-weight: 500;
}

.news-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
  line-height: 1.6;
}

.news-btn {
  margin-top: 15px;
  align-self: flex-start;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary-color);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
}

.news-btn:hover {
  color: var(--primary-hover);
  transform: translateX(3px);
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 40px 0 rgba(31, 38, 135, 0.1);
}

.card h3 {
  margin-bottom: 12px;
  color: var(--primary-color);
}

/* Tables */
.table-container {
  overflow-x: auto;
  margin-top: 20px;
  min-height: 220px;
  position: relative;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

th,
td {
  padding: 16px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

th {
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(0, 0, 0, 0.02);
}

tr:hover {
  background: rgba(255, 255, 255, 0.5);
}

/* Forms */
.form-group {
  margin-bottom: 20px;
  text-align: left;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  font-size: 0.95rem;
}

.form-control {
  width: 100%;
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  background: rgba(255, 255, 255, 0.8);
  font-family: "Inter", sans-serif;
  font-size: 1rem;
  transition: var(--transition);
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

/* Utility */
.text-center {
  text-align: center;
}
.mt-4 {
  margin-top: 1.5rem;
}
.mb-4 {
  margin-bottom: 1.5rem;
}
.hidden {
  display: none !important;
}

/* Dashboard Layout */
.dashboard {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 280px;
  background: var(--gradient-sidebar, linear-gradient(180deg, var(--primary-color) 0%, var(--secondary-color) 100%));
  color: #ffffff;
  padding: 24px;
  display: flex;
  flex-direction: column;
  box-shadow: 4px 0 25px rgba(0, 0, 0, 0.12);
  position: relative;
  z-index: 10;
  border-right: 1px solid rgba(255, 255, 255, 0.15);
}

.sidebar .brand {
  text-decoration: none;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  text-align: left;
  gap: 12px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
}

.sidebar .brand div {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.1;
}

.sidebar .brand div span {
  color: #ffffff !important;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.sidebar #sidebar-wilayah {
  color: rgba(255, 255, 255, 0.85) !important;
  font-size: 0.82rem;
  font-weight: 400;
}

.sidebar-menu {
  list-style: none;
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.sidebar-menu li a {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  color: rgba(255, 255, 255, 0.88);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  border-radius: 10px;
  transition: all 0.25s ease;
  margin-bottom: 8px;
  cursor: pointer;
  background: transparent;
}

.sidebar-menu li a i {
  font-style: normal;
  display: inline-flex;
  align-items: center;
}

.sidebar-menu li a:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  transform: translateX(4px);
  backdrop-filter: blur(8px);
}

.sidebar-menu li a.active {
  background: rgba(255, 255, 255, 0.26);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.12);
  border-left: 4px solid var(--accent-color);
  backdrop-filter: blur(10px);
}

.sidebar #btn-logout {
  color: #ffffff !important;
  background: rgba(239, 68, 68, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 10px;
  display: flex;
  align-items: center;
  padding: 12px 16px;
  text-decoration: none;
  font-weight: 600;
  cursor: pointer;
  margin-top: auto;
  transition: all 0.25s ease;
}

.sidebar #btn-logout:hover {
  background: rgba(239, 68, 68, 0.6);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.main-content {
  flex: 1;
  padding: 40px;
  overflow-y: auto;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
}

/* Loader */
.loader {
  position: relative;
  z-index: 10;
  border: 3px solid rgba(0, 0, 0, 0.08);
  border-top: 3px solid var(--primary-color);
  border-radius: 50%;
  width: 28px;
  height: 28px;
  box-sizing: border-box;
  animation: spin 0.8s linear infinite;
  margin: 0 auto;
  transform: translateZ(0);
  will-change: transform;
}

#modal-kehadiran-pegawai .modal-content,
#modal-kehadiran-pegawai .table-container {
  position: relative;
  z-index: 2;
}

#loader-kehadiran-pegawai {
  position: fixed !important;
  left: 50% !important;
  top: 50% !important;
  transform: translate(-50%, -50%) !important;
  z-index: 2147483647 !important;
  pointer-events: none;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.table-loading-cell {
  text-align: center;
  padding: 45px 16px !important;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  vertical-align: middle;
}
.table-loading-cell .loader {
  margin-bottom: 12px;
}

/* Modals */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex !important;
  align-items: center;
  justify-content: center;
  z-index: 10000 !important;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.modal.active {
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
}

.swal2-container {
  z-index: 2147483647 !important;
}

.swal2-popup,
.swal2-backdrop,
.swal2-modal,
.swal2-html-container,
.swal2-icon {
  z-index: 2147483647 !important;
}

#modal-kehadiran-pegawai {
  z-index: 12000 !important;
}

#modal-kehadiran-pegawai .modal-content {
  position: relative;
  overflow: hidden;
}

#modal-kehadiran-pegawai.loading .modal-content::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.35);
  backdrop-filter: blur(1px);
  z-index: 4;
}

.modal-content {
  background: white;
  padding: 30px;
  border-radius: 16px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(20px);
  transition: var(--transition);
}

.modal.active .modal-content {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
}
/* Tabs Navigation */
.tabs-nav {
  display: flex;
  gap: 10px;
  border-bottom: 2px solid rgba(0,0,0,0.05);
  margin-bottom: 20px;
}

.tab-item {
  background: none;
  border: none;
  padding: 10px 20px;
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  position: relative;
  transition: color 0.2s;
}

.tab-item:hover {
  color: var(--primary-color);
}

.tab-item.active {
  color: var(--primary-color);
}

.tab-item.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background-color: var(--primary-color);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.3s ease;
}


/* Web Publik Tabs */
.tabs-container { display: flex; gap: 10px; margin-bottom: 20px; background: rgba(255, 255, 255, 0.5); padding: 8px; border-radius: 12px; box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05); }
.tab-btn { flex: 1; padding: 10px 15px; border: none; background: transparent; border-radius: 8px; cursor: pointer; font-weight: 500; font-size: 0.95rem; color: var(--text-muted); transition: all 0.3s ease; }
.tab-btn:hover { background: rgba(255, 255, 255, 0.7); color: var(--primary-color); }
.tab-btn.active { background: var(--gradient-primary); color: white; box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15); transform: translateY(-2px); }
.tab-btn.hidden,
.tab-btn[hidden] { display: none !important; }

/* 4 Kotak Warna Sejajar Sebaris (Laptop & HP) */
.color-picker-grid-4 {
  display: grid !important;
  grid-template-columns: repeat(4, 1fr) !important;
  gap: 12px !important;
  margin-bottom: 25px !important;
  width: 100% !important;
  box-sizing: border-box !important;
}
.color-picker-item {
  text-align: center;
  min-width: 0;
}
.color-picker-item label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-dark);
}
.color-input-compact {
  height: 38px !important;
  padding: 3px !important;
  border-radius: 8px !important;
  cursor: pointer !important;
  width: 100% !important;
  box-sizing: border-box !important;
}
.map-picker-input-group {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ===== FIX: Missing Utility Classes ===== */

/* Flexbox Utilities */
.d-flex { display: flex; }
.justify-content-between { justify-content: space-between; }
.justify-content-end { justify-content: flex-end; }
.align-items-center { align-items: center; }
.flex-wrap { flex-wrap: wrap; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 1rem; }

/* Spacing Utilities */
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-0 { margin-bottom: 0; }
.w-100 { width: 100%; }
.p-0 { padding: 0; }

/* Text Utilities */
.text-muted { color: var(--text-muted); }
.text-dark { color: var(--text-dark); }
.text-danger { color: var(--danger-color); }
.text-primary { color: var(--primary-color); }
.fw-bold { font-weight: 700; }
.fw-500 { font-weight: 500; }
.fs-sm { font-size: 0.85rem; }

/* Shadow */
.shadow { box-shadow: 0 4px 15px rgba(0,0,0,0.1); }
.shadow-sm { box-shadow: 0 2px 8px rgba(0,0,0,0.07); }

/* Table as class (untuk section web publik) */
table.table { width: 100%; border-collapse: collapse; text-align: left; }
.table-responsive { overflow-x: auto; }

/* Badge */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.badge-primary {
  background: var(--gradient-primary);
  color: white;
}
.badge-secondary {
  background: #e5e7eb;
  color: #374151;
}
.badge-success {
  background: #d1fae5;
  color: #065f46;
}
.badge-danger {
  background: #fee2e2;
  color: #991b1b;
}

/* Button Icon (untuk akun admin edit/hapus) */
.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.2s;
}
.btn-icon:hover {
  background: rgba(0,0,0,0.06);
}

/* Modal Body & Footer */
.modal-body {
  padding: 0;
}
.modal-footer {
  margin-top: 20px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* Modal Berita Desktop */
#modal-berita .modal-content {
  max-width: 850px;
  width: 90%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
  background: #ffffff;
  border-radius: 16px;
}
#modal-berita .modal-header {
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px 16px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  background: #ffffff;
  margin-bottom: 0;
}
#modal-berita .modal-header h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-dark, #1e293b);
}
#modal-berita .close-modal {
  font-size: 1.6rem;
  cursor: pointer;
  color: var(--text-muted, #64748b);
  line-height: 1;
}
#modal-berita #form-berita {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 20px 24px 24px;
  min-height: 0;
  display: block;
  background: #ffffff;
}
#modal-berita .grid-2-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* PDF Page styling (untuk cetak daftar hadir) */
.pdf-page {
  background: white;
  width: 210mm;
  min-height: 297mm;
  padding: 20mm;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  font-family: 'Times New Roman', serif;
}
.pdf-page-title {
  font-size: 1.2rem;
  font-weight: bold;
  text-align: center;
  text-transform: uppercase;
  margin-bottom: 15px;
  border-bottom: 2px solid #000;
  padding-bottom: 10px;
}
.pdf-toolbar-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.btn-sm.btn-outline {
  padding: 4px 10px;
  font-size: 0.85rem;
}

/* FadeIn animation untuk tab-content */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* =========================================================
   MOBILE RESPONSIVE & BOTTOM NAVIGATION ALA NATIVE APP
   ========================================================= */

/* Desktop defaults: Bottom Nav & Mobile Portal Button are hidden */
.bottom-nav-mobile {
  display: none !important;
}
.btn-portal-mobile {
  display: none !important;
}

/* Dashboard Mobile Bottom Nav — hidden on desktop */
.dash-bottom-nav {
  display: none !important;
}
.btn-mobile-logout {
  display: none !important;
}

/* Topbar brand (logo+nama+user) — hanya tampil di mobile */
.topbar-brand-mobile {
  display: none !important;
}
/* Judul halaman desktop — tampil di desktop, hidden di mobile */
.topbar-page-title-shell {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  min-width: 0;
  flex: 1;
}

.topbar-page-title-desktop {
  display: block;
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.2;
  color: var(--text-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Base prevention for horizontal page overflow */
html, body {
  max-width: 100%;
  overflow-x: hidden;
}

/* Footer Publik - Desktop */
.public-footer {
  display: block;
  background: #1f2937;
  color: #ffffff;
  padding: 40px 0 28px;
  margin-top: auto;
  width: 100%;
}

.public-footer .footer-grid {
  display: grid !important;
  grid-template-columns: 1.6fr 1.1fr 1fr !important;
  gap: 24px !important;
  margin-bottom: 25px !important;
  align-items: start !important;
}

.public-footer .footer-col {
  text-align: left !important;
  width: 100% !important;
}

.public-footer .footer-col:nth-child(3) {
  text-align: right !important;
}

.public-footer .footer-col:nth-child(3) .social-links {
  justify-content: flex-end !important;
}

/* Mobile & Tablet Styles (<= 768px) */
@media (max-width: 768px) {
  /* Safe area padding for pages with bottom nav */
  body.has-bottom-nav {
    padding-bottom: 76px !important;
  }

  /* Header Mobile */
  .header {
    padding: 12px 0;
  }
  .header .brand div div {
    font-size: 1.15rem !important;
  }
  .header .brand #header-wilayah {
    font-size: 0.72rem !important;
  }
  .header .brand svg,
  .header .brand img {
    width: 32px !important;
    height: 32px !important;
  }
  .header .nav-links,
  .nav-links {
    display: none !important;
  }

  /* Tombol Masuk Portal di Header Kanan Atas Mobile */
  .btn-portal-mobile {
    display: inline-flex !important;
    align-items: center;
    gap: 6px;
    padding: 6px 13px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #ffffff !important;
    background: var(--gradient-primary);
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: var(--transition);
    border: none;
    white-space: nowrap;
  }
  .btn-portal-mobile:hover,
  .btn-portal-mobile:active {
    transform: scale(0.96);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.22);
  }
  .btn-portal-mobile i {
    font-size: 0.85rem;
  }

  /* Native App Bottom Navigation Bar (7 Menu Compact) */
  .bottom-nav-mobile {
    display: flex !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9998;
    height: 60px;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 -4px 18px rgba(0, 0, 0, 0.06);
    align-items: center;
    justify-content: space-around;
    padding: 0 2px;
    padding-bottom: env(safe-area-inset-bottom, 0);
  }

  .bnav-item {
    flex: 1;
    min-width: 0;
    padding: 0 1px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #64748b;
    font-size: 0.52rem;
    font-weight: 500;
    height: 100%;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
  }

  .bnav-icon {
    font-size: 0.95rem;
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 18px;
    transition: transform 0.2s ease, color 0.2s ease;
  }

  .bnav-label {
    line-height: 1;
    white-space: nowrap;
    letter-spacing: -0.3px;
    font-size: 0.52rem;
  }

  .bnav-item:active {
    transform: scale(0.92);
  }

  .bnav-item.active {
    color: var(--primary-color);
    font-weight: 700;
  }
  .bnav-item.active .bnav-icon {
    transform: translateY(-1px);
    color: var(--primary-color);
  }

  /* Center Elevated FAB Button (Beranda) */
  .bnav-item.bnav-center {
    position: relative;
    overflow: visible;
  }
  .bnav-center-circle {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--gradient-primary);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    margin-top: -14px;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
    border: 2.5px solid #ffffff;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
  }
  .bnav-item.bnav-center:active .bnav-center-circle {
    transform: scale(0.92);
  }
  .bnav-item.bnav-center.active .bnav-center-circle {
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.55);
    border-color: rgba(255, 255, 255, 0.95);
  }
  .bnav-item.bnav-center .bnav-label {
    margin-top: 2px;
    font-weight: 600;
    color: var(--text-dark);
  }
  .bnav-item.bnav-center.active .bnav-label {
    color: var(--primary-color);
    font-weight: 700;
  }

  /* Reposisi Tombol Scroll To Top di Mobile agar di atas Bottom Nav */
  .btn-scroll-top {
    bottom: 74px !important;
    right: 16px !important;
    width: 42px !important;
    height: 42px !important;
    font-size: 1.05rem !important;
  }

  /* Container & Spacing Mobile */
  .container {
    padding: 0 14px !important;
    max-width: 100% !important;
  }

  /* Typography Mobile - Tidak Terlalu Besar */
  h1 { font-size: 1.65rem !important; }
  h2 { font-size: 1.35rem !important; }
  h3 { font-size: 1.15rem !important; }
  h4 { font-size: 1.02rem !important; }
  .hero h1 {
    font-size: 1.85rem !important;
  }
  .hero p {
    font-size: 0.92rem !important;
    margin-bottom: 25px !important;
  }
  .page-banner {
    padding: 24px 0 !important;
  }
  .page-banner h1 {
    font-size: 1.55rem !important;
  }
  .page-banner p {
    font-size: 0.85rem !important;
  }

  /* Buttons di Layar HP: Proporsional, Tidak Meluber */
  .btn {
    font-size: 0.84rem !important;
    padding: 7px 13px !important;
    max-width: 100%;
    white-space: normal;
    text-align: center;
  }
  .btn-primary, .btn-outline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* Tables: Wajib Bisa Digeser (Scroll Horizontal) tanpa merusak lebar layar */
  .table-container,
  .table-responsive {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    display: block !important;
    margin-top: 12px !important;
    margin-bottom: 15px !important;
    border-radius: 10px;
    box-shadow: inset 0 0 4px rgba(0,0,0,0.04);
  }

  table {
    width: 100% !important;
    min-width: 540px !important; /* Menjamin tabel tetap terbaca rapi saat digeser */
  }

  th, td {
    padding: 10px 12px !important;
    font-size: 0.82rem !important;
  }

  /* Forms, Grids & Dashboard Controls di HP */
  .grid-2-col,
  .dashboard div[style*="grid-template-columns"]:not(.stats-container),
  .modal-content div[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }
  .glass-panel {
    padding: 16px 14px !important;
    border-radius: 14px !important;
  }

  /* Tabs di Dashboard & Master Data */
  .tabs-nav {
    display: flex !important;
    overflow-x: auto !important;
    flex-wrap: nowrap !important;
    gap: 8px !important;
    padding-bottom: 6px !important;
    -webkit-overflow-scrolling: touch !important;
    margin-bottom: 16px !important;
  }
  .tabs-nav .tab-item {
    flex-shrink: 0 !important;
    padding: 8px 14px !important;
    font-size: 0.82rem !important;
    white-space: nowrap !important;
  }

  /* Action Bars & Form Controls di HP (Bisa Wrap & Tidak Meluber) */
  .tab-content div[style*="display: flex"],
  .glass-panel div[style*="display: flex"],
  .modal-content div[style*="display: flex"],
  .section-content div[style*="display: flex"] {
    flex-wrap: wrap !important;
    gap: 8px !important;
  }
  .glass-panel input[type="text"].form-control,
  .glass-panel input[type="search"].form-control,
  .section-content input[type="text"].form-control,
  .section-content input[type="search"].form-control {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 100% !important;
  }
  .tab-content div[style*="display: flex"] > div,
  .glass-panel div[style*="display: flex"] > div,
  .modal-content div[style*="display: flex"] > div {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
  }

  /* Modals di HP — Pas dengan Lebar Layar */
  .modal-content {
    width: 94% !important;
    max-width: 95% !important;
    margin: 15px auto !important;
    padding: 16px 14px !important;
    max-height: 88vh !important;
    overflow-y: auto !important;
    border-radius: 14px !important;
  }
  .modal-header h3 {
    font-size: 1.1rem !important;
  }

  /* Berita Grid di HP */
  .news-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }
  .news-card {
    height: 110px;
  }
  .news-img {
    width: 120px;
  }
  .news-content {
    padding: 10px;
  }
  .news-content h4 {
    font-size: 0.95rem;
    margin-bottom: 5px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .news-content p {
    font-size: 0.8rem;
    -webkit-line-clamp: 2;
  }
  .news-date {
    font-size: 0.75rem;
    margin-bottom: 5px;
  }

  /* Filter Bar Referensi di HP */
  .filter-bar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
  }
  .search-input-wrap {
    width: 100% !important;
    min-width: 100% !important;
  }
  .cat-btn-group {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    width: 100% !important;
  }

  /* Dashboard Mobile Layout */
  .dashboard {
    flex-direction: column !important;
  }
  .sidebar {
    width: 100% !important;
    padding: 14px 16px !important;
    border-right: none !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15) !important;
  }
  .sidebar .brand {
    padding-bottom: 12px !important;
  }
  .sidebar-menu {
    flex-direction: row !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    margin-top: 12px !important;
    justify-content: center !important;
  }
  .sidebar-menu li {
    margin-bottom: 0 !important;
  }
  .sidebar-menu li a {
    padding: 7px 11px !important;
    font-size: 0.8rem !important;
    margin-bottom: 0 !important;
    border-radius: 8px !important;
  }
  .sidebar #btn-logout {
    padding: 7px 11px !important;
    font-size: 0.8rem !important;
    margin-top: 0 !important;
  }
  .main-content {
    padding: 16px 12px !important;
  }


  /* Footer Hitam Publik Responsive di HP */
  .public-footer {
    display: block !important;
    background: #1f2937 !important;
    color: #ffffff !important;
    padding: 20px 0 25px !important;
    margin-top: auto !important;
    width: 100% !important;
  }

  #maps-section {
    margin-bottom: 25px !important;
  }

  .public-footer .footer-grid {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 20px !important;
    margin-bottom: 25px !important;
  }

  .public-footer .footer-col {
    text-align: left !important;
    width: 100% !important;
  }

  .public-footer .footer-col:nth-child(3) {
    text-align: left !important;
  }

  .public-footer .footer-col:nth-child(3) .social-links {
    justify-content: flex-start !important;
  }

  .footer-col h4 {
    color: #ffffff !important;
    font-size: 1.05rem !important;
    font-weight: 700 !important;
    margin-bottom: 12px !important;
  }

  .footer-col p {
    color: #9ca3af !important;
    font-size: 0.88rem !important;
    line-height: 1.6 !important;
    margin-bottom: 8px !important;
  }

  .footer-col ul {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
    line-height: 2 !important;
  }

  .social-links {
    display: flex !important;
    gap: 12px !important;
    flex-wrap: wrap !important;
    justify-content: flex-start !important;
  }

  /* Pastikan konten utama tidak tertimpa bottom nav */
  body.has-bottom-nav main,
  body.has-bottom-nav .main-content {
    padding-bottom: 80px !important;
  }

  /* Modal di HP: beri padding bawah agar tombol simpan tidak
     tertutup bottom nav (60px) + safe area iPhone */
  .modal {
    padding-bottom: calc(60px + env(safe-area-inset-bottom, 0px)) !important;
    align-items: center !important;
  }
  .modal-content {
    display: flex !important;
    flex-direction: column !important;
    flex-wrap: nowrap !important;
    max-height: calc(90vh - 70px) !important;
    overflow-y: auto !important;
    margin: 10px auto !important;
    width: 95% !important;
    max-width: 95vw !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
  }
  /* Modal Berita Khusus HP: Kokoh, Scrollable, Fixed Header, Tidak Collapsed */
  #modal-berita .modal-content {
    width: min(94vw, 860px) !important;
    max-width: 94vw !important;
    height: 86vh !important;
    max-height: calc(90vh - 40px) !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    margin: 0 auto !important;
    padding: 0 !important;
    background: #ffffff !important;
    border: 1px solid rgba(148, 163, 184, 0.25) !important;
    border-radius: 14px !important;
    align-self: center !important;
  }
  #modal-berita .modal-header {
    flex-shrink: 0 !important;
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 14px 16px !important;
    margin: 0 !important;
    border-bottom: 1px solid rgba(148, 163, 184, 0.25) !important;
    background: #ffffff !important;
  }
  #modal-berita .modal-header h3 {
    margin: 0 !important;
    font-size: 1.08rem !important;
    font-weight: 700 !important;
    line-height: 1.3 !important;
    flex: 1 1 auto !important;
    color: #1e293b !important;
  }
  #modal-berita .close-modal {
    margin-left: auto !important;
    flex-shrink: 0 !important;
    font-size: 1.5rem !important;
    line-height: 1 !important;
    color: #64748b !important;
    cursor: pointer !important;
  }
  #modal-berita #form-berita,
  #modal-berita .modal-body {
    flex: 1 1 auto !important;
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding: 14px 16px 20px !important;
    background: #ffffff !important;
    min-height: 0 !important;
  }
  #modal-berita .form-group {
    display: block !important;
    width: 100% !important;
    margin-bottom: 14px !important;
  }
  #modal-berita .form-group label {
    display: block !important;
    margin-bottom: 6px !important;
    font-weight: 600 !important;
    color: #1e293b !important;
    font-size: 0.9rem !important;
  }
  #modal-berita .grid-2-col,
  #modal-berita [style*="display: grid"],
  #modal-berita .modal-body > div[style*="display: grid"] {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
  }
  #modal-berita #editor-berita {
    height: 200px !important;
    background: #ffffff !important;
    border-radius: 0 0 8px 8px !important;
  }
  #modal-berita .ql-toolbar.ql-snow {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 2px !important;
    padding: 6px !important;
    background: #f8fafc !important;
    border: 1px solid #cbd5e1 !important;
    border-bottom: none !important;
    border-radius: 8px 8px 0 0 !important;
  }
  #modal-berita .ql-formats {
    margin-right: 6px !important;
    margin-bottom: 4px !important;
  }
  #modal-berita .ql-container.ql-snow {
    border: 1px solid #cbd5e1 !important;
    border-radius: 0 0 8px 8px !important;
    font-size: 0.95rem !important;
  }
  #modal-berita .modal-footer {
    display: flex !important;
    flex-direction: row !important;
    justify-content: flex-end !important;
    align-items: center !important;
    gap: 10px !important;
    margin-top: 18px !important;
    padding-bottom: 12px !important;
  }
  #modal-berita .modal-footer .btn {
    padding: 8px 18px !important;
    font-size: 0.9rem !important;
  }

  /* Modals Lainnya di HP */
  #modal-slider .modal-content,
  #modal-pengurus .modal-content,
  #modal-referensi .modal-content,
  #modal-medsos .modal-content,
  #modal-preview-referensi .modal-content {
    width: min(94vw, 500px) !important;
    max-width: 94vw !important;
    min-width: 0 !important;
    background: #ffffff !important;
    border: 1px solid rgba(148, 163, 184, 0.25) !important;
    padding: 0 !important;
    overflow: hidden !important;
    margin: 0 auto !important;
    display: flex !important;
    flex-direction: column !important;
    align-self: center !important;
  }
  #modal-slider .modal-body,
  #modal-pengurus .modal-body,
  #modal-referensi form,
  #modal-medsos form,
  #modal-preview-referensi .modal-body {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    overflow-y: auto !important;
    padding: 14px !important;
    background: #ffffff !important;
    min-height: 0 !important;
  }
  #modal-slider [style*="display: grid"],
  #modal-pengurus [style*="display: grid"],
  #modal-slider .modal-body > div[style*="display: grid"],
  #modal-pengurus .modal-body > div[style*="display: grid"] {
    grid-template-columns: 1fr !important;
  }
  #modal-slider .modal-header,
  #modal-pengurus .modal-header,
  #modal-referensi .modal-header,
  #modal-medsos .modal-header,
  #modal-preview-referensi .modal-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    margin: 0 !important;
    padding: 16px 16px 12px !important;
    border-bottom: 1px solid rgba(148, 163, 184, 0.25) !important;
    background: #ffffff !important;
    flex-shrink: 0 !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 1 !important;
  }
  #modal-slider .modal-header h3,
  #modal-pengurus .modal-header h3,
  #modal-referensi .modal-header h3,
  #modal-medsos .modal-header h3,
  #modal-preview-referensi .modal-header h3 {
    margin: 0 !important;
    font-size: 1.05rem !important;
    line-height: 1.3 !important;
    flex: 1 1 auto !important;
    white-space: normal !important;
    color: var(--text-dark) !important;
  }
  .close-modal {
    margin-left: auto !important;
    flex-shrink: 0 !important;
    font-size: 1.5rem !important;
    line-height: 1 !important;
    color: var(--text-muted) !important;
  }

  /* Tabel Jadwal di HP: tuan rumah paling kiri, freeze 40% layar (60% bisa digeser) */
  #jadwal-table-wrapper {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    margin: 0 !important;
    padding-bottom: 8px !important;
  }
  #table-jadwal {
    width: max-content !important;
    min-width: 680px !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
    table-layout: fixed !important;
  }
  #table-jadwal th,
  #table-jadwal td {
    font-size: 0.8rem !important;
    padding: 8px 10px !important;
    white-space: nowrap !important;
  }
  #table-jadwal th:first-child,
  #table-jadwal td:first-child {
    position: sticky !important;
    left: 0 !important;
    z-index: 2 !important;
    background: #ffffff !important;
    width: 40vw !important;
    min-width: 40vw !important;
    max-width: 40vw !important;
    box-sizing: border-box !important;
    white-space: normal !important;
    word-break: break-word !important;
    overflow: hidden !important;
    box-shadow: 3px 0 8px rgba(15, 23, 42, 0.12) !important;
  }
  #table-jadwal th:first-child {
    z-index: 3 !important;
    background: var(--table-header-bg, #f8fafc) !important;
  }
  #table-jadwal th:nth-child(2),
  #table-jadwal td:nth-child(2) {
    min-width: 110px !important;
  }
  #table-jadwal th:nth-child(3),
  #table-jadwal td:nth-child(3) {
    min-width: 100px !important;
  }
  #table-jadwal th:nth-child(4),
  #table-jadwal td:nth-child(4) {
    min-width: 110px !important;
  }
  #table-jadwal th:nth-child(5),
  #table-jadwal td:nth-child(5) {
    min-width: 120px !important;
    text-align: center !important;
  }

  /* Tabel Laporan di HP: tuan rumah paling kiri, freeze 40% layar (60% bisa digeser) */
  #table-laporan {
    width: max-content !important;
    min-width: 650px !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
    table-layout: fixed !important;
  }
  #table-laporan th,
  #table-laporan td {
    font-size: 0.8rem !important;
    padding: 8px 10px !important;
    white-space: nowrap !important;
  }
  #table-laporan th:first-child,
  #table-laporan td:first-child {
    position: sticky !important;
    left: 0 !important;
    z-index: 2 !important;
    background: #ffffff !important;
    width: 40vw !important;
    min-width: 40vw !important;
    max-width: 40vw !important;
    box-sizing: border-box !important;
    white-space: normal !important;
    word-break: break-word !important;
    overflow: hidden !important;
    box-shadow: 3px 0 8px rgba(15, 23, 42, 0.12) !important;
  }
  #table-laporan th:first-child {
    z-index: 3 !important;
    background: var(--table-header-bg, #f8fafc) !important;
  }
  #table-laporan th:nth-child(2),
  #table-laporan td:nth-child(2) {
    min-width: 80px !important;
  }
  #table-laporan th:nth-child(3),
  #table-laporan td:nth-child(3) {
    min-width: 95px !important;
  }
  #table-laporan th:nth-child(4),
  #table-laporan td:nth-child(4) {
    min-width: 100px !important;
  }
  #table-laporan th:nth-child(5),
  #table-laporan td:nth-child(5) {
    min-width: 120px !important;
    text-align: center !important;
  }

  /* =============================================
     DASHBOARD MOBILE LAYOUT
     ============================================= */

  /* Sidebar disembunyikan di mobile, diganti bottom nav */
  .dashboard {
    flex-direction: column !important;
  }
  .sidebar {
    display: none !important;
  }

  /* Main content full width */
  .dashboard .main-content {
    padding: 12px 12px 80px 12px !important;
    width: 100% !important;
  }

  /* Top Bar mobile — Logo & Nama Aplikasi + Username di Kiri Atas, Tombol Keluar di Kanan Atas */
  .top-bar {
    position: sticky !important;
    top: 0 !important;
    z-index: 500 !important;
    background: rgba(255,255,255,0.96) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    border-bottom: 1px solid rgba(0,0,0,0.08) !important;
    padding: 10px 14px !important;
    margin-bottom: 14px !important;
    border-radius: 0 !important;
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  .topbar-page-title-desktop {
    display: none !important;
  }
  .topbar-brand-mobile {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
    width: auto !important;
    overflow: hidden !important;
  }
  .topbar-brand-mobile img,
  .topbar-brand-mobile svg {
    width: 34px !important;
    height: 34px !important;
    flex-shrink: 0 !important;
  }
  .topbar-brand-mobile div {
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    line-height: 1.15 !important;
    overflow: hidden !important;
    min-width: 0 !important;
  }
  #topbar-appname-mobile {
    font-size: 0.88rem !important;
    font-weight: 700 !important;
    color: var(--text-dark) !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
  #topbar-username-mobile {
    font-size: 0.72rem !important;
    font-weight: 500 !important;
    color: var(--primary-color) !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
  .top-bar .topbar-actions {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 8px !important;
    flex: 0 0 auto !important;
    width: auto !important;
    margin-left: auto !important;
  }
  #btn-user-profile,
  #btn-logout-desktop {
    display: none !important;
  }
  .btn-mobile-logout {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 38px !important;
    height: 38px !important;
    border-radius: 50% !important;
    background: rgba(239, 68, 68, 0.12) !important;
    border: 1px solid rgba(239, 68, 68, 0.3) !important;
    color: #ef4444 !important;
    font-size: 1.05rem !important;
    cursor: pointer !important;
    transition: all 0.2s ease;
    flex-shrink: 0 !important;
    text-decoration: none !important;
  }
  .btn-mobile-logout:hover,
  .btn-mobile-logout:active {
    background: rgba(239, 68, 68, 0.25) !important;
    transform: scale(0.93);
  }

  /* Web Publik 6 Tab di HP: 2 Tingkat, Sebaris 3 Tab Pas di Layar */
  #section-webpublik .tabs-container {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 6px !important;
    padding: 6px !important;
    width: 100% !important;
    box-sizing: border-box !important;
    background: rgba(255, 255, 255, 0.75) !important;
    border-radius: 12px !important;
    margin-bottom: 16px !important;
  }
  #section-webpublik .tabs-container .tab-btn {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 8px 2px !important;
    font-size: 0.72rem !important;
    font-weight: 600 !important;
    text-align: center !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    border-radius: 8px !important;
    min-width: 0 !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  /* Tombol Titik Koordinat Pilih Peta (Tab Sistem) agar Pas di Layar HP */
  .map-picker-input-group {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  .map-picker-input-group input {
    width: 100% !important;
    box-sizing: border-box !important;
  }
  .map-picker-input-group button {
    width: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 10px 14px !important;
    box-sizing: border-box !important;
  }

  /* 4 Kotak Warna Sejajar Sebaris di HP */
  .color-picker-grid-4 {
    gap: 6px !important;
  }
  .color-picker-item label {
    font-size: 0.68rem !important;
    margin-bottom: 4px !important;
  }
  .color-input-compact {
    height: 34px !important;
    padding: 2px !important;
  }

  /* Dashboard Bottom Navigation */
  .dash-bottom-nav {
    display: flex !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9998;
    height: 62px;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 -4px 18px rgba(0, 0, 0, 0.08);
    align-items: center;
    justify-content: space-around;
    padding: 0 2px;
    padding-bottom: env(safe-area-inset-bottom, 0);
  }

  .dbnav-item {
    flex: 1;
    min-width: 0;
    padding: 0 1px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #64748b;
    font-size: 0.52rem;
    font-weight: 500;
    height: 100%;
    cursor: pointer;
    background: none;
    border: none;
    -webkit-tap-highlight-color: transparent;
    transition: color 0.2s ease;
  }

  .dbnav-icon {
    font-size: 0.95rem;
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 20px;
    transition: transform 0.2s ease, color 0.2s ease;
  }

  .dbnav-label {
    line-height: 1;
    white-space: nowrap;
    letter-spacing: -0.3px;
    font-size: 0.52rem;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    text-align: center;
  }

  .dbnav-item:active {
    transform: scale(0.91);
  }

  .dbnav-item.active {
    color: var(--primary-color);
    font-weight: 700;
  }

  .dbnav-item.active .dbnav-icon {
    transform: translateY(-1px);
    color: var(--primary-color);
  }

  /* Center FAB (Beranda) */
  .dbnav-item.dbnav-center {
    position: relative;
    overflow: visible;
  }

  .dbnav-center-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--gradient-primary);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    margin-top: -16px;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.45);
    border: 2.5px solid #ffffff;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
  }

  .dbnav-item.dbnav-center:active .dbnav-center-circle {
    transform: scale(0.92);
  }

  .dbnav-item.dbnav-center.active .dbnav-center-circle {
    box-shadow: 0 6px 18px rgba(99, 102, 241, 0.58);
  }

  .dbnav-item.dbnav-center .dbnav-label {
    margin-top: 2px;
    font-size: 0.55rem;
  }

  /* Profil Icon di bottom nav (khusus sekolah & admin) */
  .dbnav-item.dbnav-profil .dbnav-icon {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--gradient-primary);
    color: white;
    font-size: 0.8rem;
    font-weight: 700;
    margin-bottom: 2px;
    flex-shrink: 0;
  }
}


@media (max-width: 768px) {
  .read-more-text { display: none !important; }
  .hide-text-mobile { display: none !important; }
  .news-content h4 { font-size: 0.85rem !important; }

  /* Stats cards: mini, satu baris */
  #dashboard-stats-cards {
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 6px !important;
  }
  #dashboard-stats-cards > div {
    padding: 12px 8px !important;
    border-radius: 12px !important;
    background: rgba(255,255,255,0.9) !important;
    border: 1px solid rgba(148,163,184,0.25) !important;
    box-shadow: 0 8px 18px rgba(15,23,42,0.06) !important;
    color: var(--text-dark) !important;
  }
  #dashboard-stats-cards > div > div:first-child {
    font-size: 0.6rem !important;
    margin-bottom: 4px !important;
    color: var(--text-muted) !important;
    opacity: 1 !important;
  }
  #dashboard-stats-cards > div > div:last-child {
    font-size: 1.35rem !important;
    font-weight: 800 !important;
    color: var(--primary-color) !important;
  }

  #dashboard-charts-container {
    grid-template-columns: 1fr !important;
    gap: 14px !important;
  }
  #dashboard-charts-container > .glass-panel {
    min-width: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow: hidden !important;
  }
  #dashboard-charts-container canvas {
    max-width: 100% !important;
    width: 100% !important;
    display: block !important;
  }
  #dashboard-charts-container > .glass-panel > div[style*="height: 250px"] {
    height: 200px !important;
  }

  /* Tabel sekolah: aksi jadi icon HP */
  #table-sekolah .btn-aksi-text { display: none !important; }
  #table-sekolah td:last-child {
    white-space: nowrap;
    padding: 6px 4px;
  }
  #table-sekolah td:last-child .btn { padding: 4px 7px !important; font-size: 0.8rem !important; }
  /* Kolom nama & NPSN sekolah: freeze nama sekolah 40% layar di HP */
  #table-sekolah {
    width: max-content !important;
    min-width: 680px !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
    table-layout: fixed !important;
  }
  #table-sekolah th:first-child,
  #table-sekolah td:first-child {
    position: sticky !important;
    left: 0 !important;
    z-index: 2 !important;
    background: #ffffff !important;
    width: 40vw !important;
    min-width: 40vw !important;
    max-width: 40vw !important;
    box-sizing: border-box !important;
    white-space: normal !important;
    word-break: break-word !important;
    overflow: hidden !important;
    box-shadow: 3px 0 8px rgba(15, 23, 42, 0.12) !important;
    padding: 8px 10px !important;
  }
  #table-sekolah th:first-child {
    z-index: 3 !important;
    background: var(--table-header-bg, #f8fafc) !important;
  }
  #table-sekolah td:nth-child(2), #table-sekolah th:nth-child(2) { min-width: 110px; white-space: nowrap; }

  /* Tabel pegawai TAS global: aksi sebaris + lebar kolom sekolah */
  #table-pegawai td, #table-pegawai th { font-size: 0.8rem; padding: 6px 8px; }
  #table-pegawai td:first-child { min-width: 150px; max-width: 180px; }
  #table-pegawai td:nth-child(3) { min-width: 160px; } /* kolom sekolah */
  #table-pegawai td:last-child { white-space: nowrap; }

  /* Tabel pegawai sekolah inline: freeze kolom 1 (40% layar di HP) */
  #wrapper-pegawai-sekolah-inline {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  #table-pegawai-sekolah-inline {
    width: max-content;
    min-width: 100%;
    border-collapse: separate;
    border-spacing: 0;
  }
  #table-pegawai-sekolah-inline th:first-child,
  #table-pegawai-sekolah-inline td:first-child {
    position: sticky;
    left: 0;
    z-index: 2;
    background: #ffffff;
    width: 40vw !important;
    min-width: 40vw !important;
    max-width: 40vw !important;
    box-sizing: border-box !important;
    white-space: normal !important;
    word-break: break-word !important;
    overflow: hidden !important;
    box-shadow: 3px 0 8px rgba(0,0,0,0.12);
    padding: 8px 10px !important;
  }
  #table-pegawai-sekolah-inline th:first-child {
    z-index: 3;
    background: var(--table-header-bg, #f1f5f9);
    color: var(--text-dark, #1e293b);
  }
  #table-pegawai-sekolah-inline td, #table-pegawai-sekolah-inline th { font-size: 0.8rem; padding: 6px 8px; white-space: nowrap; }
  #table-pegawai-sekolah-inline td:first-child { white-space: normal; }
  #table-pegawai-sekolah-inline td:last-child { white-space: nowrap; }

  /* Modal kehadiran pegawai HP: gabung nama+jabatan jadi 2 kolom */
  .jabatan-desktop-col { display: none !important; }
  .jabatan-mobile-inline { display: block !important; }
  #table-kehadiran-pegawai {
    width: 100% !important;
    min-width: 100% !important;
    table-layout: fixed !important;
  }
  #table-kehadiran-pegawai th, #table-kehadiran-pegawai td {
    white-space: normal !important;
    word-wrap: break-word !important;
  }
  #table-kehadiran-pegawai td:first-child,
  #table-kehadiran-pegawai th:first-child { width: 60% !important; min-width: unset !important; padding: 6px !important; }
  #table-kehadiran-pegawai td:last-child,
  #table-kehadiran-pegawai th:last-child { width: 40% !important; min-width: unset !important; padding: 6px !important; text-align: center !important; }

  /* Tab dokumen laporan di HP: tumpuk ke bawah (1 kolom) */
  #laporan-dokumen-grid {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }
}
