/* Database Murid — tampilan dashboard profesional: sidebar kiri,
   bilah atas ringkas, konten kanan. Putih/abu muda, aksen oranye. */
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: #f7f8fa; color: #1f2937; }
a { color: #c2410c; }

.app { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
  width: 248px; flex: 0 0 248px; background: #fff; border-right: 1px solid #e5e7eb;
  padding: 18px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 18px; z-index: 40;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px; }
.brandMark { width: 26px; height: 26px; border-radius: 8px; background: linear-gradient(135deg, #f6821f, #fb923c); flex: 0 0 26px; }
.brandName { font-weight: 700; font-size: 1.02rem; color: #111827; }
.menu { display: flex; flex-direction: column; gap: 4px; }
.menuItem {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 9px;
  color: #374151; text-decoration: none; font-weight: 600; font-size: .95rem;
}
.menuItem svg { width: 20px; height: 20px; flex: 0 0 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.menuItem[hidden] { display: none; }
.menuItem:hover { background: #f3f4f6; }
.menuItem.active { background: #fff1e6; color: #c2410c; box-shadow: inset 3px 0 0 #f6821f; }
.sidebarNote { margin: auto 6px 0; color: #6b7280; font-size: .8rem; line-height: 1.45; }
.sidebarOverlay { position: fixed; inset: 0; background: rgba(17, 24, 39, .45); z-index: 39; }

/* Area utama */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; background: rgba(255,255,255,.96);
  border-bottom: 1px solid #e5e7eb; padding: 12px 20px;
  display: flex; align-items: center; gap: 14px;
}
.menuBtn { display: none; background: #fff; color: #111827; border: 1px solid #d1d5db; padding: 7px 11px; font-size: 1rem; }
.topContext { font-weight: 700; color: #111827; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topActions { display: flex; gap: 8px; align-items: center; }
.topActions button { margin: 0; white-space: nowrap; }
.userInfo { margin: 0; color: #4b5563; font-size: .88rem; text-align: right; }
.content { padding: 18px 20px 28px; max-width: 1180px; width: 100%; margin: 0 auto; }

/* Kartu dan formulir */
.card { background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; padding: 18px; margin-bottom: 16px; box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.card h2 { margin: 0 0 12px; font-size: 1.12rem; color: #111827; }
.card h3 { margin: 18px 0 8px; font-size: .98rem; color: #111827; }
.card h3:first-of-type { margin-top: 6px; }
.devCard { background: #fffaf5; border-color: #fed7aa; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; align-items: end; }
label { display: flex; flex-direction: column; gap: 5px; font-size: .85rem; font-weight: 600; color: #374151; }
.checkLabel { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; }
.checkLabel input { width: auto; }
input, select, button { font: inherit; padding: 9px 10px; border-radius: 8px; }
input, select { border: 1px solid #d1d5db; background: #fff; width: 100%; color: #111827; }
input:focus, select:focus { outline: 2px solid #fdba74; border-color: #f6821f; }
button { border: 1px solid #ea580c; background: #f6821f; color: #fff; font-weight: 700; cursor: pointer; }
button:hover { background: #ea580c; }
button:active { transform: scale(.99); }
button:disabled { opacity: .55; cursor: not-allowed; }
button.small { padding: 5px 9px; font-size: .8rem; margin: 0 4px 4px 0; }
button.danger { background: #dc2626; border-color: #b91c1c; }
button.danger:hover { background: #b91c1c; }
button.secondary { background: #fff; color: #374151; border-color: #d1d5db; }
button.secondary:hover { background: #f3f4f6; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; margin: 12px 0; }
.hint { color: #6b7280; font-size: .87rem; line-height: 1.5; }

/* Tabel */
.tableWrap { overflow-x: auto; margin-top: 12px; border: 1px solid #e5e7eb; border-radius: 10px; }
table { border-collapse: collapse; width: 100%; min-width: 560px; font-size: .9rem; }
th, td { border-bottom: 1px solid #eef0f3; padding: 8px 10px; text-align: left; vertical-align: top; }
th { background: #f9fafb; color: #374151; font-size: .82rem; text-transform: uppercase; letter-spacing: .02em; }
tbody tr:last-child td { border-bottom: 0; }
.penempatanItem { display: inline-block; background: #f3f4f6; border-radius: 999px; padding: 2px 8px; margin: 0 4px 4px 0; font-size: .8rem; }
.penempatanItem button { background: none; border: 0; color: #b91c1c; padding: 0 0 0 4px; font-weight: 700; }
#tableAbsenHarian select, #tableAbsenHarian input { padding: 6px; font-size: .85rem; }
#tableAbsenHarian td:first-child, #tableAbsenHarian th:first-child { position: sticky; left: 0; background: #fff; min-width: 130px; }
#tableAbsenHarian th:first-child { background: #f9fafb; }

/* Navigasi alur */
.page[hidden], #contextBar[hidden] { display: none; }
.breadcrumb { color: #6b7280; font-size: .85rem; margin: 0 0 8px; }
.tingkatGrid, .branchGrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin: 12px 0; }
.bigBtn { display: block; text-align: center; padding: 18px 12px; border-radius: 12px; background: #fff; border: 1px solid #e5e7eb; color: #111827; text-decoration: none; font-weight: 700; font-size: 1.05rem; box-shadow: 0 1px 2px rgba(16,24,40,.05); }
.bigBtn:hover { border-color: #f6821f; color: #c2410c; background: #fffaf5; }
.bigBtn:active { transform: scale(.99); }
.bigBtn.secondaryBtn { background: #f9fafb; }
.supportLinks { font-size: .9rem; }
.supportLinks a { font-weight: 600; }
#message { padding: 11px 14px; border-radius: 10px; background: #ecfdf5; color: #065f46; min-height: 1.2em; border: 1px solid #a7f3d0; }
#message.error { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
#message:empty { background: transparent; border-color: transparent; }

/* Gerbang password aplikasi */
.gateOverlay { position: fixed; inset: 0; z-index: 80; background: rgba(17, 24, 39, .55); display: flex; align-items: center; justify-content: center; padding: 18px; }
.gateOverlay[hidden] { display: none; }
.gateCard { background: #fff; border: 1px solid #e5e7eb; border-radius: 14px; padding: 22px; width: 100%; max-width: 430px; box-shadow: 0 18px 45px rgba(16,24,40,.25); }
.gateCard h2 { margin: 0 0 10px; color: #111827; }
.gateCard form { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
.gateError { margin: 0; color: #991b1b; font-size: .88rem; min-height: 1.1em; }
.loginCard { text-align: left; }
.loginBrand { padding: 0; margin-bottom: 18px; }
.googleLoginBtn {
  display: block; text-align: center; margin-top: 16px; padding: 11px 14px;
  border-radius: 9px; border: 1px solid #d1d5db; background: #fff; color: #111827;
  font-weight: 700; text-decoration: none; box-shadow: 0 1px 2px rgba(16,24,40,.06);
}
.googleLoginBtn:hover { background: #f9fafb; border-color: #9ca3af; }
.googleLoginBtn.disabled { opacity: .55; pointer-events: none; }
#loginConfigNote { margin-top: 12px; }

/* Layar sempit: sidebar menjadi menu geser */
@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-105%); transition: transform .2s ease; box-shadow: 0 10px 30px rgba(16,24,40,.18); }
  .sidebar.open { transform: translateX(0); }
  .menuBtn { display: block; }
  .content { padding: 14px 12px 24px; }
  .topbar { padding: 10px 12px; }
  .userInfo { font-size: .8rem; }
  table { min-width: 520px; }
}
