:root {
    --sirt-primary: #1b2c49;
    --sirt-primary-dark: #121d2f;
    --sirt-accent-light: #e9f3fe;
    --sirt-sidebar-w: 250px;
    --sirt-sidebar-img: url('../img/sirta-sidebar-bg-1.png');
}

body {
    background: #f4f6f8;
    font-family: "Segoe UI", Roboto, Arial, sans-serif;
}

/* ------------------------------------------------------------------ */
/* Tema warna SiRTA — navy sesuai maskot (mengganti tombol/menu hijau  */
/* & biru bawaan Bootstrap; badge status tetap memakai warna semantik  */
/* asli agar makna "aktif/disetujui/ditolak" tidak berubah).           */
/* ------------------------------------------------------------------ */
.btn-success, .btn-primary {
    --bs-btn-color: #fff;
    --bs-btn-bg: var(--sirt-primary);
    --bs-btn-border-color: var(--sirt-primary);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--sirt-primary-dark);
    --bs-btn-hover-border-color: var(--sirt-primary-dark);
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: var(--sirt-primary-dark);
    --bs-btn-active-border-color: var(--sirt-primary-dark);
    --bs-btn-disabled-bg: var(--sirt-primary);
    --bs-btn-disabled-border-color: var(--sirt-primary);
    --bs-btn-focus-shadow-rgb: 27, 44, 73;
}

.btn-outline-success, .btn-outline-primary {
    --bs-btn-color: var(--sirt-primary);
    --bs-btn-border-color: var(--sirt-primary);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--sirt-primary);
    --bs-btn-hover-border-color: var(--sirt-primary);
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: var(--sirt-primary);
    --bs-btn-active-border-color: var(--sirt-primary);
    --bs-btn-disabled-color: var(--sirt-primary);
    --bs-btn-disabled-border-color: var(--sirt-primary);
    --bs-btn-focus-shadow-rgb: 27, 44, 73;
}

a { color: var(--sirt-primary); }
a:hover { color: var(--sirt-primary-dark); }

.form-check-input:checked {
    background-color: var(--sirt-primary);
    border-color: var(--sirt-primary);
}

.form-control:focus, .form-select:focus {
    border-color: var(--sirt-primary);
    box-shadow: 0 0 0 .25rem rgba(27, 44, 73, .15);
}

.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sirt-sidebar-w);
    flex-shrink: 0;
    background:
        linear-gradient(180deg, rgba(18, 29, 47, .6), rgba(18, 29, 47, .8)),
        var(--sirt-sidebar-img) center bottom / cover no-repeat,
        var(--sirt-primary-dark);
    color: #fff;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: .6rem;
    color: #fff;
    font-weight: 700;
    font-size: 1.15rem;
    padding: 1rem;
    width: 100%;
    background: none;
    border: 0;
    text-align: left;
    cursor: pointer;
}

.sidebar-brand:hover {
    background: rgba(255,255,255,.08);
}

.sidebar-brand-avatar {
    width: 38px;
    height: 38px;
    object-fit: cover;
    object-position: top center;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, .25);
}

.sidebar .nav-link {
    color: rgba(255,255,255,.75);
    border-radius: .4rem;
    padding: .55rem .75rem;
    margin-bottom: .15rem;
    font-size: .92rem;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
    background: var(--sirt-primary);
    color: #fff;
}

.sidebar .nav-link i {
    width: 1.2rem;
    display: inline-block;
}

.sidebar .submenu {
    padding-left: 1.1rem;
    border-left: 1px solid rgba(255,255,255,.15);
    margin: 0 0 .15rem .95rem;
}

.sidebar .submenu .nav-link {
    font-size: .87rem;
    padding: .45rem .75rem;
}

.sidebar .submenu-caret {
    transition: transform .15s ease;
}

.sidebar [aria-expanded="true"] .submenu-caret {
    transform: rotate(180deg);
}

.main-area {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    height: 60px;
    position: sticky;
    top: 0;
    z-index: 10;
}

.page-header-banner {
    position: relative;
    overflow: hidden;
    border-radius: .75rem;
    padding: 1.1rem 1.4rem;
    background:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='420' height='140' viewBox='0 0 420 140'%3E%3Cg fill='%23ffffff' fill-opacity='.08'%3E%3Cpath d='M40 140V90l30-24 30 24v50H40z'/%3E%3Cpath d='M110 140V70l24-19 24 19v70h-48z'/%3E%3Cpath d='M170 140V100l18-14 18 14v40h-36z'/%3E%3Cpath d='M220 140V60l34-27 34 27v80h-68z'/%3E%3Cpath d='M300 140V95l22-17 22 17v45h-44z'/%3E%3Cpath d='M360 140V110l14-11 14 11v30h-28z'/%3E%3C/g%3E%3C/svg%3E") right bottom / 420px 140px no-repeat,
        linear-gradient(120deg, var(--sirt-primary), var(--sirt-primary-dark));
    color: #fff;
}

.page-breadcrumb {
    font-size: .78rem;
    color: rgba(255,255,255,.75);
    display: flex;
    align-items: center;
    gap: .4rem;
    margin-bottom: .35rem;
}

.page-breadcrumb a {
    color: rgba(255,255,255,.85);
    text-decoration: none;
}

.page-breadcrumb a:hover { color: #fff; }

.page-breadcrumb .bi-chevron-right { font-size: .6rem; opacity: .7; }

.page-header-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: #fff;
    margin: 0;
}

.page-header-sub {
    font-size: .85rem;
    color: rgba(255,255,255,.8);
    margin-top: .2rem;
}

.stat-card {
    border: none;
    border-radius: .75rem;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
}

.stat-card .stat-value {
    font-size: 1.6rem;
    font-weight: 700;
}

.stat-card-link {
    transition: transform .12s ease, box-shadow .12s ease;
    cursor: pointer;
}

.stat-card-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,.12);
}

.badge-status-MENUNGGU, .badge-status-PENDING, .badge-status-BELUM_BAYAR { background: #f0ad4e; }
.badge-status-DIPROSES { background: #5bc0de; }
.badge-status-DISETUJUI, .badge-status-TERBIT, .badge-status-LUNAS, .badge-status-SELESAI, .badge-status-DITERBITKAN { background: #2e6f40; }
.badge-status-DITOLAK, .badge-status-TERLAMBAT { background: #d9534f; }
.badge-status-ARSIP, .badge-status-DRAFT, .badge-status-TIDAK_DITERBITKAN { background: #6c757d; }

.kk-tree .kk-card { border-left: 4px solid var(--sirt-primary); }
.kk-tree .anggota-group { background: #f8f9fa; border-radius: .5rem; }

@media (max-width: 991.98px) {
    .sidebar { position: fixed; left: -260px; z-index: 1050; transition: left .2s; }
    .sidebar.show { left: 0; }
}

@media (min-width: 992px) {
    .app-shell.sidebar-hidden .sidebar { display: none; }
}

/* ------------------------------------------------------------------ */
/* Tabel data modern                                                   */
/* ------------------------------------------------------------------ */
.table-modern {
    border-collapse: separate;
    border-spacing: 0;
    margin-bottom: 0;
}

.table-modern thead th {
    background: #f8fafc;
    color: #64748b;
    font-size: .74rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    border-bottom: 2px solid #eef1f5;
    padding: .85rem 1rem;
    white-space: nowrap;
}

.table-modern thead th:first-child { border-top-left-radius: .75rem; }
.table-modern thead th:last-child { border-top-right-radius: .75rem; }

.table-modern tbody td {
    padding: .7rem 1rem;
    vertical-align: middle;
    border-bottom: 1px solid #f1f5f9;
    font-size: .9rem;
}

.table-modern tbody tr {
    transition: background-color .12s ease;
}

.table-modern tbody tr:hover {
    background-color: #f3faf4;
}

.table-modern tbody tr:last-child td {
    border-bottom: none;
}

/* Header kolom yang bisa diurutkan (Asc/Desc) */
.table-modern th.sortable {
    padding: 0;
}

.table-modern th.sortable a {
    display: flex;
    align-items: center;
    gap: .35rem;
    color: inherit;
    text-decoration: none;
    padding: .85rem 1rem;
    white-space: nowrap;
}

.table-modern th.sortable a:hover {
    color: var(--sirt-primary);
}

.table-modern th.sortable .sort-icon {
    font-size: .75rem;
    opacity: .3;
}

.table-modern th.sortable.sort-asc .sort-icon,
.table-modern th.sortable.sort-desc .sort-icon {
    opacity: 1;
    color: var(--sirt-primary);
}

/* ------------------------------------------------------------------ */
/* Pagination modern                                                   */
/* ------------------------------------------------------------------ */
.pagination {
    gap: .25rem;
    flex-wrap: wrap;
}

.pagination .page-link {
    border: none;
    border-radius: .5rem !important;
    color: #475569;
    font-weight: 600;
    font-size: .85rem;
    min-width: 2.35rem;
    text-align: center;
    padding: .45rem .65rem;
}

.pagination .page-item.active .page-link {
    background: var(--sirt-primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(27, 44, 73, .35);
}

.pagination .page-item:not(.active) .page-link:hover {
    background: #eef2f0;
    color: var(--sirt-primary);
}

.pagination .page-item.disabled .page-link {
    color: #cbd5e1;
    background: transparent;
}

/* ------------------------------------------------------------------ */
/* Kartu Keluarga bergaya dokumen resmi (halaman Data Keluarga)        */
/* ------------------------------------------------------------------ */
.kk-doc-header {
    border-bottom: 3px double #1f2937;
    padding: .25rem .25rem .75rem;
}

.kk-doc-title {
    font-weight: 700;
    font-size: 1.35rem;
    letter-spacing: .06em;
    color: #1f2937;
}

.kk-doc-nomor {
    font-family: "Courier New", Courier, monospace;
    font-size: 1.15rem;
    font-weight: 600;
    letter-spacing: .3em;
    color: #1f2937;
    margin-top: .15rem;
}

.kk-doc-field {
    display: grid;
    grid-template-columns: 150px 12px 1fr;
    gap: .25rem;
    font-size: .92rem;
    padding: .2rem 0;
}

.kk-doc-field span:first-child {
    color: #64748b;
}

@media (max-width: 575.98px) {
    .kk-doc-field { grid-template-columns: 120px 10px 1fr; font-size: .85rem; }
}

/* ------------------------------------------------------------------ */
/* Popup/modal seragam — semua modal di aplikasi (aksi, konfirmasi,    */
/* form edit) memakai header bermerek SiRTA yang sama, murni lewat CSS */
/* atas markup Bootstrap standar supaya tidak perlu ubah tiap modal.   */
/* ------------------------------------------------------------------ */
.modal-content {
    border: none;
    border-radius: 1.25rem;
    overflow: hidden;
    box-shadow: 0 25px 60px rgba(15, 37, 69, .25);
}

.modal-header {
    position: relative;
    border-bottom: none;
    padding: 1.5rem 3.25rem 2rem 1.5rem;
    background: linear-gradient(160deg, var(--sirt-accent-light) 0%, #bfe3fb 65%, var(--sirt-accent-light) 100%);
    overflow: hidden;
}

.modal-header::before {
    content: "";
    position: absolute;
    left: -5%;
    right: -5%;
    bottom: -1.1rem;
    height: 1.75rem;
    background: #fff;
    border-radius: 50%;
}

.modal-header::after {
    content: "";
    position: absolute;
    right: 1.5rem;
    top: .9rem;
    width: 42px;
    height: 30px;
    background: rgba(255, 255, 255, .6);
    clip-path: polygon(50% 0%, 100% 42%, 84% 42%, 84% 100%, 16% 100%, 16% 42%, 0% 42%);
}

.modal-header .modal-title {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: .55rem;
    font-weight: 800;
    font-size: 1rem;
    color: var(--sirt-primary);
    padding-right: .5rem;
}

.modal-header .modal-title::before {
    content: "";
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: .55rem;
    background-color: var(--sirt-primary);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='white'%3E%3Cpath d='M8 .293 1 6.293V15a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-3a2 2 0 1 1 4 0v3a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1V6.293z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 15px;
}

.modal-header .btn-close {
    position: absolute;
    z-index: 2;
    top: 1rem;
    right: 1rem;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: #fff;
    background-size: 12px;
    box-shadow: 0 4px 10px rgba(15, 37, 69, .2);
    opacity: 1;
    margin: 0;
}

.modal-header .btn-close:hover {
    box-shadow: 0 6px 14px rgba(15, 37, 69, .3);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: none;
    padding: 0 1.5rem 1.5rem;
}
