:root {
    --primary: #10b981;
    --primary-dark: #059669;
    --secondary: #6366f1;
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #cbd5e1;
    --excel-green: #217346;
    --excel-header: #e9f5ee;
    --excel-stripe: #f1f9f5;
    --radius-lg: 16px;
    --radius-md: 12px;
    --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.6;
    padding: 20px;
}

.container {
    width: 100%;
    max-width: none;
    padding: 0 10px;
    margin: 0 auto;
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 2rem;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo {
    display: block;
    margin: 0 auto 1.5rem;
    max-width: 320px;
    height: auto;
    filter: drop-shadow(0 6px 10px rgba(0,0,0,0.15));
}

/* Upload Section - Glassmorphism */
.upload-section {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    margin-bottom: 2.5rem;
    text-align: center;
}

.upload-section label {
    display: block;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-main);
}

.upload-section input[type="file"] {
    display: none;
}

.custom-file-upload {
    display: inline-block;
    padding: 12px 24px;
    cursor: pointer;
    background: var(--bg-main);
    border: 2px dashed var(--primary);
    border-radius: var(--radius-md);
    color: var(--primary);
    font-weight: 600;
    margin-bottom: 1.5rem;
    transition: all 0.3s ease;
}

.custom-file-upload:hover {
    background: #ecfdf5;
    border-color: var(--primary-dark);
}

.upload-section button {
    background: var(--primary);
    color: white;
    padding: 12px 32px;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px -1px rgba(16, 185, 129, 0.2);
}

.upload-section button:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(16, 185, 129, 0.3);
}

/* Action Bar & Controls */
.action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.print-controls, .export-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.action-bar select {
    padding: 10px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: white;
    font-family: inherit;
    color: var(--text-main);
}

.btn-print, .btn-excel, .btn-pdf {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    color: white;
    transition: all 0.2s ease;
}

.btn-print { background: #64748b; }
.btn-excel { background: #059669; }
.btn-pdf { background: #dc2626; }
.btn-jpeg { background: #f59e0b; }

.btn-print:hover, .btn-excel:hover, .btn-pdf:hover, .btn-jpeg:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.search-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-grow: 1;
    min-width: 250px;
}

.search-controls input {
    width: 100%;
    padding: 10px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: white;
    font-family: inherit;
    outline: none;
    transition: all 0.2s;
}

.search-controls input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    background: #e2e8f0;
    padding: 6px;
    border-radius: 12px;
    width: fit-content;
}

.tab-btn {
    padding: 10px 24px;
    border: none;
    background: none;
    color: var(--text-muted);
    font-weight: 600;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.tab-btn.active {
    background: white;
    color: var(--primary);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.tab-content {
    display: none;
    background: white;
    padding: 20px;
    border-radius: 12px;
}

.tab-content.active {
    display: block;
}

/* Summary Cards */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.card {
    background: var(--bg-card);
    padding: 24px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    transition: all 0.3s ease;
    text-align: center;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow);
    border-color: var(--primary);
}

.card h3 {
    font-size: 0.9rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

.card p {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-main);
}

/* Tables */
.table-container {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    overflow: visible;
    box-shadow: var(--shadow);
}

.table-totals {
    background: var(--excel-green);
    color: white;
    font-weight: 700;
}

.table-totals th {
    padding: 12px 8px;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

.table-totals #totalSupervisorAmount,
.table-totals #totalWardTableAmount,
.table-totals #totalCategoryAmount,
.table-totals #totalZoneAmount,
.table-totals #totalDailyAmount {
    color: #fef08a; /* Soft yellow for currency totals */
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: center;
    border: 2px solid var(--excel-green);
    border-radius: 8px;
    overflow: hidden;
}

thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

th, td {
    border: 1px solid var(--border);
    padding: 12px 16px;
    text-align: center;
    vertical-align: middle;
}

th {
    background: var(--excel-green);
    font-weight: 700;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: white;
    border: 1px solid #1a5c38;
    white-space: nowrap;
    padding: 14px;
}

td {
    font-size: 0.95rem;
    color: var(--text-main);
    background: white;
}

/* Zebra Striping */
tbody tr:nth-child(even) td {
    background: var(--excel-stripe);
}

/* S.No Column Style - Body Only */
tbody td:first-child {
    background-color: #f1f5f9;
    font-weight: 600;
    width: 60px;
    border-right: 2px solid var(--border);
}

/* Ensure First Header is Green */
thead th:first-child {
    background-color: var(--excel-green);
    color: white;
}

/* Amount Column Highlighting */
.amount-text {
    font-weight: 700;
    color: var(--excel-green);
}

tbody tr:hover td {
    background: #fff9db !important; /* Excel-like hover highlight (light yellow) */
    transition: background 0.2s ease;
}

tbody tr:last-child td {
    border-bottom: none;
}

/* Status Badges */
.badge {
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    display: inline-block;
}

.badge-success {
    background: #10b981;
    color: white;
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.2);
}

.badge-info {
    background: #3b82f6;
    color: white;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
}

.badge-warning {
    background: #f59e0b;
    color: white;
    box-shadow: 0 2px 4px rgba(245, 158, 11, 0.2);
}

.ward-pill {
    display: inline-block;
    background: #f1f5f9;
    padding: 2px 8px;
    border-radius: 4px;
    margin: 2px;
    font-size: 0.8rem;
    border: 1px solid var(--border);
}

.amount-text {
    font-weight: 700;
    color: #059669;
}

.ward-details-cell {
    font-size: 0.85rem;
    line-height: 1.4;
    min-width: 250px;
    text-align: center;
}

.ward-item {
    padding: 4px 0;
    border-bottom: 1px dashed #e2e8f0;
    text-align: center;
}

.ward-item:last-child {
    border-bottom: none;
}

/* Responsive Table */
@media (max-width: 1024px) {
    .action-bar { flex-direction: column; align-items: stretch; }
    .tabs { width: 100%; overflow-x: auto; }
}

@media (max-width: 768px) {
    body { padding: 10px; }
    h1 { font-size: 1.75rem; }
    
    table, thead, tbody, th, td, tr { display: block; }
    thead { display: none; }
    tr { margin-bottom: 1.5rem; border: 1px solid var(--border); border-radius: 12px; padding: 1rem; }
    td { border-bottom: none; padding: 8px 0; text-align: right; display: flex; justify-content: space-between; }
    td::before { content: attr(data-label); font-weight: 600; color: var(--text-muted); margin-right: 1rem; }
}

/* Print Styles */
@media print {
    .upload-section, .action-bar, .tabs, .filter-section { display: none !important; }
    
    /* Default: hide all tabs, then show based on selection */
    .tab-content { display: none !important; }
    
    .print-all .tab-content { display: block !important; page-break-after: always; }
    
    .print-supervisor-only #supervisorTab { display: block !important; }
    .print-wardwise-only #wardTab { display: block !important; }
    .print-category-only #categoryTab { display: block !important; }
    .print-zone-only #zoneTab { display: block !important; }
    .print-daily-only #dailyTab { display: block !important; }

    body { padding: 0; background: white; }
    .container { width: 100%; max-width: none; }
    .table-container { border: 1px solid #000; box-shadow: none; }
    th { background-color: var(--primary) !important; color: white !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Missing Data Highlighting */
.missing-data {
    background-color: #fef2f2 !important; /* Extremely light red background */
}

.missing-data td:first-child {
    border-left: 5px solid #ef4444 !important; /* Move bold red accent to the first cell */
}

.missing-data td {
    color: #b91c1c !important; /* Strong red text */
    font-weight: 500;
}

.missing-data .badge {
    background: #fee2e2;
    color: #ef4444;
}

.missing-data:hover {
    background-color: #fee2e2 !important;
}

.card-danger {
    border-color: #fecaca !important;
    background-color: #fef2f2 !important;
}

.card-danger h3 {
    color: #b91c1c !important;
}

.card-danger p {
    color: #ef4444 !important;
}

.header-with-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 10px 20px;
    background: #f1f5f9;
    border-radius: 8px;
    border-left: 5px solid var(--excel-green);
}

/* Branded Report Header */
.report-header-branded {
    background: white;
    padding: 20px;
    border: 2px solid var(--excel-green);
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    margin-bottom: 0;
    text-align: center;
}

.report-header-top {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 15px;
    border-bottom: 2px solid var(--excel-green);
    padding-bottom: 15px;
    margin-bottom: 10px;
}

.report-logo {
    max-width: 180px;
    height: auto;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.1));
}

.report-title-group h2 {
    font-size: 2.4rem;
    color: var(--excel-green);
    margin: 0;
    letter-spacing: 1px;
    font-weight: 800;
}

.report-title-group h3 {
    font-size: 1.5rem;
    color: var(--text-muted);
    margin: 5px 0 0;
    text-transform: uppercase;
}

.report-meta {
    display: flex;
    justify-content: center;
    gap: 40px;
    font-size: 0.9rem;
    color: var(--text-main);
    font-weight: 600;
}

.table-container {
    border-top-left-radius: 0 !important;
    border-top-right-radius: 0 !important;
}

@media print {
    .report-header-branded {
        display: block !important;
        border: 2px solid #000;
    }
}


.filter-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.filter-group select {
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: white;
    font-family: inherit;
    font-weight: 600;
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-group select:hover {
    border-color: var(--excel-green);
}

.filter-group select:focus {
    outline: none;
    border-color: var(--excel-green);
    box-shadow: 0 0 0 3px rgba(33, 115, 70, 0.1);
}

