/* =====================================================================
   App theme — Materio-inspired (fresh, dibuat untuk Penatausahaan)
   Bootstrap 5 base + kustomisasi warna/layout ala Materio.
   ===================================================================== */
:root {
  --bs-primary: #696cff;
  --bs-primary-rgb: 105, 108, 255;
  --p-primary: #696cff;
  --p-primary-hover: #5a5ff0;
  --p-body-bg: #f5f5f9;
  --p-sidebar-w: 260px;
  --p-navbar-h: 62px;
  --p-card-shadow: 0 0.25rem 1.125rem rgba(75, 70, 92, 0.1);
  --p-border: #e4e6f0;
  --p-text: #566a7f;
  --p-heading: #384551;
}

* { scrollbar-width: thin; }
body {
  background-color: var(--p-body-bg);
  color: var(--p-text);
  font-family: "Public Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 0.9375rem;
}
h1,h2,h3,h4,h5,h6,.h1,.h2,.h3,.h4,.h5,.h6 { color: var(--p-heading); }
a { color: var(--p-primary); text-decoration: none; }
a:hover { color: var(--p-primary-hover); }

/* ---- Warna primary override Bootstrap ---- */
.btn-primary {
  --bs-btn-bg: var(--p-primary); --bs-btn-border-color: var(--p-primary);
  --bs-btn-hover-bg: var(--p-primary-hover); --bs-btn-hover-border-color: var(--p-primary-hover);
  --bs-btn-active-bg: var(--p-primary-hover); --bs-btn-active-border-color: var(--p-primary-hover);
  --bs-btn-disabled-bg: var(--p-primary); --bs-btn-disabled-border-color: var(--p-primary);
  box-shadow: 0 0.125rem 0.25rem rgba(105,108,255,0.4);
}
.btn-outline-primary {
  --bs-btn-color: var(--p-primary); --bs-btn-border-color: var(--p-primary);
  --bs-btn-hover-bg: var(--p-primary); --bs-btn-hover-border-color: var(--p-primary);
  --bs-btn-active-bg: var(--p-primary); --bs-btn-active-border-color: var(--p-primary);
}
.text-primary { color: var(--p-primary) !important; }
.bg-primary { background-color: var(--p-primary) !important; }
.form-control:focus, .form-select:focus {
  border-color: var(--p-primary);
  box-shadow: 0 0 0 0.15rem rgba(105,108,255,0.15);
}
.page-link { color: var(--p-primary); }
.page-item.active .page-link { background-color: var(--p-primary); border-color: var(--p-primary); }

/* ---- Layout ---- */
.layout-wrapper { display: flex; min-height: 100vh; }
.layout-sidebar {
  width: var(--p-sidebar-w); flex-shrink: 0; background: #fff;
  border-right: 1px solid var(--p-border); position: fixed; top: 0; bottom: 0; left: 0;
  z-index: 1030; transition: transform .2s ease;
  display: flex; flex-direction: column; overflow: hidden;
}
.layout-page {
  flex: 1; margin-left: var(--p-sidebar-w); display: flex; flex-direction: column; min-width: 0;
}
.content-wrapper { flex: 1; padding: 1.5rem; }
.content-wrapper .container-fluid { padding: 0; }

/* ---- Sidebar brand & menu ---- */
.sidebar-brand {
  height: var(--p-navbar-h); display: flex; align-items: center; gap: .5rem;
  padding: 0 1.5rem; font-weight: 700; color: var(--p-primary); font-size: 1.15rem;
  border-bottom: 1px solid var(--p-border); flex-shrink: 0; background:#fff;
}
.sidebar-brand { white-space: nowrap; }
.sidebar-pin { background: none; border: 0; padding: 0; line-height: 1; flex: 0 0 34px; }
.sidebar-brand i { font-size: 1.4rem; }
.sidebar-menu {
  list-style: none; margin: 0; padding: .375rem .75rem .75rem;
  flex: 1; min-height: 0; overflow: hidden auto; overscroll-behavior-y: contain;
}
.sidebar-menu .menu-link {
  display: flex; width: 100%; height: 2rem; gap: .55rem; align-items: center;
  padding: 0 .5rem; border: 0; border-radius: .4rem;
  background: transparent; color: var(--p-text); text-align: left; font: inherit; font-weight: 500;
}
.sidebar-menu .menu-link > i:first-child { width: 1.4rem; flex: 0 0 1.4rem; text-align: center; }
.sidebar-menu .menu-link span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-menu .menu-link:hover, .sidebar-menu .menu-link:focus-visible { background: rgba(105,108,255,.08); color: var(--p-primary); }
.sidebar-menu .menu-link.active { background: var(--p-primary); color: white; }
.sidebar-menu .menu-sub { display: none; list-style: none; padding: 0; margin: 0; }
.sidebar-menu .menu-item.open > .menu-sub { display: block; }
.sidebar-menu .menu-sub .menu-link { height: 1.8rem; padding-left: 1rem; font-size: .88rem; }
.sidebar-menu .menu-sub .menu-link > i { font-size: .8rem; }
.sidebar-menu .menu-toggle .arrow { margin-left: auto; font-size: .68rem; }
.sidebar-menu .menu-item.open > .menu-toggle .arrow { transform: rotate(90deg); }
.sidebar-menu .menu-item.open > .menu-toggle { color: var(--p-primary); }

/* ---- Navbar ---- */
.layout-navbar {
  height: var(--p-navbar-h); background: #fff; border-radius: .5rem; margin: .75rem 1.5rem 0;
  display: flex; align-items: center; padding: 0 1rem; box-shadow: var(--p-card-shadow);
  position: sticky; top: .75rem; z-index: 1020;
}
.navbar-toggle { border: none; background: transparent; font-size: 1.35rem; color: var(--p-text); }

/* ---- Cards ---- */
.card { border: 0; border-radius: .5rem; box-shadow: var(--p-card-shadow); margin-bottom: 1.5rem; }
.card-header { background: transparent; border-bottom: 1px solid var(--p-border); font-weight: 600; padding: 1.25rem 1.5rem; }
.card-body { padding: 1.5rem; }
.card-title { color: var(--p-heading); }

/* ---- Stat cards ---- */
.stat-card .stat-icon {
  width: 2.75rem; height: 2.75rem; border-radius: .5rem; display: flex; align-items: center;
  justify-content: center; font-size: 1.3rem;
}
.stat-card .stat-value { font-size: 1.5rem; font-weight: 700; color: var(--p-heading); }

/* ---- Tables ---- */
table.dataTable thead th { color: var(--p-heading); text-transform: uppercase; font-size: .8125rem; letter-spacing: .02em; }
.table > :not(caption) > * > * { padding: .75rem 1rem; }
.badge-soft-primary { background: rgba(105,108,255,.12); color: var(--p-primary); }
.badge-soft-success { background: rgba(40,199,111,.14); color: #28c76f; }
.badge-soft-secondary { background: rgba(130,134,139,.14); color: #82868b; }

/* ---- Login ---- */
.auth-wrapper { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem;
  background: linear-gradient(135deg, #f5f5f9 0%, #ececf7 100%); }
.auth-card { width: 100%; max-width: 420px; }
.auth-brand { text-align: center; margin-bottom: 1.25rem; color: var(--p-primary); font-weight: 700; font-size: 1.4rem; }

/* ---- Utilities ---- */
.cursor-pointer { cursor: pointer; }
.text-muted-2 { color: #a5a3ae; }
.btn-xs { padding: .15rem .4rem; font-size: .72rem; line-height: 1.2; }
.bg-label-primary { background: rgba(105,108,255,.12) !important; color: var(--p-primary) !important; }
.bg-label-secondary { background: rgba(130,134,139,.16) !important; color: #82868b !important; }
.btn-label-secondary { background: rgba(130,134,139,.14); border: none; color: #6d6b77; }
.btn-label-secondary:hover { background: rgba(130,134,139,.24); color: #4b465c; }
.accordion-button:not(.collapsed) { background: rgba(105,108,255,.06); color: var(--p-heading); box-shadow: none; }
.accordion-button:focus { box-shadow: none; border-color: var(--p-border); }
.accordion-button::after { flex-shrink: 0; }
.sidebar-backdrop { display:none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 1029; }

/* ---- Sidebar mini-collapse (desktop) ---- */
@media (min-width: 992px) {
  .sidebar-menu { scrollbar-gutter: stable; padding: .25rem .4rem .5rem; }
  html.sidebar-collapsed .layout-page { margin-left: 64px; }
  html.sidebar-collapsed .layout-sidebar { width: 64px; }
  html.sidebar-collapsed .layout-sidebar:hover,
  html.sidebar-collapsed .layout-sidebar:focus-within { width: var(--p-sidebar-w); box-shadow: 0 .5rem 2rem rgba(75,70,92,.2); }
  html.sidebar-collapsed .layout-sidebar:not(:hover):not(:focus-within) .sidebar-brand { padding-left: .65rem; }
  html.sidebar-collapsed .layout-sidebar:not(:hover):not(:focus-within) .sidebar-brand span,
  html.sidebar-collapsed .layout-sidebar:not(:hover):not(:focus-within) .menu-link span,
  html.sidebar-collapsed .layout-sidebar:not(:hover):not(:focus-within) .arrow { visibility: hidden; }
}

/* ---- Responsive ---- */
@media (max-width: 991.98px) {
  .layout-sidebar { transform: translateX(-100%); width: var(--p-sidebar-w); }
  .layout-sidebar.show { transform: translateX(0); }
  .layout-page { margin-left: 0 !important; }
  .sidebar-backdrop.show { display: block; }
}
