/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
    background: #f4f6f9;
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
}
a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== Header ===== */
.main-header {
    background: linear-gradient(135deg, #1a5c2e 0%, #2d8a4e 100%);
    color: #fff;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    position: sticky;
    top: 0;
    z-index: 1000;
}
.header-brand { display: flex; align-items: center; gap: 10px; }
.header-logo { height: 40px; border-radius: 6px; }
.header-title { font-size: 16px; font-weight: 700; }
.header-subtitle { font-size: 11px; opacity: 0.8; display: block; }
.main-nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.main-nav a {
    color: rgba(255,255,255,0.85);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    transition: all 0.2s;
    white-space: nowrap;
}
.main-nav a:hover { background: rgba(255,255,255,0.15); color: #fff; text-decoration: none; }
.main-nav a.active { background: rgba(255,255,255,0.25); color: #fff; font-weight: 600; }
.header-actions { margin-left: auto; }
.year-selector {
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.3);
    background: rgba(255,255,255,0.1);
    color: #fff;
    font-size: 13px;
    cursor: pointer;
}
.year-selector option { color: #333; background: #fff; }

/* ===== Container ===== */
.container { max-width: 1400px; margin: 0 auto; padding: 20px; }

/* ===== Cards ===== */
.card {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    margin-bottom: 20px;
    overflow: hidden;
}
.card-body { padding: 20px; }
.card-header { padding: 15px 20px; border-bottom: 1px solid #eee; font-weight: 600; }

/* ===== Page Header ===== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}
.page-header h1 { font-size: 24px; color: #1a5c2e; display: flex; align-items: center; gap: 10px; }

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 6px;
    border: none;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}
.btn:hover { text-decoration: none; opacity: 0.9; transform: translateY(-1px); }
.btn-primary { background: #2563eb; color: #fff; }
.btn-secondary { background: #6b7280; color: #fff; }
.btn-success { background: #16a34a; color: #fff; }
.btn-warning { background: #f59e0b; color: #fff; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-group { display: flex; gap: 6px; flex-wrap: wrap; }

/* ===== Tables ===== */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead { background: #f8fafc; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #eee; }
th { font-weight: 600; color: #374151; white-space: nowrap; }
tr:hover { background: #f8fafc; }
.sort-link { color: #374151; text-decoration: none; }
.sort-link:hover { color: #2563eb; text-decoration: none; }

/* ===== Badges ===== */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}
.badge-success { background: #dcfce7; color: #166534; }
.badge-info { background: #dbeafe; color: #1e40af; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-secondary { background: #f3f4f6; color: #4b5563; }

/* ===== Forms ===== */
.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
}
.form-control:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.form-label { display: block; font-weight: 600; margin-bottom: 4px; font-size: 13px; color: #374151; }
.form-text { font-size: 11px; color: #6b7280; margin-top: 4px; }
.form-group { margin-bottom: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; }

/* ===== Search Bar ===== */
.search-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.search-bar .form-control { max-width: 250px; }

/* ===== Modals ===== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
    background: #fff;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    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: 16px 20px;
    border-bottom: 1px solid #eee;
}
.modal-header h3 { font-size: 18px; color: #1a5c2e; }
.modal-close { background: none; border: none; font-size: 24px; cursor: pointer; color: #6b7280; }
.modal-body { padding: 20px; }
.modal-footer { padding: 16px 20px; border-top: 1px solid #eee; display: flex; justify-content: flex-end; gap: 10px; }

/* ===== Alerts ===== */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
}
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-danger { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.alert-info { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }
.alert-close { background: none; border: none; font-size: 18px; cursor: pointer; opacity: 0.6; }

/* ===== Pagination ===== */
.pagination { display: flex; gap: 4px; justify-content: center; margin-top: 20px; flex-wrap: wrap; }
.pagination a {
    padding: 6px 12px;
    border-radius: 6px;
    background: #fff;
    border: 1px solid #d1d5db;
    color: #374151;
    font-size: 13px;
}
.pagination a:hover { background: #f3f4f6; text-decoration: none; }
.pagination a.current { background: #2563eb; color: #fff; border-color: #2563eb; }

/* ===== Dashboard Stats ===== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card {
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    display: flex;
    align-items: center;
    gap: 16px;
}
.stat-icon { font-size: 28px; width: 50px; height: 50px; border-radius: 10px; display: flex; align-items: center; justify-content: center; }
.stat-icon.green { background: #dcfce7; color: #16a34a; }
.stat-icon.blue { background: #dbeafe; color: #2563eb; }
.stat-icon.orange { background: #fef3c7; color: #f59e0b; }
.stat-icon.red { background: #fee2e2; color: #dc2626; }
.stat-icon.purple { background: #f3e8ff; color: #9333ea; }
.stat-info h3 { font-size: 24px; color: #1f2937; }
.stat-info p { font-size: 12px; color: #6b7280; }

/* ===== House Dot ===== */
.house-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }

/* ===== Text Utilities ===== */
.text-center { text-align: center; }
.text-muted { color: #9ca3af; }
.text-success { color: #16a34a; }
.mb-2 { margin-bottom: 12px; }

/* ===== Export Columns Grid ===== */
.export-columns-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 8px;
    margin-top: 8px;
    padding: 12px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}
.export-col-checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s;
}
.export-col-checkbox:hover { background: #e5e7eb; }
.export-col-checkbox input[type="checkbox"] { cursor: pointer; width: 16px; height: 16px; }

/* ===== Footer ===== */
.main-footer { text-align: center; padding: 20px; color: #9ca3af; font-size: 12px; margin-top: 40px; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .main-header { flex-direction: column; align-items: flex-start; }
    .main-nav { order: 3; }
    .form-row { grid-template-columns: 1fr; }
    .page-header { flex-direction: column; align-items: flex-start; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
}
