/* ================= GLOBAL ================= */
body {
    font-family: Arial, sans-serif;
    background: #f3f4f6;
    margin: 0;
}

/* ================= LOGIN ================= */
.login-page {
    display: flex;
    height: 100vh;
    justify-content: center;
    align-items: center;
}

.login-box {
    width: 320px;
    padding: 20px;
    background: white;
    border-radius: 6px;
}

.login-box input {
    width: 100%;
    padding: 10px;
    margin-bottom: 10px;
}

.login-box button {
    width: 100%;
    padding: 10px;
    background: #2563eb;
    color: white;
    border: none;
}

.error {
    background: #fee2e2;
    padding: 8px;
    margin-bottom: 10px;
}

/* ================= BUTTON ================= */
.btn-export {
    display: inline-block;
    padding: 8px 16px;
    background: #217346;
    color: #fff;
    border: none;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background .2s;
}
.btn-export:hover { background: #185c38; }

.btn-primary {
    display: inline-block;
    padding: 10px 18px;
    background: #2563eb;
    color: #fff;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
}

.btn-primary:hover {
    background: #1e40af;
}

.btn-secondary {
    padding: 10px 18px;
    background: #e5e7eb;
    color: #111;
    border-radius: 6px;
    text-decoration: none;
}

.logout-btn {
    padding: 10px 18px;
    background: #ef4444;
    color: #fff;
    border-radius: 8px;
    text-decoration: none;
}

/* ================= DASHBOARD ================= */
.dashboard-header {
    margin-bottom: 20px;
}

.role-badge {
    background: #2563eb;
    color: #fff;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.dashboard-card {
    display: flex;
    gap: 16px;
    padding: 18px;
    border-radius: 12px;
    text-decoration: none;
    color: #111;
    background: linear-gradient(135deg, #f8fafc, #e5e7eb);
    box-shadow: 0 6px 14px rgba(0,0,0,.08);
    transition: all .25s ease;
}

.dashboard-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 14px 24px rgba(0,0,0,.15);
}

.card-icon {
    font-size: 40px;
}

.card-body h3 {
    margin: 0;
    font-size: 18px;
}

.card-body p {
    margin: 4px 0 0;
    font-size: 14px;
    color: #555;
}

/* Variasi warna dashboard */
.dashboard-card:nth-child(1) { background: linear-gradient(135deg,#dbeafe,#bfdbfe); }
.dashboard-card:nth-child(2) { background: linear-gradient(135deg,#dcfce7,#bbf7d0); }
.dashboard-card:nth-child(3) { background: linear-gradient(135deg,#fef3c7,#fde68a); }
.dashboard-card:nth-child(4) { background: linear-gradient(135deg,#ede9fe,#ddd6fe); }
.dashboard-card:nth-child(5) { background: linear-gradient(135deg,#fee2e2,#fecaca); }
.dashboard-card:nth-child(6) { background: linear-gradient(135deg,#cffafe,#a5f3fc); }

.dashboard-card.warning {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
}

.dashboard-footer {
    margin-top: 30px;
}

/* ================= CARD / TABLE ================= */
.card {
    background: #ffffff;
    padding: 16px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 8px;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
}

.table .aksi button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    margin-right: 5px;
}

/* ================= KK / WARGA ================= */
.kk-top-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.card-left,
.card-right {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 16px 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
}

.card-actions {
    margin-top: 10px;
    text-align: right;
}

.btn-kecil {
    background: none;
    border: 1px solid #94a3b8;
    border-radius: 4px;
    padding: 1px 5px;
    cursor: pointer;
    font-size: 0.85em;
    color: #334155;
    margin-left: 2px;
    vertical-align: middle;
}
.btn-kecil:hover { background: #e2e8f0; }

.row-bottom {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
}

/* ================= FORM ================= */
.form-card {
    background: #fff;
    padding: 20px;
    border-radius: 10px;
    max-width: 900px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: 600;
    margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #ccc;
    font-size: 14px;
}

.form-actions {
    text-align: right;
}

/* ================= MODAL ================= */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 999;
    background: rgba(0,0,0,0.5);
}

.modal-content {
    background: #fff;
    margin: 5% auto;
    padding: 20px;
    width: 90%;
    max-width: 900px;
    border-radius: 10px;
    position: relative;
}

.close {
    position: absolute;
    right: 15px;
    top: 10px;
    font-size: 22px;
    cursor: pointer;
}

/* ================= EMPTY / INFO ================= */
.empty-box {
    max-width: 520px;
    margin: 80px auto;
    padding: 30px;
    background: #fff;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 12px 30px rgba(0,0,0,.15);
}

/* ================= RESPONSIVE ================= */
@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
    }

    .form-actions,
    .card-actions {
        text-align: center;
    }

    .kk-top-grid {
        grid-template-columns: 1fr;
    }

    .row-bottom {
        flex-direction: column;
        gap: 10px;
    }

.btn-secondary {
    display: inline-block;
    padding: 10px 18px;
    background: #6b7280;
    color: #fff;
    border-radius: 6px;
    text-decoration: none;
}

.btn-secondary:hover {
    background: #4b5563;
}



}


.dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}
.eyebrow {
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6b7280;
    font-size: 12px;
}
.dashboard-header h2 {
    margin: 4px 0 6px;
}
.subtitle {
    margin: 0;
    color: #4b5563;
}

/* ══════════════════════════════════════════════════════════
   NEW DASHBOARD 2026
══════════════════════════════════════════════════════════ */

/* ── Container 1: Welcome ── */
.db-welcome {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 60%, #38bdf8 100%);
    border-radius: 16px;
    padding: 28px 32px;
    color: #fff;
    margin-bottom: 24px;
    box-shadow: 0 8px 24px rgba(37,99,235,0.30);
    flex-wrap: wrap;
}
.db-welcome-left {
    display: flex;
    align-items: center;
    gap: 20px;
}
.db-welcome-icon {
    font-size: 52px;
    line-height: 1;
    background: rgba(255,255,255,0.15);
    border-radius: 50%;
    width: 72px;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.db-sapa {
    margin: 0 0 2px;
    font-size: 13px;
    opacity: 0.85;
    text-transform: uppercase;
    letter-spacing: .06em;
}
.db-username {
    margin: 0 0 10px;
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -.02em;
}
.db-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.db-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .03em;
}
.db-badge-role    { background: rgba(255,255,255,0.25); }
.db-badge-wilayah { background: rgba(255,255,255,0.15); }

.db-welcome-right {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}
.db-date-box, .db-total-box {
    background: rgba(255,255,255,0.15);
    border-radius: 12px;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 180px;
}
@media (max-width: 640px) {
    .db-welcome { padding: 20px 18px; gap: 14px; }
    .db-welcome-left { width: 100%; }
    .db-welcome-right {
        width: 100%;
        flex-wrap: nowrap;
        gap: 10px;
    }
    .db-date-box, .db-total-box {
        flex: 1;
        min-width: 0;
        padding: 10px 12px;
        gap: 8px;
    }
    .db-date-icon, .db-total-icon { font-size: 22px; }
    .db-total-value { font-size: 22px; }
    .db-date-value  { font-size: 12px; }
    .db-username    { font-size: 20px; }
    .db-welcome-icon { width: 52px; height: 52px; font-size: 38px; }
}
.db-date-icon, .db-total-icon {
    font-size: 28px;
}
.db-date-label {
    font-size: 11px;
    opacity: .75;
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-bottom: 2px;
}
.db-date-value  { font-size: 14px; font-weight: 600; }
.db-total-value { font-size: 28px; font-weight: 700; line-height: 1; }

/* ── Section wrapper ── */
.db-section {
    background: #fff;
    border-radius: 16px;
    padding: 24px 28px;
    margin-bottom: 24px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.07);
}
.db-section-header {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid #f1f5f9;
}
.db-section-icon  { font-size: 26px; line-height: 1; margin-top: 2px; }
.db-section-title { margin: 0 0 2px; font-size: 17px; font-weight: 700; color: #1e293b; }
.db-section-sub   { margin: 0; font-size: 13px; color: #64748b; }

/* ── Container 2: RW Table ── */
.db-rw-table-wrap {
    overflow-x: auto;
}
.db-rw-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 500px;
    font-size: 14px;
}
.db-rw-table thead tr {
    background: #1e3a5f;
    color: #fff;
}
.db-rw-table thead th {
    padding: 10px 16px;
    text-align: center;
    font-weight: 600;
    white-space: nowrap;
    letter-spacing: .03em;
}
.db-rw-th-label  { text-align: left !important; }
.db-rw-th-total  { background: #2563eb; }
.db-rw-table tbody tr:hover { background: #f8fafc; }
.db-rw-td-label {
    padding: 14px 16px;
    font-weight: 600;
    color: #374151;
    white-space: nowrap;
}
.db-rw-td-total {
    text-align: center;
    font-size: 20px;
    font-weight: 700;
    color: #2563eb;
    padding: 14px 16px;
    background: #eff6ff;
}
.db-rw-td-count {
    text-align: center;
    padding: 10px 16px;
    vertical-align: middle;
    min-width: 80px;
}
.db-rw-count {
    display: block;
    font-size: 18px;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.2;
}
.db-rw-bar-wrap {
    height: 6px;
    background: #e2e8f0;
    border-radius: 999px;
    margin: 5px auto;
    width: 70%;
    overflow: hidden;
}
.db-rw-bar {
    height: 100%;
    background: linear-gradient(90deg,#2563eb,#38bdf8);
    border-radius: 999px;
    transition: width .6s ease;
}
.db-rw-pct {
    font-size: 11px;
    color: #94a3b8;
}

/* ── Container 3: 8-Card Grid ── */
.db-cards-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}
@media (max-width: 1200px) { .db-cards-grid { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 640px)  { .db-cards-grid { grid-template-columns: 1fr; } }

.db-card {
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
}
.db-card-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 18px 14px;
}
.db-card-emoji  { font-size: 28px; line-height: 1; }
.db-card-title  { font-size: 15px; font-weight: 700; margin: 0; color: inherit; }
.db-card-subtitle { font-size: 12px; opacity: .75; margin: 2px 0 0; }
.db-card-body   { padding: 0 18px 18px; flex: 1; }

/* Card colour themes */
.db-card-blue  { background: linear-gradient(135deg,#eff6ff,#dbeafe); }
.db-card-blue .db-card-head { background: #2563eb; color: #fff; }

.db-card-teal  { background: linear-gradient(135deg,#f0fdfa,#ccfbf1); }
.db-card-teal .db-card-head { background: #0d9488; color: #fff; }

.db-card-pink  { background: linear-gradient(135deg,#fdf2f8,#fce7f3); }
.db-card-pink .db-card-head { background: #db2777; color: #fff; }

.db-card-red   { background: linear-gradient(135deg,#fef2f2,#fee2e2); }
.db-card-red .db-card-head  { background: #dc2626; color: #fff; }

.db-card-amber { background: linear-gradient(135deg,#fffbeb,#fef3c7); }
.db-card-amber .db-card-head { background: #d97706; color: #fff; }

.db-card-green { background: linear-gradient(135deg,#f0fdf4,#dcfce7); }
.db-card-green .db-card-head { background: #16a34a; color: #fff; }

/* Bar rows inside cards */
.db-bar-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}
.db-bar-row:last-child { margin-bottom: 0; }
.db-bar-label {
    width: 130px;
    font-size: 12px;
    color: #374151;
    flex-shrink: 0;
    white-space: normal;
    line-height: 1.3;
}
.db-bar-track {
    flex: 1;
    height: 8px;
    background: rgba(0,0,0,0.08);
    border-radius: 999px;
    overflow: hidden;
}
.db-bar-fill {
    height: 100%;
    border-radius: 999px;
    transition: width .6s ease;
    min-width: 2px;
}
.db-bar-val {
    width: 36px;
    text-align: right;
    font-size: 12px;
    font-weight: 700;
    color: #1e293b;
    flex-shrink: 0;
}

/* Bumil card */
.db-bumil-body {
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding-top: 10px !important;
}
.db-bumil-stat   { text-align: center; flex: 1; }
.db-bumil-num    { font-size: 36px; font-weight: 800; line-height: 1; color: #9d174d; }
.db-bumil-lbl    { font-size: 11px; color: #6b7280; margin-top: 4px; line-height: 1.3; }
.db-bumil-divider {
    width: 1px;
    height: 60px;
    background: rgba(0,0,0,0.12);
    flex-shrink: 0;
}
.db-bumil-born .db-bumil-num    { color: #16a34a; }  /* hijau  – sudah lahir   */
.db-bumil-pending .db-bumil-num { color: #d97706; }  /* kuning – belum lahir   */
.db-bumil-soon .db-bumil-num    { color: #dc2626; }  /* merah  – akan lahir    */

/* Stunting card */
.db-single-stat-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px 0 4px !important;
    text-align: center;
}
.db-big-number { font-size: 64px; font-weight: 900; line-height: 1; }
.db-big-label  { font-size: 13px; color: #6b7280; margin-top: 2px; }
.db-big-red    { color: #dc2626; }
.db-big-ok     { margin-top: 10px; font-size: 12px; color: #16a34a; font-weight: 600; }
.db-big-warn   { margin-top: 10px; font-size: 12px; color: #d97706; font-weight: 600; }
.db-big-alert  { margin-top: 10px; font-size: 12px; color: #dc2626; font-weight: 600; }

/* Mini table inside cards */
.db-mini-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.db-mini-table td {
    padding: 7px 4px;
    border-bottom: 1px solid rgba(0,0,0,0.06);
    color: #374151;
    vertical-align: middle;
}
.db-mini-table tr:last-child td { border-bottom: none; }
.db-mini-count { text-align: right; white-space: nowrap; }
.db-pill {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
}
.db-pill-amber { background: #fef3c7; color: #92400e; }
.db-pill-green { background: #dcfce7; color: #14532d; }

/* ── Filter Form (Statistik) ── */
.filter-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    padding: 10px 0;
}
.filter-form label {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    white-space: nowrap;
}
.filter-form select,
.filter-form input[type="date"] {
    padding: 5px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 13px;
    background: #fff;
    max-width: 100%;
}
.filter-form button[type="submit"] {
    padding: 5px 16px;
    background: #111827;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    white-space: nowrap;
}
.filter-group {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
}
.filter-group label {
    white-space: nowrap;
    font-weight: 600;
    font-size: 13px;
    color: #374151;
}
.filter-group select,
.filter-group input[type="date"] {
    padding: 5px 8px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 13px;
    background: #fff;
    min-width: 0;
}
.filter-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.filter-actions button {
    padding: 5px 16px;
    background: #111827;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    white-space: nowrap;
}
.filter-actions a {
    font-size: 12px;
    color: #6b7280;
    text-decoration: none;
    white-space: nowrap;
}
@media (max-width: 640px) {
    .filter-form {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    .filter-group {
        width: 100%;
        justify-content: space-between;
    }
    .filter-group select,
    .filter-group input[type="date"] { flex: 1; }
    .filter-actions { width: 100%; }
    .filter-actions button { flex: 1; }
}

/* ── RW Table mobile (vertikal) ── */
.db-rw-table-wrap  { overflow-x: auto; }
.db-rw-mobile-wrap { display: none; }
@media (max-width: 640px) {
    .db-rw-table-wrap  { display: none; }
    .db-rw-mobile-wrap { display: block; }
}
.db-rw-vtable {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.db-rw-vtable thead tr {
    background: #1e3a5f;
    color: #fff;
}
.db-rw-vtable thead th {
    padding: 10px 14px;
    font-weight: 600;
    text-align: left;
}
.db-rw-vtable thead th:last-child { text-align: right; }
.db-rw-vtable tbody tr:nth-child(odd)  { background: #f8fafc; }
.db-rw-vtable tbody tr:nth-child(even) { background: #fff; }
.db-rw-vtable tbody tr.db-rw-vtotal {
    background: #eff6ff;
    font-weight: 700;
    border-top: 2px solid #bfdbfe;
}
.db-rw-vtable tbody td {
    padding: 10px 14px;
    color: #1e293b;
    vertical-align: middle;
}
.db-rw-vtable tbody td:last-child {
    text-align: right;
    font-weight: 700;
    font-size: 16px;
    color: #2563eb;
}
