:root {
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --primary: #10b981; /* Green theme for money */
    --primary-hover: #059669;
    --border: #e2e8f0;
    --cell-bg: #f1f5f9;
    --danger: #ef4444;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    min-height: 100vh;
}

.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.app-header {
    background-color: var(--card-bg);
    border-bottom: 1px solid var(--border);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
}

.app-header .nav-links {
    display: flex;
    gap: 1.25rem;
    align-items: center;
    flex-wrap: wrap;
}
.app-header .nav-links a {
    color: var(--text-main, #0f172a);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: color 0.2s;
}
.app-header .nav-links a:hover {
    color: var(--primary, #2563eb);
}


.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
}

.header-actions {
    display: flex;
    gap: 1rem;
}

.btn {
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.btn-primary { background-color: var(--primary); color: white; }
.btn-primary:hover { background-color: var(--primary-hover); }
.btn-secondary { background-color: white; border: 1px solid var(--border); color: var(--text-main); }
.btn-secondary:hover { background-color: var(--bg-color); }

.main-content {
    padding: 2rem;
    display: flex;
    justify-content: center;
}

.payroll-wrapper {
    background-color: var(--card-bg);
    width: 100%;
    max-width: 1200px;
    padding: 2rem;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.doc-header {
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.doc-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
    width: 100%;
    margin-bottom: 0.5rem;
}

.company-name {
    font-size: 0.875rem;
    color: var(--text-muted);
    min-height: 50px;
    width: 300px;
}

.doc-meta {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    text-align: right;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.hidden-input, .hidden-input-inline {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-main);
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
    padding: 0.25rem;
    border-radius: 0.25rem;
}

textarea.hidden-input { resize: none; }
.hidden-input:hover, .hidden-input:focus, .hidden-input-inline:hover, .hidden-input-inline:focus {
    border-color: var(--border);
    background: var(--cell-bg);
}

.table-responsive { overflow-x: auto; }

.payroll-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 900px;
}

.payroll-table th, .payroll-table td {
    border: 1px solid var(--border);
    padding: 0.75rem;
    text-align: right;
    vertical-align: middle;
}

.payroll-table th {
    background-color: var(--cell-bg);
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.payroll-table th.col-employee, .payroll-table td.col-employee { text-align: left; }
.col-employee { width: 20%; }

@media (max-width: 768px) {
    .payroll-table th.col-employee, .payroll-table td.col-employee {
        position: sticky;
        left: 0;
        background-color: var(--card-bg, #fff);
        z-index: 1;
        box-shadow: 2px 0 4px -2px rgba(0, 0, 0, 0.1);
    }
    .payroll-table th.col-employee { background-color: var(--cell-bg); }
    /* Same reasoning as shift/style.css: the table is wider than the screen
       by design (8 pay columns) - .table-responsive already scrolls, but
       that wasn't visually obvious. Tighten cells, add momentum scrolling,
       and a persistent edge shadow so "there's more, swipe" is visible. */
    .payroll-table th, .payroll-table td {
        padding: 0.5rem 0.4rem;
        font-size: 0.8rem;
    }
    .table-responsive {
        position: relative;
        -webkit-overflow-scrolling: touch;
    }
    .table-responsive::after {
        content: '';
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        width: 20px;
        background: linear-gradient(to right, transparent, rgba(15, 23, 42, 0.12));
        pointer-events: none;
    }
}
.col-total { background-color: var(--cell-bg); font-weight: 700; color: var(--primary); }
.col-bold { font-weight: 600; }
.col-action { width: 4%; border: none !important; }

.num-input {
    width: 70px;
    text-align: right;
}

.text-right { text-align: right !important; padding-right: 1rem !important; }

.btn-delete {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 0.25rem;
}
.btn-delete:hover { color: var(--danger); background: #fee2e2; }

@media print {
    body { background: white; }
    .app-header, .hide-in-pdf { display: none !important; }
    .main-content { padding: 0; }
    .payroll-wrapper { box-shadow: none; padding: 0; }
    .hidden-input, .hidden-input-inline { border: none !important; background: transparent !important; }
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .app-container { flex-direction: column !important; height: auto !important; }
    .controls-panel { width: 100% !important; min-width: 100% !important; border-right: none !important; border-bottom: 1px solid #e2e8f0; height: auto !important; padding: 15px !important; }
    .preview-panel { width: 100% !important; padding: 10px !important; overflow-x: auto !important; }
    .invoice-wrapper, .document-wrapper, .cv-wrapper, .quotation-wrapper, .expense-wrapper, .payroll-wrapper, .inventory-wrapper, .shift-wrapper { min-width: 700px; transform: scale(1) !important; transform-origin: top left; }
    .header-left, .header-right { width: 100% !important; text-align: left !important; margin-bottom:10px; }
    .invoice-header, .cv-header, .quotation-header { flex-direction: column !important; gap: 1rem !important; }
    .actions { flex-direction: column !important; }
    .btn { width: 100% !important; margin-bottom: 5px; }
}

/* Per-tool FAQ section */
.tool-faq-section {
    max-width: 900px;
    margin: 0 auto 40px;
    padding: 0 20px;
}
.tool-faq-section h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main, #0f172a);
    margin-bottom: 20px;
}
.tool-faq-section .faq-item {
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 10px;
    margin-bottom: 10px;
    background: #ffffff;
    overflow: hidden;
}
.tool-faq-section .faq-item summary {
    cursor: pointer;
    padding: 14px 44px 14px 18px;
    font-weight: 600;
    color: var(--text-main, #0f172a);
    font-size: 0.95rem;
    list-style: none;
    position: relative;
}
.tool-faq-section .faq-item summary::-webkit-details-marker {
    display: none;
}
.tool-faq-section .faq-item summary::after {
    content: '+';
    position: absolute;
    right: 18px;
    top: 12px;
    font-size: 1.3rem;
    line-height: 1;
    color: var(--primary, #2563eb);
    transition: transform 0.2s;
}
.tool-faq-section .faq-item[open] summary::after {
    transform: rotate(45deg);
}
.tool-faq-section .faq-item summary:hover {
    background: #f8fafc;
}
.tool-faq-section .faq-item p {
    padding: 0 18px 16px;
    margin: 0;
    color: var(--text-muted, #64748b);
    font-size: 0.9rem;
    line-height: 1.65;
}
.tool-faq-section .faq-item p a {
    color: var(--primary, #2563eb);
}

/* Related Tools cross-links */
.related-tools-section {
    max-width: 900px;
    margin: 0 auto 24px;
    padding: 0 20px;
}
.related-tools-section h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main, #0f172a);
    margin-bottom: 20px;
}
.related-tools-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}
.related-tool-card {
    display: block;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 10px;
    padding: 16px 18px;
    background: #ffffff;
    text-decoration: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.related-tool-card:hover {
    border-color: var(--primary, #2563eb);
    box-shadow: 0 4px 12px -4px rgba(0, 0, 0, 0.1);
}
.related-tool-card strong {
    display: block;
    color: var(--primary, #2563eb);
    font-size: 0.95rem;
    margin-bottom: 6px;
}
.related-tool-card span {
    display: block;
    color: var(--text-muted, #64748b);
    font-size: 0.85rem;
    line-height: 1.5;
}
@media (max-width: 768px) {
    .related-tools-grid {
        grid-template-columns: 1fr;
    }
}
