/* ===== BPI Daily Activity Cleaner ===== */
:root {
    --bpi-blue: #1460c4;
    --bpi-blue-dark: #0d4a99;
    --bpi-blue-soft: #e8f0fb;
    --bpi-green: #2e9d5b;
    --bpi-bg: #f3f5f9;
    --bpi-border: #e3e8ef;
    --bpi-text-muted: #6b7686;
    --bs-primary: #1460c4;
    --bs-primary-rgb: 20, 96, 196;
    --bs-link-color: #1460c4;
    --bs-link-color-rgb: 20, 96, 196;
    --bs-body-font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

body { background: var(--bpi-bg); color: #1e2733; font-size: .94rem; }
a { text-decoration: none; }

.btn-primary { --bs-btn-bg: var(--bpi-blue); --bs-btn-border-color: var(--bpi-blue); --bs-btn-hover-bg: var(--bpi-blue-dark); --bs-btn-hover-border-color: var(--bpi-blue-dark); --bs-btn-active-bg: var(--bpi-blue-dark); --bs-btn-disabled-bg: var(--bpi-blue); --bs-btn-disabled-border-color: var(--bpi-blue); }
.btn-outline-primary { --bs-btn-color: var(--bpi-blue); --bs-btn-border-color: var(--bpi-blue); --bs-btn-hover-bg: var(--bpi-blue); --bs-btn-hover-border-color: var(--bpi-blue); --bs-btn-active-bg: var(--bpi-blue); --bs-btn-active-border-color: var(--bpi-blue); }
.text-primary { color: var(--bpi-blue) !important; }
.bg-primary-soft { background: var(--bpi-blue-soft) !important; }
.form-control:focus, .form-select:focus { border-color: #7ea9e3; box-shadow: 0 0 0 .2rem rgba(20, 96, 196, .15); }

/* ---------- Brand ---------- */
.brand-logo {
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 800; letter-spacing: -.04em; color: var(--bpi-blue);
    background: #fff; border-radius: .55rem; padding: .05rem .45rem; font-size: 1.15rem; line-height: 1.4;
}
.brand-logo-img { padding: .15rem .35rem; }
.brand-logo-img img { height: 26px; max-width: 110px; object-fit: contain; display: block; }
.brand-logo-lg { font-size: 1.9rem; padding: .25rem 1rem; border-radius: .8rem; }
.brand-logo-lg.brand-logo-img img { height: 52px; max-width: 200px; }

/* Footer hak cipta */
.app-footer { margin-top: 2.5rem; padding-top: 1rem; border-top: 1px solid var(--bpi-border); text-align: center; font-size: .75rem; color: var(--bpi-text-muted); line-height: 1.6; }

/* Pratinjau pengaturan */
.preview-navbar { background: var(--bpi-blue); border-radius: .7rem; padding: .7rem 1rem; display: flex; align-items: center; gap: .6rem; color: #fff; }
.preview-print { border: 1.5px solid #000; display: grid; grid-template-columns: 26% 1fr 34%; font-family: Arial, sans-serif; color: #000; background: #fff; }
.preview-print > div { padding: .5rem; display: flex; flex-direction: column; justify-content: center; }
.preview-print > div + div { border-left: 1.5px solid #000; }
.preview-print .pv-logo { align-items: center; text-align: center; }
.preview-print .pv-logo img { max-width: 100%; max-height: 46px; object-fit: contain; }
.preview-print .pv-logo .mark { font-weight: 900; color: #1460c4; font-size: 1.2rem; }
.preview-print .pv-title { text-align: center; font-weight: 700; font-size: .95rem; }
.preview-print .pv-info { font-size: .72rem; }
.brand-text { font-weight: 700; font-size: .95rem; line-height: 1.1; }
.brand-text small { display: block; font-weight: 500; opacity: .8; font-size: .72rem; }

/* ---------- Navbar ---------- */
.app-navbar { background: var(--bpi-blue); box-shadow: 0 2px 8px rgba(13, 74, 153, .25); }
.app-navbar .nav-link { color: rgba(255, 255, 255, .82); font-weight: 500; border-radius: .5rem; padding: .45rem .75rem !important; }
.app-navbar .nav-link:hover { color: #fff; background: rgba(255, 255, 255, .1); }
.app-navbar .nav-link.active { color: #fff; background: rgba(255, 255, 255, .18); }
.app-navbar .nav-link { white-space: nowrap; display: flex; align-items: center; gap: .4rem; }
.app-navbar .nav-link .badge { font-size: .65rem; }
.app-navbar .navbar-brand { min-width: 0; }
.app-navbar .brand-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.app-navbar .user-meta { white-space: nowrap; }
/* Layar sedang: menu ikon saja (nama menu muncul sebagai tooltip), supaya tetap satu baris */
@media (min-width: 1200px) and (max-width: 1599.98px) {
    .app-navbar.nav-compact .nav-label { display: none; }
    .app-navbar.nav-compact .nav-link { padding: .5rem .7rem !important; font-size: 1.1rem; position: relative; }
    .app-navbar.nav-compact .nav-link .badge { position: absolute; top: 2px; right: -2px; font-size: .6rem; }
    .app-navbar.nav-compact .user-meta { display: none; }
}
/* Menu terlipat (☰): rata kiri, satu baris per menu */
@media (max-width: 1199.98px) {
    .app-navbar .navbar-collapse { padding-bottom: .5rem; }
}
.avatar {
    width: 34px; height: 34px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
    background: #fff; color: var(--bpi-blue); font-weight: 700; font-size: .8rem; flex-shrink: 0;
}
.avatar-sm { width: 28px; height: 28px; font-size: .7rem; background: var(--bpi-blue-soft); }

/* ---------- Kartu & umum ---------- */
.card { border: 1px solid var(--bpi-border); border-radius: .85rem; box-shadow: 0 1px 2px rgba(16, 24, 40, .04); }
.card-header { background: #fff; border-bottom: 1px solid var(--bpi-border); font-weight: 600; border-radius: .85rem .85rem 0 0 !important; }
.page-title { font-weight: 700; font-size: 1.35rem; margin: 0; }
.page-subtitle { color: var(--bpi-text-muted); font-size: .88rem; }
.text-muted-2 { color: var(--bpi-text-muted) !important; }
.small-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--bpi-text-muted); font-weight: 600; }
.table > :not(caption) > * > * { padding: .65rem .75rem; }
.table thead th { font-size: .75rem; text-transform: uppercase; letter-spacing: .03em; color: var(--bpi-text-muted); font-weight: 600; background: #f8fafc; white-space: nowrap; }
.table-hover tbody tr:hover > * { background: #f6f9fe; }

.stat-card { padding: 1rem 1.1rem; display: flex; flex-direction: row; gap: .85rem; align-items: center; height: 100%; }
.stat-card .stat-icon { width: 44px; height: 44px; border-radius: .7rem; display: flex; align-items: center; justify-content: center; font-size: 1.25rem; flex-shrink: 0; }
.stat-card .stat-value { font-size: 1.5rem; font-weight: 700; line-height: 1.1; }
.stat-card .stat-label { font-size: .8rem; color: var(--bpi-text-muted); }
a.stat-card-link { color: inherit; display: block; height: 100%; }
a.stat-card-link .card { transition: transform .12s, box-shadow .12s; }
a.stat-card-link:hover .card { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(16, 24, 40, .08); }

.status-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }

/* Grafik batang sederhana */
.mini-bars { display: flex; align-items: stretch; gap: 6px; height: 150px; }
.mini-bars .bar-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.mini-bars .bar-area { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; }
.mini-bars .bar { width: 100%; max-width: 34px; background: #b9d0f0; border-radius: 5px 5px 2px 2px; min-height: 2px; position: relative; }
.mini-bars .bar.today { background: var(--bpi-blue); }
.mini-bars .bar.weekend { background: #dbe3ee; }
.mini-bars .bar-val { font-size: .66rem; color: var(--bpi-text-muted); margin-bottom: 2px; }
.mini-bars .bar-lbl { font-size: .66rem; color: var(--bpi-text-muted); margin-top: 4px; white-space: nowrap; }

.hbar { height: 8px; background: #edf1f7; border-radius: 4px; overflow: hidden; }
.hbar > div { height: 100%; background: var(--bpi-blue); border-radius: 4px; }

/* ---------- Layar Cleaner (mobile-first) ---------- */
body.cleaner-mode { padding-bottom: 84px; }
.cleaner-container { max-width: 640px; margin: 0 auto; }
.bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 1030; background: #fff;
    border-top: 1px solid var(--bpi-border); display: flex; padding: .35rem 0 calc(.35rem + env(safe-area-inset-bottom));
    box-shadow: 0 -2px 10px rgba(16, 24, 40, .05);
}
.bottom-nav a { flex: 1; text-align: center; color: var(--bpi-text-muted); font-size: .72rem; font-weight: 600; padding: .25rem 0; }
.bottom-nav a i { display: block; font-size: 1.35rem; line-height: 1.2; }
.bottom-nav a.active { color: var(--bpi-blue); }

.report-header-card { background: linear-gradient(135deg, var(--bpi-blue), #2a7de1); color: #fff; border: 0; }
.report-header-card .meta-label { font-size: .7rem; opacity: .8; text-transform: uppercase; letter-spacing: .05em; }
.report-header-card .meta-value { font-weight: 600; font-size: .9rem; }
.report-header-card .btn-light { color: var(--bpi-blue); font-weight: 600; }

.btn-add-activity {
    font-size: 1.05rem; font-weight: 700; padding: .9rem; border-radius: .9rem;
    box-shadow: 0 6px 16px rgba(20, 96, 196, .28);
}

.task-card { border-left: 4px solid #f0ad4e; }
.task-card.done { border-left-color: var(--bpi-green); opacity: .8; }

.activity-item { display: flex; gap: .8rem; padding: .85rem 1rem; border-bottom: 1px solid var(--bpi-border); }
.activity-item:last-child { border-bottom: 0; }
.activity-item .time {
    font-weight: 700; font-size: .95rem; color: var(--bpi-blue); min-width: 50px; padding-top: 1px;
    font-variant-numeric: tabular-nums;
}
.activity-item .loc { font-weight: 600; }
.activity-item .area { font-size: .76rem; color: var(--bpi-text-muted); }
.activity-item .works { margin-top: .3rem; display: flex; flex-wrap: wrap; gap: .25rem; }
.work-pill { background: var(--bpi-blue-soft); color: var(--bpi-blue-dark); border-radius: 50rem; font-size: .74rem; padding: .15rem .55rem; font-weight: 500; }
.event-pill { background: #fff4e0; color: #9a5b00; border-radius: 50rem; font-size: .72rem; padding: .12rem .5rem; font-weight: 600; }
.proposed-pill { background: #fdecef; color: #b02a37; border-radius: 50rem; font-size: .66rem; padding: .05rem .4rem; font-weight: 600; }
.activity-item .actions { display: flex; flex-direction: column; gap: .3rem; }
.activity-item .actions .btn { padding: .25rem .5rem; font-size: .8rem; }

/* Modal aktivitas */
.modal-sheet .modal-content { border-radius: 1rem; border: 0; }
@media (max-width: 575.98px) {
    .modal-sheet .modal-dialog { margin: 0; position: fixed; bottom: 0; left: 0; right: 0; max-width: none; }
    .modal-sheet .modal-content { border-radius: 1.1rem 1.1rem 0 0; max-height: 94vh; }
    .modal-sheet.fade .modal-dialog { transform: translateY(100%); }
    .modal-sheet.show .modal-dialog { transform: none; }
}
.time-input { font-size: 1.6rem; font-weight: 700; text-align: center; padding: .4rem; letter-spacing: .05em; }
.time-quick .btn { font-size: .78rem; }

.chip {
    display: inline-flex; align-items: center; gap: .35rem; border: 1.5px solid var(--bpi-border); background: #fff;
    border-radius: 50rem; padding: .42rem .85rem; font-size: .86rem; font-weight: 500; cursor: pointer; user-select: none;
    margin: 0 .3rem .45rem 0; color: #334155; transition: all .1s;
}
.chip:hover { border-color: #9bbbe6; }
.chip.active { background: var(--bpi-blue); border-color: var(--bpi-blue); color: #fff; }
.chip.active .bi-check-lg { display: inline-block !important; }
.chip.chip-event.active { background: #e08a00; border-color: #e08a00; }
.chip.chip-new { border-style: dashed; }

.selected-location {
    border: 1.5px solid var(--bpi-blue); background: var(--bpi-blue-soft); border-radius: .75rem; padding: .6rem .8rem;
    display: flex; align-items: center; gap: .6rem;
}
.selected-location .icon { font-size: 1.3rem; color: var(--bpi-blue); }
.location-results { max-height: 260px; overflow-y: auto; border: 1px solid var(--bpi-border); border-radius: .6rem; }
.location-results .list-group-item { border-left: 0; border-right: 0; cursor: pointer; padding: .6rem .8rem; }
.location-results .list-group-item:first-child { border-top: 0; }
.location-results .list-group-item:hover { background: #f4f8fe; }

.sticky-actions { position: sticky; bottom: 0; background: #fff; border-top: 1px solid var(--bpi-border); }

/* ---------- Approval / laporan ---------- */
.timeline { list-style: none; padding: 0; margin: 0; position: relative; }
.timeline li { position: relative; padding: 0 0 1rem 2.1rem; }
.timeline li::before { content: ""; position: absolute; left: 13px; top: 26px; bottom: 0; width: 2px; background: var(--bpi-border); }
.timeline li:last-child::before { display: none; }
.timeline .tl-icon { position: absolute; left: 0; top: 0; width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: .85rem; color: #fff; }

.sign-box { border: 1px dashed #c7d2e0; border-radius: .7rem; padding: .8rem; text-align: center; height: 100%; }
.sign-box .sign-title { font-size: .75rem; color: var(--bpi-text-muted); }
.sign-box .sign-status { margin: .5rem 0; font-size: 1.4rem; }
.sign-box .sign-name { font-weight: 700; border-top: 1px solid #c7d2e0; padding-top: .35rem; margin-top: .35rem; }
.sign-box .sign-role { font-size: .74rem; color: var(--bpi-text-muted); }

/* Matriks rekap klien */
.matrix td, .matrix th { text-align: center; vertical-align: middle; }
.matrix td:first-child, .matrix th:first-child { text-align: left; }
.matrix .cell { display: inline-flex; align-items: center; justify-content: center; min-width: 38px; height: 30px; border-radius: .45rem; font-weight: 700; font-size: .8rem; color: #fff; }
.matrix .cell.empty { background: #f1f4f8; color: #b6c0cc; font-weight: 400; }

/* Login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem; background: linear-gradient(160deg, var(--bpi-blue) 0%, #2a7de1 45%, var(--bpi-bg) 45%); }
.login-card { width: 100%; max-width: 400px; border-radius: 1.1rem; border: 0; box-shadow: 0 12px 40px rgba(13, 74, 153, .18); }

/* Toast */
.toast-container { z-index: 1090; }

@media (max-width: 767.98px) {
    .page-title { font-size: 1.15rem; }
    .table-responsive-stack thead { display: none; }
}

/* ---------- Sub-menu (master data, tahap persetujuan) ---------- */
.subnav {
    display: flex; align-items: stretch; gap: .25rem; background: #fff; border: 1px solid var(--bpi-border);
    border-radius: .9rem; padding: .35rem; overflow-x: auto; scroll-behavior: smooth;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
    scrollbar-width: thin; scrollbar-color: #c9d3e1 transparent;
}
.subnav::-webkit-scrollbar { height: 6px; }
.subnav::-webkit-scrollbar-track { background: transparent; }
.subnav::-webkit-scrollbar-thumb { background: #c9d3e1; border-radius: 6px; }
.subnav::-webkit-scrollbar-thumb:hover { background: #9fb0c8; }
.subnav-inline { display: inline-flex; max-width: 100%; }

/* Pembungkus: tombol panah + efek pudar bila ada menu yang tersembunyi */
.subnav-wrap { position: relative; }
.subnav-wrap.subnav-wrap-inline { display: inline-block; max-width: 100%; }
.subnav-wrap > .subnav { margin-bottom: 0 !important; }
.subnav-wrap.is-scrollable > .subnav { padding-bottom: .45rem; }
.subnav-wrap::before, .subnav-wrap::after {
    content: ""; position: absolute; top: 1px; bottom: 1px; width: 64px; pointer-events: none; z-index: 1;
    opacity: 0; transition: opacity .15s;
}
.subnav-wrap::before { left: 1px; border-radius: .9rem 0 0 .9rem; background: linear-gradient(to right, #fff 35%, rgba(255, 255, 255, 0)); }
.subnav-wrap::after { right: 1px; border-radius: 0 .9rem .9rem 0; background: linear-gradient(to left, #fff 35%, rgba(255, 255, 255, 0)); }
.subnav-wrap.can-left::before, .subnav-wrap.can-right::after { opacity: 1; }
.subnav-btn {
    position: absolute; top: calc(50% - 3px); transform: translateY(-50%); z-index: 2;
    width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--bpi-border); background: #fff;
    color: var(--bpi-blue); box-shadow: 0 2px 8px rgba(16, 24, 40, .12);
    display: flex; align-items: center; justify-content: center; font-size: .9rem; padding: 0;
    opacity: 0; visibility: hidden; transition: opacity .15s, background .12s;
}
.subnav-btn:hover { background: var(--bpi-blue); color: #fff; border-color: var(--bpi-blue); }
.subnav-btn.prev { left: 6px; }
.subnav-btn.next { right: 6px; }
.subnav-wrap.can-left .subnav-btn.prev, .subnav-wrap.can-right .subnav-btn.next { opacity: 1; visibility: visible; }
@media (hover: none) { .subnav-btn { width: 28px; height: 28px; } }
.subnav a {
    display: flex; align-items: center; gap: .55rem; padding: .4rem .85rem .4rem .45rem; border-radius: .65rem;
    color: #475467; font-weight: 500; font-size: .88rem; white-space: nowrap; transition: background .12s, color .12s;
}
.subnav a .ico {
    width: 30px; height: 30px; border-radius: .55rem; display: inline-flex; align-items: center; justify-content: center;
    background: #f1f4f9; color: #64748b; font-size: .95rem; flex-shrink: 0; transition: background .12s, color .12s;
}
.subnav a:hover { background: #f5f8fd; color: var(--bpi-blue); }
.subnav a:hover .ico { background: var(--bpi-blue-soft); color: var(--bpi-blue); }
.subnav a.active { background: var(--bpi-blue-soft); color: var(--bpi-blue-dark); font-weight: 600; }
.subnav a.active .ico { background: var(--bpi-blue); color: #fff; box-shadow: 0 2px 6px rgba(20, 96, 196, .3); }
.subnav a .count {
    margin-left: .1rem; min-width: 22px; padding: 0 .4rem; height: 20px; border-radius: 50rem; font-size: .72rem; font-weight: 700;
    display: inline-flex; align-items: center; justify-content: center; background: #eef1f5; color: #475467;
}
.subnav a.active .count { background: var(--bpi-blue); color: #fff; }
.subnav-sep { width: 1px; background: var(--bpi-border); margin: .45rem .3rem; flex-shrink: 0; }

/* ---------- Laporan kinerja ---------- */
.chart-box { position: relative; height: 260px; }
.perf-period { font-size: .85rem; color: var(--bpi-text-muted); }
.perf-hero-value { font-size: 3.2rem; font-weight: 800; line-height: 1; letter-spacing: -.02em; }
.delta { font-size: .78rem; font-weight: 600; white-space: nowrap; }
.delta-up { color: #1d7a45; }
.delta-down { color: #c0392b; }
.delta-flat { color: var(--bpi-text-muted); }
.perf-pill { display: inline-block; min-width: 56px; padding: .15rem .5rem; border-radius: 50rem; font-weight: 600; font-size: .82rem;
    background: linear-gradient(90deg, var(--bpi-blue-soft) var(--v), #f3f5f9 var(--v)); color: var(--bpi-blue-dark); }
.perf-table th.sort-asc::after { content: " ▲"; font-size: .6rem; }
.perf-table th.sort-desc::after { content: " ▼"; font-size: .6rem; }
.perf-method .card-header { cursor: pointer; }

.perf-cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.perf-cal-head { text-align: center; font-size: .7rem; font-weight: 600; color: var(--bpi-text-muted); text-transform: uppercase; }
.perf-cal-day { position: relative; aspect-ratio: 1.25; border-radius: .55rem; padding: .3rem .4rem; display: flex; flex-direction: column;
    justify-content: space-between; font-size: .75rem; color: #fff; border: 1px solid transparent; min-height: 42px; }
.perf-cal-day .n { font-weight: 700; }
.perf-cal-day .a { font-size: .7rem; opacity: .9; text-align: right; }
.perf-cal-day .flag { position: absolute; top: .3rem; right: .35rem; font-size: .7rem; }
a.perf-cal-day:hover { filter: brightness(.92); color: #fff; }
.perf-cal-day.st-tepat { background: #2e9d5b; }
.perf-cal-day.st-telat { background: #e0a800; color: #3d2e00; }
.perf-cal-day.st-telat .flag, .perf-cal-day.st-telat .a { color: #3d2e00; }
.perf-cal-day.st-absen { background: #d64550; }
.perf-cal-day.st-off { background: #f1f4f8; color: #9aa5b1; }
.perf-cal-day.st-future { background: #fff; color: #c3cad3; border: 1px dashed #dde3ea; }

/* ---------- Cetak ---------- */
@media print {
    @page { size: A4 portrait; margin: 12mm; }
    body { background: #fff; font-size: 11px; }
    .app-navbar, .bottom-nav, .no-print, .toast-container, .subnav-wrap, .subnav-btn { display: none !important; }
    main { padding: 0 !important; max-width: none !important; }
    .card { box-shadow: none !important; break-inside: avoid; }
    .collapse.d-print-block { display: block !important; }
    .row > [class*="col-lg"] { break-inside: avoid; }
    a { color: inherit !important; }
}

/* ---------- Indikator loading global ---------- */
.page-progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 2000; pointer-events: none; opacity: 0; transition: opacity .25s; }
.page-progress.active { opacity: 1; }
.page-progress .bar {
    height: 100%; width: 0; background: linear-gradient(90deg, #ffd54f, #ffb300);
    box-shadow: 0 0 10px rgba(255, 179, 0, .8), 0 0 4px rgba(255, 179, 0, .6); transition: width .25s ease; border-radius: 0 2px 2px 0;
}
.page-loading-pill {
    position: fixed; top: 14px; left: 50%; z-index: 2001; transform: translate(-50%, -12px); opacity: 0; pointer-events: none;
    background: #1e2733; color: #fff; font-size: .82rem; font-weight: 600; padding: .45rem .9rem; border-radius: 50rem;
    box-shadow: 0 6px 20px rgba(16, 24, 40, .25); display: flex; align-items: center; transition: opacity .2s, transform .2s;
}
.page-loading-pill.show { opacity: 1; transform: translate(-50%, 0); }
body.is-loading, body.is-loading a, body.is-loading button { cursor: progress !important; }
@media print { .page-progress, .page-loading-pill { display: none !important; } }
