* {
    margin: 0; padding: 0; box-sizing: border-box; font-family: 'Inter', sans-serif;
}

body { background-color: #f4f7f6; color: #333; display: flex; height: 100vh; }

.sidebar { width: 250px; background-color: #1a252f; color: #fff; display: flex; flex-direction: column; }
.brand { padding: 30px 20px; background-color: #151e27; }
.brand h2 { font-weight: 700; font-size: 24px; letter-spacing: 1px; }
.brand p { font-size: 12px; color: #1abc9c; margin-top: 5px; }

.nav { list-style: none; margin-top: 20px; }
.nav li { padding: 15px 20px; cursor: pointer; font-size: 15px; font-weight: 500; transition: all 0.2s ease; border-left: 4px solid transparent; }
.nav li:hover { background-color: #2c3e50; }
.nav li.active { background-color: #2c3e50; border-left: 4px solid #1abc9c; }

.main-content { flex: 1; display: flex; flex-direction: column; overflow-y: auto; }
header { background-color: #fff; padding: 20px 40px; display: flex; justify-content: space-between; align-items: center; box-shadow: 0 2px 5px rgba(0,0,0,0.05); }
h1 { font-size: 22px; color: #2c3e50; }

.date-selector { display: flex; align-items: center; gap: 10px; font-weight: 500; }
.date-selector input { padding: 8px 12px; border: 1px solid #ddd; border-radius: 4px; font-family: inherit; }

.view { display: none; padding: 40px; }
.view.active { display: block; }

.card { background: #fff; border-radius: 8px; padding: 30px; box-shadow: 0 4px 6px rgba(0,0,0,0.04); }
.card h3 { margin-bottom: 20px; color: #2c3e50; font-size: 18px; border-bottom: 2px solid #f4f7f6; padding-bottom: 10px; }

table { width: 100%; border-collapse: collapse; margin-bottom: 20px; font-size: 14px; }
th, td { padding: 12px 15px; text-align: left; border-bottom: 1px solid #eee; }
th { background-color: #f9fbfb; font-weight: 600; color: #555; }

input[type="number"], input[type="text"], input[type="date"], select { width: 100%; padding: 8px 12px; border: 1px solid #ddd; border-radius: 4px; outline: none; transition: border-color 0.2s; }
input:focus, select:focus { border-color: #1abc9c; }

.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 8px; font-weight: 500; color: #444; font-size: 14px;}

.task-row { display: flex; gap: 15px; margin-bottom: 15px; align-items: center; background: #fcfcfc; padding: 15px; border-radius: 6px; border: 1px solid #eee; }
.task-row .flex-2 { flex: 2; }
.task-row .flex-1 { flex: 1; }
.remove-btn { background: #e74c3c; color: white; border: none; width: 30px; height: 30px; border-radius: 50%; cursor: pointer; font-weight: bold; }

.actions { margin-top: 30px; text-align: right; }

.btn { padding: 10px 20px; border: none; border-radius: 4px; cursor: pointer; font-weight: 500; font-size: 14px; transition: background 0.2s; }
.btn-primary { background-color: #1abc9c; color: #fff; }
.btn-primary:hover { background-color: #16a085; }
.btn-secondary { background-color: #ecf0f1; color: #2c3e50; }
.btn-secondary:hover { background-color: #bdc3c7; }

.master-tabs { display: flex; gap: 10px; flex-wrap: wrap; }
.crud-form { margin-top: 20px; background: #f9fbfb; padding: 20px; border-radius: 8px; border: 1px solid #eee; display:none;}
.crud-form h4 { margin-bottom: 15px; color:#2c3e50;}

.toast { position: fixed; bottom: -60px; right: 40px; background: #27ae60; color: white; padding: 15px 30px; border-radius: 4px; font-weight: 500; box-shadow: 0 4px 6px rgba(0,0,0,0.1); transition: bottom 0.3s ease; z-index: 1000; }
.toast.show { bottom: 40px; }
.toast.error { background: #e74c3c; }

/* Report Sub-Tabs */
.report-sub-tabs { display: flex; gap: 0; border-bottom: 2px solid #ddd; margin-bottom: 20px; }
.report-sub-tab { padding: 12px 24px; cursor: pointer; font-weight: 600; font-size: 14px; color: #7f8c8d; border-bottom: 3px solid transparent; transition: all 0.2s ease; background: none; border-top: none; border-left: none; border-right: none; }
.report-sub-tab:hover { color: #2c3e50; background: #f9fbfb; }
.report-sub-tab.active { color: #1abc9c; border-bottom: 3px solid #1abc9c; }
.report-sub-content { display: none; }
.report-sub-content.active { display: block; }

/* Paid Badge */
.paid-badge { display: inline-flex; align-items: center; gap: 4px; background: #d5f5e3; color: #1e8449; padding: 3px 10px; border-radius: 12px; font-size: 11px; font-weight: 700; letter-spacing: 0.5px; }
.unpaid-badge { display: inline-flex; align-items: center; gap: 4px; background: #fdebd0; color: #d35400; padding: 3px 10px; border-radius: 12px; font-size: 11px; font-weight: 700; letter-spacing: 0.5px; }

/* Locked Row */
.locked-row { background: #eafaf1 !important; }
.locked-row td { color: #555; }
.locked-row input, .locked-row select { pointer-events: none; opacity: 0.5; }

/* Export Bar */
.export-bar { display: flex; gap: 8px; align-items: center; padding: 10px 0; margin-top: 10px; flex-wrap: wrap; }
.export-bar .btn { padding: 6px 14px; font-size: 12px; display: flex; align-items: center; gap: 5px; }
.btn-csv { background: #27ae60; color: #fff; }
.btn-csv:hover { background: #219a52; }
.btn-pdf { background: #e74c3c; color: #fff; }
.btn-pdf:hover { background: #c0392b; }
.btn-lock { background: #8e44ad; color: #fff; }
.btn-lock:hover { background: #7d3c98; }
.btn-unlock { background: #d35400; color: #fff; }
.btn-unlock:hover { background: #ba4a00; }

/* Lock Modal Overlay */
.lock-modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 999; display: flex; justify-content: center; align-items: center; }
.lock-modal { background: #fff; border-radius: 10px; padding: 30px; max-width: 700px; width: 90%; max-height: 80vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.lock-modal h3 { margin-bottom: 15px; color: #2c3e50; font-size: 18px; border-bottom: 2px solid #f4f7f6; padding-bottom: 10px; }
.lock-modal .lock-group { background: #f9fbfb; border: 1px solid #eee; border-radius: 6px; margin-bottom: 12px; overflow: hidden; }
.lock-modal .lock-group-header { background: #ecf0f1; padding: 10px 15px; display: flex; justify-content: space-between; align-items: center; font-weight: 600; color: #2c3e50; font-size: 14px; }
.lock-modal .lock-worker-row { display: flex; align-items: center; gap: 10px; padding: 8px 15px; border-bottom: 1px solid #f0f0f0; font-size: 13px; }
.lock-modal .lock-worker-row:last-child { border-bottom: none; }
.lock-modal .lock-worker-row label { flex: 1; cursor: pointer; }
.lock-modal .lock-worker-row .lock-amt { font-weight: 700; color: #27ae60; min-width: 80px; text-align: right; }
.lock-modal-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 20px; padding-top: 15px; border-top: 2px solid #f4f7f6; }
.lock-modal-footer .lock-total { font-size: 18px; font-weight: 700; color: #2c3e50; }

/* Payment History */
.payment-history { margin-top: 20px; }
.payment-history-item { display: flex; align-items: center; gap: 15px; padding: 8px 12px; background: #f9fbfb; border: 1px solid #eee; border-radius: 6px; margin-bottom: 6px; font-size: 13px; }
.payment-history-item .ph-amount { font-weight: 700; color: #27ae60; font-size: 14px; white-space: nowrap; }

/* Print Envelope Overrides */
@media print {
    .sidebar, header, .date-selector, .print-actions, .toast, .export-bar, .lock-modal-overlay, .report-sub-tabs { display: none !important; }
    .main-content { margin: 0 !important; padding: 0 !important; }
    .card { box-shadow: none !important; border: none !important; margin: 0 !important; padding: 0 !important; }
    .view { padding: 0 !important; }
    
    /* Hide the form inputs at the top of Reports View */
    .report-controls, .report-actions-bar { display: none !important; }
    
    .print-envelope { 
        page-break-inside: avoid;
        break-inside: avoid;
        page-break-after: always;
        break-after: page; 
        box-shadow: none !important; 
        margin: 0 auto !important; 
        border: 1px solid #000 !important; 
    }

    /* Salary disbursement print */
    .salary-sheet { page-break-inside: avoid; }
    .salary-sheet table { font-size: 12px; }
    .salary-sheet th, .salary-sheet td { padding: 6px 8px; border: 1px solid #333; }
}
