:root {
    /* ---- Design tokens ---- */
    --erp-primary: #12876f;
    --erp-primary-dark: #0d6b58;
    --erp-radius: 14px;
    --erp-radius-sm: 10px;
    --erp-shadow-card: 0 1px 3px rgba(0, 0, 0, .06), 0 1px 2px rgba(0, 0, 0, .04);
    --erp-space-1: 8px;
    --erp-space-2: 12px;
    --erp-space-3: 16px;
    --erp-space-4: 24px;
    --erp-space-5: 32px;
    --erp-icon-size: 22px;

    --erp-sidebar-width: 250px;
    --erp-sidebar-collapsed-width: 64px;
    --erp-bottom-nav-height: 60px;

    /* Alias kept for the auth pages built earlier */
    --auth-accent: var(--erp-primary);
    --auth-accent-dark: var(--erp-primary-dark);

    /* ---- Bootstrap 5.3 variable overrides ----
       Ini yang membuat SEMUA .btn-primary/.card/.shadow-sm/heading di
       seluruh app/Views/** ikut berubah tanpa perlu edit satu-satu view. */
    --bs-primary: var(--erp-primary);
    --bs-primary-rgb: 18, 135, 111;
    --bs-border-radius: var(--erp-radius);
    --bs-border-radius-sm: var(--erp-radius-sm);
    --bs-border-radius-lg: 18px;
    --bs-box-shadow-sm: var(--erp-shadow-card);
    --bs-body-font-size: 0.9375rem;
    --bs-link-color: var(--erp-primary);
    --bs-link-color-rgb: 18, 135, 111;
    --bs-link-hover-color: var(--erp-primary-dark);
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.3rem; }
h4 { font-size: 1.15rem; }
h5 { font-size: 1.05rem; }
h6 { font-size: .95rem; }

.bi {
    font-size: var(--erp-icon-size);
    line-height: 1;
    vertical-align: -0.15em;
}

/* Tombol/link kecil (mis. ikon di dalam tombol/label) tidak perlu ikon sebesar itu */
.btn-sm .bi,
.dropdown-item .bi,
.nav-link .bi,
small .bi,
.small .bi {
    font-size: 1.1em;
}

@media (max-width: 991.98px) {
    .btn {
        min-height: 44px;
    }
    .btn-sm {
        min-height: 38px;
    }
}

body {
    background-color: #f5f6f8;
}

/* ---------------------------------------------------------------- */
/* Sidebar desktop (collapsible)                                     */
/* ---------------------------------------------------------------- */
.erp-sidebar {
    width: var(--erp-sidebar-width);
    min-height: calc(100vh - 56px);
    background-color: #fff;
    border-right: 1px solid #e5e7eb;
    position: sticky;
    top: 0;
    transition: width .15s ease;
    flex-shrink: 0;
}

body.sidebar-collapsed .erp-sidebar {
    width: var(--erp-sidebar-collapsed-width);
}

body.sidebar-collapsed .erp-sidebar .nav-label,
body.sidebar-collapsed .erp-sidebar .sidebar-heading {
    display: none;
}

body.sidebar-collapsed .erp-sidebar .nav-link {
    display: flex;
    justify-content: center;
    padding: 0.6rem;
    margin: 0.15rem 0.4rem;
}

body.sidebar-collapsed .erp-sidebar .nav-link .bi {
    margin: 0 !important;
}

.erp-sidebar-nav .nav-link {
    color: #495057;
    border-radius: var(--erp-radius-sm);
    margin: 0.1rem 0.5rem;
    padding: 0.5rem 0.75rem;
    display: flex;
    align-items: center;
}

.erp-sidebar-nav .nav-link.active,
.erp-sidebar-nav .nav-link:hover {
    background-color: rgba(18, 135, 111, 0.1);
    color: var(--erp-primary);
}

.sidebar-heading {
    letter-spacing: 0.04em;
}

.sidebar-heading-btn {
    letter-spacing: 0.04em;
    cursor: pointer;
}

.sidebar-chevron {
    font-size: 0.85rem !important;
    transition: transform .15s ease;
}

.sidebar-heading-btn[aria-expanded="false"] .sidebar-chevron {
    transform: rotate(-90deg);
}

.erp-sidebar-nav .nav-link.text-danger:hover {
    background-color: rgba(220, 53, 69, 0.08);
    color: #dc3545 !important;
}

#sidebarCollapseToggle .bi {
    font-size: 1.2rem;
}

/* ---------------------------------------------------------------- */
/* Navbar atas                                                       */
/* ---------------------------------------------------------------- */
.erp-navbar {
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    min-height: 60px;
    position: relative;
}

.erp-navbar .navbar-brand {
    color: #1f2937;
    font-size: 1.05rem;
}

.erp-navbar-btn {
    width: 44px;
    height: 44px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e5e7eb;
    border-radius: var(--erp-radius-sm);
    background: #fff;
    color: #374151;
}

.erp-navbar-btn:hover {
    background: #f3f4f6;
    color: var(--erp-primary);
}

.erp-navbar-btn.d-lg-inline-flex.align-items-center {
    width: auto;
    padding: 0 0.75rem;
}

/* ---------------------------------------------------------------- */
/* Bottom navigation (mobile)                                        */
/* ---------------------------------------------------------------- */
.erp-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1030;
    background: #fff;
    border-top: 1px solid #e5e7eb;
    display: flex;
    align-items: stretch;
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, .05);
}

.erp-bottom-nav .dropup {
    flex: 1;
    display: flex;
}

.erp-bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: var(--erp-bottom-nav-height);
    color: #6b7280;
    text-decoration: none;
    font-size: 0.7rem;
    font-weight: 500;
    border: 0;
    background: transparent;
    border-radius: var(--erp-radius-sm);
    margin: 4px 2px;
}

.erp-bottom-nav-item .bi {
    font-size: 1.3rem;
}

.erp-bottom-nav-item.active,
.erp-bottom-nav-item:hover {
    color: var(--erp-primary);
    background: rgba(18, 135, 111, 0.08);
}

/* Tombol Tambah (FAB) di tengah -- sengaja diangkat sedikit ke atas bar */
.erp-bottom-nav-center {
    flex: 0 0 auto !important;
    align-items: center;
    justify-content: center;
    padding: 0 0.5rem;
}

.erp-bottom-nav-fab {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: 4px solid #fff;
    background: var(--erp-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: -14px;
    box-shadow: 0 4px 12px rgba(18, 135, 111, .35);
}

.erp-bottom-nav-fab .bi {
    font-size: 1.4rem;
}

.erp-bottom-nav-fab:active {
    background: var(--erp-primary-dark);
}

@media (max-width: 991.98px) {
    body {
        padding-bottom: calc(var(--erp-bottom-nav-height) + env(safe-area-inset-bottom) + 8px);
    }
}

/* ---------------------------------------------------------------- */
/* Dashboard: kartu sambutan, stat, quick actions                    */
/* ---------------------------------------------------------------- */
.erp-greeting-card {
    background: linear-gradient(140deg, #17a389 0%, #0d6b58 100%);
    color: #fff;
    border-radius: var(--erp-radius);
    padding: var(--erp-space-4);
}

.erp-stat-card {
    background: #fff;
    border-radius: var(--erp-radius);
    box-shadow: var(--erp-shadow-card);
    padding: var(--erp-space-3);
    height: 100%;
}

.erp-stat-label {
    color: #6b7280;
    font-size: 0.85rem;
    font-weight: 600;
}

.erp-stat-value {
    font-size: 1.9rem;
    font-weight: 700;
    line-height: 1.2;
    color: #1f2937;
}

.erp-quick-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 88px;
    padding: var(--erp-space-2);
    background: #fff;
    border-radius: var(--erp-radius);
    box-shadow: var(--erp-shadow-card);
    color: #374151;
    text-decoration: none;
    text-align: center;
    font-size: 0.8rem;
    font-weight: 600;
}

.erp-quick-tile .bi {
    font-size: 1.5rem;
    color: var(--erp-primary);
}

.erp-quick-tile:hover {
    color: var(--erp-primary);
    background: #f9fafb;
}

.erp-quick-tile.is-disabled {
    opacity: .55;
    pointer-events: none;
}

/* ---------------------------------------------------------------- */
/* Auth pages (login/register/dst)                                   */
/* ---------------------------------------------------------------- */
body.auth-page {
    background-color: #eef1f4;
}

.auth-hero {
    background: linear-gradient(160deg, #17a389 0%, #0d6b58 100%);
    color: #fff;
}

.auth-hero-icon {
    width: 64px;
    height: 64px;
    border-radius: var(--erp-radius);
    background: rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
}

.auth-panel {
    background-color: #eef1f4;
}

.auth-card {
    border: none;
    border-radius: var(--bs-border-radius-lg);
}

.auth-card-icon {
    width: 48px;
    height: 48px;
    min-width: 48px;
    border-radius: var(--erp-radius-sm);
    background: rgba(18, 135, 111, 0.12);
    color: var(--auth-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.btn-auth-primary {
    background-color: var(--auth-accent);
    border-color: var(--auth-accent);
    color: #fff;
}

.btn-auth-primary:hover,
.btn-auth-primary:focus {
    background-color: var(--auth-accent-dark);
    border-color: var(--auth-accent-dark);
    color: #fff;
}

.auth-link {
    color: var(--auth-accent);
    font-weight: 600;
}

.auth-toggle-password {
    text-decoration: none;
    color: #6c757d;
}

.wilayah-group .form-label {
    margin-bottom: 0.2rem;
}

/* ---------------------------------------------------------------- */
/* Hirarki teks di dalam kartu (mobile)                              */
/* ---------------------------------------------------------------- */
/* Ukurannya mengikuti tingkatan H1-H4, tapi memakai class -- bukan tag
   <h1>..<h4> sungguhan. Satu halaman berisi belasan kartu; kalau tiap
   kartu memakai tag heading, struktur halaman jadi punya belasan H1 dan
   pembaca layar kehilangan urutan judul yang benar. */
.erp-card-h1 {
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.3;
    color: #1f2937;
}

.erp-card-h2 {
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.3;
    color: #1f2937;
}

.erp-card-h3 {
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.3;
    color: #374151;
}

.erp-card-h4 {
    font-size: 0.8rem;
    font-weight: 400;
    line-height: 1.35;
    color: #6b7280;
}

.erp-log-card .card-body {
    padding: var(--erp-space-2) var(--erp-space-3);
}

/* Nomor panjang (NPWP 16 digit, NITKU). tabular-nums membuat semua angka
   selebar sama sehingga lebarnya bisa diperkirakan dan tidak patah di
   tengah nomor -- angka yang terpotong jadi dua baris gampang salah baca. */
.erp-card-num {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
}

/* Kaki kartu data: tombol Edit & Hapus, dipisah garis tipis dari isinya. */
.erp-card-actions {
    display: flex;
    gap: 0.5rem;
    border-top: 1px solid #eef0f2;
    margin-top: 0.65rem;
    padding-top: 0.65rem;
}

.erp-card-actions > * {
    flex: 1;
}

.erp-card-actions .btn {
    width: 100%;
    min-height: 38px;
}

/* Tombol mungil untuk aksi sekunder (mis. "Lihat Semua" di judul daftar).
   min-height dinolkan supaya tidak ikut aturan tinggi 44px milik .btn di
   mobile -- tombol ini bukan aksi utama, jadi tidak perlu sebesar itu. */
.erp-btn-xs {
    padding: 0.2rem 0.6rem;
    font-size: 0.72rem;
    font-weight: 600;
    min-height: 0 !important;
    border-radius: 999px;
}

.erp-btn-xs .bi {
    font-size: 0.85rem;
}

/* ---------------------------------------------------------------- */
/* Foto profil                                                       */
/* ---------------------------------------------------------------- */
.erp-avatar-sm {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
}

.erp-avatar-lg {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .12);
}

.erp-avatar-placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(18, 135, 111, 0.12);
    color: var(--erp-primary);
    font-size: 2.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

/* ---------------------------------------------------------------- */
/* Grid hak akses role                                               */
/* ---------------------------------------------------------------- */
.erp-permission-table th,
.erp-permission-table td {
    vertical-align: middle;
}

.erp-permission-table .form-check {
    margin-bottom: 0;
    min-height: auto;
}

.erp-permission-table .form-check-input {
    width: 1.15em;
    height: 1.15em;
    cursor: pointer;
}

/* ---------------------------------------------------------------- */
/* Input huruf kapital                                               */
/* ---------------------------------------------------------------- */
/* Pasangan visual dari logika di app.js -- huruf langsung tampak besar
   saat diketik. Password/email/[data-no-uppercase] sengaja tidak ikut. */
input[type="text"]:not([data-no-uppercase]),
textarea:not([data-no-uppercase]) {
    text-transform: uppercase;
}

input[type="text"]::placeholder,
textarea::placeholder {
    text-transform: none;
}
