* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f0f2f5;
    color: #333;
}

.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: #e2e8f0;
    border-left: 4px solid #3182ce;
}

.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: #1e3a5f;
    margin-bottom: 25px;
    font-size: 1.8rem;
}

/* Summary Cards */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    transition: transform 0.2s;
}

.card:hover {
    transform: translateY(-2px);
}

.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: #ebf8ff;
    color: #2b6cb0;
}

.card-masuk .card-icon {
    background: #f0fff4;
    color: #276749;
}

.card-keluar .card-icon {
    background: #fff5f5;
    color: #c53030;
}

.card-iuran .card-icon {
    background: #faf5ff;
    color: #6b46c1;
}

.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.3rem;
    font-weight: 700;
    color: #2d3748;
}

/* Forms */
.input-form {
    background: white;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

.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: 10px 14px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #63b3ed;
}

/* 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;
}

.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; }

/* 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;
    }
}
