* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f0f2f5;
    color: #333;
}

.header {
    background: linear-gradient(135deg, #2c3e50, #3498db);
    color: white;
    padding: 20px 0;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.header h1 {
    font-size: 28px;
    margin-bottom: 5px;
}

.header p {
    font-size: 14px;
    opacity: 0.8;
}

.container {
    max-width: 1400px;
    margin: 30px auto;
    padding: 0 20px;
}

.two-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
    align-items: start;
}

.column {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Form */
.form-card {
    background: white;
    border-radius: 12px;
    padding: 25px 30px;
    margin-bottom: 30px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.form-card h2 {
    margin-bottom: 20px;
    color: #2c3e50;
    font-size: 20px;
    border-bottom: 2px solid #3498db;
    padding-bottom: 10px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    align-items: end;
}

.form-grid.single-col {
    grid-template-columns: 1fr;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 5px;
    color: #555;
}

.form-group input,
.form-group select {
    padding: 10px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #3498db;
}

.btn {
    padding: 10px 25px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: #3498db;
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
}

.btn-danger {
    background: #e74c3c;
    color: white;
    padding: 6px 14px;
    font-size: 13px;
}

.btn-danger:hover {
    background: #c0392b;
}

/* Table */
.table-card {
    background: white;
    border-radius: 12px;
    padding: 25px 30px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    overflow-x: auto;
}

.table-card h2 {
    margin-bottom: 20px;
    color: #2c3e50;
    font-size: 20px;
    border-bottom: 2px solid #3498db;
    padding-bottom: 10px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    background: #2c3e50;
    color: white;
    padding: 12px 15px;
    text-align: left;
    font-size: 14px;
}

thead th:first-child {
    border-radius: 8px 0 0 0;
}

thead th:last-child {
    border-radius: 0 8px 0 0;
}

tbody tr {
    border-bottom: 1px solid #eee;
    transition: background 0.2s;
}

tbody tr:hover {
    background: #f8f9fa;
}

tbody td {
    padding: 12px 15px;
    font-size: 14px;
}

.photo-thumb {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
    cursor: pointer;
    transition: transform 0.3s;
    border: 2px solid #e0e0e0;
}

.photo-thumb:hover {
    transform: scale(1.1);
}

.no-photo {
    color: #aaa;
    font-style: italic;
    font-size: 13px;
}

.total-row {
    background: #eaf4fd;
    font-weight: 700;
}

.total-row td {
    padding: 14px 15px;
    font-size: 15px;
    color: #2c3e50;
}

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.8);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-overlay.active {
    display: flex;
}

.modal-overlay img {
    max-width: 90%;
    max-height: 90%;
    border-radius: 8px;
}

.modal-overlay .close-btn {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 36px;
    cursor: pointer;
}

/* Filter */
.filter-bar {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.filter-bar select {
    padding: 8px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
}

.alert {
    padding: 12px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Stats bar */
.stats-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 25px;
}

.stat-card {
    background: white;
    border-radius: 10px;
    padding: 18px 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border-left: 4px solid #ccc;
    text-align: center;
}

.stat-label {
    font-size: 12px;
    font-weight: 600;
    color: #777;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.stat-value {
    font-size: 22px;
    font-weight: 700;
    color: #2c3e50;
}

.stat-green { border-left-color: #27ae60; }
.stat-green .stat-value { color: #27ae60; }
.stat-blue { border-left-color: #3498db; }
.stat-blue .stat-value { color: #3498db; }
.stat-orange { border-left-color: #e67e22; }
.stat-orange .stat-value { color: #e67e22; }
.stat-red { border-left-color: #e74c3c; }
.stat-red .stat-value { color: #e74c3c; }

@media (max-width: 1024px) {
    .stats-bar {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 600px) {
    .stats-bar {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Months checkboxes */
.months-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-top: 8px;
}

.month-check {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.month-check:hover {
    border-color: #3498db;
    background: #eaf4fd;
}

.month-check input:checked + span {
    font-weight: 700;
    color: #2c3e50;
}

.month-check:has(input:checked) {
    border-color: #3498db;
    background: #eaf4fd;
}

.btn-select-all {
    grid-column: span 4;
    background: #ecf0f1;
    border: 1px solid #bdc3c7;
    border-radius: 6px;
    padding: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    color: #555;
    transition: background 0.2s;
}

.btn-select-all:hover {
    background: #dfe6e9;
}

/* Apartment cards */
.apt-card {
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    margin-bottom: 10px;
    overflow: hidden;
}

.apt-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #f8f9fa;
    cursor: pointer;
    transition: background 0.2s;
}

.apt-header:hover {
    background: #eaf4fd;
}

.apt-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.apt-number {
    background: #2c3e50;
    color: white;
    padding: 4px 10px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 13px;
}

.apt-name {
    font-weight: 600;
    font-size: 14px;
    color: #333;
}

.apt-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.apt-total {
    font-weight: 700;
    color: #27ae60;
    font-size: 14px;
}

.btn-view {
    background: #3498db;
    color: white;
    padding: 6px 14px;
    font-size: 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.3s;
}

.btn-view:hover {
    background: #2980b9;
}

.apt-payments {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
    background: white;
}

.apt-payments.open {
    max-height: 2000px;
}

.apt-payments table {
    margin: 0;
}

.apt-payments thead th {
    background: #5a6f80;
    padding: 8px 15px;
    font-size: 13px;
    border-radius: 0;
}

.apt-payments tbody td {
    padding: 8px 15px;
    font-size: 13px;
}

.year-section {
    border-bottom: 2px solid #e0e0e0;
}

.year-section:last-child {
    border-bottom: none;
}

.year-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 15px;
    background: #2c3e50;
    color: white;
    font-weight: 700;
    font-size: 14px;
}

.year-total {
    color: #2ecc71;
    font-size: 13px;
}

.btn-edit {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    color: #3498db;
    padding: 2px 6px;
    border-radius: 4px;
    transition: background 0.2s;
}

.btn-edit:hover {
    background: #eaf4fd;
}

.edit-modal-box {
    background: white;
    border-radius: 12px;
    padding: 25px 30px;
    width: 400px;
    max-width: 90%;
}

.edit-modal-box h3 {
    margin-bottom: 15px;
    color: #2c3e50;
}

.total-bar {
    background: #eaf4fd;
    padding: 14px 16px;
    border-radius: 10px;
    margin-top: 10px;
    font-size: 15px;
    color: #2c3e50;
    text-align: right;
}

@media (max-width: 1024px) {
    .two-columns {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
    .header h1 {
        font-size: 22px;
    }
}
