:root {
    --sidebar: #18324a;
    --sidebar-soft: #214760;
    --page: #f4f7fb;
    --text: #243447;
    --muted: #6b7b8c;
    --primary: #246bfe;
    --line: #dbe4ee;
}

body {
    background: var(--page);
    color: var(--text);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #18324a, #2e806f 58%, #f0b44d);
}

.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.login-panel {
    width: min(440px, 100%);
    background: #fff;
    border-radius: 8px;
    padding: 34px;
    box-shadow: 0 24px 70px rgba(12, 31, 52, .25);
}

.brand-mark,
.brand-icon {
    width: 48px;
    height: 48px;
    display: inline-grid;
    place-items: center;
    border-radius: 8px;
    background: #e8f2ff;
    color: var(--primary);
    font-size: 24px;
}

.login-panel h1 {
    margin-top: 18px;
    font-size: 30px;
    font-weight: 800;
}

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

.sidebar {
    width: 270px;
    flex: 0 0 270px;
    background: var(--sidebar);
    color: #fff;
    padding: 22px 18px;
}

.sidebar-brand {
    color: #fff;
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    font-size: 21px;
    font-weight: 800;
    margin-bottom: 28px;
}

.sidebar-nav {
    display: grid;
    gap: 8px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #d9e6ef;
    text-decoration: none;
    padding: 12px 14px;
    border-radius: 8px;
    font-weight: 650;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    background: var(--sidebar-soft);
    color: #fff;
}

.sidebar-nav i {
    width: 22px;
    text-align: center;
}

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

.topbar {
    min-height: 92px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 22px 30px;
    background: #fff;
    border-bottom: 1px solid var(--line);
}

.topbar h1 {
    font-size: 28px;
    line-height: 1.2;
    margin: 0;
    font-weight: 800;
}

.eyebrow {
    color: var(--muted);
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: .08em;
    font-weight: 800;
}

.content-area {
    padding: 28px 30px;
}

.metric-card,
.panel,
.info-band {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 12px 28px rgba(30, 50, 70, .06);
}

.metric-card {
    display: flex;
    gap: 14px;
    align-items: center;
    min-height: 124px;
    padding: 20px;
}

.metric-card p {
    margin: 0 0 6px;
    color: var(--muted);
    font-size: 14px;
}

.metric-note {
    display: block;
    color: #667892;
    font-size: 14px;
    line-height: 1.2;
    margin-bottom: 7px;
}

.metric-card strong {
    display: block;
    font-size: 23px;
    line-height: 1.2;
}

.metric-icon {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    font-size: 22px;
    background: #edf4ff;
    color: var(--primary);
}

.accent-green .metric-icon { background: #e8f8f0; color: #168a53; }
.accent-orange .metric-icon { background: #fff3dd; color: #bd6b00; }
.accent-teal .metric-icon { background: #e3f8f5; color: #087b70; }
.accent-indigo .metric-icon { background: #eef0ff; color: #5555c7; }
.accent-red .metric-icon { background: #ffeceb; color: #cc3430; }
.accent-dark .metric-icon { background: #edf0f3; color: #344054; }

.panel {
    padding: 22px;
}

.panel h2,
.info-band h2 {
    font-size: 20px;
    font-weight: 800;
    margin-bottom: 18px;
}

.panel-head {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: center;
    margin-bottom: 16px;
}

.panel-head h2 {
    margin: 0;
}

.search-form,
.export-actions,
.rekap-filter {
    display: flex;
    gap: 8px;
}

.rekap-filter {
    flex-wrap: wrap;
    justify-content: flex-end;
}

.rekap-filter .form-select {
    width: auto;
    min-width: 170px;
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(130px, 1fr)) auto;
    gap: 10px;
}

.info-band {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
}

.info-band p {
    margin: 0;
    color: var(--muted);
}

.table thead th {
    color: #526173;
    background: #f7f9fc;
    white-space: nowrap;
}

.table tfoot th {
    background: #f7f9fc;
}

.table-section-row th {
    background: #e8f2ff;
    color: #1f4d87;
    font-size: 15px;
}

.subtotal-row th {
    background: #f7fbf8;
    color: #1e6b45;
}

.actions {
    white-space: nowrap;
}

.pagination-wrap {
    display: flex;
    justify-content: flex-end;
    margin-top: 12px;
}

.search-select {
    position: relative;
}

.search-select-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 20;
    display: none;
    max-height: 240px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 16px 34px rgba(30, 50, 70, .16);
    padding: 6px;
}

.search-select-menu.show {
    display: grid;
    gap: 4px;
}

.search-select-menu::after {
    content: "Nama warga tidak ditemukan";
    display: none;
    color: var(--muted);
    padding: 10px 12px;
    font-size: 14px;
}

.search-select-menu.is-empty::after {
    display: block;
}

.search-select-menu button {
    width: 100%;
    border: 0;
    background: transparent;
    border-radius: 8px;
    padding: 9px 10px;
    text-align: left;
}

.search-select-menu button:hover,
.search-select-menu button:focus {
    background: #edf4ff;
}

.search-select-menu button span {
    display: block;
    font-weight: 700;
    color: var(--text);
}

.search-select-menu button small {
    color: var(--muted);
}

.ts-wrapper.form-select {
    padding: 0;
    border: 0;
}

.ts-control {
    min-height: 44px;
    border-color: var(--line);
    border-radius: 8px;
    padding: 7px 12px;
}

.ts-control input {
    font-size: 15px;
}

.ts-dropdown {
    border-color: var(--line);
    border-radius: 8px;
    box-shadow: 0 16px 34px rgba(30, 50, 70, .16);
    overflow: hidden;
}

.ts-dropdown .option {
    padding: 0;
}

.warga-option {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 4px 14px;
    padding: 10px 12px;
}

.warga-option strong {
    color: var(--text);
    font-size: 14px;
}

.warga-option span {
    color: var(--muted);
    font-size: 12px;
    white-space: nowrap;
}

.warga-option span:last-child {
    grid-column: 1 / -1;
}

.warga-selected {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.warga-selected strong {
    font-size: 14px;
}

.warga-selected span,
.no-results {
    color: var(--muted);
    font-size: 12px;
}

.btn {
    border-radius: 8px;
    font-weight: 650;
}

.form-control,
.form-select,
.input-group-text {
    border-radius: 8px;
}

@media (max-width: 992px) {
    .app-shell { display: block; }
    .sidebar {
        width: 100%;
        flex: none;
    }
    .sidebar-nav {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .topbar,
    .info-band,
    .panel-head {
        align-items: flex-start;
        flex-direction: column;
    }
    .filter-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 576px) {
    .content-area,
    .topbar {
        padding: 20px 16px;
    }
    .sidebar-nav {
        grid-template-columns: 1fr;
    }
    .filter-grid,
    .search-form {
        grid-template-columns: 1fr;
        width: 100%;
    }
    .search-form {
        display: grid;
    }
    .export-actions {
        flex-wrap: wrap;
    }
}
