:root {
  --brand: #4e73df;
  --brand-dark: #2e59d9;
  --sidebar-w: 248px;
  --topbar-h: 56px;
}

* { box-sizing: border-box; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: #f4f5f7;
  font-size: 14px;
}

/* ---------- Shell ---------- */
.app-sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: #1f2937;
  color: #cbd5e1;
  overflow-y: auto;
  z-index: 1040;
  transition: transform .2s ease;
}
.app-sidebar .brand {
  height: var(--topbar-h);
  display: flex; align-items: center; gap: .5rem;
  padding: 0 1rem;
  font-weight: 700; color: #fff;
  background: rgba(0,0,0,.2);
  text-decoration: none;
}
.app-sidebar .brand img { max-height: 30px; }
.app-sidebar .nav-group {
  padding: .5rem 1rem .25rem;
  font-size: .7rem; text-transform: uppercase; letter-spacing: .08em;
  color: #64748b;
}

/* Grup menu yang bisa dilipat. Memakai <details> supaya keadaan terbuka bisa
   ditentukan server (tidak berkedip) dan tetap berfungsi tanpa JavaScript. */
.app-sidebar .nav-sect > summary {
  display: flex; align-items: center; gap: .5rem;
  cursor: pointer; user-select: none;
  list-style: none;                /* buang segitiga bawaan */
  padding: .6rem 1rem .35rem;
}
.app-sidebar .nav-sect > summary::-webkit-details-marker { display: none; }
.app-sidebar .nav-sect > summary:hover { color: #94a3b8; }
.app-sidebar .nav-sect > summary:focus-visible {
  outline: 2px solid var(--brand); outline-offset: -2px;
}
.app-sidebar .nav-sect > summary .chev {
  font-size: .7rem; transition: transform .18s ease; flex: none;
}
.app-sidebar .nav-sect[open] > summary .chev { transform: rotate(180deg); }
/* Titik penanda: grup tertutup yang memuat halaman aktif */
.app-sidebar .nav-sect:not([open]) > summary.has-active::after {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: var(--brand); flex: none; margin-left: .15rem;
}
.app-sidebar a.nav-item {
  display: flex; align-items: center; gap: .6rem;
  padding: .5rem 1rem;
  color: #cbd5e1; text-decoration: none;
  border-left: 3px solid transparent;
}
.app-sidebar a.nav-item:hover { background: rgba(255,255,255,.05); color: #fff; }
.app-sidebar a.nav-item.active {
  background: rgba(78,115,223,.15);
  border-left-color: var(--brand);
  color: #fff;
}
.app-sidebar a.nav-item i { width: 1.1rem; text-align: center; }

.app-main {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex; flex-direction: column;
}
.app-topbar {
  height: var(--topbar-h);
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  display: flex; align-items: center;
  padding: 0 1rem;
  position: sticky; top: 0; z-index: 1030;
}
.app-content { padding: 1.25rem; flex: 1; }
.app-footer {
  padding: .75rem 1.25rem;
  color: #9ca3af; font-size: .8rem;
  border-top: 1px solid #e5e7eb;
  background: #fff;
}

.btn-brand { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-brand:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
a { color: var(--brand); }

.card { border: 1px solid #e5e7eb; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.card-header { background: #fff; border-bottom: 1px solid #eef0f2; font-weight: 600; }
.table > :not(caption) > * > * { padding: .5rem .6rem; }
.table thead th { background: #f8f9fb; font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: #6b7280; }
.text-mono { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.required::after { content: " *"; color: #dc2626; }

/* ---------- Sidebar toggle (mobile) ---------- */
.sidebar-backdrop { display: none; }
@media (max-width: 992px) {
  .app-sidebar { transform: translateX(-100%); }
  body.sidebar-open .app-sidebar { transform: translateX(0); }
  body.sidebar-open .sidebar-backdrop {
    display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 1039;
  }
  .app-main { margin-left: 0; }
}

/* ---------- Auth ---------- */
.auth-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  padding: 1rem;
}
.auth-card { width: 100%; max-width: 400px; }

/* ── Kepala halaman ─────────────────────────────────────────────────────
   Jejak lokasi di atas judul, tombol kembali di kirinya. Dibuat ringan
   supaya tidak mencuri perhatian dari isi halaman. */
.page-head .page-crumb {
  display: flex; flex-wrap: wrap; align-items: center; gap: .3rem;
  font-size: .76rem; color: #8a94a6; margin-bottom: .25rem;
}
.page-head .page-crumb a { color: #8a94a6; text-decoration: none; }
.page-head .page-crumb a:hover { color: var(--brand); text-decoration: underline; }
.page-head .page-crumb .sep { opacity: .5; }
.page-head .page-crumb .cur { color: #495463; font-weight: 500; }
.min-w-0 { min-width: 0; }
