:root {
    --bg-color: #f3f4f6;
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --primary: #0ea5e9;
    --primary-hover: #0284c7;
    --border: #e5e7eb;
    --card-bg: #ffffff;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ==================================================== */
/* TOP NAVIGATION */
/* ==================================================== */
.top-nav {
    background-color: var(--card-bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 32px;
    height: 64px;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.nav-brand h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #111827;
    margin-right: 48px;
}

.nav-tabs {
    display: flex;
    height: 100%;
}

.nav-tab {
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    padding: 0 24px;
    height: 100%;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.nav-tab:hover {
    color: var(--text-main);
}

.nav-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* ==================================================== */
/* MAIN LAYOUT */
/* ==================================================== */
.main-content {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.view-section {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 32px;
    overflow-y: auto;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.view-section.active {
    opacity: 1;
    pointer-events: auto;
}

.container-wide {
    max-width: 1200px;
    margin: 0 auto;
}

.split-layout {
    display: flex;
    height: 100%;
    width: 100%;
}

.preview-controls {
    width: 400px;
    padding: 32px;
    border-right: 1px solid var(--border);
    background: var(--bg-color);
    overflow-y: auto;
}

.preview-display {
    flex: 1;
    background-color: #e2e8f0;
    padding: 32px;
    overflow-y: auto;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

/* ==================================================== */
/* CARDS & FORMS */
/* ==================================================== */
.card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 24px;
    color: #111827;
}

.grid-2-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.full-width {
    grid-column: 1 / -1;
}

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

.input-group label {
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 6px;
    color: #4b5563;
}

.input-group input, .input-group select {
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.875rem;
    font-family: 'Inter', sans-serif;
    transition: border-color 0.15s ease;
}

.input-group input:focus, .input-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

.input-group small {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 6px;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.checkbox-group label {
    font-size: 0.95rem;
    font-weight: 500;
    color: #111827;
    cursor: pointer;
}

.help-text {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.divider {
    height: 1px;
    background-color: var(--border);
    margin: 24px 0;
}

.section-label {
    display: block;
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: #374151;
}

/* ==================================================== */
/* BUTTONS */
/* ==================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    text-decoration: none;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}

.btn-primary:hover:not(:disabled) { background-color: var(--primary-hover); }

.btn-secondary {
    background-color: white;
    color: #374151;
    border: 1px solid #d1d5db;
}

.btn-secondary:hover:not(:disabled) { background-color: #f9fafb; }

.btn-sm { padding: 6px 12px; font-size: 0.75rem; }
.btn-lg { padding: 14px 20px; font-size: 1rem; font-weight: 600; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* ==================================================== */
/* FILE UPLOAD */
/* ==================================================== */
.file-upload-wrapper {
    position: relative;
    overflow: hidden;
    width: 100%;
}

.file-upload-wrapper input[type="file"] {
    position: absolute;
    font-size: 100px;
    opacity: 0;
    right: 0;
    top: 0;
    cursor: pointer;
}

.file-upload-label {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    background: #f8fafc;
    border: 2px dashed #cbd5e1;
    border-radius: 8px;
    text-align: center;
    color: #64748b;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.file-upload-wrapper:hover .file-upload-label {
    border-color: var(--primary);
    background-color: #f0f9ff;
    color: var(--primary);
}

/* ==================================================== */
/* SUB-TABS (Manual vs Upload) */
/* ==================================================== */
.sub-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
}
.sub-tab-btn {
    padding: 10px 24px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
}
.sub-tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}
.sub-tab-content { display: none; }
.sub-tab-content.active { display: block; }

/* ==================================================== */
/* DYNAMIC ITEMS LIST */
/* ==================================================== */
.item-row {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    align-items: center;
}
.item-row input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.875rem;
}
.item-row input.short { flex: 0 0 100px; }
.remove-item-btn {
    background: #fee2e2;
    color: #ef4444;
    border: none;
    border-radius: 6px;
    width: 36px;
    height: 36px;
    cursor: pointer;
    font-weight: bold;
    font-size: 1.25rem;
    line-height: 1;
}
.remove-item-btn:hover { background: #fca5a5; }

/* ==================================================== */
/* UTILS */
/* ==================================================== */
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.p-3 { padding: 12px; }
.bg-gray-100 { background-color: #f3f4f6; }
.rounded { border-radius: 8px; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.font-bold { font-weight: bold; }
.text-green-600 { color: #16a34a; }
.text-red-600 { color: #dc2626; }
.text-red-500 { color: #ef4444; }
.pl-4 { padding-left: 16px; }
.list-disc { list-style-type: disc; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-start { display: flex; justify-content: flex-start; align-items: center; }
.gap-4 { gap: 16px; }

/* ==================================================== */
/* MODAL */
/* ==================================================== */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.modal-content {
    background: white;
    width: 500px;
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1);
}
.modal-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: #111827;
}
.modal-desc {
    font-size: 0.95rem;
    color: #4b5563;
    margin-bottom: 20px;
}
.modal-warning {
    background: #fef2f2;
    border-left: 4px solid #ef4444;
    padding: 12px;
    margin-bottom: 24px;
    color: #991b1b;
    font-size: 0.875rem;
}
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}
.modal-actions .btn { width: auto; }

/* Progress */
.progress-bar {
    width: 100%;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 0.3s ease;
}
.progress-text {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 8px;
    text-align: center;
}

/* ==================================================== */
/* HISTORY TABLE STYLES */
/* ==================================================== */
.history-table-container {
    overflow-x: auto;
}
.history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    text-align: left;
}
.history-table th {
    padding: 12px;
    background-color: #f9fafb;
    border-bottom: 2px solid var(--border);
    color: #4b5563;
    font-weight: 600;
}
.history-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.history-table tbody tr:hover {
    background-color: #f3f4f6;
}

/* ==================================================== */
/* PAYSLIP TEMPLATE STYLES (Printed output) */
/* ==================================================== */
.payslip-document {
    background: white;
    width: 800px;
    min-height: 800px;
    padding: 60px 80px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    font-family: 'Jost', sans-serif;
    color: #000;
}
.payslip-header-section { display: flex; justify-content: flex-end; margin-bottom: 60px; }
.payslip-branding { text-align: right; }
.payslip-branding h1 { font-size: 32px; font-weight: 400; letter-spacing: 1px; margin-bottom: 4px; color: #1a2b56; }
.payslip-branding h1 span { color: #00c2cb; font-weight: 400; }
.payslip-branding p { font-family: 'Inter', sans-serif; font-size: 14px; letter-spacing: 2px; color: #333; text-transform: uppercase; }
.payslip-details { margin-bottom: 50px; font-family: 'Inter', sans-serif; }
.detail-row { display: flex; margin-bottom: 16px; font-size: 16px; }
.detail-label { width: 250px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; }
.detail-value { text-transform: uppercase; letter-spacing: 1px; color: #333; }
.payslip-table { width: 100%; border-collapse: collapse; margin-bottom: 60px; font-family: 'Inter', sans-serif; }
.payslip-table th { font-weight: 700; text-transform: uppercase; letter-spacing: 2px; padding-bottom: 16px; border-bottom: 2px solid #000; }
.payslip-table td { padding: 20px 0; font-size: 15px; border-bottom: 1px solid #000; color: #333; }
.col-desc { text-align: left; width: 40%; }
.col-rate { text-align: center; width: 20%; }
.col-hours { text-align: center; width: 20%; }
.col-amount { text-align: right; width: 20%; }
.center-align { text-align: center; }
.right-align { text-align: right; }
.payslip-total { display: flex; justify-content: space-between; font-family: 'Inter', sans-serif; font-weight: 800; font-size: 24px; letter-spacing: 1px; }
