:root {
    --brand-900: #0b3760;
    --brand-700: #0f4c81;
    --brand-500: #1a6fb8;
    --brand-100: #e8f1fa;
    --surface: #f5f7fb;
    --sidebar-w: 268px;
    --topbar-h: 60px;

    /* Font stack disamakan dengan aplikasi lama (AI Studio): tidak memuat font
       eksternal apapun - keduanya font sistem/OS (lebih cepat dimuat, tidak
       tergantung koneksi ke Google Fonts). font-mono dipakai untuk label, kode,
       angka, navigasi & tombol (kesan teknis/presisi seperti aplikasi lama);
       font-sans untuk paragraf/deskripsi supaya tetap nyaman dibaca. */
    --font-sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

* { box-sizing: border-box; }

/* html font-size mengecilkan SELURUH komponen Bootstrap 5 sekaligus (button,
   modal, form-control, table, badge, pagination, dropdown, dst) karena
   semuanya didefinisikan pakai satuan rem relatif ke elemen html - jadi
   perubahan di sini otomatis berlaku di SEMUA halaman/menu tanpa perlu
   mengedit tiap view satu-satu. Default browser 16px -> kita kecilkan. */
html { -webkit-text-size-adjust: 100%; font-size: 15px; }

body {
    font-family: var(--font-sans);
    background: var(--surface);
    color: #1f2937;
    font-size: 14px;
}

/* Komponen Bootstrap yang perlu sedikit disesuaikan lagi di luar efek rem,
   supaya konsisten rapat/kecil di semua halaman modul (Master Data,
   Purchasing, Inventory, dst). */
.table { font-size: .92rem; }
.table th { font-size: .8rem; text-transform: uppercase; color: #6b7280; font-weight: 600; }
.modal-title { font-size: 1.05rem; }
.form-label { font-size: .85rem; margin-bottom: .3rem; }
.form-control, .form-select { font-size: .9rem; }
.btn { font-size: .875rem; }
.btn-sm { font-size: .8rem; }
.badge { font-size: .75rem; }
.alert { font-size: .875rem; }
.input-group-text { font-size: .9rem; }
.small, small { font-size: .82rem; }

/* Label, navigasi, tombol, kode/angka, dan judul memakai font-mono - meniru
   gaya aplikasi lama, teks paragraf/deskripsi tetap font-sans agar mudah dibaca. */
.form-label,
.btn,
.badge,
h1, h2, h3, h4, h5, h6,
table th,
.app-topbar__title,
.app-sidebar *,
.stat-card__label, .stat-card__value,
.panel__header h3,
.login-card__brand h1,
.login-card__brand p,
.login-card__footer {
    font-family: var(--font-mono);
}

/* ===== Guest layout (login / change password) ===== */
.guest-body {
    min-height: 100vh;
    background: radial-gradient(circle at 20% 20%, var(--brand-700), var(--brand-900) 70%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.guest-wrapper { width: 100%; display: flex; justify-content: center; }

.login-card {
    background: #fff;
    border-radius: 16px;
    padding: 32px 28px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.login-card__brand { text-align: center; margin-bottom: 24px; }
.login-card__logo {
    width: 50px; height: 50px; border-radius: 13px;
    background: var(--brand-100); color: var(--brand-700);
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; margin: 0 auto 12px;
}
.login-card__brand h1 { font-size: 19px; font-weight: 700; margin: 0; color: var(--brand-900); letter-spacing: -.01em; }
.login-card__brand p { color: #6b7280; font-size: 12px; margin-top: 4px; }
.login-card__submit { padding: 10px; font-weight: 600; font-size: 13.5px; }
.login-card__footer { text-align: center; margin-top: 22px; font-size: 11px; color: #9ca3af; }

@media (max-width: 575.98px) {
    .guest-body { padding: 12px; }
    .login-card { padding: 26px 20px; border-radius: 14px; max-width: 100%; }
    .login-card__brand { margin-bottom: 20px; }
    .login-card__logo { width: 44px; height: 44px; font-size: 19px; }
    .login-card__brand h1 { font-size: 17px; }
}

/* ===== App shell (dashboard) ===== */
.app-shell { display: flex; min-height: 100vh; }

.app-sidebar {
    width: var(--sidebar-w);
    background: var(--brand-900);
    color: #cfe0ef;
    display: flex; flex-direction: column;
    position: fixed; top: 0; left: 0; height: 100vh;
    z-index: 1030;
    transition: transform .25s ease;
}
.app-sidebar__brand {
    display: flex; align-items: center; gap: 12px;
    padding: 18px 20px; font-size: 20px; color: #fff;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.app-sidebar__brand-title { font-weight: 700; font-size: 14px; line-height: 1.2; letter-spacing: -.01em; }
.app-sidebar__brand-sub { font-size: 10.5px; color: #8fb3d4; }
.app-sidebar__nav { flex: 1; overflow-y: auto; padding: 12px 10px; }

.app-sidebar__link, .app-sidebar__group-toggle {
    display: flex; align-items: center; gap: 12px; width: 100%;
    padding: 9px 12px; border: none; background: none; color: #cfe0ef;
    text-decoration: none; font-size: 12.5px; border-radius: 8px; margin-bottom: 2px;
    cursor: pointer;
}
.app-sidebar__link:hover, .app-sidebar__group-toggle:hover { background: rgba(255,255,255,.08); color: #fff; }
.app-sidebar__link.is-active, .app-sidebar__group-toggle.is-active { background: var(--brand-500); color: #fff; }
.app-sidebar__chevron { margin-left: auto; font-size: 10px; transition: transform .2s; }
.app-sidebar__group-toggle[aria-expanded="true"] .app-sidebar__chevron,
.app-sidebar__group-toggle:not(.collapsed) .app-sidebar__chevron { transform: rotate(180deg); }

.app-sidebar__submenu { padding-left: 30px; padding-top: 2px; padding-bottom: 6px; }
.app-sidebar__sublink {
    display: flex; align-items: center; justify-content: space-between;
    padding: 7px 10px; color: #a9c3dc; text-decoration: none;
    font-size: 12px; border-radius: 6px;
}
.app-sidebar__sublink:hover { background: rgba(255,255,255,.06); color: #fff; }
.app-sidebar__sublink.is-active { color: #fff; font-weight: 600; }
.badge-planned {
    font-size: 9.5px; background: rgba(255,255,255,.12); padding: 2px 6px;
    border-radius: 4px; color: #d9e6f2;
}
.app-sidebar__footer { padding: 14px 20px; font-size: 10.5px; color: #6f93b3; border-top: 1px solid rgba(255,255,255,.08); }

.app-main { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-width: 0; }

.app-topbar {
    height: var(--topbar-h);
    background: #fff; border-bottom: 1px solid #e5e7eb;
    display: flex; align-items: center; gap: 12px; padding: 0 20px;
    position: sticky; top: 0; z-index: 1020;
}
.app-topbar__burger { display: none; border: none; background: none; font-size: 20px; color: var(--brand-900); flex-shrink: 0; }
.app-topbar__title { font-size: 15px; font-weight: 700; margin: 0; color: var(--brand-900); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-topbar__spacer { flex: 1; min-width: 8px; }
.app-topbar__user { display: flex; align-items: center; gap: 9px; border: none; background: none; padding: 5px 6px; border-radius: 10px; flex-shrink: 0; }
.app-topbar__user:hover { background: #f3f4f6; }
.app-topbar__avatar {
    width: 30px; height: 30px; border-radius: 50%; background: var(--brand-700); color: #fff;
    display: flex; align-items: center; justify-content: center; font-weight: 700; text-transform: uppercase;
    font-size: 12.5px; flex-shrink: 0;
}
.app-topbar__user-info { text-align: left; }
.app-topbar__user-name { display: block; font-size: 12px; font-weight: 600; color: #111827; }
.app-topbar__user-role { display: block; font-size: 10px; color: #6b7280; }

.app-content { padding: 22px; flex: 1; }

.page-heading { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 18px; flex-wrap: wrap; gap: 10px; }
.page-heading h2 { font-size: 18px; font-weight: 700; margin: 0; color: var(--brand-900); }

.stat-card {
    background: #fff; border-radius: 12px; padding: 16px; display: flex; align-items: center; gap: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,.06); height: 100%;
}
.stat-card--outline { border: 1px solid #e5e7eb; box-shadow: none; }
.stat-card__icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }
.stat-card__value { font-size: 19px; font-weight: 700; color: #111827; line-height: 1.15; }
.stat-card__label { font-size: 11.5px; color: #6b7280; }

.panel { background: #fff; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.06); overflow: hidden; }
.panel__header { padding: 14px 16px; border-bottom: 1px solid #f1f2f4; }
.panel__header h3 { font-size: 13.5px; font-weight: 700; margin: 0; color: var(--brand-900); display: flex; gap: 8px; align-items: center; }
.panel .table { margin-bottom: 0; }
.panel .table th { font-size: 10.5px; text-transform: uppercase; color: #9ca3af; border-bottom-width: 1px; }
.panel .table td { font-size: 12.5px; }

.coming-soon { text-align: center; padding: 60px 16px; }
.coming-soon i { font-size: 48px; color: #cbd5e1; }
.coming-soon h2 { margin-top: 16px; font-size: 18px; font-weight: 700; color: var(--brand-900); }
.coming-soon p { max-width: 480px; margin: 10px auto 24px; font-size: 13px; }

.sidebar-backdrop {
    position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 1025;
    opacity: 0; visibility: hidden; transition: opacity .2s;
}
.sidebar-backdrop.is-visible { opacity: 1; visibility: visible; }

@media (max-width: 991.98px) {
    .app-sidebar { transform: translateX(-100%); }
    .app-sidebar.is-open { transform: translateX(0); }
    .app-main { margin-left: 0; }
    .app-topbar__burger { display: inline-flex; align-items: center; justify-content: center; }
}

/* ===== Ponsel (<= 575px): rapatkan spasi & sembunyikan teks yang tidak esensial ===== */
@media (max-width: 575.98px) {
    html { font-size: 13.5px; }
    :root { --topbar-h: 54px; }
    body { font-size: 13px; }
    .app-topbar { padding: 0 12px; gap: 8px; }
    .app-topbar__title { font-size: 13.5px; }
    .app-topbar__user-info { display: none; }
    .app-content { padding: 14px; }
    .page-heading { margin-bottom: 14px; }
    .page-heading h2 { font-size: 16px; }
    .page-heading .btn { width: 100%; justify-content: center; }
    .stat-card { padding: 12px; gap: 10px; }
    .stat-card__icon { width: 34px; height: 34px; font-size: 15px; border-radius: 8px; }
    .stat-card__value { font-size: 16px; }
    .stat-card__label { font-size: 10.5px; }
    .panel__header { padding: 12px 14px; }
    .panel .table th, .panel .table td { font-size: 11.5px; white-space: nowrap; }
    .btn { font-size: 12.5px; }

    /* Berlaku di SEMUA halaman modul (Master Data/Purchasing/Inventory/dst),
       bukan hanya dashboard - supaya rapi di smartphone tanpa perlu
       menyentuh tiap view. */
    .panel__header .input-group { max-width: 100% !important; width: 100%; }
    .panel__header { flex-direction: column; align-items: stretch !important; }
    .modal-dialog { margin: 10px; }
    .modal-body { padding: 14px; }
    .modal-header, .modal-footer { padding: 12px 14px; }
    .modal-footer { flex-wrap: wrap; gap: 6px; }
    .modal-footer .btn { flex: 1; }
    .table-responsive { -webkit-overflow-scrolling: touch; }
    .btn-group .btn { font-size: 11.5px; padding: .35rem .5rem; }
}
