/* ==========================================================================
   Aplikasi Sekolah Digital - Modern Design System CSS
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --secondary: #0f172a;
  --accent: #059669;
  --accent-light: #ecfdf5;
  --warning: #d97706;
  --warning-light: #fffbeb;
  --danger: #dc2626;
  --danger-light: #fef2f2;
  --info: #0891b2;
  --info-light: #ecfeff;
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --sidebar-width: 260px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 10px 25px rgba(15, 23, 42, 0.1);
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.6;
  overflow-x: hidden;
}

a {
  text-decoration: none;
  color: inherit;
}

/* ==================== Layout Structure ==================== */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  background: #0f172a;
  color: #f8fafc;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  box-shadow: 4px 0 15px rgba(0,0,0,0.1);
  transition: var(--transition);
}

.sidebar-header {
  padding: 24px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-brand-icon {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, var(--primary), #3b82f6);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 20px;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.sidebar-brand-text h2 {
  font-size: 16px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.3px;
}

.sidebar-brand-text p {
  font-size: 11px;
  color: #94a3b8;
  font-weight: 500;
}

.sidebar-menu {
  padding: 20px 12px;
  flex: 1;
  overflow-y: auto;
}

.menu-category {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #64748b;
  padding: 12px 12px 6px 12px;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  color: #94a3b8;
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  margin-bottom: 4px;
  transition: var(--transition);
}

.menu-item i {
  font-size: 17px;
  width: 22px;
  text-align: center;
  transition: var(--transition);
}

.menu-item:hover, .menu-item.active {
  color: #ffffff;
  background: rgba(255,255,255,0.08);
}

.menu-item.active {
  background: linear-gradient(90deg, var(--primary), #3b82f6);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
  background: rgba(0,0,0,0.2);
}

.user-card {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar {
  width: 38px;
  height: 38px;
  background: #334155;
  color: #60a5fa;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}

.user-info {
  flex: 1;
  overflow: hidden;
}

.user-info .name {
  font-size: 13px;
  font-weight: 600;
  color: #ffffff;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.user-info .role {
  font-size: 11px;
  color: #94a3b8;
  text-transform: capitalize;
}

.btn-logout {
  color: #f87171;
  font-size: 16px;
  padding: 8px;
  border-radius: 6px;
  transition: var(--transition);
}

.btn-logout:hover {
  background: rgba(239, 68, 68, 0.15);
}

/* ==================== Main Body Content ==================== */
.main-content {
  margin-left: var(--sidebar-width);
  width: calc(100% - var(--sidebar-width));
  max-width: calc(100% - var(--sidebar-width));
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  box-sizing: border-box;
}

.top-navbar {
  height: 70px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  padding: 0 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 90;
  box-shadow: var(--shadow-sm);
}

.page-header-title h1 {
  font-size: 20px;
  font-weight: 700;
  color: var(--secondary);
}

.page-header-title p {
  font-size: 12px;
  color: var(--text-muted);
}

.top-navbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.date-badge {
  background: var(--bg-main);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 6px;
}

.content-body {
  padding: 30px;
  flex: 1;
  width: 100%;
  box-sizing: border-box;
}

/* ==================== Cards & Stat Widgets ==================== */
.grid-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 22px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

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

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

.stat-icon.primary { background: var(--primary-light); color: var(--primary); }
.stat-icon.accent { background: var(--accent-light); color: var(--accent); }
.stat-icon.warning { background: var(--warning-light); color: var(--warning); }
.stat-icon.danger { background: var(--danger-light); color: var(--danger); }
.stat-icon.info { background: var(--info-light); color: var(--info); }

.stat-details h3 {
  font-size: 24px;
  font-weight: 800;
  color: var(--secondary);
  line-height: 1.2;
}

.stat-details p {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

.card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-md);
  margin-bottom: 24px;
}

.card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-body {
  padding: 24px;
}

/* ==================== Tables & Data Display ==================== */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

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

.table th {
  background: #f8fafc;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  text-align: left;
}

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

.table tbody tr:hover {
  background: #f1f5f9;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.badge-success { background: var(--accent-light); color: var(--accent); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-info { background: var(--info-light); color: var(--info); }
.badge-secondary { background: #f1f5f9; color: #475569; }

/* ==================== Buttons & Forms ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: var(--transition);
}

.btn-primary { background: var(--primary); color: #ffffff; }
.btn-primary:hover { background: var(--primary-hover); box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25); }

.btn-accent { background: var(--accent); color: #ffffff; }
.btn-accent:hover { background: #047857; }

.btn-danger { background: var(--danger); color: #ffffff; }
.btn-danger:hover { background: #b91c1c; }

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-main);
}
.btn-outline:hover { background: #f1f5f9; }

.btn-sm { padding: 6px 12px; font-size: 12px; }

.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--secondary);
  margin-bottom: 6px;
}

.form-control, .form-select {
  width: 100%;
  padding: 10px 14px;
  font-size: 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: #ffffff;
  color: var(--text-main);
  outline: none;
  transition: var(--transition);
}

.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.filter-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 20px;
  background: var(--bg-card);
  padding: 16px 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

/* ==================== Login Portal Landing Design ==================== */
.login-landing-container {
  min-height: 100vh;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #1e1b4b 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px 20px;
  position: relative;
  overflow: hidden;
}

.login-landing-container::before {
  content: '';
  position: absolute;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(37,99,235,0.15) 0%, rgba(0,0,0,0) 70%);
  top: -100px;
  left: -100px;
  pointer-events: none;
}

.landing-header {
  text-align: center;
  margin-bottom: 40px;
  z-index: 2;
}

.landing-header .logo-badge {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, var(--primary), #3b82f6);
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 30px;
  margin: 0 auto 16px auto;
  box-shadow: 0 8px 25px rgba(37, 99, 235, 0.4);
}

.landing-header h1 {
  font-size: 32px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.5px;
}

.landing-header p {
  font-size: 15px;
  color: #94a3b8;
  margin-top: 6px;
}

.portal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
  width: 100%;
  max-width: 960px;
  z-index: 2;
}

.portal-card {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  padding: 30px 24px;
  text-align: center;
  color: #fff;
  transition: var(--transition);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.portal-card:hover {
  transform: translateY(-8px);
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.25);
  box-shadow: 0 15px 35px rgba(0,0,0,0.3);
}

.portal-icon {
  width: 60px;
  height: 60px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  margin-bottom: 20px;
}

.portal-card.admin .portal-icon { background: rgba(37,99,235,0.2); color: #60a5fa; }
.portal-card.guru .portal-icon { background: rgba(5,150,105,0.2); color: #34d399; }
.portal-card.bk .portal-icon { background: rgba(217,119,6,0.2); color: #fbbf24; }

.portal-card h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
}

.portal-card p {
  font-size: 13px;
  color: #94a3b8;
  line-height: 1.5;
  margin-bottom: 20px;
}

.portal-card .btn-portal {
  margin-top: auto;
  width: 100%;
  padding: 10px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.1);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  transition: var(--transition);
}

.portal-card:hover .btn-portal {
  background: var(--primary);
}

/* ==================== Login Form Box ==================== */
.login-box {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 36px;
  z-index: 2;
  border: 1px solid var(--border-color);
}

.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.alert-danger { background: var(--danger-light); color: var(--danger); border: 1px solid #fecaca; }
.alert-success { background: var(--accent-light); color: var(--accent); border: 1px solid #a7f3d0; }
.alert-info { background: var(--info-light); color: var(--info); border: 1px solid #a5f3fc; }

/* ==================== Mobile Backdrop & Drawer Components ==================== */
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 9998;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.sidebar-backdrop.active {
  opacity: 1;
  visibility: visible;
}

.sidebar-close-btn {
  display: none;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ffffff;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  font-size: 16px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  margin-left: auto;
  flex-shrink: 0;
}

.sidebar-close-btn:hover {
  background: rgba(239, 68, 68, 0.25);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.4);
}

/* ==================== Mobile Responsiveness (Tablet & Handphone) ==================== */
@media (max-width: 768px) {
  :root {
    --sidebar-width: 290px;
  }

  .mobile-toggle-btn {
    display: inline-flex !important;
  }

  .sidebar-close-btn {
    display: inline-flex !important;
  }

  .sidebar {
    width: var(--sidebar-width) !important;
    max-width: 85vw !important;
    transform: translateX(-100%);
    box-shadow: none;
    z-index: 9999;
  }

  .sidebar.mobile-open {
    transform: translateX(0);
    box-shadow: 12px 0 40px rgba(0, 0, 0, 0.65);
  }

  .main-content {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Top Navbar */
  .top-navbar {
    padding: 10px 14px !important;
    height: 64px !important;
    gap: 8px;
  }

  .page-header-title {
    min-width: 0;
    max-width: 180px;
  }

  .page-header-title h1 {
    font-size: 15px !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.25;
  }

  .page-header-title p {
    font-size: 10px !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .top-navbar-right {
    gap: 8px;
    flex-shrink: 0;
  }

  .content-body {
    padding: 14px 10px !important;
  }

  /* Banners in all modules */
  .card[style*="background: linear-gradient"],
  div[style*="background: linear-gradient"],
  .card[style*="padding: 24px"],
  .card[style*="padding: 26px"] {
    padding: 16px 14px !important;
    border-radius: 16px !important;
  }

  /* Banner flex layout: title on top, buttons stacked or gridded below */
  .card > div[style*="justify-content: space-between"],
  div[style*="background: linear-gradient"] > div[style*="justify-content: space-between"],
  div[style*="margin-bottom: 24px; flex-wrap: wrap; gap: 14px"],
  div[style*="margin-bottom: 22px; flex-wrap: wrap; gap: 12px"] {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 14px !important;
  }

  .card > div[style*="justify-content: space-between"] > div:first-child,
  div[style*="background: linear-gradient"] > div[style*="justify-content: space-between"] > div:first-child {
    width: 100% !important;
  }

  .card > div[style*="justify-content: space-between"] > div:first-child h2,
  div[style*="background: linear-gradient"] > div[style*="justify-content: space-between"] > div:first-child h1,
  div[style*="background: linear-gradient"] > div[style*="justify-content: space-between"] > div:first-child h2 {
    font-size: 20px !important;
    line-height: 1.3 !important;
  }

  /* Action button containers in module banners */
  .card > div[style*="justify-content: space-between"] > div[style*="display: flex; gap: 10px"],
  .card > div[style*="justify-content: space-between"] > div[style*="display: flex; gap: 8px"],
  div[style*="background: linear-gradient"] > div[style*="justify-content: space-between"] > div[style*="display: flex; gap: 10px"],
  div[style*="background: linear-gradient"] > div[style*="justify-content: space-between"] > div[style*="display: flex; gap: 8px"],
  div[style*="display: flex; gap: 10px; flex-wrap: wrap"] {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)) !important;
    gap: 8px !important;
    width: 100% !important;
  }

  .card > div[style*="justify-content: space-between"] > div[style*="display: flex; gap: 10px"] .btn,
  .card > div[style*="justify-content: space-between"] > div[style*="display: flex; gap: 8px"] .btn,
  div[style*="background: linear-gradient"] > div[style*="justify-content: space-between"] > div[style*="display: flex; gap: 10px"] .btn,
  div[style*="display: flex; gap: 10px; flex-wrap: wrap"] .btn {
    width: 100% !important;
    padding: 9px 10px !important;
    font-size: 12px !important;
    justify-content: center !important;
    text-align: center !important;
  }

  /* Standalone button bars at top of modules */
  div[style*="margin-bottom: 20px; display: flex; gap: 10px"],
  div[style*="margin-bottom: 24px; display: flex; gap: 10px"],
  div[style*="margin-bottom: 16px; display: flex; gap: 10px"] {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)) !important;
    gap: 8px !important;
    width: 100% !important;
  }

  div[style*="margin-bottom: 20px; display: flex; gap: 10px"] .btn,
  div[style*="margin-bottom: 24px; display: flex; gap: 10px"] .btn,
  div[style*="margin-bottom: 16px; display: flex; gap: 10px"] .btn {
    width: 100% !important;
    padding: 9px 10px !important;
    font-size: 12px !important;
    justify-content: center !important;
    text-align: center !important;
  }

  /* Stats Grid */
  .grid-stats {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
    margin-bottom: 18px !important;
  }

  .stat-card {
    padding: 14px 12px !important;
    gap: 10px !important;
    border-radius: 12px !important;
  }

  .stat-icon {
    width: 40px !important;
    height: 40px !important;
    font-size: 18px !important;
    border-radius: 10px !important;
  }

  .stat-details h3 {
    font-size: 17px !important;
    line-height: 1.2 !important;
  }

  .stat-details p {
    font-size: 11px !important;
    line-height: 1.25 !important;
  }

  /* Cards & Headers */
  .card {
    margin-bottom: 16px !important;
    border-radius: 14px !important;
  }

  .card-header {
    padding: 14px 14px !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
  }

  .card-header .card-title {
    font-size: 15px !important;
  }

  .card-header > div:last-child {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
  }

  .card-header .btn {
    flex: 1 1 auto;
    font-size: 12px !important;
    padding: 8px 12px !important;
    justify-content: center;
  }

  .card-body {
    padding: 14px 12px !important;
  }

  /* Tables: Horizontal Touch Scroll without squishing columns */
  .table-responsive {
    display: block !important;
    width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    margin-bottom: 10px;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f1f5f9;
  }

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

  .table-responsive::-webkit-scrollbar-track {
    background: #f1f5f9;
  }

  .table-responsive::-webkit-scrollbar-thumb {
    background: #94a3b8;
    border-radius: 4px;
  }

  .table-responsive .table,
  .card-body > .table {
    min-width: 650px !important;
  }

  .card-body > .table {
    display: block !important;
    width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  .table th, .table td {
    padding: 9px 12px !important;
    font-size: 12px !important;
  }

  /* Forms & Filters */
  .filter-bar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
    padding: 14px !important;
  }

  .filter-bar form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
  }

  .filter-bar .form-control,
  .filter-bar .form-select,
  .filter-bar .btn,
  .card-body form select.form-select,
  .card-body form input.form-control {
    width: 100% !important;
    min-width: 0 !important;
  }

  .form-group {
    margin-bottom: 14px;
  }

  .form-control, .form-select {
    padding: 9px 12px;
    font-size: 13.5px;
    min-height: 42px;
  }

  .btn {
    padding: 9px 14px;
    font-size: 13px;
    min-height: 40px;
  }

  /* Modals */
  .modal-dialog,
  .modal-box,
  .modal-content,
  #modalAdd > div,
  #modalEdit > div,
  #modalKategori > div,
  #modalImageLightbox > div,
  .modal-overlay > div {
    width: 95% !important;
    max-width: 95% !important;
    margin: 10px auto !important;
    max-height: 90vh !important;
    border-radius: 16px !important;
  }

  #modalAdd,
  #modalEdit,
  #modalKategori,
  #modalImageLightbox,
  .modal-overlay {
    padding: 10px 8px !important;
  }

  #modalAdd form,
  #modalEdit form,
  #modalKategori form {
    padding: 14px 12px !important;
  }

  .modal-body {
    max-height: calc(90vh - 120px) !important;
    overflow-y: auto !important;
    padding: 16px 14px !important;
  }

  /* Responsive camera video and canvas elements */
  video,
  canvas,
  #video,
  #canvas,
  #webcam-video,
  #captured-preview {
    max-width: 100% !important;
    height: auto !important;
  }
}

/* ==================== Extra Small Devices (Handphone <= 480px) ==================== */
@media (max-width: 480px) {
  .page-header-title {
    max-width: 135px;
  }

  .page-header-title h1 {
    font-size: 14px !important;
  }

  /* Hide date badge on narrow smartphones to preserve header spacing */
  .date-badge {
    display: none !important;
  }

  .nav-btn-compact {
    padding: 6px 10px !important;
    font-size: 11px !important;
  }

  .nav-btn-compact .nav-btn-text {
    display: none;
  }

  /* Stat cards: icon top, clear large text, prevent awkward line wrapping */
  .grid-stats {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }

  .stat-card {
    flex-direction: column !important;
    align-items: flex-start !important;
    padding: 12px 10px !important;
    gap: 6px !important;
  }

  .stat-icon {
    width: 36px !important;
    height: 36px !important;
    font-size: 16px !important;
  }

  .stat-details h3 {
    font-size: 15px !important;
  }

  .stat-details p {
    font-size: 10.5px !important;
    line-height: 1.2 !important;
  }

  /* Action buttons in module banners: 2-column grid */
  .card > div[style*="justify-content: space-between"] > div[style*="display: flex; gap: 10px"],
  .card > div[style*="justify-content: space-between"] > div[style*="display: flex; gap: 8px"],
  div[style*="margin-bottom: 20px; display: flex; gap: 10px"],
  div[style*="margin-bottom: 24px; display: flex; gap: 10px"] {
    grid-template-columns: 1fr 1fr !important;
  }
}

/* ==================== Print / PDF Printable Stylesheet ==================== */
@media print {
  .sidebar, .top-navbar, .btn, .filter-bar, .no-print {
    display: none !important;
  }
  
  .main-content {
    margin-left: 0 !important;
    padding: 0 !important;
  }
  
  .content-body {
    padding: 0 !important;
  }
  
  body {
    background: #ffffff !important;
    color: #000000 !important;
    font-size: 12pt;
  }
  
  .card {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
  }
  
  .print-header {
    display: block !important;
    text-align: center;
    border-bottom: 3px double #000;
    padding-bottom: 12px;
    margin-bottom: 20px;
  }

  .print-header h2 { font-size: 18pt; font-weight: bold; text-transform: uppercase; }
  .print-header h3 { font-size: 14pt; font-weight: bold; }
  .print-header p { font-size: 10pt; color: #333; }

  .table {
    width: 100% !important;
    border-collapse: collapse !important;
  }

  .table th, .table td {
    border: 1px solid #000 !important;
    padding: 6px 8px !important;
    font-size: 10pt !important;
  }

  .table th { background: #f0f0f0 !important; }

  .print-footer-signatures {
    display: flex !important;
    justify-content: space-between;
    margin-top: 40px;
    page-break-inside: avoid;
  }

  .signature-box {
    text-align: center;
    width: 220px;
  }

  .signature-space {
    height: 70px;
  }
}

.print-header, .print-footer-signatures {
  display: none;
}

/* Permanently Hide Mobile Bottom Navigation Dock */
.mobile-bottom-nav {
  display: none !important;
}
