/*
 * Tema SIMAS — Sistem Informasi Manajemen Aset IPI Garut.
 * Di atas AdminLTE 3.0.2 (Bootstrap 4). Warna resmi IPI: navy #002147 + emas #fdc800
 * (sama dengan aplikasi Survei IPI). Font: Geist.
 */
:root {
	--brand: #002147;
	--brand-2: #0b3a6e;
	--brand-soft: #eef3f8;
	--gold: #fdc800;
	--bg: #f4f6f9;
	--surface: #ffffff;
	--ink: #111827;
	--ink-2: #374151;
	--muted: #6b7280;
	--line: #e5e7eb;
	--focus: #2a78d6;
	--bar: #2a78d6;          /* satu warna untuk grafik batang (seri tunggal) */
	--ok: #16794a;
	--warn: #b45309;
	--bad: #b42318;
	--radius: 10px;
	--font-sans: 'Geist', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
	--font-mono: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

body, .main-sidebar, .brand-link, .btn, .form-control, .custom-select, .swal2-popup, .tooltip, .popover, .dropdown-menu {
	font-family: var(--font-sans);
}
body { color: var(--ink-2); background: var(--bg); font-size: .9375rem; }
table, .tabular-nums, .dataTables_info, .pagination, .kpi-value { font-variant-numeric: tabular-nums; }
.mono, code { font-family: var(--font-mono); }
a { color: var(--brand-2); }
a:hover { color: var(--brand); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.content-wrapper { background: var(--bg); }

/* ---------- Bar atas ---------- */
.main-header.navbar {
	border-top: 3px solid var(--gold);
	border-bottom: 1px solid var(--line) !important;
	box-shadow: none;
}
.main-header .nav-link { color: var(--brand); }
.main-header .user-menu .user-image { width: 30px; height: 30px; margin-top: -3px; object-fit: cover; box-shadow: none !important; border: 1px solid var(--line); }
.main-header .user-menu .user-name { font-weight: 500; }
.main-header .user-header { background: var(--brand) !important; color: #fff; }
.main-header .user-header img { object-fit: cover; box-shadow: none !important; border: 3px solid rgba(255,255,255,.25) !important; }
.main-header .user-footer { background: #f9fafb; }
.navbar-badge { font-weight: 600; }

/* ---------- Sidebar ---------- */
.main-sidebar { background: var(--surface); box-shadow: none !important; border-right: 1px solid var(--line); }
.brand-link {
	display: flex; align-items: center; height: 57px;
	border-bottom: 1px solid var(--line) !important; padding: .5rem 1rem;
}
.brand-link .logo { height: 36px; width: auto; max-width: 100%; transition: opacity .2s; }
.sidebar-mini.sidebar-collapse .main-sidebar:not(:hover) .brand-link .logo { opacity: 0; }
.sidebar { padding: .5rem .5rem 1.5rem; }
.nav-sidebar .nav-header {
	font-size: .7rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
	color: var(--muted); padding: 1rem .75rem .35rem;
}
.nav-sidebar > .nav-item { margin-bottom: 2px; }
.nav-sidebar .nav-link {
	color: var(--ink-2) !important; border-radius: 8px; padding: .5rem .75rem;
	position: relative; font-weight: 500;
}
.nav-sidebar .nav-link .nav-icon { color: #64748b; font-size: 1rem; width: 1.6rem; }
.nav-sidebar .nav-link:hover { background: var(--brand-soft) !important; color: var(--brand) !important; }
.nav-sidebar > .nav-item > .nav-link.active,
.nav-sidebar .nav-treeview .nav-link.active {
	background: var(--brand) !important; color: #fff !important; box-shadow: none !important;
}
.nav-sidebar > .nav-item > .nav-link.active .nav-icon,
.nav-sidebar .nav-treeview .nav-link.active .nav-icon { color: var(--gold); }
.nav-sidebar > .nav-item > .nav-link.active::before {
	content: ''; position: absolute; left: -.5rem; top: 6px; bottom: 6px; width: 3px;
	border-radius: 0 3px 3px 0; background: var(--gold);
}
/* menu induk yang sedang terbuka (bukan halaman aktif) */
.nav-sidebar .menu-open > .nav-link:not(.active) { background: transparent !important; }
.nav-sidebar .nav-treeview { padding-left: .5rem; }
.nav-sidebar .nav-treeview .nav-link { font-weight: 400; padding: .4rem .75rem; }
.nav-sidebar .nav-treeview .nav-icon { font-size: .45rem !important; }
.nav-flat .nav-item > .nav-link { border-left: 0 !important; }

/* ---------- Judul halaman ---------- */
.content-header { padding: 1.25rem .5rem .5rem; }
.content-header h1 { font-size: 1.5rem; font-weight: 600; color: var(--ink); letter-spacing: -.01em; }
.content-header .breadcrumb { background: transparent; font-size: .8125rem; margin: 0; padding: .35rem 0; }
.content-header .breadcrumb-item.active { color: var(--muted); }
.page-sub { color: var(--muted); margin: .15rem 0 0; font-size: .875rem; }

/* ---------- Kartu ---------- */
.card {
	border: 1px solid var(--line); border-radius: var(--radius); box-shadow: none;
	margin-bottom: 1.25rem;
}
.card-header {
	background: var(--surface) !important; color: var(--ink) !important;
	border-bottom: 1px solid var(--line); padding: .85rem 1.25rem;
	border-top-left-radius: var(--radius) !important; border-top-right-radius: var(--radius) !important;
}
.card-primary:not(.card-outline) > .card-header,
.card-info:not(.card-outline) > .card-header,
.card-success:not(.card-outline) > .card-header,
.card-danger:not(.card-outline) > .card-header,
.card-warning:not(.card-outline) > .card-header { background: var(--surface) !important; color: var(--ink) !important; }
.card-primary:not(.card-outline) > .card-header a,
.card-header .btn-tool { color: var(--muted) !important; }
.card-title { font-size: 1rem; font-weight: 600; }
.card-body { padding: 1.25rem; }
.card-footer { background: #fafbfc; border-top: 1px solid var(--line); }
.card-footer:empty { display: none; }
.card-outline.card-primary { border-top: 3px solid var(--brand); }

/* ---------- Tombol ---------- */
.btn { border-radius: 8px; font-weight: 500; }
.btn-sm { border-radius: 6px; }
.btn-primary { background: var(--brand); border-color: var(--brand); }
.btn-primary:hover, .btn-primary:focus { background: var(--brand-2); border-color: var(--brand-2); }
.btn-outline-primary { color: var(--brand); border-color: #b8c6d8; }
.btn-outline-primary:hover { background: var(--brand); border-color: var(--brand); }
.btn-info { background: #1d6fb8; border-color: #1d6fb8; }
.btn-success { background: var(--ok); border-color: var(--ok); }
.btn-danger { background: var(--bad); border-color: var(--bad); }
.btn-warning { background: var(--gold); border-color: var(--gold); color: var(--brand); }

/* tombol aksi ikon di tabel: kecil, seragam, ada jarak */
td .btn-sm { padding: .25rem .5rem; margin: 1px 2px; }
td .btn-sm + br { display: none; }

/* ---------- Form ---------- */
.form-control, .custom-select, .select2-container--default .select2-selection--single {
	border-radius: 8px; border-color: #d0d5dd;
}
.form-control:focus, .custom-select:focus { border-color: var(--focus); box-shadow: 0 0 0 3px rgba(42,120,214,.15); }
label, .col-form-label { font-weight: 500; color: var(--ink-2); }
.form-text, .help-block { color: var(--muted); }
.text-danger p, p.text-danger { margin: .25rem 0 0; font-size: .8125rem; }

/* ---------- Tabel ---------- */
.table { color: var(--ink-2); }
.table thead th {
	background: #f8fafc; color: var(--muted); font-weight: 600; font-size: .75rem;
	text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--line) !important;
	border-top: 0; vertical-align: middle; white-space: nowrap;
}
.table td { vertical-align: middle; border-top: 1px solid #eef0f3; padding: .55rem .75rem; }
.table-bordered, .table-bordered td, .table-bordered th { border-color: #eef0f3; }
.table-striped tbody tr:nth-of-type(odd) { background: #fbfcfd; }
.table-hover tbody tr:hover, .table-striped tbody tr:hover { background: var(--brand-soft); }
div.dataTables_wrapper div.dataTables_filter input { border-radius: 8px; margin-left: .5rem; }
div.dataTables_wrapper div.dataTables_length select { border-radius: 8px; }
.page-item.active .page-link { background: var(--brand); border-color: var(--brand); }
.page-link { color: var(--brand); }

/* ---------- Badge & alert ---------- */
.badge { font-weight: 600; padding: .3em .6em; border-radius: 999px; }
.alert { border-radius: var(--radius); border: 1px solid transparent; }
.alert-info { background: #eef5fc; border-color: #cfe1f5; color: #1e3a5f; }
.alert-warning { background: #fff8e6; border-color: #f7df9b; color: #7a4b00; }
.alert-danger { background: #fdf0ef; border-color: #f4c7c3; color: #7a1d14; }
.alert-success { background: #eefaf3; border-color: #bfe8d0; color: #14532d; }
.alert .close { color: inherit; }

/* ---------- KPI & grafik batang (dashboard / statistik) ---------- */
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.25rem; height: 100%; display: flex; flex-direction: column; }
.kpi-label { font-size: .8125rem; color: var(--muted); font-weight: 500; display: flex; align-items: center; gap: .5rem; }
.kpi-label i { color: var(--brand-2); }
.kpi-value { font-size: 1.75rem; font-weight: 600; color: var(--ink); letter-spacing: -.02em; line-height: 1.2; margin-top: .35rem; }
.kpi-note { font-size: .8125rem; color: var(--muted); margin-top: .25rem; }
.kpi a.kpi-link { margin-top: auto; padding-top: .5rem; font-size: .8125rem; font-weight: 500; }
.kpi-hero .kpi-value { font-size: 2.25rem; }

.rank-list { list-style: none; margin: 0; padding: 0; }
.rank-list li { display: grid; grid-template-columns: minmax(8rem, 38%) 1fr auto; gap: .75rem; align-items: center; padding: .3rem 0; }
.rank-list .rank-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); font-size: .875rem; }
.rank-list .rank-track { height: 14px; background: transparent; position: relative; }
.rank-list .rank-bar { height: 100%; background: var(--bar); border-radius: 0 4px 4px 0; min-width: 2px; }
.rank-list li:hover .rank-bar { filter: brightness(.85); }
.rank-list .rank-val { font-size: .8125rem; color: var(--ink-2); text-align: right; min-width: 3.5rem; font-variant-numeric: tabular-nums; }
.rank-list li.is-other .rank-bar { background: #9aa4b2; }
.rank-list li.is-other .rank-name { color: var(--muted); font-style: italic; }
.rank-axis { border-left: 1px solid var(--line); }

.split-bar { display: flex; height: 12px; border-radius: 6px; overflow: hidden; gap: 2px; background: var(--surface); }
.split-bar > span { display: block; height: 100%; }
.legend-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: .35rem; vertical-align: -1px; }
.status-ok { color: var(--ok); }
.status-warn { color: var(--warn); }
.status-bad { color: var(--bad); }

.check-list { list-style: none; padding: 0; margin: 0; }
.check-list li { display: flex; gap: .75rem; align-items: flex-start; padding: .6rem 0; border-top: 1px solid #eef0f3; }
.check-list li:first-child { border-top: 0; }
.check-list .check-icon { color: var(--warn); margin-top: .15rem; }
.check-list .check-title { font-weight: 500; color: var(--ink); }
.check-list .check-meta { font-size: .8125rem; color: var(--muted); }

/* ---------- Login ---------- */
.login-page {
	background: linear-gradient(160deg, #002147 0%, #0b3a6e 55%, #0f4c8a 100%) !important;
	min-height: 100vh;
}
.login-box { width: 380px; max-width: calc(100% - 2rem); margin: 0 auto 4rem; }
.login-card { background: var(--surface); border-radius: 14px; padding: 2rem; box-shadow: 0 20px 50px rgba(0, 20, 50, .35); border-top: 4px solid var(--gold); }
.login-card .logo { height: 44px; width: auto; display: block; margin: 0 auto 1.25rem; }
.login-card h1 { font-size: 1.125rem; font-weight: 600; text-align: center; color: var(--ink); margin: 0 0 .25rem; }
.login-card .login-sub { text-align: center; color: var(--muted); font-size: .875rem; margin-bottom: 1.5rem; }
.login-foot { text-align: center; color: rgba(255,255,255,.75); font-size: .8125rem; margin-top: 1.25rem; }
.login-foot a { color: #fff; }

/* ---------- Halaman publik detail aset (dibuka dari QR, mayoritas di HP) ---------- */
.public-page { background: var(--bg); min-height: 100vh; display: flex; flex-direction: column; }
.public-top { background: var(--surface); border-top: 3px solid var(--gold); border-bottom: 1px solid var(--line); padding: .75rem 0; }
.public-top img { height: 34px; }
.public-main { flex: 1; padding: 1.5rem 0 2.5rem; }
.public-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; max-width: 640px; margin: 0 auto; overflow: hidden; }
.public-card .head { padding: 1.25rem 1.25rem 1rem; border-bottom: 1px solid var(--line); }
.public-card .head .kode { font-family: var(--font-mono); font-size: .8125rem; color: var(--muted); word-break: break-all; }
.public-card .head h1 { font-size: 1.25rem; font-weight: 600; color: var(--ink); margin: .25rem 0 .5rem; }
.public-card dl { margin: 0; display: grid; grid-template-columns: 40% 60%; }
.public-card dt, .public-card dd { padding: .7rem 1.25rem; border-top: 1px solid #eef0f3; margin: 0; font-size: .9375rem; }
.public-card dt { color: var(--muted); font-weight: 400; }
.public-card dd { color: var(--ink); font-weight: 500; word-break: break-word; }
.public-card dl > :nth-child(-n+2) { border-top: 0; }
.public-foot { text-align: center; color: var(--muted); font-size: .8125rem; padding: 1rem; }

/* ---------- Footer ---------- */
.main-footer { background: var(--surface); border-top: 1px solid var(--line); color: var(--muted); font-size: .8125rem; }

@media (max-width: 576px) {
	.content-header h1 { font-size: 1.25rem; }
	.rank-list li { grid-template-columns: 7rem 1fr auto; }
	.public-card dl { grid-template-columns: 1fr; }
	.public-card dt { padding-bottom: 0; border-top: 1px solid #eef0f3; }
	.public-card dd { border-top: 0; padding-top: .15rem; }
	.public-card dl > :nth-child(2) { border-top: 0; }
}

@media print {
	.main-sidebar, .main-header, .main-footer { display: none !important; }
	.content-wrapper { margin: 0 !important; }
}

/* ---------- Perbaikan global tabel & menu ---------- */
.sidebar { overflow-x: hidden; }
/* menu induk yang berisi halaman aktif: cukup ditandai lembut, anaknya yang navy */
.nav-sidebar > .nav-item.menu-open > .nav-link.active,
.nav-sidebar > .nav-item.has-treeview.menu-open > .nav-link.active {
	background: var(--brand-soft) !important; color: var(--brand) !important;
}
.nav-sidebar > .nav-item.menu-open > .nav-link.active .nav-icon { color: var(--brand-2); }
.nav-sidebar > .nav-item.menu-open > .nav-link.active::before { display: none; }
/* kolom aksi: tombol sebaris, kolom sesempit mungkin */
.table td:has(> a.btn-sm), .table td:has(> button.btn-sm), .table td:has(> form .btn-sm) { white-space: nowrap; width: 1%; }
/* header duplikat di bawah tabel tidak perlu */
.table tfoot { display: none; }
td[align="center"] { text-align: center; }
.dataTables_wrapper .row:first-child { margin-bottom: .5rem; }
.dataTables_wrapper .dataTables_info { color: var(--muted); font-size: .8125rem; }
.main-sidebar { border-right: 0; box-shadow: inset -1px 0 0 var(--line) !important; overflow-x: hidden; }
.rank-list .rank-track, .rank-list .rank-bar { display: block; }
.rank-list li.is-other .rank-track { border-left-color: transparent; }
.cek-scroll { max-height: 560px; overflow-y: auto; padding-right: .25rem; }
.btn-outline-primary.active, .btn-outline-primary:not(:disabled):not(.disabled).active, .btn-outline-primary:not(:disabled):not(.disabled):active { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn:focus, .btn.focus { box-shadow: 0 0 0 3px rgba(42,120,214,.2); }
/* tombol bawaan template "tutup kartu" hanya menyembunyikan kartu sampai reload — membingungkan */
.card-tools [data-card-widget="remove"] { display: none; }
