/* SIMPEKA — tema antarmuka */
:root {
    --ink: #101828;
    --muted: #667085;
    --line: #e4e7ec;
    --surface: #f4f6fa;
    --navy: #0f2a4a;
    --navy-2: #163a63;
    --accent: #155eef;
    --sidebar-w: 248px;
    --bs-primary: #155eef;
    --bs-primary-rgb: 21, 94, 239;
    --bs-body-font-family: 'Plus Jakarta Sans', 'Noto Sans Arabic', system-ui, -apple-system, 'Segoe UI', 'Segoe UI Arabic', 'Traditional Arabic', sans-serif;
    --bs-body-color: #101828;
    --bs-border-color: #e4e7ec;
}
body { background: var(--surface); font-size: .925rem; }
a { color: var(--accent); }
.btn-primary { --bs-btn-bg: #155eef; --bs-btn-border-color: #155eef; --bs-btn-hover-bg: #004eeb; --bs-btn-hover-border-color: #004eeb; }
.text-muted, .text-secondary { color: var(--muted) !important; }

/* Sidebar */
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); background: var(--navy); color: #cfd8e6; display: flex; flex-direction: column; z-index: 1040; transition: transform .2s; }
.brand { display: flex; align-items: center; gap: .7rem; padding: 1.15rem 1.2rem; color: #fff; text-decoration: none; border-bottom: 1px solid rgba(255,255,255,.07); }
.brand-mark { width: 38px; height: 38px; border-radius: 10px; background: linear-gradient(135deg, #2e90fa, #155eef); display: grid; place-items: center; font-size: 1.2rem; }
.brand-name { display: block; font-weight: 800; letter-spacing: .06em; line-height: 1.1; }
.brand-sub { display: block; font-size: .72rem; opacity: .65; }
.nav-heading { font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; opacity: .5; padding: 1.1rem 1.3rem .35rem; }
.nav-item-link { display: flex; align-items: center; gap: .75rem; margin: 1px .7rem; padding: .55rem .75rem; border-radius: 8px; color: #cfd8e6; text-decoration: none; font-weight: 500; }
.nav-item-link i { font-size: 1.05rem; opacity: .85; }
.nav-item-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item-link.active { background: var(--navy-2); color: #fff; box-shadow: inset 3px 0 0 #53b1fd; }
.sidebar-foot { margin-top: auto; padding: 1rem 1.3rem; border-top: 1px solid rgba(255,255,255,.07); font-size: .85rem; }

/* Main */
.main { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 1030; display: flex; align-items: center; gap: .9rem; padding: .7rem 1.6rem; background: rgba(255,255,255,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.page-title { font-size: 1.15rem; font-weight: 700; margin: 0; }
.year-select { width: auto; font-weight: 700; border-color: #b2ccff; color: var(--accent); }
.btn-user { display: flex; align-items: center; gap: .5rem; border: 0; font-weight: 600; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: #eff4ff; color: var(--accent); display: grid; place-items: center; font-weight: 700; }
.btn-icon { border: 0; padding: .2rem .4rem; }
.content { padding: 1.5rem 1.6rem; flex: 1; }
.footer { padding: 1rem 1.6rem; color: var(--muted); font-size: .8rem; }

@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); }
    .main { margin-left: 0; }
    body.sidebar-open .sidebar { transform: none; }
    body.sidebar-open .sidebar-backdrop { position: fixed; inset: 0; background: rgba(16,24,40,.4); z-index: 1035; }
    .content, .topbar { padding-left: 1rem; padding-right: 1rem; }
}

/* Kartu */
.card { border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.card-header { background: transparent; border-bottom: 1px solid var(--line); padding: .9rem 1.15rem; font-weight: 700; display: flex; align-items: center; gap: .5rem; }
.card-header .small { font-weight: 500; }
.card-body { padding: 1.15rem; }

/* KPI */
.kpi, .card.kpi { display: flex; flex-direction: row; justify-content: flex-start; gap: .9rem; align-items: center; padding: 1.05rem 1.15rem; text-align: left; }
a.card.kpi { transition: border-color .15s, box-shadow .15s; }
a.card.kpi:hover { border-color: #b2ccff; box-shadow: 0 4px 14px rgba(16,24,40,.06); }
.kpi-icon { width: 46px; height: 46px; flex: none; border-radius: 12px; display: grid; place-items: center; font-size: 1.3rem; }
.kpi-value { font-size: 1.65rem; font-weight: 800; line-height: 1; }
.kpi-label { color: var(--muted); font-size: .8rem; margin-top: .25rem; }
.tone-primary { background: #eff4ff; color: #155eef; }
.tone-success { background: #ecfdf3; color: #039855; }
.tone-warning { background: #fffaeb; color: #dc6803; }
.tone-danger  { background: #fef3f2; color: #d92d20; }
.tone-secondary { background: #f2f4f7; color: #475467; }
.tone-info { background: #f0f9ff; color: #0086c9; }

/* Hero visi */
.hero { background: linear-gradient(120deg, #0f2a4a 0%, #163a63 55%, #1849a9 100%); color: #fff; border: 0; overflow: hidden; position: relative; }
.hero::after { content: ''; position: absolute; right: -60px; top: -60px; width: 240px; height: 240px; border-radius: 50%; background: rgba(255,255,255,.06); }
.hero .label { text-transform: uppercase; letter-spacing: .12em; font-size: .7rem; opacity: .7; }
.hero .visi { font-size: 1.15rem; font-weight: 600; line-height: 1.45; }
.ring { --p: 0; --c: #53b1fd; width: 120px; height: 120px; border-radius: 50%; background: conic-gradient(var(--c) calc(var(--p) * 1%), rgba(255,255,255,.15) 0); display: grid; place-items: center; flex: none; }
.ring > div { width: 92px; height: 92px; border-radius: 50%; background: #133559; display: grid; place-items: center; text-align: center; }
.ring b { font-size: 1.6rem; line-height: 1; }

/* Badge lembut */
.badge-soft { display: inline-flex; align-items: center; padding: .22rem .6rem; border-radius: 999px; font-size: .74rem; font-weight: 600; white-space: nowrap; }
.badge-soft-primary { background: #eff4ff; color: #004eeb; }
.badge-soft-success { background: #ecfdf3; color: #027a48; }
.badge-soft-warning { background: #fffaeb; color: #b54708; }
.badge-soft-danger { background: #fef3f2; color: #b42318; }
.badge-soft-secondary { background: #f2f4f7; color: #344054; }
.badge-soft-dark { background: #e4e7ec; color: #344054; }
.badge-soft-info { background: #f0f9ff; color: #026aa2; }

/* Tabel */
.table { --bs-table-bg: transparent; margin: 0; }
.table > thead th { font-size: .73rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; background: #f9fafb; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table > :not(caption) > * > * { padding: .7rem .9rem; vertical-align: middle; }
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: #f8faff; }
.row-link { cursor: pointer; }
.prog-name { font-weight: 600; color: var(--ink); text-decoration: none; }
.prog-name:hover { color: var(--accent); }

/* Utilitas: izinkan elemen flex/grid menyusut (tidak ada di Bootstrap) */
.min-w-0 { min-width: 0; }

/* Chip misi di kartu visi (latar gelap) */
.chip-misi { display: inline-flex; align-items: center; gap: .35rem; padding: .3rem .75rem; border-radius: 999px;
    background: rgba(83, 177, 253, .22); border: 1px solid rgba(132, 202, 255, .45); color: #e0f2fe;
    font-size: .76rem; font-weight: 600; letter-spacing: .02em; cursor: default; transition: background .15s; }
.chip-misi i { font-size: .7rem; color: #84caff; }
.chip-misi:hover { background: rgba(83, 177, 253, .38); color: #fff; }

/* Baris capaian per misi: nomor | teks + bar | angka */
.misi-baris { display: grid; grid-template-columns: minmax(0, 1fr) 96px; gap: .9rem; align-items: center; padding: .7rem 0; }
.misi-baris + .misi-baris { border-top: 1px dashed var(--line); }
.misi-isi { min-width: 0; }
.misi-teks { font-size: .86rem; font-weight: 500; line-height: 1.4; margin-bottom: .4rem;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.misi-angka { text-align: right; line-height: 1.2; }
.misi-angka b { display: block; font-size: 1.05rem; }
.misi-angka small { color: var(--muted); font-size: .74rem; white-space: nowrap; }
@media (max-width: 575.98px) { .misi-baris { grid-template-columns: minmax(0, 1fr) 72px; gap: .6rem; } }

/* Badge misi berwarna: [nomor] Label */
.badge-misi { display: inline-flex; align-items: center; gap: .4rem; padding: .2rem .65rem .2rem .25rem; border-radius: 999px;
    font-size: .75rem; font-weight: 600; line-height: 1.3; white-space: nowrap; border: 1px solid transparent; vertical-align: middle; }
.badge-misi b { display: inline-grid; place-items: center; min-width: 1.35rem; height: 1.35rem; border-radius: 999px; font-size: .7rem; color: #fff; }
.badge-misi.besar { font-size: .82rem; padding: .3rem .85rem .3rem .3rem; }
.bm-biru   { background: #eff4ff; color: #004eeb; border-color: #c7d7fe; } .bm-biru b   { background: #2e6bf0; }
.bm-hijau  { background: #ecfdf3; color: #027a48; border-color: #abefc6; } .bm-hijau b  { background: #12b76a; }
.bm-oranye { background: #fff4ed; color: #c4320a; border-color: #fdcfb0; } .bm-oranye b { background: #fb6514; }
.bm-ungu   { background: #f4f3ff; color: #5925dc; border-color: #d9d6fe; } .bm-ungu b   { background: #7a5af8; }
.bm-merah  { background: #fff1f3; color: #c01048; border-color: #fecdd6; } .bm-merah b  { background: #f63d68; }
.bm-toska  { background: #f0fdf9; color: #107569; border-color: #99f6e0; } .bm-toska b  { background: #15b79e; }
.bm-kuning { background: #fefbe8; color: #a15c07; border-color: #feee95; } .bm-kuning b { background: #eaaa08; }
.bm-abu    { background: #f2f4f7; color: #344054; border-color: #d0d5dd; } .bm-abu b    { background: #667085; }

/* Pilihan misi berbentuk kartu (form program kerja) */
.pilih-misi { display: grid; gap: .5rem; }
.pilih-misi label { display: flex; align-items: flex-start; gap: .65rem; padding: .6rem .75rem; border: 1px solid var(--line);
    border-radius: 10px; cursor: pointer; transition: border-color .15s, background .15s; }
.pilih-misi label:hover { border-color: #b2ccff; background: #f8faff; }
.pilih-misi input { margin-top: .2rem; flex: none; }
.pilih-misi input:checked + .pm-isi .badge-misi { box-shadow: 0 0 0 2px #fff, 0 0 0 4px currentColor; }
.pilih-misi label:has(input:checked) { border-color: var(--accent); background: #f5f8ff; box-shadow: 0 0 0 1px var(--accent); }
.pm-isi { min-width: 0; }
.pm-isi .pm-teks { display: block; font-size: .82rem; color: var(--muted); margin-top: .25rem; line-height: 1.35; }

/* Pilihan warna badge (form Visi & Misi) */
.pilih-warna { display: flex; flex-wrap: wrap; gap: .3rem; }
.pilih-warna label { cursor: pointer; }
.pilih-warna input { position: absolute; opacity: 0; pointer-events: none; }
.pilih-warna span { display: block; width: 1.4rem; height: 1.4rem; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); }
.pilih-warna input:checked + span { box-shadow: 0 0 0 2px var(--ink); }
.pilih-warna input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.pw-biru { background: #2e6bf0; } .pw-hijau { background: #12b76a; } .pw-oranye { background: #fb6514; } .pw-ungu { background: #7a5af8; }
.pw-merah { background: #f63d68; } .pw-toska { background: #15b79e; } .pw-kuning { background: #eaaa08; } .pw-abu { background: #667085; }

/* Misi */
.misi-no { width: 30px; height: 30px; border-radius: 8px; background: #eff4ff; color: var(--accent); display: grid; place-items: center; font-weight: 800; flex: none; font-size: .85rem; }

/* Timeline monitoring */
.timeline { position: relative; padding-left: 1.6rem; }
.timeline::before { content: ''; position: absolute; left: 7px; top: 4px; bottom: 4px; width: 2px; background: var(--line); }
.tl-item { position: relative; padding-bottom: 1.2rem; }
.tl-item::before { content: ''; position: absolute; left: -1.6rem; top: 4px; width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 3px solid var(--accent); }
.tl-item.selesai::before { border-color: #12b76a; }
.tl-item.tertunda::before { border-color: #f79009; }

.empty { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }
.empty i { font-size: 2.2rem; display: block; margin-bottom: .5rem; opacity: .5; }
.form-label { font-weight: 600; font-size: .85rem; }
.form-control, .form-select { border-radius: 9px; }
.chip-filter .btn { border-radius: 999px; }

/* Login */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-side { background: linear-gradient(140deg, #0f2a4a, #1849a9); color: #fff; padding: 3rem; display: flex; flex-direction: column; justify-content: space-between; }
.login-form { display: grid; place-items: center; padding: 2rem; background: #fff; }
@media (max-width: 860px) { .login-wrap { grid-template-columns: 1fr; } .login-side { display: none; } }

/* Cetak */
@media print {
    .sidebar, .topbar, .footer, .no-print, .alert { display: none !important; }
    .main { margin: 0; }
    .content { padding: 0; }
    body { background: #fff; font-size: 11pt; }
    .card { box-shadow: none; break-inside: avoid; }
}

/* Nomor misi berwarna mengikuti warna badge misi */
.misi-no.bm-biru { background: #eff4ff; color: #004eeb; border: 1px solid #c7d7fe; }
.misi-no.bm-hijau { background: #ecfdf3; color: #027a48; border: 1px solid #abefc6; }
.misi-no.bm-oranye { background: #fff4ed; color: #c4320a; border: 1px solid #fdcfb0; }
.misi-no.bm-ungu { background: #f4f3ff; color: #5925dc; border: 1px solid #d9d6fe; }
.misi-no.bm-merah { background: #fff1f3; color: #c01048; border: 1px solid #fecdd6; }
.misi-no.bm-toska { background: #f0fdf9; color: #107569; border: 1px solid #99f6e0; }
.misi-no.bm-kuning { background: #fefbe8; color: #a15c07; border: 1px solid #feee95; }
.misi-no.bm-abu { background: #f2f4f7; color: #344054; border: 1px solid #d0d5dd; }

/* Kartu status program: donat + rincian angka */
.status-donat { position: relative; height: 190px; margin: .25rem 0 1rem; }
.status-tengah { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; pointer-events: none; }
.status-tengah b { font-size: 1.9rem; line-height: 1; }
.status-tengah span { color: var(--muted); font-size: .78rem; }
.status-rinci { list-style: none; padding: 0; margin: auto 0 0; }
.status-rinci li { display: flex; align-items: center; gap: .6rem; padding: .42rem 0; border-top: 1px dashed var(--line); font-size: .86rem; }
.status-rinci li.kosong { color: var(--muted); }
.status-rinci .titik { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.status-rinci b { min-width: 1.5rem; text-align: right; }
.status-rinci .persen { width: 2.6rem; text-align: right; color: var(--muted); font-size: .78rem; }

/* Tahapan kegiatan */
.tahap-bar { display: flex; gap: 3px; height: 12px; }
.tahap-bar span { background: #e4e7ec; border-radius: 3px; min-width: 4px; transition: background .2s; }
.tahap-bar span.selesai { background: #12b76a; }
.tahap-bar span.telat { background: #fda29b; }
.table-tahapan td { vertical-align: top; }
.table-tahapan tr.tahap-selesai .tahap-nama { color: var(--muted); text-decoration: line-through; text-decoration-color: #98a2b3; }
.tahap-nama { font-weight: 600; font-size: .9rem; }
.tahap-cek { width: 26px; height: 26px; border-radius: 8px; border: 2px solid #98a2b3; background: #fff; display: grid; place-items: center;
    color: #fff; font-size: 1rem; line-height: 1; padding: 0; cursor: pointer; transition: all .15s; }
.tahap-cek:hover { border-color: #12b76a; background: #ecfdf3; }
.tahap-cek.aktif { background: #12b76a; border-color: #12b76a; }
.tahap-cek:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cek-tahapan { max-height: 240px; overflow: auto; border: 1px solid var(--line); border-radius: 9px; padding: .5rem .75rem; }
.cek-tahapan .form-check { margin: .2rem 0; }
.prog-tahap { font-size: .72rem; color: var(--muted); }

/* Teks Arab: arah tulisan otomatis per paragraf (Arab → kanan-ke-kiri, Latin → kiri-ke-kanan) */
input:not([type]), input[type=text], input[type=search], textarea { unicode-bidi: plaintext; }
.content :is(p, td, li, h2, .prog-name, .misi-teks, .tahap-nama, .pm-teks, .visi, .text-truncate, .small, .badge-misi, .chip-misi),
.page-title, .hero .visi, .tl-item > div { unicode-bidi: plaintext; }
:lang(ar), .arab { font-family: 'Noto Sans Arabic', 'Segoe UI Arabic', 'Traditional Arabic', serif; font-size: 1.05em; line-height: 1.8; }

/* ===== Catat progres cepat ===== */
.btn-catat { padding: .2rem .5rem; line-height: 1.2; }
#modalCatatCepat .modal-header { gap: .75rem; }
#modalCatatCepat .cek-tahapan { max-height: 240px; overflow-y: auto; }
#modalCatatCepat details summary { cursor: pointer; }

/* ===== Timeline (Gantt) ===== */
.gantt-gulir { overflow-x: auto; }
.gantt { --lebar-label: 250px; min-width: 860px; position: relative; }
.gantt-baris { display: grid; grid-template-columns: var(--lebar-label) minmax(0, 1fr); align-items: center; border-bottom: 1px solid #f2f4f7; min-height: 46px; }
.gantt-label { padding: .4rem 1rem; min-width: 0; line-height: 1.3; }
.gantt-label .prog-name { font-size: .875rem; }
.gantt-jalur { position: relative; height: 46px; margin-right: 1rem; }
.gantt-kepala { position: sticky; top: 0; z-index: 3; background: #f9fafb; border-bottom: 1px solid #eaecf0; min-height: 36px; }
.gantt-kepala .gantt-label { font-size: .75rem; font-weight: 600; color: #667085; text-transform: uppercase; letter-spacing: .03em; }
.gantt-kepala .gantt-jalur { height: 36px; }
.g-bulan { position: absolute; top: 50%; transform: translateY(-50%); padding-left: 6px; font-size: .75rem; font-weight: 600; color: #667085; }
.g-bulan.kini { color: #155eef; }
.gantt-isi { position: relative; }
.gantt-garis { position: absolute; top: 0; bottom: 0; left: var(--lebar-label); right: 1rem; pointer-events: none; z-index: 0; }
.gantt-garis span { position: absolute; top: 0; bottom: 0; border-left: 1px dashed #eaecf0; }
.gantt-garis .g-hari-ini { border-left: 2px solid #f04438; z-index: 2; }
.gantt-grup { display: flex; align-items: center; gap: .5rem; padding: .55rem 1rem; background: #fcfcfd; border-bottom: 1px solid #f2f4f7; position: relative; z-index: 1; min-width: 0; }
.gantt-grup .text-truncate { min-width: 0; }
.gantt-isi .gantt-baris { position: relative; z-index: 1; }
.gantt-isi .gantt-baris:hover { background: rgba(21, 94, 239, .03); }
.g-bar { position: absolute; top: 13px; height: 20px; min-width: 6px; border-radius: 6px; overflow: hidden; display: block; outline-offset: 2px; transition: filter .15s; }
.g-bar:hover { filter: brightness(.95); }
.g-bar .g-isi { display: block; height: 100%; }
.g-bar.potong-kiri { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.g-bar.potong-kanan { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.g-berjalan { background: #d1e0ff; } .g-berjalan .g-isi { background: #155eef; }
.g-tertunda { background: #fef0c7; } .g-tertunda .g-isi { background: #f79009; }
.g-terlambat { background: #fee4e2; } .g-terlambat .g-isi { background: #f04438; }
.g-selesai { background: #d1fadf; } .g-selesai .g-isi { background: #12b76a; }
.g-batal { background: #eaecf0; } .g-batal .g-isi { background: #98a2b3; }
.g-teks { position: absolute; top: 14px; padding: 0 6px; font-size: .75rem; font-weight: 700; color: #344054; white-space: nowrap; }
.g-titik { position: absolute; top: 30px; width: 9px; height: 9px; margin-left: -4.5px; border-radius: 50%; background: #fff; border: 2px solid #475467; z-index: 2; }
.g-titik.selesai { background: #12b76a; border-color: #12b76a; }
.g-titik.lewat { border-color: #f04438; }
.g-realisasi { position: absolute; top: 9px; width: 10px; height: 10px; margin-left: -5px; background: #027a48; transform: rotate(45deg); border: 2px solid #fff; z-index: 2; }
.g-kosong { position: absolute; top: 50%; transform: translateY(-50%); font-size: .8rem; color: #98a2b3; padding-left: 6px; }
.g-status { font-weight: 600; }
.g-status.g-berjalan, .g-status.g-tertunda, .g-status.g-terlambat, .g-status.g-selesai, .g-status.g-batal { background: none; }
.g-status.g-berjalan { color: #155eef; } .g-status.g-tertunda { color: #b54708; } .g-status.g-terlambat { color: #d92d20; } .g-status.g-selesai { color: #027a48; } .g-status.g-batal { color: #667085; }
.g-contoh { display: inline-block; width: 22px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; background-image: linear-gradient(90deg, var(--g-tua) 55%, transparent 55%); }
.g-contoh.g-berjalan { --g-tua: #155eef; } .g-contoh.g-tertunda { --g-tua: #f79009; } .g-contoh.g-terlambat { --g-tua: #f04438; } .g-contoh.g-selesai { --g-tua: #12b76a; }
.g-titik.contoh, .g-realisasi.contoh { position: static; display: inline-block; margin: 0 5px 0 0; vertical-align: -1px; }
.g-hari-ini.contoh { display: inline-block; width: 0; height: 12px; border-left: 2px solid #f04438; margin-right: 5px; vertical-align: -2px; }
@media (max-width: 575.98px) { .gantt { --lebar-label: 170px; } }
@media print {
    .gantt-gulir { overflow: visible; }
    .gantt { min-width: 0; --lebar-label: 200px; }
    .gantt-kepala { position: static; }
    .g-bar, .g-isi, .g-titik, .g-realisasi, .gantt-garis span, .g-contoh { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
.g-teks.di-dalam { margin-left: 4px; top: 15px; line-height: 16px; padding: 0 5px; border-radius: 4px; background: rgba(255,255,255,.9); z-index: 1; }
.gantt-garis .g-ganti-tahun { border-left: 2px solid #98a2b3; }
.g-bulan { font-size: .72rem; }
