* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --accent: #4f46e5;          /* indigo – satu warna aksen utama */
    --accent-soft: #eef2ff;
    --ink: #0f172a;             /* near-black untuk teks utama */
    --ink-soft: #475569;        /* teks sekunder */
    --ink-muted: #94a3b8;       /* teks redup */
    --line: #e9edf3;            /* border tipis */
    --surface: #ffffff;
    --bg: #f6f7f9;
    --radius: 14px;
    --shadow-sm: 0 1px 2px rgba(16,24,40,0.04), 0 1px 3px rgba(16,24,40,0.06);
    --shadow-md: 0 4px 12px rgba(16,24,40,0.06), 0 2px 4px rgba(16,24,40,0.04);
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    letter-spacing: -0.01em;
}

.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 250px;
    background: #ffffff;
    color: #111827;
    padding: 20px 0;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    border-right: 1px solid #e2e8f0;
}

.sidebar-header {
    text-align: center;
    padding: 20px;
    border-bottom: 1px solid #e2e8f0;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.sidebar-logo {
    width: 100px;
    height: auto;
    display: block;
}

.sidebar-header h2 {
    font-size: 1.4rem;
    margin-bottom: 0;
}

.sidebar-header p {
    opacity: 0.7;
    font-size: 0.9rem;
}

.nav-item {
    cursor: pointer;
    transition: all 0.3s ease;
    display: block;
    font-size: 0.95rem;
}
.nav-item:hover {
    background: #f1f5f9;
}

/* Make nav links fill the whole item so right-click/new-tab and whole-row clicks work */
.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 25px;
    color: inherit;
    text-decoration: none;
    width: 100%;
}
.nav-link:hover {
    color: inherit;
}

.nav-item:hover {
    background: #f1f5f9;
}

.nav-item.active {
    background: var(--accent-soft);
    border-left: 3px solid var(--accent);
}
.nav-item.active .nav-link {
    color: var(--accent);
    font-weight: 600;
}

.nav-item i {
    width: 20px;
    text-align: center;
}

.nav-section {
    padding: 12px 25px 4px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(17,24,39,0.5);
    font-weight: 600;
    list-style: none;
}

.nav-logout {
    color: #e53e3e !important;
    margin-top: 10px;
    border-top: 1px solid #e2e8f0;
}

.nav-logout:hover {
    background: rgba(229, 62, 62, 0.1) !important;
}

.nav-logout:hover {
    background: rgba(252, 129, 129, 0.2) !important;
}

/* Main Content */
.main-content {
    margin-left: 250px;
    padding: 30px;
    flex: 1;
    width: calc(100% - 250px);
    background-image: url('');
    background-repeat: no-repeat;
    background-position: top right;
    background-size: 140px;
    background-attachment: fixed;
}

.page {
    display: none;
}

.page.active {
    display: block;
}

.page h1 {
    color: var(--ink);
    margin-bottom: 25px;
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

/* Summary Cards */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.card-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}

.card-saldo .card-icon {
    background: var(--accent-soft);
    color: var(--accent);
}

.card-masuk .card-icon {
    background: #ecfdf5;
    color: #059669;
}

.card-keluar .card-icon {
    background: #fef2f2;
    color: #dc2626;
}

.card-iuran .card-icon {
    background: var(--accent-soft);
    color: var(--accent);
}

.card-security .card-icon {
    background: #e6fffa;
    color: #205c4d;
}

.card-trash .card-icon {
    background: #fffaf0;
    color: #9c4221;
}

.card-info h3 {
    font-size: 0.85rem;
    color: #718096;
    margin-bottom: 5px;
}

.card-info p {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--ink);
    letter-spacing: -0.02em;
}

/* Forms */
.input-form {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: var(--shadow-sm);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #4a5568;
    font-size: 0.9rem;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--ink);
    background: #fcfcfd;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(79,70,229,0.12);
}

.form-group label {
    color: var(--ink-soft);
}

/* Tag Checkboxes */
.tag-checks {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.tag-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 400;
    cursor: pointer;
}
.tag-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: #2b6cb0;
    color: white;
}

.btn-primary:hover {
    background: #2c5282;
}

.btn-danger {
    background: #c53030;
    color: white;
}

.btn-danger:hover {
    background: #9b2c2c;
}

.btn-invoice {
    background: #dd6b20;
    color: white;
}

.btn-invoice:hover {
    background: #c05621;
}

.form-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.btn-delete {
    background: #fed7d7;
    color: #c53030;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.3s;
}

.btn-delete:hover {
    background: #fc8181;
    color: white;
}

/* Tables */
.data-table {
    width: 100%;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    border-collapse: collapse;
}

.data-table thead {
    background: #edf2f7;
}

.data-table th {
    padding: 14px 16px;
    text-align: left;
    font-size: 0.85rem;
    color: #4a5568;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #edf2f7;
    font-size: 0.9rem;
}

.data-table tbody tr:hover {
    background: #f7fafc;
}

.empty-state {
    text-align: center;
    color: #a0aec0;
    padding: 30px !important;
    font-style: italic;
}

/* Badge */
.badge-masuk {
    background: #c6f6d5;
    color: #276749;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-keluar {
    background: #fed7d7;
    color: #c53030;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-iuran {
    background: #e9d8fd;
    color: #6b46c1;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

/* Filter Section */
.filter-section {
    background: white;
    padding: 15px 20px;
    border-radius: 12px;
    margin-bottom: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    display: flex;
    align-items: center;
    gap: 10px;
}

.filter-section label {
    font-weight: 600;
    color: #4a5568;
}

.filter-section select {
    padding: 8px 14px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.9rem;
}

/* Radio Group */
.radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.radio-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: normal;
    cursor: pointer;
}

/* Recent Transactions */
.recent-transactions {
    margin-top: 10px;
}

.recent-transactions h2 {
    color: #2d3748;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 10px;
}

.import-note {
    color: #4a5568;
    font-size: 0.95rem;
    margin-bottom: 18px;
}

.page-header h1 {
    margin-bottom: 0;
}

.import-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-import {
    background: #38a169;
    color: white;
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s;
}

.btn-import:hover {
    background: #2f855a;
}

.btn-import-merge {
    background: #805ad5;
    color: white;
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s;
}

.btn-import-merge:hover {
    background: #6b46c1;
}

/* Sortable Table */
.sortable-table th.sortable {
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}

.sortable-table th.sortable:hover {
    background: #e2e8f0;
}

.sortable-table th.sortable i {
    margin-left: 5px;
    font-size: 0.75rem;
    opacity: 0.5;
}

.sortable-table th.sortable.sort-asc i,
.sortable-table th.sortable.sort-desc i {
    opacity: 1;
    color: #2b6cb0;
}

/* Search Input */
.search-input {
    padding: 8px 14px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.9rem;
    min-width: 200px;
    transition: border-color 0.3s;
}

.search-input:focus {
    outline: none;
    border-color: #63b3ed;
}

/* Status Badge */
.status-menempati {
    background: #c6f6d5;
    color: #276749;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.status-belum {
    background: #fefcbf;
    color: #975a16;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.status-tentative {
    background: #e9d8fd;
    color: #553c9a;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.status-tidak {
    background: #e2e8f0;
    color: #4a5568;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.status-beku {
    background: #bee3f8;
    color: #2c5282;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.status-ruko {
    background: #fed7d7;
    color: #c53030;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.status-pindah {
    background: #feebc8;
    color: #9c4221;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.ipl-text {
    font-size: 0.8rem;
    color: #4a5568;
}

/* Tag Badge */
.tag-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-right: 4px;
    margin-bottom: 4px;
}
.tag-keamanan { background: #ebf8ff; color: #2b6cb0; }
.tag-kas { background: #faf5ff; color: #6b46c1; }
.tag-rkm { background: #fff5f5; color: #c53030; }
.tag-sampah { background: #e6fffa; color: #205c4d; }

/* Jenis Hunian Badge */
.badge-jenis-hunian {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    margin-left: 6px;
    vertical-align: middle;
}
.badge-jenis-tetap {
    background: #e9d8fd;
    color: #553c9a;
}
.badge-jenis-kontrak {
    background: #feebc8;
    color: #9c4221;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: 16px;
    width: 100%;
    max-width: 700px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid #e2e8f0;
}

.modal-header h2 {
    color: #1e3a5f;
    font-size: 1.3rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    color: #718096;
    line-height: 1;
    padding: 0 5px;
}

.modal-close:hover {
    color: #c53030;
}

.modal-body {
    padding: 25px;
}

.modal-info {
    background: #f7fafc;
    border-radius: 10px;
    padding: 15px 20px;
    margin-bottom: 20px;
}

.modal-info p {
    margin-bottom: 6px;
    font-size: 0.95rem;
}

.modal-info p:last-child {
    margin-bottom: 0;
}

.highlight-text {
    color: #2b6cb0;
    font-weight: 700;
    font-size: 1rem;
}

.modal-filter {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.modal-filter label {
    font-weight: 600;
    color: #4a5568;
}

.modal-filter select {
    padding: 6px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.9rem;
}

/* Iuran Grid - Calendar Style */
.iuran-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 25px;
}

.iuran-grid-item {
    border-radius: 10px;
    padding: 12px;
    text-align: center;
    font-size: 0.85rem;
    font-weight: 600;
    transition: transform 0.2s;
}

.iuran-grid-item:hover {
    transform: scale(1.03);
}

.iuran-grid-item .bulan-name {
    display: block;
    margin-bottom: 4px;
}

.iuran-grid-item .bulan-amount {
    display: block;
    font-size: 0.75rem;
    font-weight: normal;
    opacity: 0.8;
}

.iuran-lunas {
    background: #c6f6d5;
    color: #276749;
    border: 2px solid #9ae6b4;
}

.iuran-deposit {
    background: #fefcbf;
    color: #975a16;
    border: 2px solid #f6e05e;
}

.iuran-belum {
    background: #fed7d7;
    color: #c53030;
    border: 2px solid #feb2b2;
}

.iuran-detail-table {
    margin-top: 10px;
}

.iuran-detail-table h3 {
    color: #2d3748;
    margin-bottom: 10px;
    font-size: 1rem;
}

/* Button Detail */
.btn-detail {
    background: #ebf8ff;
    color: #2b6cb0;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.3s;
    margin-right: 5px;
}

.btn-detail:hover {
    background: #bee3f8;
    color: #2c5282;
}

.btn-edit {
    background: #fefcbf;
    color: #975a16;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.3s;
    margin-right: 5px;
}

.btn-edit:hover {
    background: #f6e05e;
    color: #744210;
}

.btn-cancel {
    background: #e2e8f0;
    color: #4a5568;
}

.btn-cancel:hover {
    background: #cbd5e0;
}

/* Saving cells */
.saving-cell {
    text-align: center;
    font-size: 0.75rem;
    padding: 6px 4px !important;
}

.saving-paid {
    background: #c6f6d5;
    color: #276749;
    font-weight: 600;
}

.saving-empty {
    color: #cbd5e0;
}

.saving-summary {
    margin-top: 10px;
}

/* Bulk Actions */
.bulk-actions {
    margin-bottom: 10px;
    min-height: 30px;
}

/* Warga Link */
.warga-link {
    color: #2b6cb0;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.warga-link:hover {
    color: #1a4971;
    text-decoration: underline;
}

@media (max-width: 600px) {
    .iuran-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .modal-content {
        max-width: 100%;
        border-radius: 12px;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 60px;
        padding: 10px 0;
    }

    .sidebar-header h2,
    .sidebar-header p,
    .nav-item span {
        display: none;
    }

    .nav-item {
        justify-content: center;
        padding: 14px;
    }

    .main-content {
        margin-left: 60px;
        width: calc(100% - 60px);
        padding: 15px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .summary-cards {
        grid-template-columns: 1fr 1fr;
    }

    .radio-group {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .summary-cards {
        grid-template-columns: 1fr;
    }
}

/* =====================================================
   COLLAPSIBLE SIDEBAR GROUPS
   ===================================================== */

/* Group header (klik untuk collapse/expand) */
.nav-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 25px 4px;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}

.nav-group-header:hover {
    background: #f1f5f9;
}

.nav-group-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(17,24,39,0.5);
    font-weight: 700;
}

.nav-group-arrow {
    font-size: 0.65rem;
    color: rgba(17,24,39,0.4);
    transition: transform 0.25s ease;
}

.nav-group-header.collapsed .nav-group-arrow {
    transform: rotate(-90deg);
}

/* Submenu container */
.nav-submenu {
    list-style: none;
    overflow: hidden;
    max-height: 600px;
    transition: max-height 0.3s ease, opacity 0.25s ease;
    opacity: 1;
}

.nav-submenu.collapsed {
    max-height: 0;
    opacity: 0;
}

/* Summary cards baru: pemasukan & pengeluaran */
.card-pemasukan .card-icon {
    background: #e6fffa;
    color: #2c7a7b;
}

.card-pengeluaran .card-icon {
    background: #fff5f5;
    color: #c53030;
}

.card-keamanan .card-icon {
    background: #ebf8ff;
    color: #2b6cb0;
}

.card-rkm .card-icon {
    background: #fff5f5;
    color: #c53030;
}

.card-sampah .card-icon {
    background: #e6fffa;
    color: #2c7a7b;
}

/* Summary total bar di atas tabel */
.summary-bar {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.summary-bar-item {
    background: white;
    border-radius: 10px;
    padding: 14px 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 180px;
}

.summary-bar-item .sbi-label {
    font-size: 0.78rem;
    color: #718096;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.summary-bar-item .sbi-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: #1e3a5f;
}

.summary-bar-item .sbi-value.green  { color: #276749; }
.summary-bar-item .sbi-value.red    { color: #c53030; }
.summary-bar-item .sbi-value.purple { color: #6b46c1; }

.btn-secondary {
    background: #e2e8f0;
    color: #4a5568;
}
.btn-secondary:hover {
    background: #cbd5e0;
}

/* Active tab style untuk rekapan */
.rekapan-tab-btn.btn-primary {
    box-shadow: 0 2px 8px rgba(43,108,176,0.25);
}

/* =====================================================
   MODAL TABS
   ===================================================== */
.modal-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 0;
}

.modal-tab-btn {
    background: none;
    border: none;
    padding: 8px 18px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #718096;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    border-radius: 6px 6px 0 0;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.modal-tab-btn:hover {
    color: #2b6cb0;
    background: #f7fafc;
}

.modal-tab-btn.active {
    color: #2b6cb0;
    border-bottom-color: #2b6cb0;
    background: #ebf8ff;
}

.modal-tab-content {
    animation: fadeInTab 0.15s ease;
}

@keyframes fadeInTab {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* =====================================================
   SITE PLAN
   ===================================================== */
.siteplan-legend {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 14px;
    background: white;
    padding: 12px 18px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
}
.sp-legend-item {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #4a5568;
}
.sp-dot {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    display: inline-block;
}
.sp-dot.sp-menempati { background: #68d391; border: 2px solid #38a169; }
.sp-dot.sp-belum     { background: #faf089; border: 2px solid #d69e2e; }
.sp-dot.sp-ruko      { background: #fc8181; border: 2px solid #e53e3e; }
.sp-dot.sp-kosong    { background: #e2e8f0; border: 2px solid #a0aec0; }

.siteplan-summary {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.sp-blok-summary {
    background: white;
    border-radius: 10px;
    padding: 10px 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
    font-size: 0.82rem;
    text-align: center;
    min-width: 90px;
}
.sp-blok-summary .sp-bs-title {
    font-weight: 700;
    color: #2b6cb0;
    font-size: 0.9rem;
    display: block;
    margin-bottom: 3px;
}
.sp-blok-summary .sp-bs-count {
    font-size: 1.4rem;
    font-weight: 800;
    color: #2d3748;
    display: block;
}
.sp-blok-summary .sp-bs-label {
    color: #718096;
    font-size: 0.75rem;
}

.siteplan-scroll {
    overflow-x: auto;
    padding-bottom: 16px;
}
.siteplan-container {
    display: flex;
    gap: 10px;
    min-width: max-content;
    align-items: flex-start;
}

/* Blok container */
.sp-blok {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}
.sp-blok-title {
    background: #2b6cb0;
    color: white;
    font-weight: 800;
    font-size: 0.8rem;
    padding: 5px 14px;
    border-radius: 6px;
    text-align: center;
    width: 100%;
    letter-spacing: 0.5px;
}
.sp-blok-title.sp-title-b5 { background: #276749; }
.sp-blok-title.sp-title-b4 { background: #c05621; }
.sp-blok-title.sp-title-b3 { background: #b7791f; }
.sp-blok-title.sp-title-b2 { background: #2c7a7b; }
.sp-blok-title.sp-title-b1 { background: #553c9a; }
.sp-blok-title.sp-title-a2 { background: #2b6cb0; }
.sp-blok-title.sp-title-al { background: #702459; }

.sp-blok-cols {
    display: flex;
    gap: 4px;
}
.sp-col {
    display: flex;
    flex-direction: column;
    gap: 3px;
    width: 100px;
}
.sp-col-label {
    text-align: center;
    font-size: 0.65rem;
    color: #718096;
    font-weight: 600;
    padding: 2px 0;
}

/* Kavling card */
.sp-kavling {
    background: #e2e8f0;
    border: 1.5px solid #a0aec0;
    border-radius: 5px;
    padding: 5px 6px;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    min-height: 52px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.sp-kavling:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.18);
    z-index: 2;
    position: relative;
}
.sp-kavling.sp-menempati {
    background: #c6f6d5;
    border-color: #38a169;
}
.sp-kavling.sp-belum {
    background: #fefcbf;
    border-color: #d69e2e;
}
.sp-kavling.sp-ruko {
    background: #fed7d7;
    border-color: #e53e3e;
}
.sp-kavling.sp-kosong {
    background: #f7fafc;
    border-color: #e2e8f0;
    cursor: default;
}
.sp-kavling.sp-empty {
    background: white;
    border-color: #e2e8f0;
    cursor: default;
    min-height: 52px;
}
.sp-kavling .sp-no-rumah {
    font-size: 0.68rem;
    font-weight: 700;
    color: #2d3748;
    line-height: 1.2;
}
.sp-kavling .sp-nama {
    font-size: 0.63rem;
    color: #4a5568;
    margin-top: 2px;
    line-height: 1.2;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.sp-kavling .sp-status-badge {
    font-size: 0.58rem;
    font-weight: 700;
    margin-top: 3px;
    padding: 1px 5px;
    border-radius: 4px;
    display: inline-block;
    width: fit-content;
}
.sp-menempati .sp-status-badge { background: #276749; color: white; }
.sp-belum     .sp-status-badge { background: #d69e2e; color: white; }
.sp-ruko      .sp-status-badge { background: #c53030; color: white; }

/* Lorong label */
.sp-lorong {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
    font-size: 0.7rem;
    font-weight: 700;
    color: #4a5568;
    background: #e2e8f0;
    padding: 8px 4px;
    border-radius: 6px;
    align-self: stretch;
    display: flex;
    align-items: center;
    justify-content: center;
    letter-spacing: 1px;
}

/* Jalan label */
.sp-jalan {
    background: #4a5568;
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 6px 10px;
    border-radius: 6px;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    letter-spacing: 1px;
    align-self: stretch;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Total bar */
.sp-total-bar {
    display: flex;
    gap: 4px;
    margin-top: 10px;
    background: #2d3748;
    color: white;
    padding: 8px 14px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.85rem;
    align-items: center;
}
.sp-total-blok {
    background: #e53e3e;
    color: white;
    font-weight: 800;
    font-size: 1.1rem;
    padding: 4px 10px;
    border-radius: 6px;
    min-width: 100px;
    text-align: center;
}

/* ===== Dashboard panels: Tunggakan & Cashflow ===== */
.dashboard-panel {
    background: #fff;
    border-radius: 12px;
    padding: 18px 20px;
    margin-top: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.dashboard-panel .panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    gap: 12px;
    flex-wrap: wrap;
}

.dashboard-panel .panel-head h2 {
    font-size: 1.15rem;
    color: #2d3748;
    margin: 0;
}

.btn-link {
    background: none;
    border: none;
    color: #3182ce;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 4px 6px;
}
.btn-link:hover { text-decoration: underline; }

.cashflow-select {
    padding: 6px 10px;
    border: 1px solid #cbd5e0;
    border-radius: 8px;
    font-size: 0.9rem;
    background: #fff;
}

/* Tunggakan */
.tunggakan-summary {
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
}

.tunggakan-stat {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.tunggakan-angka {
    font-size: 2.2rem;
    font-weight: 700;
    color: #c53030;
}

.tunggakan-sub { color: #718096; font-size: 0.9rem; }

.progress-wrap {
    position: relative;
    flex: 1;
    min-width: 200px;
    height: 22px;
    background: #fed7d7;
    border-radius: 11px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    width: 0;
    background: #48bb78;
    border-radius: 11px;
    transition: width 0.4s ease;
}

.progress-label {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    line-height: 22px;
    text-align: center;
    font-size: 0.8rem;
    font-weight: 600;
    color: #1a202c;
}

.tunggakan-list { margin-top: 14px; }

/* Cashflow */
.cashflow-table-wrap { overflow-x: auto; }

.cashflow-table td { vertical-align: middle; }

.cf-amount { font-weight: 600; font-size: 0.92rem; }
.cf-in { color: #276749; }
.cf-out { color: #c53030; }

.cf-bar {
    margin-top: 4px;
    height: 6px;
    background: #edf2f7;
    border-radius: 3px;
    overflow: hidden;
}
.cf-bar-in { height: 100%; background: #48bb78; }
.cf-bar-out { height: 100%; background: #f56565; }

.tren-up { color: #c53030; font-weight: 600; font-size: 0.85rem; }
.tren-down { color: #276749; font-weight: 600; font-size: 0.85rem; }
.tren-flat { color: #a0aec0; }

/* ===== Komposisi Warga: donut + bars ===== */
.komposisi-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 28px;
    align-items: start;
}

.komposisi-subtitle {
    font-size: 1rem;
    color: #4a5568;
    margin: 0 0 14px;
}

.donut-row {
    display: flex;
    align-items: center;
    gap: 22px;
    flex-wrap: wrap;
}

.donut {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    flex-shrink: 0;
    /* hollow center -> donut */
    -webkit-mask: radial-gradient(circle 45px at center, transparent 98%, #000 100%);
            mask: radial-gradient(circle 45px at center, transparent 98%, #000 100%);
    background: #edf2f7;
}

.donut-legend {
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: 0.9rem;
    color: #2d3748;
}
.donut-legend li { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.legend-dot { width: 12px; height: 12px; border-radius: 3px; display: inline-block; flex-shrink: 0; }
.legend-pct { color: #718096; }

.partisipasi-item { margin-bottom: 14px; }
.partisipasi-head {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: #2d3748;
    margin-bottom: 5px;
}
.partisipasi-track {
    height: 14px;
    background: #edf2f7;
    border-radius: 7px;
    overflow: hidden;
}
.partisipasi-fill {
    height: 100%;
    border-radius: 7px;
    transition: width 0.4s ease;
}

@media (max-width: 768px) {
    .komposisi-grid { grid-template-columns: 1fr; }
}

/* ===== Status bayar iuran (di form input iuran) ===== */
.iuran-status-bayar {
    margin: -4px 0 14px;
    padding: 10px 14px;
    background: #ebf8ff;
    border: 1px solid #bee3f8;
    border-left: 4px solid #3182ce;
    border-radius: 8px;
    font-size: 0.9rem;
    color: #2c5282;
}
.iuran-status-bayar .status-belum { color: #c05621; font-weight: 600; }

/* ===== Banner riwayat pembayaran per-warga (halaman Iuran) ===== */
.iuran-riwayat-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 10px 14px;
    margin-bottom: 12px;
    background: #fffaf0;
    border: 1px solid #feebc8;
    border-left: 4px solid #dd6b20;
    border-radius: 8px;
    font-size: 0.9rem;
    color: #7b341e;
}

/* ===== Toast Notifications ===== */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 260px;
    max-width: 380px;
    padding: 13px 16px;
    border-radius: 12px;
    background: #ffffff;
    color: var(--ink);
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: 0 8px 24px rgba(16,24,40,0.12), 0 2px 6px rgba(16,24,40,0.08);
    border: 1px solid var(--line);
    border-left: 4px solid var(--ink-muted);
    cursor: pointer;
    transform: translateX(120%);
    opacity: 0;
    transition: transform 0.35s cubic-bezier(0.16,1,0.3,1), opacity 0.35s ease;
}

.toast.toast-show {
    transform: translateX(0);
    opacity: 1;
}

.toast i { font-size: 1.1rem; flex-shrink: 0; }

.toast-success { border-left-color: #10b981; }
.toast-success i { color: #10b981; }
.toast-error { border-left-color: #ef4444; }
.toast-error i { color: #ef4444; }
.toast-warning { border-left-color: #f59e0b; }
.toast-warning i { color: #f59e0b; }
.toast-info { border-left-color: var(--accent); }
.toast-info i { color: var(--accent); }

@media (max-width: 480px) {
    .toast-container { left: 12px; right: 12px; top: 12px; }
    .toast { min-width: 0; max-width: none; }
}

/* ===== Modal Preview Laporan PDF ===== */
.report-preview-modal {
    position: fixed;
    inset: 0;
    z-index: 9000;
    background: rgba(15, 23, 42, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    backdrop-filter: blur(2px);
}

.report-preview-box {
    background: var(--surface, #fff);
    border-radius: var(--radius, 14px);
    width: 100%;
    max-width: 1000px;
    height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
}

.report-preview-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 14px 18px;
    border-bottom: 1px solid var(--line, #e9edf3);
    font-weight: 600;
    color: var(--ink, #0f172a);
}

.report-preview-frame {
    flex: 1;
    width: 100%;
    border: none;
    background: #525659; /* abu khas viewer PDF */
}

@media (max-width: 640px) {
    .report-preview-box { height: 95vh; }
}

/* ===== Ringkasan Arus Kas (dashboard) ===== */
.cashflow-overview {
    display: grid;
    grid-template-columns: 1fr auto 1fr auto 1fr;
    align-items: stretch;
    gap: 14px;
    margin-bottom: 28px;
}

.cf-ov-card {
    background: var(--surface, #fff);
    border: 1px solid var(--line, #e9edf3);
    border-radius: var(--radius, 14px);
    padding: 18px 20px;
    box-shadow: var(--shadow-sm, 0 1px 3px rgba(16,24,40,0.06));
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cf-ov-top { display: flex; align-items: center; gap: 10px; }

.cf-ov-icon {
    width: 34px; height: 34px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    flex-shrink: 0;
}
.cf-ov-label { font-size: 0.85rem; color: var(--ink-soft, #475569); font-weight: 600; }

.cf-ov-value {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--ink, #0f172a);
}

.cf-ov-detail {
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-size: 0.78rem;
    color: var(--ink-muted, #94a3b8);
    margin-top: auto;
}
.cf-ov-detail strong { color: var(--ink-soft, #475569); font-weight: 700; }

/* warna aksen per kartu */
.cf-ov-in .cf-ov-icon { background: #ecfdf5; color: #059669; }
.cf-ov-in .cf-ov-value { color: #059669; }
.cf-ov-out .cf-ov-icon { background: #fef2f2; color: #dc2626; }
.cf-ov-out .cf-ov-value { color: #dc2626; }
.cf-ov-balance {
    background: linear-gradient(135deg, #eef2ff, #f8fafc);
    border-color: #c7d2fe;
}
.cf-ov-balance .cf-ov-icon { background: var(--accent, #4f46e5); color: #fff; }
.cf-ov-balance .cf-ov-value { color: var(--accent, #4f46e5); }
.cf-ov-balance.is-negative { background: linear-gradient(135deg, #fef2f2, #fff); border-color: #fecaca; }
.cf-ov-balance.is-negative .cf-ov-icon { background: #dc2626; }
.cf-ov-balance.is-negative .cf-ov-value { color: #dc2626; }

.cf-ov-op {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--ink-muted, #94a3b8);
}

/* Responsif: tumpuk vertikal di layar kecil, sembunyikan operator */
@media (max-width: 860px) {
    .cashflow-overview { grid-template-columns: 1fr; }
    .cf-ov-op { display: none; }
}
