/* =========================================================
   SI-LARA — Sistem Laporan Realisasi Anggaran
   Tema warna: Biru - Putih (identitas Kominfo/Komdigi)
   Desain profesional: tipografi Inter, shadow lembut, aksen konsisten
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    --biru-tua: #0A3457;
    --biru-tua-2: #0A3D91;
    --biru: #0B5FBF;
    --biru-muda: #2E8BEE;
    --biru-pucat: #EAF3FF;
    --biru-pucat-2: #F6F9FC;
    --putih: #FFFFFF;
    --abu: #6B7A90;
    --abu-terang: #E7ECF3;
    --merah: #D64545;
    --merah-pucat: #FBEAEA;
    --hijau: #1E9E5A;
    --hijau-pucat: #E7F8EE;
    --kuning: #C4790E;
    --kuning-pucat: #FDF3E3;
    --ungu: #6A4FC7;
    --radius: 12px;
    --shadow: 0 1px 2px rgba(15, 35, 75, 0.04), 0 4px 16px rgba(15, 35, 75, 0.06);
    --shadow-lg: 0 8px 28px rgba(15, 35, 75, 0.10);
}

* { box-sizing: border-box; }

body {
    background: var(--biru-pucat-2);
    font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
    font-size: 14px;
    color: #1E2A3C;
    margin: 0;
    -webkit-font-smoothing: antialiased;
    touch-action: manipulation; /* cegah double-tap zoom di iOS Safari, biar berasa app native */
}

/* ===================== TIPOGRAFI DASAR (konsisten di semua halaman) ===================== */
h1, h2, h3, h4, h5, h6 { font-family: 'Inter', 'Segoe UI', Arial, sans-serif; }

.form-label {
    font-size: 13px;
    font-weight: 600;
    color: #38455A;
    margin-bottom: 6px;
}

.form-control, .form-select {
    font-size: 13.5px;
}

.form-text { font-size: 12px; }

.modal-title { font-size: 16.5px; font-weight: 700; }

.btn { font-size: 13.5px; }
.btn-sm { font-size: 12.5px; }

.alert { font-size: 13px; }

label.form-label span.text-danger { font-weight: 400; }

a { text-decoration: none; }

::selection { background: var(--biru-muda); color: var(--putih); }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #C7D4E5; border-radius: 10px; }
::-webkit-scrollbar-track { background: transparent; }

/* ===================== LOGIN ===================== */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--biru-tua) 0%, var(--biru) 55%, var(--biru-muda) 100%);
    padding: 20px;
}

.login-card {
    background: var(--putih);
    border-radius: 20px;
    box-shadow: 0 24px 60px rgba(5, 20, 45, 0.30);
    max-width: 920px;
    width: 100%;
    display: flex;
    overflow: hidden;
}

.login-side {
    background: linear-gradient(160deg, var(--biru-tua), var(--biru) 65%, var(--biru-muda));
    color: var(--putih);
    flex: 1;
    padding: 48px 38px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
}

.login-side::before {
    content: "";
    position: absolute;
    left: -40px;
    top: -40px;
    width: 140px;
    height: 140px;
    background: rgba(255,255,255,0.06);
    border-radius: 50%;
}

.login-side::after {
    content: "";
    position: absolute;
    right: -60px;
    bottom: -60px;
    width: 220px;
    height: 220px;
    background: rgba(255,255,255,0.08);
    border-radius: 50%;
}

.login-side h1 {
    font-size: 27px;
    margin: 16px 0 6px;
    font-weight: 800;
    letter-spacing: 0.3px;
}

.login-side p {
    opacity: 0.9;
    line-height: 1.6;
    font-size: 14px;
}

.login-logo-badge {
    width: 56px;
    height: 56px;
    background: var(--putih);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: var(--biru-tua);
    font-size: 20px;
}

.login-form-box {
    flex: 1;
    padding: 45px 40px;
}

.login-form-box h2 {
    color: var(--biru-tua);
    font-weight: 700;
    margin-bottom: 4px;
}

.login-form-box .subtitle {
    color: var(--abu);
    font-size: 14px;
    margin-bottom: 28px;
}

.form-control:focus {
    border-color: var(--biru);
    box-shadow: 0 0 0 3px rgba(11, 95, 191, 0.15);
}

/* ===================== LOGIN/REGISTER — RESPONSIF (mobile & PWA) ===================== */
@media (max-width: 768px) {
    .login-wrapper { padding: 14px; align-items: flex-start; padding-top: max(14px, calc(env(safe-area-inset-top, 0px) + 14px)); }

    .login-card {
        flex-direction: column;
        max-width: 440px;
        border-radius: 18px;
        margin: auto;
    }

    .login-side {
        padding: 26px 26px 22px;
        text-align: center;
        align-items: center;
        flex: none;
    }
    .login-side::before, .login-side::after { display: none; }
    .login-logo-badge { width: 46px; height: 46px; font-size: 18px; margin: 0 auto; }
    .login-side h1 { font-size: 21px; margin: 10px 0 4px; }
    .login-side p { font-size: 12.5px; margin: 0; }
    .login-side p + p { display: none; }

    .login-form-box { flex: none; padding: 26px 22px 30px; }
    .login-form-box h2 { font-size: 18px; }
    .login-form-box .subtitle { font-size: 13px; margin-bottom: 20px; }

    /* Font-size 16px pada input mencegah auto-zoom Safari/Chrome saat fokus di HP */
    .login-form-box .form-control { font-size: 16px; padding: 11px 14px; }
    .login-form-box .btn-biru { padding: 12px 20px; font-size: 15px; }
    .demo-akun { font-size: 12px; }
}

@media (max-width: 420px) {
    .login-wrapper { padding: 0; align-items: stretch; }
    .login-card { border-radius: 0; min-height: 100vh; box-shadow: none; margin: 0; max-width: 100%; }
    .login-form-box { padding-bottom: calc(30px + env(safe-area-inset-bottom, 0px)); }
}

/* Saat dibuka sebagai PWA terpasang (standalone), beri jarak status bar HP */
@media (display-mode: standalone) {
    .login-wrapper { padding-top: max(20px, calc(env(safe-area-inset-top, 0px) + 16px)); }
}

.btn-biru {
    background: var(--biru-tua-2);
    border: 1px solid var(--biru-tua-2);
    color: var(--putih);
    font-weight: 600;
    padding: 9px 20px;
    border-radius: 8px;
    transition: 0.15s ease;
    box-shadow: 0 1px 2px rgba(10,61,145,0.15);
}
.btn-biru:hover { background: var(--biru); border-color: var(--biru); color: var(--putih); transform: translateY(-1px); box-shadow: 0 4px 10px rgba(10,61,145,0.22); }
.btn-biru:active { transform: translateY(0); }
.btn-biru:disabled, .btn-biru[disabled] { opacity: 0.55; transform: none; box-shadow: none; }

.demo-akun {
    margin-top: 22px;
    background: var(--biru-pucat);
    border-radius: 8px;
    padding: 12px 14px;
    font-size: 12.5px;
    color: var(--biru-tua);
}

/* ===================== LAYOUT ===================== */
.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 254px;
    background: linear-gradient(190deg, #0A3457 0%, #082B49 55%, #061F37 100%);
    color: var(--putih);
    flex-shrink: 0;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    overflow-y: auto;
    z-index: 200;
    border-right: 1px solid rgba(255,255,255,0.04);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 22px 18px;
    border-bottom: 1px solid rgba(255,255,255,0.10);
}

.sidebar-brand .badge-logo {
    width: 40px; height: 40px;
    background: var(--putih);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    color: var(--biru-tua); font-weight: 800;
    font-size: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.sidebar-brand .brand-text b { font-size: 15px; display:block; letter-spacing: 0.3px; }
.sidebar-brand .brand-text span { font-size: 11px; opacity: 0.68; }

.sidebar-menu { padding: 16px 12px; }

.sidebar-menu .menu-label {
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    opacity: 0.45;
    padding: 16px 12px 8px;
    font-weight: 600;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 11px;
    color: rgba(255,255,255,0.82);
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 500;
    margin-bottom: 2px;
    transition: 0.15s ease;
}

.sidebar-menu a i { width: 16px; text-align: center; font-size: 13px; opacity: 0.9; }

.sidebar-menu a:hover {
    background: rgba(255,255,255,0.08);
    color: var(--putih);
    padding-left: 17px;
}

.sidebar-menu a.active {
    background: var(--putih);
    color: var(--biru-tua);
    font-weight: 700;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.main-content {
    margin-left: 254px;
    flex: 1;
    width: calc(100% - 254px);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.topbar {
    background: var(--putih);
    box-shadow: 0 1px 0 rgba(15,35,75,0.06);
    padding: 14px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 90;
}

.topbar h4 { margin: 0; color: var(--biru-tua); font-weight: 700; font-size: 18px; letter-spacing: -0.2px; }
.topbar .sub { font-size: 12.5px; color: var(--abu); margin-top: 1px; }

.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--biru-pucat);
    padding: 6px 14px 6px 8px;
    border-radius: 30px;
    border: 1px solid rgba(10,61,145,0.06);
}

.user-chip .avatar {
    width: 32px; height: 32px;
    background: linear-gradient(150deg, var(--biru-tua-2), var(--biru));
    color: var(--putih);
    border-radius: 50%;
    display: flex; align-items:center; justify-content:center;
    font-weight: 700; font-size: 13px;
}

.page-body { padding: 28px; max-width: 1400px; flex: 1 0 auto; width: 100%; }

/* ===================== CARDS ===================== */
.stat-card {
    background: var(--putih);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    border-left: 4px solid var(--biru);
    height: 100%;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }

.stat-card .stat-icon {
    width: 44px; height: 44px;
    border-radius: 10px;
    display: flex; align-items:center; justify-content:center;
    font-size: 18px;
    margin-bottom: 12px;
}

.stat-card .stat-label { color: var(--abu); font-size: 12.5px; margin-bottom: 4px; font-weight: 500; }
.stat-card .stat-value { color: var(--biru-tua); font-size: 23px; font-weight: 800; letter-spacing: -0.3px; }

.bg-icon-blue { background: var(--biru-pucat); color: var(--biru-tua-2); }
.bg-icon-green { background: var(--hijau-pucat); color: var(--hijau); }
.bg-icon-orange { background: var(--kuning-pucat); color: var(--kuning); }
.bg-icon-red { background: var(--merah-pucat); color: var(--merah); }

.card-panel {
    background: var(--putih);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid rgba(15,35,75,0.04);
}

.card-panel .card-header {
    background: var(--putih);
    border-bottom: 1px solid var(--abu-terang);
    font-weight: 700;
    color: var(--biru-tua);
    padding: 16px 20px;
    border-radius: var(--radius) var(--radius) 0 0 !important;
    font-size: 14.5px;
    letter-spacing: -0.1px;
}

.card-panel .card-body { padding: 20px; }

/* ===================== TABLE ===================== */
table.table thead th {
    background: var(--biru-pucat);
    color: var(--biru-tua-2);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    border-bottom: none;
    white-space: nowrap;
    padding: 12px 16px;
}

table.table td { font-size: 13.5px; vertical-align: middle; padding: 12px 16px; border-color: var(--abu-terang); }
table.table tbody tr:hover { background: var(--biru-pucat-2); }
table.table tbody tr:last-child td { border-bottom: none; }
table.table td.text-end,
table.table th.text-end { white-space: nowrap; }

/* Dropdown status ringkas di dalam tabel (realisasi & pengajuan) */
.status-select-inline {
    font-size: 11.5px;
    font-weight: 600;
    padding: 5px 28px 5px 12px;
    min-width: 128px;
    width: auto;
    display: inline-block;
    border-radius: 20px;
    background-position: right 10px center;
    background-size: 12px 12px;
}

.progress { background: var(--abu-terang); height: 7px; border-radius: 6px; }
.progress-bar { background: linear-gradient(90deg, var(--biru-tua-2), var(--biru-muda)); }

/* ===================== BADGE ===================== */
.badge-status {
    padding: 4px 11px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.1px;
    white-space: nowrap;
}
.badge-draft { background: #EEF0F4; color: #616E80; }
.badge-verif { background: var(--kuning-pucat); color: var(--kuning); }
.badge-approve { background: var(--hijau-pucat); color: var(--hijau); }
.badge-reject { background: var(--merah-pucat); color: var(--merah); }
.badge-realized { background: #EDE9FB; color: var(--ungu); }

/* ===================== BUTTONS ===================== */
.btn-outline-biru {
    border: 1px solid var(--biru);
    color: var(--biru);
    background: transparent;
    font-weight: 500;
    transition: 0.15s ease;
}
.btn-outline-biru:hover { background: var(--biru); color: var(--putih); border-color: var(--biru); }

.btn-sm-action {
    width: 32px; height: 32px;
    display: inline-flex; align-items:center; justify-content:center;
    border-radius: 7px;
    border: none;
    transition: 0.15s ease;
}
.btn-sm-action:hover { transform: translateY(-1px); }

/* ===================== MISC ===================== */
.section-title {
    color: var(--biru-tua);
    font-weight: 700;
    margin-bottom: 16px;
}

.footer-app {
    text-align: center;
    padding: 18px 20px;
    color: var(--abu);
    font-size: 12px;
    flex-shrink: 0;
    border-top: 1px solid var(--abu-terang);
    background: var(--putih);
}

/* ===================== LOG TRACKER / AKTIVITAS ===================== */
.log-list { display: flex; flex-direction: column; }

.log-item {
    display: flex;
    gap: 14px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--abu-terang);
    transition: background 0.15s ease;
}
.log-item:last-child { border-bottom: none; }
.log-item:hover { background: var(--biru-pucat-2); }

.log-icon {
    width: 38px; height: 38px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.log-body { flex: 1; min-width: 0; }

.log-top {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 2px;
}

.log-aktivitas { font-weight: 600; font-size: 13.5px; color: #1E2A3C; }
.log-modul { font-size: 10.5px; font-weight: 600; }

.log-ket { font-size: 12.5px; color: var(--abu); margin-bottom: 4px; line-height: 1.5; }

.log-meta { font-size: 12px; color: #9AA5B5; }
.log-meta i { width: 12px; }

/* ===================== DETAIL MODAL (grid rincian) ===================== */
.detail-section-label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--biru-tua-2);
    margin-bottom: 12px;
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 20px;
}

.detail-item.detail-full { grid-column: 1 / -1; }

.detail-label {
    font-size: 11.5px;
    color: var(--abu);
    font-weight: 500;
    margin-bottom: 3px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.detail-value {
    font-size: 13.5px;
    color: #1E2A3C;
    line-height: 1.5;
}

@media print {
    .no-print { display: none !important; }
    .main-content { margin-left: 0 !important; width: 100% !important; }
}

@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.28s ease;
        box-shadow: 8px 0 30px rgba(0,0,0,0.25);
    }
    .sidebar.show { transform: translateX(0); }
    .main-content { margin-left: 0; width: 100%; }
}

/* ===================== BACKDROP (saat drawer sidebar terbuka di mobile) ===================== */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(6, 20, 40, 0.45);
    z-index: 99;
    opacity: 0;
    transition: opacity 0.2s ease;
}
.sidebar-backdrop.show { display: block; opacity: 1; }

/* ===================== BOTTOM NAVIGATION (ala Android, khusus layar HP) ===================== */
.bottom-nav {
    display: none;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    background: var(--putih);
    box-shadow: 0 -2px 16px rgba(15, 35, 75, 0.12);
    z-index: 150;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
    align-items: stretch;
}

.bn-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 6px 2px;
    color: #8A96A8;
    background: none;
    border: none;
    text-decoration: none;
    font-size: 10.5px;
    font-weight: 500;
    border-radius: 10px;
    transition: color 0.15s ease, background 0.15s ease;
}

.bn-item i { font-size: 18px; }

.bn-item.active {
    color: var(--biru-tua-2);
    font-weight: 700;
    background: var(--biru-pucat);
}

.bn-item:active { background: var(--biru-pucat); }

@media (max-width: 640px) {
    .bottom-nav { display: flex; }
    .page-body { padding-bottom: calc(78px + env(safe-area-inset-bottom, 0px)); }
    .footer-app { display: none; }
    .topbar { padding: 12px 16px; }
    .topbar h4 { font-size: 16px; }
    .topbar .sub { display: none; }
    .user-chip { padding: 5px 10px 5px 5px; }
    .user-chip > div:last-child { max-width: 90px; }
    .user-chip > div:last-child div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}

@media (max-width: 400px) {
    .user-chip > div:last-child { display: none; }
    .user-chip { padding: 0; background: none; border: none; }
}

/* PWA standalone mode: beri jarak ekstra atas untuk status bar/notch */
@media (display-mode: standalone) {
    .topbar { padding-top: max(14px, env(safe-area-inset-top, 14px)); }
}