/* Timesheets report — report-specific styling for the in-page report fragment
 * rendered into #reportContainer on the Timesheets page (templates/time/
 * index.html). The report used to live in a srcdoc iframe with its own copy of
 * the design tokens and base CSS; it is now a normal in-page table. Everything
 * generic (.btn, .table, .filter-*, .toolbar, .search-input, .sort-indicator,
 * .col-filter-*, .hide-toggle, .summary*, .pie-chart-card, .progress-*) comes
 * from frykt components.css + app.css. Only report-unique classes live here.
 *
 * The fragment is wrapped in <div class="ts-report"> for a single container
 * hook; all variables resolve against the page tokens (frykt + app.css). */

/* Lock column widths via <colgroup> so filtering / sorting can't resize
 * columns based on which rows happen to be visible. */
#timesheetTable { table-layout: fixed; }
/* Only the long approval-groups text needs ellipsis; scope it to that span. */
#timesheetTable .payroll-groups {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
}
/* Reserve the flagged-indicator space on every clickable row so toggling
 * Cleared (which adds/removes .flagged) doesn't shift the first cell's text. */
#timesheetTable tbody tr.clickable { cursor: pointer; }
#timesheetTable tbody tr.clickable td:first-child { border-left: 3px solid transparent; }
#timesheetTable tbody tr.flagged td:first-child { border-left-color: var(--red); }
#timesheetTable tbody tr.filtered-out { display: none !important; }

.hours-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    margin: 1px;
    white-space: nowrap;
}

.hours-total { background: #e8f5e9; color: #2e7d32; }
.hours-pro { background: #f3e5f5; color: #7b1fa2; }
.hours-reg { background: #e3f2fd; color: #1976d2; }
.hours-ovt { background: #fff3e0; color: #f57c00; }
.hours-pto { background: #e0f2f1; color: #00897b; }
.hours-uto { background: #fff9c4; color: #f57f17; }
.hours-other { background: #f5f5f5; color: #616161; }
.hours-violation { background: #ffebee; color: #c62828; border: 1px solid #c62828; }

/* When the displayed hours came from Foundation his_timecard (not HH2), tint
 * the hours-total badge calm blue instead of the default green. Hover the badge
 * for "SOURCE: Foundation" in the tooltip. */
.hours-badge.hours-total.from-foundation {
    background: #eaf2f8;
    color: #1a5276;
}

.badge-critical {
    background: #fee;
    color: #c0392b;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.badge-cleared {
    background: #eee;
    color: #7f8c8d;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.badge-excluded {
    background: #ecf0f1;
    color: #34495e;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    font-style: italic;
}

.badge-paytype {
    background: #e3f2fd;
    color: #1976d2;
    padding: 3px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
    margin: 1px;
    display: inline-block;
}

.sync-banner {
    margin-bottom: 16px;
    padding: 10px 14px;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    flex-wrap: wrap;
}
.sync-banner-stale { background: #fff9c4; color: #7f6f17; border: 1px solid #f1c40f; }
.sync-banner-never { background: #fadbd8; color: #c0392b; border: 1px solid #e74c3c; }
.sync-banner button {
    padding: 6px 12px;
    background: #34495e;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}
.sync-banner button:hover { background: #2c3e50; }
.sync-banner button:disabled { opacity: 0.6; cursor: wait; }

.foundation-badge {
    padding: 3px 7px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    margin-left: 6px;
    text-decoration: none;
    display: inline-block;
    white-space: nowrap;
}
.foundation-badge-active { background: #fee; color: #c0392b; }
.foundation-badge-active:hover { background: #fdd; }
.foundation-badge-exempt { background: #e3f2fd; color: #1976d2; }
.foundation-badge-terminated { background: #ecf0f1; color: #7f8c8d; }
.foundation-badge-not-in-foundation { background: #fff3e0; color: #f57c00; }
.foundation-badge-sync-stale { background: #fff9c4; color: #f57f17; }

.status-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Expandable detail row */
.expandable-row { display: none; background: #f8f9fa; }
.expandable-row.visible { display: table-row; }
.expandable-content {
    padding: 15px 20px;
    display: flex;
    gap: 20px;
}
.expandable-left { flex: 2; min-width: 0; }
.expandable-right { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.email-section {
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    height: 100%;
}
.email-section h5 {
    margin: 0 0 8px 0;
    font-size: 12px;
    color: #7f8c8d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.contact-prev-week {
    color: #b9770e;
    font-style: italic;
    font-weight: 600;
    cursor: help;
}
.email-field { display: flex; flex-direction: column; gap: 6px; }
.email-field-header { display: flex; justify-content: space-between; align-items: center; }
.email-field-label { font-size: 11px; font-weight: 600; color: #555; }

.copy-btn {
    padding: 4px 10px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 10px;
    cursor: pointer;
    transition: background 0.2s;
}
.copy-btn:hover { background: #2980b9; }
.copy-btn.copied { background: #27ae60; }

.email-content {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 10px;
    font-size: 11px;
    font-family: 'Courier New', monospace;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 150px;
    overflow-y: auto;
    line-height: 1.4;
}

.email-actions { margin-top: auto; padding-top: 10px; border-top: 1px solid #e0e0e0; }

.compose-btn {
    width: 100%;
    padding: 10px;
    background: #27ae60;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    text-decoration: none;
    display: block;
    text-align: center;
}
.compose-btn:hover { background: #229954; }

.employee-meta { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0; }
.employee-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 6px;
    border: 1px solid;
    font-size: 13px;
    line-height: 1;
}
.employee-meta-item .employee-meta-icon { font-size: 16px; line-height: 1; }
.employee-meta-label {
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 10px;
    font-weight: 700;
    opacity: 0.85;
}
.employee-meta-value { font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.employee-meta-item.meta-terminated { background: #fdecea; border-color: #e74c3c; color: #922b21; }
.employee-meta-item.meta-pto { background: #eaf4fb; border-color: #3498db; color: #1f618d; }

.daily-table { width: 100%; margin-top: 10px; font-size: 11px; border-collapse: collapse; }
.daily-table th { background: #95a5a6; color: var(--accent-text); font-size: 10px; padding: 5px; text-align: left; }
.daily-table td { padding: 5px; font-size: 11px; border-bottom: 1px solid var(--border); }

.expand-icon { display: inline-block; margin-right: 6px; transition: transform 0.2s; font-size: 10px; }
.expand-icon.expanded { transform: rotate(90deg); }

.violation-list { margin: 10px 0 15px 0; }
.violation-item {
    margin: 5px 0;
    padding: 8px;
    background: white;
    border-radius: 4px;
    border-left: 4px solid #e74c3c;
    font-size: 12px;
}
.violation-item.warning { border-left-color: #f39c12; }
.violation-item strong { display: block; margin-bottom: 3px; }

.tooltip { position: relative; display: inline-block; }
.tooltip .tooltiptext {
    visibility: hidden;
    width: 350px;
    background-color: #2c3e50;
    color: #fff;
    text-align: left;
    border-radius: 6px;
    padding: 10px;
    position: absolute;
    z-index: 1000;
    bottom: 125%;
    left: 50%;
    margin-left: -175px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 11px;
    line-height: 1.4;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    pointer-events: none;
}
.tooltip .tooltiptext::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #2c3e50 transparent transparent transparent;
}
.tooltip:hover .tooltiptext { visibility: visible; opacity: 1; }
/* Belt-and-suspenders against sticky-thead stacking quirks: the sticky <th>
 * creates its own stacking context, and some WebKit versions don't honor the
 * tooltiptext's z-index across that boundary. Lifting the hovered badge itself
 * brings the whole subtree above the header. See z-index scale in app.css. */
.tooltip:hover { z-index: 20; }

.payroll-groups { font-size: 10px; color: #7f8c8d; }
.suggested-correction { background: #e8f5e9; padding: 5px; border-radius: 3px; font-size: 10px; margin-top: 3px; }

/* Approval-History (transaction log) modal */
.txlog-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(2px);
    z-index: 10000;
    justify-content: center;
    align-items: center;
}
.txlog-overlay.visible { display: flex; }
.txlog-modal {
    background: white;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    width: 90vw;
    max-width: 1100px;
    height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.txlog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #e0e0e0;
    background: #f8f9fa;
}
.txlog-header h3 { margin: 0; font-size: 16px; color: #2c3e50; }
.txlog-close {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: #7f8c8d;
    padding: 0 4px;
    line-height: 1;
}
.txlog-close:hover { color: #2c3e50; }
.txlog-body { display: flex; flex: 1; overflow: hidden; }
.txlog-left { flex: 1; overflow-y: auto; padding: 16px 20px; border-right: 1px solid #e0e0e0; }
.txlog-right { width: 280px; min-width: 280px; overflow-y: auto; padding: 16px; background: #fafafa; }
.txlog-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.txlog-table th {
    background: #2c3e50;
    color: white;
    padding: 8px 10px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 1;
}
.txlog-table td { padding: 6px 10px; border-bottom: 1px solid #eee; vertical-align: top; }
.txlog-table tr[data-user-color] td { border-left: 3px solid transparent; }
.txlog-table tr.txlog-changed td { background: #fff3e0; }
.txlog-date-header td { background: #f0f0f0; font-weight: 600; font-size: 11px; color: #555; padding: 5px 10px; }

.txlog-revision-list { list-style: none; padding: 0; margin: 0; }
.txlog-revision-item {
    position: relative;
    padding: 10px 12px 10px 24px;
    margin-bottom: 4px;
    border-radius: 6px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: background 0.15s, border-color 0.15s;
}
.txlog-revision-item:hover { background: #e8eaed; }
.txlog-revision-item.selected { background: #e3f2fd; border-color: #1976d2; }
.txlog-revision-item::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 16px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--user-color, #bbb);
}
.txlog-revision-item:not(:last-child)::after {
    content: '';
    position: absolute;
    left: 11px;
    top: 26px;
    bottom: -6px;
    width: 2px;
    background: #ddd;
}
.txlog-rev-user { font-weight: 600; font-size: 13px; color: #2c3e50; }
.txlog-rev-meta { font-size: 11px; color: #7f8c8d; margin-top: 2px; }
.txlog-rev-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
    margin-left: 4px;
}
.txlog-badge-submitted { background: #fff3e0; color: #e65100; }
.txlog-badge-approved { background: #e8f5e9; color: #2e7d32; }
.txlog-badge-sealed { background: #e3f2fd; color: #1565c0; }
.txlog-rev-count { font-size: 10px; color: #999; margin-top: 2px; }
.txlog-empty { text-align: center; color: #999; padding: 40px; font-size: 14px; }
.txlog-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 15px;
    padding: 0 2px;
    opacity: 0.6;
    transition: opacity 0.15s;
    text-decoration: none;
}
.txlog-btn:hover { opacity: 1; }
.txlog-units-changed { text-decoration: line-through; color: #e74c3c; font-size: 10px; margin-right: 4px; }
.txlog-user-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; vertical-align: middle; }
.txlog-state-label {
    font-size: 11px;
    color: #7f8c8d;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e0e0e0;
}

@media print {
    .summary-toggle { display: none; }
    .expandable-row { display: table-row !important; }
    .expand-icon { display: none; }
    .txlog-overlay { display: none !important; }
    .txlog-btn { display: none; }
}

/* --------------------- Correction apply modal ---------------------- */
.correction-table { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 4px; }
.correction-table th, .correction-table td { padding: 5px 8px; text-align: left; border-bottom: 1px solid var(--border, #e5e7eb); }
.correction-table th { font-weight: 600; color: var(--text-muted, #6b7280); font-size: 10px; text-transform: uppercase; letter-spacing: 0.04em; }
.correction-msg { padding: 8px 10px; border-radius: 6px; font-size: 12px; margin-bottom: 8px; }
.correction-msg.correction-warn { background: #fef3c7; color: #92400e; }
.correction-msg.correction-error { background: #fee2e2; color: #991b1b; }
.correction-msg.correction-ok { background: #dcfce7; color: #166534; }
.correction-note { font-size: 10px; color: var(--text-muted, #6b7280); margin-top: 10px; line-height: 1.4; }
