@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Poppins:wght@400;500;600;700;800&display=swap');

:root {
  color-scheme: light;
  --primary: #0f766e;
  --primary-dark: #0b5e58;
  --primary-light: #14b8a6;
  --primary-soft: #e6f6f3;
  --primary-surface: rgba(15, 118, 110, 0.08);
  --secondary: #ffffff;
  --content-bg: #f3f6fb;
  --surface: rgba(255, 255, 255, 0.94);
  --surface-solid: #ffffff;
  --surface-soft: #f7fafc;
  --surface-muted: #eef3f8;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #7c8aa0;
  --border-color: #d9e2ec;
  --border-strong: #c7d2de;
  --shadow-xs: 0 4px 10px rgba(15, 23, 42, 0.05);
  --shadow-sm: 0 10px 30px rgba(15, 23, 42, 0.08);
  --shadow-md: 0 18px 45px rgba(15, 23, 42, 0.12);
  --shadow-lg: 0 28px 60px rgba(15, 23, 42, 0.16);
  --shadow: var(--shadow-sm);
  --radius-xs: 10px;
  --radius-sm: 12px;
  --radius: 16px;
  --radius-lg: 24px;
  --sidebar-w: 276px;
  --topbar-h: 78px;
  --font-main: 'Inter', 'Poppins', 'Segoe UI', Roboto, Arial, sans-serif;
  --success: #1f9d68;
  --success-soft: #e8f8f0;
  --warning: #f0a202;
  --warning-soft: #fff4db;
  --danger: #d64550;
  --danger-soft: #fdecee;
  --info: #2f80ed;
  --info-soft: #eaf2fe;
  --bs-body-bg: var(--content-bg);
  --bs-body-color: var(--text-primary);
  --bs-body-font-family: var(--font-main);
  --bs-primary: var(--primary);
  --bs-primary-rgb: 15, 118, 110;
  --bs-border-radius: var(--radius-sm);
  --bs-border-color: var(--border-color);
  --bs-secondary-color: var(--text-secondary);
  --bs-heading-color: var(--text-primary);
  /* Modern spacing system */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  --spacing-2xl: 2.5rem;
  /* Enhanced transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
  --transition-slow: 0.35s ease;
  /* Glass morphism effects */
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(255, 255, 255, 0.3);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  --skeleton-bg: #e2e8f0;
}

/* 10x Responsive Page Load Animation */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-content {
  animation: fadeIn var(--transition-slow);
}

/* Premium Skeleton Loading Animation */
@keyframes skeletonLoading {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.skeleton {
  background: linear-gradient(90deg, #f0f2f5 25%, #e2e8f0 50%, #f0f2f5 75%);
  background-size: 200% 100%;
  animation: skeletonLoading 1.5s infinite linear;
  border-radius: var(--radius-sm);
  display: inline-block;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-main);
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--text-primary);
  background:
    radial-gradient(circle at top right, rgba(15, 118, 110, 0.12), transparent 22%),
    radial-gradient(circle at left top, rgba(59, 130, 246, 0.06), transparent 26%),
    linear-gradient(180deg, #f8fbff 0%, #f3f6fb 100%);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection {
  background: rgba(15, 118, 110, 0.18);
  color: var(--text-primary);
}

img {
  max-width: 100%;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: rgba(148, 163, 184, 0.12);
}

::-webkit-scrollbar-thumb {
  background: rgba(71, 85, 105, 0.32);
  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(15, 118, 110, 0.42);
}

h1, h2, h3, h4, h5, h6 {
  letter-spacing: -0.02em;
}

:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 0.22rem rgba(15, 118, 110, 0.18);
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.25s ease, opacity 0.25s ease;
}

a:hover {
  color: var(--primary-dark);
}

.fw-500 { font-weight: 500 !important; }
.fw-600 { font-weight: 600 !important; }
.fw-700 { font-weight: 700 !important; }
.fw-800 { font-weight: 800 !important; }

.text-label {
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.text-meta {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.text-primary-custom {
  color: var(--primary) !important;
}

.bg-primary-bg-subtle,
.bg-primary-subtle-custom {
  background: var(--primary-soft) !important;
}

.app-wrapper {
  display: flex;
  min-height: 100vh;
}

.glass-panel {
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.42);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(20px);
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.09), transparent 26%),
    linear-gradient(180deg, #0f766e 0%, #0a5d57 100%);
  color: #ffffff;
  box-shadow: var(--shadow-lg);
  z-index: 1040;
  overflow-y: auto;
  transition: transform 0.28s ease;
}

.sidebar.collapsed {
  transform: translateX(-100%);
}

.sidebar-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: transparent;
  border: 0;
  color: #ffffff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  z-index: 10;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  transition: background 0.2s ease;
}

.sidebar-close:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: rotate(90deg);
}

/* Sidebar Interaction Optimization */
.sidebar-link {
  position: relative;
  overflow: hidden;
}

.sidebar-link::after {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  height: 0%;
  width: 3px;
  background: #ffffff;
  transform: translateY(-50%);
  transition: height var(--transition-normal);
  border-radius: 0 4px 4px 0;
}

.sidebar-link:hover::after {
  height: 40%;
}

.sidebar-link.active::after {
  height: 60%;
  background: var(--primary);
}

@media (min-width: 992px) {
  .sidebar-close {
    display: none;
  }
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 1.55rem 1.3rem 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.sidebar-brand-icon {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: transparent;
}

.sidebar-brand-icon img {
  width: 42px;
  height: 42px;
  object-fit: contain;
  mix-blend-mode: multiply;
  filter: brightness(1.05);
}

.sidebar-brand-name {
  font-size: 1.02rem;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.2;
}

.sidebar-brand-sub {
  font-size: 0.74rem;
  color: rgba(255, 255, 255, 0.8);
}

.sidebar-nav {
  flex: 1;
  padding: 1.1rem 0.9rem;
}

.sidebar-section-label {
  padding: 1rem 0.65rem 0.4rem;
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.sidebar-section-label:first-child {
  padding-top: 0.3rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.88rem 0.95rem;
  margin-bottom: 0.35rem;
  border-radius: 14px;
  color: rgba(255, 255, 255, 0.92);
  font-weight: 500;
  transition: background 0.25s ease, transform 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
}

.sidebar-link i {
  width: 18px;
  text-align: center;
  font-size: 1rem;
}

.sidebar-link:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.13);
  transform: translateX(4px);
}

.sidebar-link.active {
  color: var(--primary);
  background: #ffffff;
  box-shadow: 0 14px 28px rgba(6, 36, 34, 0.16);
}

.sidebar-footer {
  padding: 1rem 1.25rem 1.2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.sidebar-user-avatar,
.topbar-avatar,
.avatar {
  border-radius: 50%;
  overflow: hidden;
  background: var(--primary-soft);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
}

.sidebar-user-avatar {
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}

.sidebar-user-avatar img,
.topbar-avatar img,
.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sidebar-user-name {
  color: #ffffff;
  font-size: 0.9rem;
  font-weight: 600;
}

.sidebar-user-role {
  color: rgba(255, 255, 255, 0.76);
  font-size: 0.75rem;
}

.main-wrapper {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  transition: margin-left 0.28s ease, max-width 0.28s ease;
  max-width: calc(100% - var(--sidebar-w));
  width: calc(100% - var(--sidebar-w));
  margin-right: auto;
}

.main-wrapper.sidebar-collapsed {
  margin-left: 0;
  max-width: 100%;
  width: 100%;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 1030;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 1.5rem;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(217, 226, 236, 0.9);
  transition: padding 0.28s ease, height 0.28s ease, gap 0.28s ease;
}

.topbar-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  color: var(--primary);
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  transition: background 0.25s ease;
  cursor: pointer;
}

.topbar-toggle .hamburger {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 22px;
}

.topbar-toggle .hamburger span {
  display: block;
  width: 100%;
  height: 2.5px;
  background: var(--primary);
  border-radius: 2px;
  transition: all 0.3s ease;
}

.topbar-toggle:hover .hamburger span:first-child {
  transform: translateY(7px) rotate(45deg);
}

.topbar-toggle:hover .hamburger span:nth-child(2) {
  opacity: 0;
}

.topbar-toggle:hover .hamburger span:last-child {
  transform: translateY(-7px) rotate(-45deg);
}

.topbar-toggle:hover {
  background: var(--primary-soft);
}



.topbar-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.03em;
}

.topbar-date {
  color: var(--text-secondary);
  font-size: 0.8rem;
}

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.btn-topbar-icon,
#darkModeToggle {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  border: 1px solid rgba(217, 226, 236, 0.92);
  background: rgba(255, 255, 255, 0.9);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-xs);
  transition: all 0.25s ease;
}

.btn-topbar-icon:hover,
#darkModeToggle:hover {
  border-color: rgba(15, 118, 110, 0.2);
  background: var(--primary-soft);
  color: var(--primary);
  transform: translateY(-1px);
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.42rem 0.65rem;
  border-radius: 999px;
  border: 1px solid transparent;
  transition: all 0.25s ease;
  color: inherit;
}

.topbar-user:hover {
  border-color: rgba(15, 118, 110, 0.14);
  background: var(--primary-soft);
}

.topbar-avatar {
  width: 40px;
  height: 40px;
  box-shadow: inset 0 0 0 1px rgba(29, 120, 120, 0.12);
}

.topbar-user-name {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-primary);
}

.topbar-user-role {
  font-size: 0.72rem;
  color: var(--text-muted);
}

  .page-content {
  flex: 1;
  padding: 1.8rem;
  /* Ensure content doesn't overlap with fixed elements */
  width: 100%;
  box-sizing: border-box;
}

 @media (max-width: 767.98px) {
   .page-content {
     padding: 1rem;
     padding-bottom: calc(70px + 1rem + env(safe-area-inset-bottom));
   }

   .topbar-title {
     font-size: 1rem;
     min-width: 0;
   }

   .topbar-right {
     gap: 0.5rem;
   }
 }

 @media (max-width: 575.98px) {
   .page-content {
     padding: 0.85rem;
     padding-bottom: calc(70px + 0.85rem + env(safe-area-inset-bottom));
   }

  .topbar-title {
    font-size: 0.96rem;
  }
}

/* Guru mode specific padding overrides */
  @media (min-width: 768px) {
    .guru-mode .page-content {
      max-width: 100%;
      padding-bottom: calc(75px + 2.5rem + env(safe-area-inset-bottom));
      /* Enhanced desktop layout with better spacing */
      padding-top: 2.5rem;
      padding-left: 1.5rem;
      padding-right: 1.5rem;
    }
  }
  
  /* Additional desktop enhancements for guru mode */
  @media (min-width: 992px) {
    .guru-mode .page-content {
      max-width: 100%;
      padding-left: 2.5rem;
      padding-right: 2.5rem;
    }
    
    .guru-mode .portal-hero,
    .guru-mode .card {
      margin-left: 0;
      margin-right: 0;
    }
  }

.app-footer {
  padding: 1rem 1.8rem 1.4rem;
  border-top: 1px solid rgba(217, 226, 236, 0.8);
  background: rgba(255, 255, 255, 0.64);
  backdrop-filter: blur(14px);
  color: var(--text-secondary);
  font-size: 0.82rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.app-footer-meta {
  color: var(--text-muted);
}

.page-header {
  margin-bottom: 1.75rem;
}

.page-header h1 {
  margin: 0 0 0.3rem;
  font-size: clamp(1.4rem, 2vw, 1.8rem);
  font-weight: 700;
  color: var(--text-primary);
}

.page-header p {
  margin: 0;
  color: var(--text-secondary);
}

.card {
  border: 1px solid rgba(217, 226, 236, 0.86);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  overflow: hidden;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: rgba(15, 118, 110, 0.18);
}

.card-header {
  padding: 1.05rem 1.25rem;
  border-bottom: 1px solid rgba(217, 226, 236, 0.82);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(247, 250, 252, 0.96) 100%);
  color: var(--text-primary);
  font-weight: 600;
}

.card-body {
  padding: 1.25rem;
}

.card-footer {
  padding: 1rem 1.25rem;
  background: transparent;
  border-top: 1px solid rgba(217, 226, 236, 0.8);
}

.stat-card {
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: '';
  position: absolute;
  right: -26px;
  top: -26px;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  background: rgba(29, 120, 120, 0.08);
}

.stat-card .stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--primary-soft);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.stat-card .stat-value {
  font-size: 1.8rem;
  line-height: 1;
  font-weight: 700;
}

.stat-card .stat-label {
  margin-top: 0.45rem;
  color: var(--text-secondary);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

.table-responsive {
  border-radius: 0 0 var(--radius) var(--radius);
  overflow-x: auto;
}

.table {
  margin-bottom: 0;
  color: var(--text-primary);
  vertical-align: middle;
}

.table thead th {
  background: #f6f9fc;
  color: var(--text-secondary);
  font-size: 0.74rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.95rem 1rem;
  border-bottom: 1px solid rgba(217, 226, 236, 0.96);
}

.table tbody td {
  padding: 0.95rem 1rem;
  border-bottom: 1px solid rgba(217, 226, 236, 0.72);
}

.table tbody tr:nth-child(even) {
  background: rgba(248, 250, 252, 0.78);
}

.table tbody tr:hover {
  background: rgba(230, 246, 243, 0.82);
}

/* High Responsive Table Stacking for Mobile */
@media (max-width: 991.98px) {
  .table-responsive {
    border: 0;
  }
  
  .table thead {
    display: none; /* Sembunyikan header tabel di mobile */
  }
  
  .table, .table tbody, .table tr, .table td {
    display: block;
    width: 100%;
  }
  
  .table tr {
    margin-bottom: 1rem;
    background: var(--surface-solid) !important;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 0.5rem;
    box-shadow: var(--shadow-xs);
  }
  
  .table td {
    text-align: right;
    padding: 0.6rem 0.8rem;
    border-bottom: 1px solid var(--surface-muted);
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  
  .table td::before {
    content: attr(data-label);
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-right: 1rem;
  }
  
  .table td:last-child {
    border-bottom: 0;
  }
  
  .table .avatar {
    margin-left: auto;
  }
}

.table-sortable.sortable,
th.sortable {
  cursor: pointer;
}

.badge {
  border-radius: 999px;
  font-weight: 700;
  padding: 0.48rem 0.74rem;
  letter-spacing: 0.01em;
}

.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border-radius: 999px;
}

.bg-success-subtle { background: var(--success-soft) !important; }
.text-success { color: var(--success) !important; }
.bg-warning-subtle { background: var(--warning-soft) !important; }
.text-warning { color: var(--warning) !important; }
.bg-danger-subtle { background: var(--danger-soft) !important; }
.text-danger { color: var(--danger) !important; }
.bg-info-subtle { background: var(--info-soft) !important; }
.text-info { color: var(--info) !important; }

.btn {
  border-radius: var(--radius-sm);
  font-weight: 600;
  transition: all 0.25s ease;
  box-shadow: none;
}

.btn i {
  margin-right: 0.35rem;
}

.btn-primary {
  --bs-btn-bg: var(--primary);
  --bs-btn-border-color: var(--primary);
  --bs-btn-hover-bg: var(--primary-dark);
  --bs-btn-hover-border-color: var(--primary-dark);
  --bs-btn-active-bg: var(--primary-dark);
  --bs-btn-active-border-color: var(--primary-dark);
  box-shadow: 0 12px 26px rgba(15, 118, 110, 0.16);
}

.btn-primary:hover,
.btn-outline-primary:hover,
.btn-outline-secondary:hover,
.btn-outline-danger:hover,
.btn-outline-warning:hover,
.btn-outline-info:hover,
.btn-success:hover,
.btn-info:hover {
  transform: translateY(-1px);
}

.btn-outline-primary {
  --bs-btn-color: var(--primary);
  --bs-btn-border-color: rgba(15, 118, 110, 0.28);
  --bs-btn-hover-bg: var(--primary);
  --bs-btn-hover-border-color: var(--primary);
}

.btn-outline-secondary {
  --bs-btn-color: var(--text-secondary);
  --bs-btn-border-color: var(--border-color);
  --bs-btn-hover-bg: #eef3f7;
  --bs-btn-hover-border-color: #d7e0e8;
  --bs-btn-hover-color: var(--text-primary);
}

.btn-outline-danger,
.btn-outline-warning,
.btn-outline-info {
  background: var(--surface-solid);
}

.form-control,
.form-select,
.input-group-text,
.form-range {
  border-radius: var(--radius-sm);
}

.form-control,
.form-select {
  min-height: 46px;
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.94);
  color: var(--text-primary);
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.02);
  transition: border-color 0.25s ease, box-shadow 0.25s ease, background 0.25s ease, transform 0.25s ease;
}

.form-control:focus,
.form-select:focus {
  border-color: rgba(15, 118, 110, 0.42);
  background: #ffffff;
  box-shadow: 0 0 0 0.24rem rgba(15, 118, 110, 0.12);
}

.form-control::placeholder,
textarea::placeholder {
  color: #94a3b8;
}

.form-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.input-group-text {
  background: var(--surface-soft);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.dropdown-menu {
  border: 1px solid rgba(217, 226, 236, 0.9);
  border-radius: 16px;
  box-shadow: var(--shadow-md);
  padding: 0.45rem;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(18px);
}

.dropdown-item {
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  transition: background 0.25s ease, color 0.25s ease;
}

.dropdown-item:hover {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.alert {
  border: 1px solid transparent;
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
}

.alert-dismissible .btn-close {
  padding: 1rem;
}

.avatar {
  width: 38px;
  height: 38px;
  font-size: 0.82rem;
}

.avatar-lg {
  width: 56px;
  height: 56px;
  font-size: 1rem;
}

.avatar-xl {
  width: 84px;
  height: 84px;
  font-size: 1.2rem;
}

.distance-meter,
.upload-zone {
  background: var(--surface);
  border: 1px solid rgba(217, 226, 236, 0.86);
  border-radius: var(--radius);
}

.distance-meter {
  padding: 1rem 1.2rem;
}

.distance-value {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.1;
}

.radius-bar {
  height: 10px;
  border-radius: 999px;
  background: #e6edf5;
  overflow: hidden;
}

.radius-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.25s ease;
}

.gps-status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}

.gps-status.loading {
  color: var(--text-secondary);
  background: #eef3f7;
}

.gps-status.in-range {
  color: var(--success);
  background: var(--success-soft);
}

.gps-status.out-range {
  color: var(--danger);
  background: var(--danger-soft);
}

#presensiMap,
#sekolahMap,
#guruMap {
  width: 100%;
  min-height: 380px;
  border-radius: var(--radius);
  border: 1px solid rgba(217, 226, 236, 0.86);
}

.lokasi-guru-trigger {
  color: var(--text-primary);
  text-decoration: none;
  font: inherit;
}

.lokasi-guru-trigger:hover {
  color: var(--primary);
}

.upload-zone {
  padding: 1rem;
  cursor: pointer;
  transition: border-color 0.25s ease, background 0.25s ease, transform 0.25s ease;
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: rgba(15, 118, 110, 0.45);
  background: #f1fbf9;
  transform: translateY(-1px);
}

.progress {
  border-radius: 999px;
  background: #eaf0f6;
}

.progress-bar {
  border-radius: 999px;
}

.modal-content {
  border: 1px solid rgba(217, 226, 236, 0.9);
  border-radius: 20px;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.modal-header,
.modal-footer {
  border-color: rgba(217, 226, 236, 0.85);
}

.portal-hero {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  padding: 1.8rem;
  color: #ffffff;
  background:
    radial-gradient(circle at top right, rgba(255, 255, 255, 0.18), transparent 22%),
    linear-gradient(135deg, #0f766e 0%, #11998e 100%);
  box-shadow: 0 22px 48px rgba(15, 118, 110, 0.22);
}

.portal-hero::before,
.portal-hero::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
}

.portal-hero::before {
  width: 220px;
  height: 220px;
  top: -80px;
  right: -70px;
}

.portal-hero::after {
  width: 140px;
  height: 140px;
  bottom: -60px;
  right: 80px;
}

.portal-hero-content {
  position: relative;
  z-index: 1;
}

.portal-hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.38rem 0.72rem;
  margin-bottom: 0.9rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.portal-hero h1,
.portal-hero h2,
.portal-hero h3 {
  color: #ffffff;
  margin-bottom: 0.55rem;
}

.portal-hero p {
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 0;
}

.portal-hero-metrics {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
  gap: 0.85rem;
  margin-top: 1.2rem;
}

.portal-metric {
  padding: 0.9rem 1rem;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.portal-metric-label {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.76);
}

.portal-metric-value {
  margin-top: 0.2rem;
  font-size: 1.5rem;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.1;
}

.portal-panel {
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid rgba(217, 226, 236, 0.86);
  box-shadow: var(--shadow-sm);
}

.portal-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.portal-panel-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.portal-panel-subtitle {
  color: var(--text-secondary);
  font-size: 0.82rem;
}

.quick-action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.9rem;
}

.dashboard-icon-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

@media (max-width: 991px) {
  .dashboard-icon-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
  }
}

@media (max-width: 767px) {
  .dashboard-icon-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }
  .dashboard-icon-card {
    padding: 1rem 0.5rem;
    border-radius: 12px;
  }
  .dashboard-icon-card .icon-wrap {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
  }
  .dashboard-icon-card strong {
    font-size: 0.8rem;
  }
  .dashboard-icon-card small {
    font-size: 0.65rem;
    line-height: 1.3;
    display: block;
  }
}

.dashboard-icon-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 1.25rem 1rem;
  border-radius: 16px;
  border: 1px solid rgba(217, 226, 236, 0.86);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(247, 250, 252, 0.98) 100%);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  text-decoration: none;
  color: inherit;
}

.dashboard-icon-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
  border-color: rgba(15, 118, 110, 0.24);
}

.dashboard-icon-card .icon-wrap {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  margin-bottom: 0.75rem;
}

.dashboard-icon-card strong {
  display: block;
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.dashboard-icon-card small {
  display: block;
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.bg-primary-soft {
  background: rgba(13, 110, 253, 0.12);
}

.bg-secondary-soft {
  background: rgba(108, 117, 125, 0.12);
}

.bg-info-soft {
  background: rgba(13, 202, 240, 0.12);
}

.bg-success-soft {
  background: rgba(25, 135, 84, 0.12);
}

.quick-action-card {
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
  padding: 1rem;
  border-radius: 18px;
  border: 1px solid rgba(217, 226, 236, 0.86);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(247, 250, 252, 0.98) 100%);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.quick-action-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
  border-color: rgba(15, 118, 110, 0.24);
}

.quick-action-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(180deg, #eefbf8 0%, #e6f6f3 100%);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(15, 118, 110, 0.08);
}

.quick-action-title {
  color: var(--text-primary);
  font-size: 0.92rem;
  font-weight: 600;
  margin-bottom: 0.15rem;
}

.quick-action-text {
  color: var(--text-secondary);
  font-size: 0.78rem;
}

.stat-card-modern .card-body {
  padding: 1.15rem;
}

.stat-card-modern .stat-icon {
  box-shadow: inset 0 0 0 1px rgba(29, 120, 120, 0.1);
}

.list-clean {
  list-style: none;
  margin: 0;
  padding: 0;
}

.list-clean li + li {
  border-top: 1px solid rgba(223, 231, 238, 0.75);
}

.list-row {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.95rem 0;
}

.section-stack > * + * {
  margin-top: 1.25rem;
}

.page-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.page-toolbar-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.filter-card .card-body {
  padding: 1rem 1.1rem;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.9rem;
}

.summary-item {
  padding: 1rem;
  border-radius: 18px;
  border: 1px solid rgba(217, 226, 236, 0.86);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(251, 253, 253, 0.98) 100%);
  box-shadow: var(--shadow-xs);
}

.summary-item-label {
  color: var(--text-secondary);
  font-size: 0.8rem;
  margin-bottom: 0.35rem;
}

.summary-item-value {
  font-size: 1.45rem;
  line-height: 1.1;
  font-weight: 700;
  color: var(--text-primary);
}

.content-shell {
  border-radius: var(--radius);
  border: 1px solid rgba(217, 226, 236, 0.86);
  background: rgba(255, 255, 255, 0.97);
  box-shadow: var(--shadow-sm);
}

.profile-shell {
  display: grid;
  grid-template-columns: minmax(240px, 280px) 1fr;
  gap: 1.25rem;
}

.profile-summary {
  padding: 1.3rem;
  border-radius: 20px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbfb 100%);
  border: 1px solid rgba(217, 226, 236, 0.86);
}

.profile-summary .avatar-xl {
  box-shadow: 0 12px 24px rgba(29, 120, 120, 0.14);
}

.profile-summary-meta {
  display: grid;
  gap: 0.8rem;
  margin-top: 1.2rem;
}

.profile-meta-item {
  padding: 0.85rem 0.95rem;
  border-radius: 14px;
  background: #f8fbfc;
}

.auth-shell,
.utility-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1rem, 3vw, 2.5rem);
  position: relative;
  overflow: hidden;
}

.auth-shell::before,
.auth-shell::after,
.utility-shell::before,
.utility-shell::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

.auth-shell::before,
.utility-shell::before {
  width: 360px;
  height: 360px;
  top: -120px;
  right: -120px;
  background: rgba(20, 184, 166, 0.18);
}

.auth-shell::after,
.utility-shell::after {
  width: 260px;
  height: 260px;
  left: -90px;
  bottom: -120px;
  background: rgba(59, 130, 246, 0.12);
}

.auth-shell {
  background:
    radial-gradient(circle at top right, rgba(20, 184, 166, 0.18), transparent 24%),
    radial-gradient(circle at left bottom, rgba(59, 130, 246, 0.14), transparent 28%),
    linear-gradient(135deg, #0f172a 0%, #0f766e 55%, #14b8a6 100%);
  width: min(100%, 900px);
  max-width: 900px;
}

.auth-frame {
  width: min(100%, 400px);
  max-width: 400px;
  margin-inline: auto;
  position: relative;
  z-index: 1;
}

.auth-split {
  max-width: 900px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: start;
}

.auth-main {
  width: 100%;
}

.guide-card {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  border-radius: 24px;
  padding: 1.5rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

.guide-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid rgba(13, 148, 136, 0.15);
}

.guide-section {
  margin-bottom: 1rem;
}

.guide-section h6 {
  font-size: 0.82rem;
  font-weight: 600;
  color: #334155;
  margin-bottom: 0.5rem;
}

.guide-list {
  font-size: 0.8rem;
  color: #475569;
  padding-left: 1rem;
  margin-bottom: 0;
  line-height: 1.6;
}

.guide-list li {
  margin-bottom: 0.35rem;
}

.guide-help {
  padding-top: 0.75rem;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

@media (max-width: 768px) {
  .auth-split {
    grid-template-columns: 1fr;
  }
  
  .auth-sidebar {
    order: -1;
  }
}

.utility-shell {
  background:
    radial-gradient(circle at top right, rgba(220, 38, 38, 0.14), transparent 24%),
    radial-gradient(circle at left bottom, rgba(245, 158, 11, 0.12), transparent 28%),
    linear-gradient(135deg, #fff7ed 0%, #fef2f2 48%, #fee2e2 100%);
}

.auth-card,
.utility-card {
  position: relative;
  z-index: 1;
  border: 0;
  border-radius: 28px;
  overflow: hidden;
}

.auth-card {
  width: 100%;
  max-width: none;
  margin-inline: 0;
}

.utility-card {
  width: min(100%, 1100px);
  max-width: 1100px;
}

.auth-card .card-body,
.utility-card .card-body {
  padding: clamp(1.4rem, 3vw, 2.5rem);
}

.brand-lockup {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.85rem;
  margin-bottom: clamp(1.25rem, 2.5vw, 1.9rem);
}

.brand-lockup img {
  width: clamp(58px, 9vw, 78px);
  height: clamp(58px, 9vw, 78px);
  object-fit: contain;
}

.brand-lockup h1,
.brand-lockup h2,
.brand-lockup h3 {
  margin: 0;
}

.brand-lockup p {
  margin: 0;
  color: var(--text-secondary);
}

.auth-card .text-label {
  font-size: 0.72rem;
}

.auth-card h1,
.auth-card .h3 {
  font-size: clamp(1.35rem, 2.5vw, 1.8rem);
}

.auth-card .brand-lockup p {
  font-size: clamp(0.9rem, 1.8vw, 0.98rem);
  max-width: 28rem;
}

.auth-form {
  display: grid;
  gap: 0.2rem;
}

.auth-form .mb-3,
.auth-form .mb-4 {
  margin-bottom: 1rem !important;
}

.auth-form .btn[type='submit'] {
  min-height: 48px;
  margin-top: 0.35rem;
}

.auth-form .input-group .btn {
  min-width: 52px;
}

.auth-form .input-group .btn {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

.auth-form .form-control {
  padding-left: 0.95rem;
  padding-right: 0.95rem;
}

.utility-stack > * + * {
  margin-top: 1.25rem;
}

.tool-grid {
  display: grid;
  gap: 1.25rem;
}

.tool-grid.tool-grid-2 {
  grid-template-columns: 1.15fr 0.85fr;
}

.tool-section {
  padding: 1.35rem;
  border-radius: 20px;
  border: 1px solid rgba(217, 226, 236, 0.86);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(247, 250, 252, 0.98) 100%);
  box-shadow: var(--shadow-xs);
}

.tool-section-title {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  font-weight: 700;
}

.tool-section-subtitle {
  margin: 0 0 1rem;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.table-clean {
  width: 100%;
  border-collapse: collapse;
}

.table-clean th,
.table-clean td {
  padding: 0.85rem 0.9rem;
  border-bottom: 1px solid rgba(217, 226, 236, 0.78);
  text-align: left;
  font-size: 0.85rem;
}

.table-clean th {
  font-size: 0.73rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-secondary);
  background: rgba(248, 250, 252, 0.92);
}

.inline-code,
code {
  background: rgba(15, 118, 110, 0.08);
  color: var(--primary-dark);
  padding: 0.2rem 0.45rem;
  border-radius: 8px;
  font-size: 0.84em;
}

.warning-banner {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
  padding: 1rem 1.1rem;
  border-radius: 18px;
  background: linear-gradient(180deg, #fff7db 0%, #fff1bf 100%);
  border: 1px solid rgba(240, 162, 2, 0.28);
  color: #7c5300;
}

.warning-banner i {
  font-size: 1.1rem;
  line-height: 1.2;
}

.error-state {
  max-width: 560px;
  text-align: center;
}

.error-code {
  font-size: clamp(4.5rem, 12vw, 7rem);
  line-height: 1;
  font-weight: 800;
  letter-spacing: -0.05em;
  background: linear-gradient(135deg, #dc2626 0%, #f97316 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.error-actions {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.profile-form-card {
  padding: 1.3rem;
}

.form-section-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

.skeleton {
  background: linear-gradient(90deg, #edf2f6 25%, #f8fbfd 50%, #edf2f6 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.3s infinite linear;
  border-radius: var(--radius-sm);
}

@keyframes skeleton-loading {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 40, 0.42);
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s ease;
  z-index: 1035;
}

.sidebar-overlay.show {
  opacity: 1;
  visibility: visible;
}

[data-theme='dark'] {
  color-scheme: dark;
  --content-bg: #0b1120;
  --primary-light: #2dd4bf;
  --surface: rgba(15, 23, 42, 0.88);
  --surface-solid: #111827;
  --surface-soft: #182235;
  --surface-muted: #1f2937;
  --text-primary: #e5eefb;
  --text-secondary: #b5c3d9;
  --text-muted: #89a0bd;
  --border-color: #263448;
  --border-strong: #334155;
  --primary-soft: rgba(20, 184, 166, 0.16);
  --primary-surface: rgba(20, 184, 166, 0.12);
  --shadow-xs: 0 8px 18px rgba(2, 6, 23, 0.35);
  --shadow-sm: 0 16px 32px rgba(2, 6, 23, 0.36);
  --shadow-md: 0 24px 48px rgba(2, 6, 23, 0.42);
  --shadow-lg: 0 34px 68px rgba(2, 6, 23, 0.5);
}

[data-theme='dark'] body {
  background:
    radial-gradient(circle at top right, rgba(20, 184, 166, 0.18), transparent 24%),
    radial-gradient(circle at left top, rgba(59, 130, 246, 0.12), transparent 28%),
    linear-gradient(180deg, #09111f 0%, #0c1627 100%);
}

[data-theme='dark'] .topbar,
[data-theme='dark'] .app-footer,
[data-theme='dark'] .card,
[data-theme='dark'] .form-control,
[data-theme='dark'] .form-select,
[data-theme='dark'] .input-group-text,
[data-theme='dark'] .modal-content,
[data-theme='dark'] .upload-zone,
[data-theme='dark'] .distance-meter {
  background: rgba(15, 23, 42, 0.9);
  color: var(--text-primary);
}

[data-theme='dark'] .topbar,
[data-theme='dark'] .app-footer,
[data-theme='dark'] .card,
[data-theme='dark'] .portal-panel,
[data-theme='dark'] .summary-item,
[data-theme='dark'] .quick-action-card,
[data-theme='dark'] .content-shell,
[data-theme='dark'] .profile-summary,
[data-theme='dark'] .profile-meta-item,
[data-theme='dark'] .dropdown-menu,
[data-theme='dark'] .modal-content {
  border-color: rgba(38, 52, 72, 0.96);
}

[data-theme='dark'] .card-header,
[data-theme='dark'] .table thead th,
[data-theme='dark'] .input-group-text,
[data-theme='dark'] .profile-meta-item {
  background: rgba(24, 34, 53, 0.92);
}

[data-theme='dark'] .table thead th {
  color: var(--text-secondary);
}

[data-theme='dark'] .table tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.025);
}

[data-theme='dark'] .table tbody tr:hover {
  background: rgba(20, 184, 166, 0.14);
}

[data-theme='dark'] .btn-topbar-icon,
[data-theme='dark'] #darkModeToggle,
[data-theme='dark'] .btn-outline-secondary,
[data-theme='dark'] .btn-outline-primary,
[data-theme='dark'] .btn-outline-danger,
[data-theme='dark'] .btn-outline-warning,
[data-theme='dark'] .btn-outline-info {
  background: rgba(15, 23, 42, 0.88);
  border-color: rgba(51, 65, 85, 0.94);
  color: var(--text-secondary);
}

[data-theme='dark'] .btn-topbar-icon:hover,
[data-theme='dark'] #darkModeToggle:hover,
[data-theme='dark'] .topbar-user:hover,
[data-theme='dark'] .dropdown-item:hover {
  background: rgba(20, 184, 166, 0.12);
  color: #dffcf7;
}

[data-theme='dark'] .form-control,
[data-theme='dark'] .form-select {
  background: rgba(15, 23, 42, 0.76);
}

[data-theme='dark'] .form-control::placeholder,
[data-theme='dark'] textarea::placeholder {
  color: #7f93ac;
}

[data-theme='dark'] .table tbody td,
[data-theme='dark'] .card-header,
[data-theme='dark'] .card-footer,
[data-theme='dark'] .modal-header,
[data-theme='dark'] .modal-footer {
  border-color: rgba(38, 52, 72, 0.86);
}

[data-theme='dark'] .quick-action-card,
[data-theme='dark'] .summary-item,
[data-theme='dark'] .profile-summary {
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.95) 0%, rgba(17, 24, 39, 0.95) 100%);
}

[data-theme='dark'] .tool-section,
[data-theme='dark'] .table-clean th {
  background: rgba(15, 23, 42, 0.9);
}

[data-theme='dark'] .table-clean th,
[data-theme='dark'] .table-clean td {
  border-color: rgba(38, 52, 72, 0.86);
}

[data-theme='dark'] .inline-code,
[data-theme='dark'] code {
  background: rgba(45, 212, 191, 0.12);
  color: #b5fff4;
}

[data-theme='dark'] .warning-banner {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.26);
  color: #fde68a;
}

[data-theme='dark'] .sidebar-link.active {
  background: rgba(226, 232, 240, 0.98);
}

[data-theme='dark'] .portal-hero {
  box-shadow: 0 24px 50px rgba(2, 6, 23, 0.42);
}

@media (max-width: 991.98px) {
  .sidebar {
    transform: translateX(-100%);
    width: min(86vw, 320px);
  }

  .main-wrapper {
    margin-left: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
  }

  .topbar {
    padding: 0 1rem;
    gap: 0.75rem;
  }

  .topbar-date {
    display: none;
  }

  .page-content {
    padding: 1rem;
  }

  .page-toolbar,
  .portal-panel-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .page-toolbar-actions {
    width: 100%;
  }

  .page-toolbar-actions .btn,
  .page-toolbar .btn {
    width: 100%;
  }

  .summary-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .app-footer {
    padding: 1rem;
    flex-direction: column;
  }
}

@media (max-width: 767.98px) {
  body {
    font-size: 0.92rem;
  }

  .sidebar-brand {
    padding: 1.2rem 1rem 1rem;
  }

  .sidebar-nav {
    padding: 0.9rem 0.75rem;
  }

  .sidebar-link {
    padding: 0.82rem 0.85rem;
    gap: 0.75rem;
  }

  .topbar {
    padding: 0 0.85rem;
  }

  .topbar-title {
    font-size: 1rem;
    min-width: 0;
  }

  .topbar-user div:last-child {
    display: none;
  }

  .topbar-right {
    gap: 0.5rem;
  }

  .btn-topbar-icon,
  #darkModeToggle,
  .topbar-avatar {
    width: 38px;
    height: 38px;
  }

  .page-header {
    margin-bottom: 1.2rem;
  }

  .page-header h1 {
    font-size: 1.25rem;
  }

  .page-header p {
    font-size: 0.88rem;
  }

  .page-toolbar {
    gap: 0.85rem;
  }

  .page-toolbar .btn,
  .page-toolbar-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .portal-hero {
    padding: 1.2rem;
  }

  .portal-hero-metrics,
  .quick-action-grid,
  .summary-strip {
    grid-template-columns: 1fr;
  }

  .portal-metric,
  .summary-item,
  .quick-action-card,
  .tool-section {
    border-radius: 16px;
  }

  .profile-shell {
    grid-template-columns: 1fr;
  }

  .card-header,
  .card-body,
  .card-footer {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .card-header {
    gap: 0.6rem;
    flex-wrap: wrap;
  }

  .filter-card .row > [class*='col-'],
  form.row > [class*='col-'] {
    width: 100%;
  }

  .filter-card .d-flex,
  .page-toolbar-actions {
    flex-direction: column;
  }

  .filter-card .btn,
  .filter-card .form-select,
  .filter-card .form-control {
    width: 100%;
  }

  .table-responsive {
    border-radius: 0 0 14px 14px;
  }

  .auth-card .card-body,
  .utility-card .card-body {
    padding: 1.35rem;
  }

  .auth-shell {
    align-items: stretch;
  }

  .auth-card {
    width: 100%;
    max-width: 100%;
    border-radius: 22px;
  }

  .auth-frame {
    width: 100%;
    max-width: 100%;
  }

  .auth-card .brand-lockup {
    gap: 0.7rem;
    margin-bottom: 1.25rem;
  }

  .auth-card .brand-lockup p {
    font-size: 0.9rem;
  }

  .tool-grid.tool-grid-2 {
    grid-template-columns: 1fr;
  }

  .table thead th,
  .table tbody td {
    padding: 0.78rem 0.72rem;
    white-space: nowrap;
    font-size: 0.82rem;
  }

  .badge {
    padding: 0.42rem 0.68rem;
  }

  .btn {
    min-height: 42px;
  }

  .modal-dialog {
    margin: 0.75rem;
  }

  .modal-body {
    padding: 1rem;
  }
}

@media (max-width: 575.98px) {
  .page-content {
    padding: 0.85rem;
  }

  .topbar {
    padding: 0 0.75rem;
  }

  .topbar-title {
    font-size: 0.96rem;
  }

  .page-header h1 {
    font-size: 1.15rem;
  }

  .portal-hero {
    border-radius: 18px;
    padding: 1rem;
  }

  .portal-hero-kicker {
    font-size: 0.7rem;
  }

  .quick-action-card {
    padding: 0.9rem;
  }

  .quick-action-title {
    font-size: 0.88rem;
  }

  .quick-action-text,
  .summary-item-label,
  .text-meta {
    font-size: 0.76rem;
  }

  .summary-item-value,
  .stat-card .stat-value,
  .distance-value {
    font-size: 1.3rem;
  }

  .auth-shell,
  .utility-shell {
    padding: 0.75rem;
  }

  .auth-card,
  .utility-card {
    border-radius: 18px;
  }

  .auth-card .card-body,
  .utility-card .card-body {
    padding: 1.1rem;
  }
}

@media (min-width: 992px) {
  .auth-shell {
    padding-inline: 2rem;
  }

  .auth-card {
    width: 100%;
  }

   .auth-frame {
     width: 380px;
     max-width: 380px;
   }
 }

/* ==================== BOTTOM NAVIGATION FOR GURU ==================== */

/* Edge-to-edge style for mobile (base) */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  transform: none;
  min-height: 68px;
  max-width: none;
  background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(255,255,255,0.96) 100%);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow:
    0 -4px 20px rgba(15, 118, 110, 0.08),
    0 -1px 4px rgba(0, 0, 0, 0.03),
    inset 0 1px 0 rgba(255, 255, 255, 0.95);
  border-top: 1px solid rgba(15, 118, 110, 0.12);
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 1050;
  padding: 0 0.5rem;
  padding-bottom: calc(0.5rem + env(safe-area-inset-bottom));
  gap: 0.25rem;
  animation: slideUpFade 0.4s ease-out;
}

@keyframes slideUpFade {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Nav link base */
.bottom-nav-link {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  padding: 0.55rem 0.2rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.68rem;
  font-weight: 600;
  border-radius: 12px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  text-align: center;
  min-width: 0;
  -webkit-tap-highlight-color: transparent;
}

.bottom-nav-link i {
  font-size: 1.4rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  background: transparent;
}

.bottom-nav-link span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
  display: block;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--text-muted);
}

/* Active state */
.bottom-nav-link.active {
  color: var(--primary);
}
.bottom-nav-link.active::before {
  content: '';
  position: absolute;
  top: 3px;
  left: 50%;
  transform: translateX(-50%);
  width: 5px;
  height: 5px;
  background: var(--primary);
  border-radius: 50%;
  opacity: 0.9;
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.15);
}
.bottom-nav-link.active i {
  background: var(--primary-soft);
  color: var(--primary);
  transform: scale(1.06);
  box-shadow: 0 4px 12px rgba(15, 118, 110, 0.2);
}

/* Hover (desktop) */
.bottom-nav-link:hover:not(.active) {
  color: var(--text-secondary);
  background: var(--surface-soft);
}
.bottom-nav-link:hover:not(.active) i {
  transform: translateY(-2px);
  background: rgba(15, 118, 110, 0.05);
}

/* Active press */
.bottom-nav-link:active {
  transform: scale(0.96);
}

/* Tablet & Desktop: Full-width edge-to-edge (768px and up) */
@media (min-width: 768px) {
  .bottom-nav {
    left: 0;
    right: 0;
    transform: none;
    bottom: 0;
    max-width: none;
    border-radius: 0;
    padding: 0 0.5rem;
    padding-bottom: calc(0.5rem + env(safe-area-inset-bottom));
    gap: 0.25rem;
    box-shadow:
      0 -4px 20px rgba(15, 118, 110, 0.08),
      0 -1px 4px rgba(0, 0, 0, 0.03),
      inset 0 1px 0 rgba(255, 255, 255, 0.95);
    border-top: 1px solid rgba(15, 118, 110, 0.12);
  }

  .bottom-nav-link {
    padding: 0.5rem 0.3rem;
    border-radius: 12px;
    gap: 0.15rem;
  }

  .bottom-nav-link i {
    width: 36px;
    height: 36px;
    font-size: 1.4rem;
    border-radius: 10px;
    background: transparent;
  }

  .bottom-nav-link span {
    font-size: 0.68rem;
  }

  .bottom-nav-link.active::before {
    top: 3px;
    bottom: auto;
    width: 5px;
    height: 5px;
  }

  .bottom-nav-link.active i {
    transform: scale(1.06);
    box-shadow: 0 4px 12px rgba(15, 118, 110, 0.2);
  }
}

/* Larger desktop screens (992px+) - subtle size tweaks */
@media (min-width: 992px) {
  .bottom-nav {
    min-height: 72px;
    gap: 0.35rem;
  }

  .bottom-nav-link {
    padding: 0.55rem 0.4rem;
  }

  .bottom-nav-link i {
    width: 38px;
    height: 38px;
    font-size: 1.45rem;
  }

  .bottom-nav-link span {
    font-size: 0.7rem;
  }
}

/* ==================== GURU MODE LAYOUT ==================== */

/* Fix main-wrapper offset for Guru mode (no sidebar) */
.main-wrapper.guru-mode {
  margin-left: 0;
  width: 100%;
  max-width: 100%;
}

/* Full-width page content for guru mode (all screen sizes) */
.guru-mode .page-content {
  padding-bottom: calc(70px + 1rem + env(safe-area-inset-bottom));
  padding-left: 1rem;
  padding-right: 1rem;
  max-width: none;
  margin-left: 0;
  margin-right: 0;
}

/* Larger padding on tablet/desktop */
@media (min-width: 768px) {
  .guru-mode .page-content {
    padding-bottom: calc(70px + 1.5rem + env(safe-area-inset-bottom));
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
}

@media (min-width: 992px) {
  .guru-mode .page-content {
    padding-left: 2rem;
    padding-right: 2rem;
  }
}

/* Topbar adjustments for guru mode */
.guru-mode .topbar {
  padding-left: 1rem;
}

.guru-mode .topbar-title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  max-width: calc(100% - 120px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.guru-mode .topbar-right {
  margin-left: 0;
  position: absolute;
  right: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.guru-mode .topbar-date {
  display: none;
}

.guru-mode .topbar-toggle {
  display: none !important;
}

/* Hide app footer when bottom nav is present (guru mode) */
.guru-mode .app-footer {
  display: none;
}

/* Main wrapper adjustments for guru mode (no sidebar) */
.main-wrapper.guru-mode {
  margin-left: 0;
}

.main-wrapper.guru-mode .topbar-toggle {
  display: none;
}

.main-wrapper.guru-mode .app-footer {
  display: none;
}

/* Mobile topbar tweaks */
@media (max-width: 767.98px) {
  .guru-mode .topbar-title {
    font-size: 1rem;
    max-width: calc(100% - 80px);
  }
}

/* ==================== ADMIN MODE RESPONSIVE ==================== */

/* ── Admin Bottom Navigation (Mobile Only) ── */
.admin-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  min-height: 64px;
  background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(255,255,255,0.96) 100%);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow:
    0 -4px 20px rgba(15, 118, 110, 0.08),
    0 -1px 4px rgba(0, 0, 0, 0.03),
    inset 0 1px 0 rgba(255, 255, 255, 0.95);
  border-top: 1px solid rgba(15, 118, 110, 0.12);
  display: none;
  align-items: center;
  justify-content: space-around;
  z-index: 1050;
  padding: 0 0.25rem;
  padding-bottom: env(safe-area-inset-bottom);
  gap: 0;
  animation: slideUpFade 0.4s ease-out;
}

.admin-bottom-nav-link {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  padding: 0.45rem 0.15rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.62rem;
  font-weight: 600;
  border-radius: 10px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  text-align: center;
  min-width: 0;
  -webkit-tap-highlight-color: transparent;
}

.admin-bottom-nav-link i {
  font-size: 1.25rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  background: transparent;
}

.admin-bottom-nav-link span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
  display: block;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.admin-bottom-nav-link.active {
  color: var(--primary);
}

.admin-bottom-nav-link.active::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  background: var(--primary);
  border-radius: 50%;
  opacity: 0.9;
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.15);
}

.admin-bottom-nav-link.active i {
  background: var(--primary-soft);
  color: var(--primary);
  transform: scale(1.05);
  box-shadow: 0 3px 10px rgba(15, 118, 110, 0.2);
}

.admin-bottom-nav-link:active {
  transform: scale(0.95);
}

/* Show admin bottom nav only on mobile (<992px) */
@media (max-width: 991.98px) {
  .admin-bottom-nav {
    display: flex;
  }

  /* Add padding-bottom to page-content for admin mode when bottom nav shows */
  .main-wrapper:not(.guru-mode) .page-content {
    padding-bottom: calc(68px + 1rem + env(safe-area-inset-bottom));
  }

  /* Hide footer on mobile admin (bottom nav replaces it) */
  .main-wrapper:not(.guru-mode) .app-footer {
    display: none;
  }
}

/* Dark mode for admin bottom nav */
[data-theme='dark'] .admin-bottom-nav {
  background: linear-gradient(180deg, rgba(15,23,42,0.98) 0%, rgba(15,23,42,0.96) 100%);
  border-top-color: rgba(38, 52, 72, 0.96);
  box-shadow:
    0 -4px 20px rgba(2, 6, 23, 0.35),
    0 -1px 4px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(38, 52, 72, 0.5);
}

/* ── Admin Desktop Improvements ── */
@media (min-width: 992px) {
  /* Sidebar always visible on desktop */
  .sidebar {
    transform: translateX(0) !important;
  }

  .main-wrapper:not(.guru-mode) {
    margin-left: var(--sidebar-w);
    max-width: calc(100% - var(--sidebar-w));
    width: calc(100% - var(--sidebar-w));
  }

  .main-wrapper:not(.guru-mode) .page-content {
    padding: 2rem 2.5rem;
  }

  /* Make topbar stretch full width */
  .main-wrapper:not(.guru-mode) .topbar {
    padding: 0 2.5rem;
  }

  /* Topbar toggle hidden on desktop */
  .topbar-toggle {
    display: none;
  }
}

/* ── Admin Tablet (768px - 991px) ── */
@media (min-width: 768px) and (max-width: 991.98px) {
  .main-wrapper:not(.guru-mode) .page-content {
    padding: 1.5rem;
    padding-bottom: calc(68px + 1.5rem + env(safe-area-inset-bottom));
  }

  /* Improve stat cards grid on tablet */
  .main-wrapper:not(.guru-mode) .stat-card .stat-value {
    font-size: 1.5rem;
  }
}

/* ── Admin Mobile (<768px) ── */
@media (max-width: 767.98px) {
  /* Better mobile topbar for admin */
  .main-wrapper:not(.guru-mode) .topbar {
    height: 60px;
    padding: 0 0.75rem;
    gap: 0.5rem;
  }

  .main-wrapper:not(.guru-mode) .page-content {
    padding: 0.85rem;
    padding-bottom: calc(68px + 1rem + env(safe-area-inset-bottom));
  }

  /* Page header compact on mobile */
  .main-wrapper:not(.guru-mode) .page-header {
    margin-bottom: 1rem;
  }

  .main-wrapper:not(.guru-mode) .page-header h1 {
    font-size: 1.15rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
  }

  .main-wrapper:not(.guru-mode) .page-header p {
    font-size: 0.82rem;
    margin-top: 0.2rem;
  }

  /* Card improvements for mobile */
  .main-wrapper:not(.guru-mode) .card {
    border-radius: 14px;
    overflow: hidden;
  }

  .main-wrapper:not(.guru-mode) .card:hover {
    transform: none;
  }

  .main-wrapper:not(.guru-mode) .card-header {
    padding: 0.85rem 1rem;
    font-size: 0.88rem;
  }

  .main-wrapper:not(.guru-mode) .card-body {
    padding: 0.85rem 1rem;
  }

  /* Stat cards mobile */
  .main-wrapper:not(.guru-mode) .stat-card .stat-value {
    font-size: 1.4rem;
  }

  .main-wrapper:not(.guru-mode) .stat-card .stat-label {
    font-size: 0.68rem;
  }

  .main-wrapper:not(.guru-mode) .stat-card .stat-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    font-size: 1rem;
  }

  /* Table mobile improvements */
  .main-wrapper:not(.guru-mode) .table thead th {
    font-size: 0.68rem;
    padding: 0.65rem 0.6rem;
    letter-spacing: 0.03em;
  }

  .main-wrapper:not(.guru-mode) .table tbody td {
    padding: 0.65rem 0.6rem;
    font-size: 0.8rem;
  }

  /* Action buttons more compact on mobile */
  .main-wrapper:not(.guru-mode) .table .btn-sm {
    font-size: 0.72rem;
    padding: 0.3rem 0.5rem;
    min-height: 32px;
    border-radius: 8px;
  }

  /* Avatar smaller on mobile */
  .main-wrapper:not(.guru-mode) .table .avatar {
    width: 30px;
    height: 30px;
    font-size: 0.7rem;
  }

  /* Portal hero compact */
  .main-wrapper:not(.guru-mode) .portal-hero {
    padding: 1rem;
    border-radius: 14px;
  }

  .main-wrapper:not(.guru-mode) .portal-hero h1,
  .main-wrapper:not(.guru-mode) .portal-hero .h3 {
    font-size: 1rem;
    line-height: 1.4;
  }

  .main-wrapper:not(.guru-mode) .portal-hero p {
    font-size: 0.8rem;
    line-height: 1.5;
  }

  .main-wrapper:not(.guru-mode) .portal-hero-kicker {
    font-size: 0.65rem;
    padding: 0.25rem 0.6rem;
    margin-bottom: 0.6rem;
  }

  .main-wrapper:not(.guru-mode) .portal-hero-metrics {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin-top: 0.8rem;
  }

  .main-wrapper:not(.guru-mode) .portal-metric {
    padding: 0.6rem 0.7rem;
    border-radius: 10px;
    text-align: center;
  }

  .main-wrapper:not(.guru-mode) .portal-metric-label {
    font-size: 0.6rem;
  }

  .main-wrapper:not(.guru-mode) .portal-metric-value {
    font-size: 1.2rem;
  }

  /* Quick actions grid on mobile */
  .main-wrapper:not(.guru-mode) .quick-action-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }

  .main-wrapper:not(.guru-mode) .quick-action-card {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 0.75rem 0.5rem;
    border-radius: 12px;
  }

  .main-wrapper:not(.guru-mode) .quick-action-icon {
    width: 36px;
    height: 36px;
    font-size: 1rem;
    border-radius: 10px;
  }

  .main-wrapper:not(.guru-mode) .quick-action-title {
    font-size: 0.78rem;
  }

  .main-wrapper:not(.guru-mode) .quick-action-text {
    font-size: 0.68rem;
    display: none;
  }

  /* Chart container height */
  .main-wrapper:not(.guru-mode) canvas {
    max-height: 200px;
  }

  /* Badges compact */
  .main-wrapper:not(.guru-mode) .badge {
    font-size: 0.68rem;
    padding: 0.32rem 0.55rem;
  }

  /* Filter cards stack on mobile */
  .main-wrapper:not(.guru-mode) .filter-card .card-body {
    padding: 0.75rem;
  }

  /* Alert compact on mobile */
  .main-wrapper:not(.guru-mode) .alert {
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
    border-radius: 12px;
  }

  /* Summary strip on mobile admin */
  .main-wrapper:not(.guru-mode) .summary-strip {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }

  .main-wrapper:not(.guru-mode) .summary-item {
    padding: 0.75rem;
    border-radius: 12px;
  }

  .main-wrapper:not(.guru-mode) .summary-item-value {
    font-size: 1.1rem;
  }

  .main-wrapper:not(.guru-mode) .summary-item-label {
    font-size: 0.72rem;
  }

  /* Form controls slightly smaller on mobile */
  .main-wrapper:not(.guru-mode) .form-control,
  .main-wrapper:not(.guru-mode) .form-select {
    min-height: 42px;
    font-size: 0.88rem;
  }

  .main-wrapper:not(.guru-mode) .form-label {
    font-size: 0.8rem;
    margin-bottom: 0.35rem;
  }

  /* Button full width on mobile for primary actions */
  .main-wrapper:not(.guru-mode) .btn-primary.w-100 {
    min-height: 44px;
    font-size: 0.9rem;
  }

  /* Map on mobile */
  #sekolahMap {
    height: 280px !important;
  }
}

/* ── Admin Extra Small (<576px) ── */
@media (max-width: 575.98px) {
  .main-wrapper:not(.guru-mode) .topbar {
    height: 56px;
    padding: 0 0.65rem;
  }

  .main-wrapper:not(.guru-mode) .topbar-title {
    font-size: 0.9rem;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .main-wrapper:not(.guru-mode) .page-content {
    padding: 0.65rem;
    padding-bottom: calc(68px + 0.75rem + env(safe-area-inset-bottom));
  }

  .main-wrapper:not(.guru-mode) .portal-hero-metrics {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.35rem;
  }

  .main-wrapper:not(.guru-mode) .portal-metric {
    padding: 0.5rem;
  }

  .main-wrapper:not(.guru-mode) .portal-metric-label {
    font-size: 0.55rem;
  }

  .main-wrapper:not(.guru-mode) .portal-metric-value {
    font-size: 1rem;
  }

  /* Quick action grid full width */
  .main-wrapper:not(.guru-mode) .quick-action-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.4rem;
  }

  /* Map smaller */
  #sekolahMap {
    height: 240px !important;
  }

  /* Table better scrollability */
  .main-wrapper:not(.guru-mode) .table-responsive {
    margin: 0 -0.25rem;
  }
}

/* ── Admin Large Desktop (>1400px) ── */
@media (min-width: 1400px) {
  .main-wrapper:not(.guru-mode) .page-content {
    padding: 2.5rem 3.5rem;
  }

  .main-wrapper:not(.guru-mode) .topbar {
    padding: 0 3.5rem;
  }
}

/* ── Sekolah Page Specific Responsive ── */
@media (max-width: 991.98px) {
  /* Stack form and map vertically on tablet/mobile */
  .main-wrapper:not(.guru-mode) .col-lg-5,
  .main-wrapper:not(.guru-mode) .col-lg-7 {
    flex: 0 0 100%;
    max-width: 100%;
  }
}

/* ── Admin Presensi Table Mobile Improvements ── */
@media (max-width: 767.98px) {
  /* Make presensi table more readable on mobile */
  .main-wrapper:not(.guru-mode) .table .text-nowrap {
    white-space: normal;
  }

  .main-wrapper:not(.guru-mode) .table .d-flex.align-items-center.gap-2 {
    gap: 0.4rem !important;
  }

  .main-wrapper:not(.guru-mode) .table .fw-600 {
    font-size: 0.82rem;
  }

  .main-wrapper:not(.guru-mode) .table .text-meta {
    font-size: 0.68rem;
  }

  /* Action buttons wrap */
  .main-wrapper:not(.guru-mode) td.text-nowrap {
    white-space: normal !important;
  }

  .main-wrapper:not(.guru-mode) td.text-nowrap .btn {
    margin-bottom: 0.25rem;
  }

  .main-wrapper:not(.guru-mode) td.text-nowrap form.d-inline {
    display: inline-block !important;
  }

  /* List items compact */
  .main-wrapper:not(.guru-mode) .list-row {
    padding: 0.65rem 0;
    gap: 0.5rem;
  }
}

/* ── Admin Section Stack Mobile ── */
@media (max-width: 767.98px) {
  .main-wrapper:not(.guru-mode) .section-stack > * + * {
    margin-top: 0.85rem;
  }

  .main-wrapper:not(.guru-mode) .row.g-3 {
    --bs-gutter-y: 0.6rem;
    --bs-gutter-x: 0.6rem;
  }

  .main-wrapper:not(.guru-mode) .row.g-4 {
    --bs-gutter-y: 0.75rem;
    --bs-gutter-x: 0.75rem;
  }

  .main-wrapper:not(.guru-mode) .mb-4 {
    margin-bottom: 0.75rem !important;
  }
}

/* ── Smooth Transitions for Layout Change ── */
.main-wrapper:not(.guru-mode) .page-content,
.main-wrapper:not(.guru-mode) .topbar {
  transition: padding 0.25s ease;
}

/* ── Profile Shell Mobile Admin ── */
@media (max-width: 767.98px) {
  .main-wrapper:not(.guru-mode) .profile-shell {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .main-wrapper:not(.guru-mode) .profile-summary {
    padding: 1rem;
    border-radius: 14px;
  }

  .main-wrapper:not(.guru-mode) .avatar-xl {
    width: 64px;
    height: 64px;
    font-size: 1rem;
  }
}

/* ── Admin Dashboard Icon Grid Mobile ── */
@media (max-width: 767.98px) {
  .main-wrapper:not(.guru-mode) .dashboard-icon-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }

  .main-wrapper:not(.guru-mode) .dashboard-icon-card {
    padding: 0.85rem 0.5rem;
    border-radius: 12px;
  }

  .main-wrapper:not(.guru-mode) .dashboard-icon-card .icon-wrap {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    font-size: 1rem;
    margin-bottom: 0.4rem;
  }

  .main-wrapper:not(.guru-mode) .dashboard-icon-card strong {
    font-size: 0.78rem;
  }

  .main-wrapper:not(.guru-mode) .dashboard-icon-card small {
    font-size: 0.62rem;
  }
}

/* ── Admin Tool Grid Mobile ── */
@media (max-width: 767.98px) {
  .main-wrapper:not(.guru-mode) .tool-grid.tool-grid-2 {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .main-wrapper:not(.guru-mode) .tool-section {
    padding: 1rem;
    border-radius: 14px;
  }
}

/* ── Touch-friendly Improvements ── */
@media (max-width: 991.98px) {
  /* Larger touch targets */
  .main-wrapper:not(.guru-mode) .btn {
    min-height: 40px;
  }

  .main-wrapper:not(.guru-mode) .btn-sm {
    min-height: 34px;
  }

  /* Checkbox bigger on touch */
  .main-wrapper:not(.guru-mode) input[type="checkbox"] {
    width: 18px;
    height: 18px;
  }
}

/* ══════════════════════════════════════════════════════════════
   PRESENSI PAGE — Mobile-First Premium Redesign
   ══════════════════════════════════════════════════════════════ */

/* ── GPS Pulse Animation ── */
@keyframes gpsPulse {
  0%   { transform: scale(1);   opacity: 1; }
  50%  { transform: scale(1.15); opacity: 0.7; }
  100% { transform: scale(1);   opacity: 1; }
}
@keyframes gpsRing {
  0%   { transform: scale(0.8); opacity: 0.8; }
  100% { transform: scale(2.5); opacity: 0; }
}
@keyframes slideUp {
  from { transform: translateY(24px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
@keyframes shimmerGps {
  0%   { background-position: -200% 0; }
  100% { background-position:  200% 0; }
}
@keyframes bounceIn {
  0%   { transform: scale(0.85); opacity: 0; }
  60%  { transform: scale(1.05); opacity: 1; }
  100% { transform: scale(1); }
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── GPS Status Badge (premium) ── */
.gps-status {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.95rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  transition: all 0.3s ease;
}
.gps-status.loading  { color: #64748b; background: #f1f5f9; }
.gps-status.in-range { color: #15803d; background: #dcfce7; box-shadow: 0 0 0 1px #86efac; }
.gps-status.out-range{ color: #dc2626; background: #fee2e2; box-shadow: 0 0 0 1px #fca5a5; }

/* ── GPS Pulse Icon ── */
.gps-pulse-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.gps-pulse-wrap .gps-ring {
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 2px solid currentColor;
  animation: gpsRing 1.5s ease-out infinite;
  opacity: 0;
}
.gps-pulse-icon {
  animation: gpsPulse 1.5s ease-in-out infinite;
}

/* ── Presensi Action Cards (big touch-friendly buttons) ── */
.presensi-action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}
@media (max-width: 575.98px) {
  .presensi-action-grid { grid-template-columns: 1fr 1fr; gap: 0.65rem; }
}

.presensi-card-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 1.4rem 1rem;
  border-radius: 20px;
  border: none;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: transform 0.18s cubic-bezier(.34,1.56,.64,1), box-shadow 0.18s ease, opacity 0.18s ease;
  text-align: center;
  min-height: 110px;
  line-height: 1.3;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  overflow: hidden;
  will-change: transform;
}
.presensi-card-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.12);
  opacity: 0;
  transition: opacity 0.15s ease;
}
.presensi-card-btn:active::after { opacity: 1; }
.presensi-card-btn:not(:disabled):active {
  transform: scale(0.95);
}
.presensi-card-btn:not(:disabled):hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 18px 36px rgba(0,0,0,0.18);
}
.presensi-card-btn:disabled {
  opacity: 0.48;
  cursor: not-allowed;
  transform: none !important;
}
.presensi-card-btn .btn-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255,255,255,0.22);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}
.presensi-card-btn.btn-masuk {
  background: linear-gradient(135deg, #059669 0%, #10b981 100%);
  color: #ffffff;
  box-shadow: 0 12px 28px rgba(5,150,105,0.32);
}
.presensi-card-btn.btn-pulang {
  background: linear-gradient(135deg, #0284c7 0%, #38bdf8 100%);
  color: #ffffff;
  box-shadow: 0 12px 28px rgba(2,132,199,0.32);
}
.presensi-card-btn.btn-izin {
  background: linear-gradient(135deg, #d97706 0%, #fbbf24 100%);
  color: #ffffff;
  box-shadow: 0 12px 28px rgba(217,119,6,0.28);
}
.presensi-card-btn.btn-sakit {
  background: linear-gradient(135deg, #7c3aed 0%, #a78bfa 100%);
  color: #ffffff;
  box-shadow: 0 12px 28px rgba(124,58,237,0.28);
}
.presensi-card-btn.done {
  background: linear-gradient(135deg, #334155 0%, #475569 100%);
  box-shadow: 0 8px 20px rgba(30,41,59,0.18);
}
.presensi-card-btn .done-check {
  position: absolute;
  top: 10px;
  right: 12px;
  font-size: 1rem;
  opacity: 0.8;
}

/* ── GPS Info Panel ── */
.gps-info-panel {
  border-radius: 20px;
  background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
  border: 1px solid #bbf7d0;
  padding: 1.1rem 1.25rem;
  animation: slideUp 0.4s ease;
}
.gps-info-panel.gps-out {
  background: linear-gradient(135deg, #fff1f2 0%, #fee2e2 100%);
  border-color: #fecaca;
}
.gps-info-panel.gps-loading {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border-color: #e2e8f0;
}

/* ── Distance Donut ── */
.distance-donut-wrap {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.distance-donut {
  position: relative;
  width: 72px;
  height: 72px;
  flex-shrink: 0;
}
.distance-donut svg {
  transform: rotate(-90deg);
  width: 72px;
  height: 72px;
}
.distance-donut-track { fill: none; stroke: #e2e8f0; stroke-width: 6; }
.distance-donut-fill  { fill: none; stroke-width: 6; stroke-linecap: round; transition: stroke-dashoffset 0.6s cubic-bezier(.4,0,.2,1), stroke 0.3s ease; }
.distance-donut-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--text-primary);
  text-align: center;
  line-height: 1.1;
}

/* ── Map Container Responsive ── */
#presensiMap {
  height: 280px;
  border-radius: 16px;
  z-index: 1;
  transition: height 0.3s ease;
}
@media (min-width: 768px) {
  #presensiMap { height: 360px; }
}
@media (max-width: 575.98px) {
  #presensiMap { height: 220px; }
}

/* ── Status Today Card ── */
.status-today-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0;
  border-bottom: 1px solid rgba(217,226,236,0.5);
}
.status-today-row:last-child { border-bottom: none; }

/* ── Accuracy Bar ── */
.accuracy-bar {
  height: 5px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
  margin-top: 4px;
}
.accuracy-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.5s ease, background 0.3s ease;
}

/* ── Float GPS Button (mobile) ── */
.gps-refresh-fab {
  position: fixed;
  bottom: calc(80px + env(safe-area-inset-bottom));
  right: 1rem;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  box-shadow: 0 8px 24px rgba(15,118,110,0.38);
  cursor: pointer;
  z-index: 900;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}
.gps-refresh-fab:active { transform: scale(0.92); }
.gps-refresh-fab.spinning i { animation: spin 0.8s linear infinite; }
@media (min-width: 992px) { .gps-refresh-fab { display: none; } }

/* ── Selfie Modal Premium ── */
#selfieVideo {
  border-radius: 16px;
  width: 100%;
  max-height: 320px;
  object-fit: cover;
  background: #0f172a;
}
.selfie-frame {
  position: relative;
  display: inline-block;
  width: 100%;
}
.selfie-frame-corner {
  position: absolute;
  width: 28px;
  height: 28px;
  border-color: var(--primary);
  border-style: solid;
  opacity: 0.7;
}
.selfie-frame-corner.tl { top: 8px; left: 8px; border-width: 3px 0 0 3px; border-radius: 6px 0 0 0; }
.selfie-frame-corner.tr { top: 8px; right: 8px; border-width: 3px 3px 0 0; border-radius: 0 6px 0 0; }
.selfie-frame-corner.bl { bottom: 8px; left: 8px; border-width: 0 0 3px 3px; border-radius: 0 0 0 6px; }
.selfie-frame-corner.br { bottom: 8px; right: 8px; border-width: 0 3px 3px 0; border-radius: 0 0 6px 0; }

/* ── Bottom Sheet Modal (mobile) ── */
@media (max-width: 575.98px) {
  .modal-dialog {
    margin: 0;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-width: 100%;
    align-items: flex-end;
  }
  .modal.fade .modal-dialog {
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(.4,0,.2,1);
  }
  .modal.show .modal-dialog {
    transform: translateY(0);
  }
  .modal-content {
    border-radius: 24px 24px 0 0 !important;
    border-bottom: none !important;
  }
  .modal-content::before {
    content: '';
    display: block;
    width: 40px;
    height: 4px;
    border-radius: 2px;
    background: #cbd5e1;
    margin: 10px auto 0;
  }
}

/* ── Btn size mobile ── */
@media (max-width: 767.98px) {
  .guru-mode .btn-lg {
    padding: 0.75rem 1.25rem;
    font-size: 1rem;
    min-height: 52px;
  }
  .guru-mode .btn {
    min-height: 44px;
    touch-action: manipulation;
  }
  .guru-mode .card-body { padding: 1rem; }
  .guru-mode .card-header { padding: 0.85rem 1rem; }
}

/* ── Smooth transition for all interactive elements ── */
.guru-mode .card,
.guru-mode .btn,
.guru-mode .gps-status,
.guru-mode .badge {
  will-change: transform;
}

/* ── No hover lift on presensi action cards (prevents layout jump) ── */
.guru-mode .card:has(.presensi-action-grid):hover {
  transform: none;
}

