/* Optimasi Fit-to-Screen Semua OS HP (iOS Safari, Android Chrome) & Desktop v4 */
*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: rgba(37, 99, 235, 0.14);
}

/* Kunci anti-overflow iOS Safari pada CSS Grid & Flex */
.grid > * {
  min-width: 0;
}

main, section, article {
  max-width: 100%;
}

p, h1, h2, h3, h4, li {
  overflow-wrap: break-word;
  word-wrap: break-word;
}

a, button, input, select, textarea, label, summary {
  touch-action: manipulation;
}

/* ===== KUNCI HEADER ANTI-TUMPUK UNTUK NAMA ORANG TUA & SISWA YANG PANJANG ===== */
.jk-dash-ortu header > div,
.jk-dash-siswa header > div,
.jk-dash-guru header > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.jk-dash-ortu header > div > :first-child,
.jk-dash-siswa header > div > :first-child,
.jk-dash-guru header > div > :first-child {
  min-width: 0 !important;
  flex: 1 1 0% !important;
  overflow: hidden;
}

.jk-dash-ortu header > div > :last-child,
.jk-dash-siswa header > div > :last-child,
.jk-dash-guru header > div > :last-child {
  flex-shrink: 0 !important;
}

/* Batas presisi nama siswa panjang pada tab anak & papan peringkat */
.jk-child-tab-clamp {
  max-width: 210px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (min-width: 640px) {
  .jk-child-tab-clamp {
    max-width: 270px;
  }
}

.jk-table-scroll {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.no-scrollbar::-webkit-scrollbar {
  display: none;
}
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* Safe area untuk notch & home indicator iPhone / Android */
.jk-bottom-nav {
  padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px)) !important;
  padding-left: calc(6px + env(safe-area-inset-left, 0px)) !important;
  padding-right: calc(6px + env(safe-area-inset-right, 0px)) !important;
}

@media (max-width: 767px) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]),
  select,
  textarea {
    font-size: 16px !important;
    min-height: 44px;
  }

  button:not(.jk-theme-btn):not(.jk-compact-btn),
  a.jk-touch-btn {
    min-height: 42px;
  }

  /* Padatkan sedikit tombol header di layar HP agar ruang nama orang tua & siswa makin lega */
  .jk-dash-ortu header button:not(.jk-theme-btn),
  .jk-dash-ortu header a:not([href="/"]),
  .jk-dash-siswa header button:not(.jk-theme-btn),
  .jk-dash-siswa header a:not([href="/"]) {
    min-height: 36px;
    padding-left: 10px;
    padding-right: 10px;
    font-size: 11.5px;
    white-space: nowrap;
  }

  body.has-jk-bottom-bar,
  body.jk-dash-guru {
    padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px)) !important;
  }

  body.jk-dash-ortu,
  body.jk-dash-siswa {
    padding-bottom: calc(74px + env(safe-area-inset-bottom, 0px)) !important;
  }

  body.jk-dash-guru #jk-tour-fab {
    bottom: calc(74px + env(safe-area-inset-bottom, 0px)) !important;
    right: 12px !important;
  }

  body.jk-dash-ortu #jk-tour-fab,
  body.jk-dash-siswa #jk-tour-fab {
    bottom: calc(14px + env(safe-area-inset-bottom, 0px)) !important;
    left: 12px !important;
  }

  #jk-big-timer {
    top: 138px !important;
    width: min(92vw, 260px) !important;
    padding: 8px 14px 10px !important;
  }

  body.jk-timer-open #jk-toast-stack {
    top: 224px !important;
  }
}

@media print {
  .jk-bottom-nav,
  #jk-tour-fab {
    display: none !important;
  }
}
