:root {
    --bg-color: #f1f5f9;
    --card-bg: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --border: #e2e8f0;
    --cell-bg: #f8fafc;
    --cell-hover: #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;
}

/* Header */
.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 */
.main-content {
    padding: 2rem;
    display: flex;
    justify-content: center;
}

.planner-wrapper {
    background-color: var(--card-bg);
    width: 100%;
    max-width: 1400px;
    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);
}

/* Document Header */
.doc-header {
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.doc-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
    width: 300px;
}

.doc-meta {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Hidden Inputs */
.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;
}

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

/* Table */
.table-responsive {
    overflow-x: auto;
}

.shift-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1000px;
}

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

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

.col-employee { width: 15%; text-align: left !important; }
.col-total { width: 8%; font-weight: 700; background-color: var(--cell-bg); }
.col-action { width: 4%; border: none !important; background: transparent !important; }

@media (max-width: 768px) {
    .shift-table th.col-employee, .shift-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);
    }
    .shift-table th.col-employee { background-color: var(--cell-bg); }
    /* The table is wider than the screen by design (7 day columns) -
       .table-responsive already scrolls, but that wasn't visually obvious.
       Tighten cells so more fits per screen, add momentum scrolling, and a
       persistent edge shadow so "there's more, swipe" is visible at rest. */
    .shift-table th, .shift-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;
    }
}

/* Time inputs layout */
.time-slot {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    align-items: center;
}

.time-input-group {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.time-input-group input[type="time"] {
    border: 1px solid var(--border);
    border-radius: 0.25rem;
    padding: 0.1rem;
    font-size: 0.75rem;
    color: var(--text-main);
    outline: none;
    width: 80px;
}

.time-input-group input[type="time"]:focus {
    border-color: var(--primary);
}

.day-total {
    font-size: 0.75rem;
    color: var(--primary);
    font-weight: 600;
    margin-top: 0.25rem;
}

.employee-name-input {
    width: 100%;
    font-weight: 500;
}

.btn-copy-week {
    display: block;
    margin-top: 0.35rem;
    padding: 0;
    border: none;
    background: none;
    color: var(--primary);
    font-size: 0.7rem;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
    white-space: nowrap;
}

.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;
}

/* PDF Export styles */
@media print {
    body { background: white; }
    .app-header, .hide-in-pdf { display: none !important; }
    .main-content { padding: 0; }
    .planner-wrapper { box-shadow: none; padding: 0; }
    .hidden-input, .hidden-input-inline { border: none !important; background: transparent !important; }
    .time-input-group input[type="time"] { border: none; background: transparent; padding: 0; appearance: none; -webkit-appearance: none; }
    .time-input-group span { display: none; } /* hide the "to" word if it looks bad, but leaving it is fine */
}

/* 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;
    }
}
