/* ==========================================================================
   Timesheets tab — read-only time-log view + CSV export (v1.3.18)
   The native Fluent Boards Timesheet report (Reports > Timesheet) requires
   the "Manager" board role, which also grants editing/deleting other
   users' time logs and removing board members — too much power for a
   read-only customer-facing view. This tab is a self-contained,
   server-rendered replacement: it queries Fluent Boards' own
   fbs_time_tracks table directly (any board role, incl. the default
   "Member", is enough to view it) and never touches Fluent Boards'
   write endpoints. All colors go through the --fcpa-* portal roles
   (Astra palette, dark-safe) — same policy as the Invoices fallback.
   ========================================================================== */

.fcpa-active .fcpa-timesheet .fcpa-timesheet-title {
    font-size: 18px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--fcpa-text, var(--ast-global-color-2));
    margin: 0 0 6px;
}

.fcpa-active .fcpa-timesheet .fcpa-timesheet-intro {
    max-width: 640px;
    font-size: 14px;
    line-height: 1.55;
    color: var(--fcpa-muted, var(--ast-global-color-3));
    margin: 0 0 18px;
}

.fcpa-active .fcpa-timesheet .fcpa-timesheet-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;
    margin: 0 0 16px;
}

.fcpa-active .fcpa-timesheet .fcpa-timesheet-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 13px;
    color: var(--fcpa-muted, var(--ast-global-color-3));
}

.fcpa-active .fcpa-timesheet .fcpa-timesheet-field select,
.fcpa-active .fcpa-timesheet .fcpa-timesheet-field input[type="date"] {
    padding: 7px 10px;
    border: 1px solid var(--fcpa-border, var(--ast-global-color-6));
    border-radius: 8px;
    background-color: var(--fcpa-bg, var(--ast-global-color-5));
    color: var(--fcpa-text, var(--ast-global-color-2));
    font-size: 14px;
}

.fcpa-active .fcpa-timesheet .fcpa-timesheet-apply,
.fcpa-active .fcpa-timesheet .fcpa-timesheet-export {
    display: inline-block;
    padding: 8px 18px;
    border: 1px solid var(--fcpa-accent, var(--ast-global-color-1));
    border-radius: 8px;
    background-color: var(--fcpa-accent, var(--ast-global-color-1));
    color: var(--fcpa-accent-text, var(--ast-global-color-5));
    font-weight: 500;
    font-size: 14px;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
}

.fcpa-active .fcpa-timesheet .fcpa-timesheet-apply:hover,
.fcpa-active .fcpa-timesheet .fcpa-timesheet-apply:focus-visible,
.fcpa-active .fcpa-timesheet .fcpa-timesheet-export:hover,
.fcpa-active .fcpa-timesheet .fcpa-timesheet-export:focus-visible {
    opacity: 0.9;
}

.fcpa-active .fcpa-timesheet .fcpa-timesheet-export {
    background-color: transparent;
    color: var(--fcpa-accent, var(--ast-global-color-1));
}

.fcpa-active .fcpa-timesheet .fcpa-timesheet-empty {
    color: var(--fcpa-muted, var(--ast-global-color-3));
}

.fcpa-active .fcpa-timesheet .fcpa-timesheet-card {
    border: 1px solid var(--fcpa-border, var(--ast-global-color-6));
    border-radius: 10px;
    overflow: auto;
    background-color: var(--fcpa-bg, var(--ast-global-color-5));
}

.fcpa-active .fcpa-timesheet .fcpa-timesheet-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

/* Neutralise Astra's global table border rules, same as the Invoices
   fallback table: draw the table with this sheet's single border color. */
.fcpa-active .fcpa-timesheet .fcpa-timesheet-table,
.fcpa-active .fcpa-timesheet .fcpa-timesheet-table th,
.fcpa-active .fcpa-timesheet .fcpa-timesheet-table td {
    border: 0;
}

.fcpa-active .fcpa-timesheet .fcpa-timesheet-table th,
.fcpa-active .fcpa-timesheet .fcpa-timesheet-table td {
    padding: 12px 16px;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid var(--fcpa-border, var(--ast-global-color-6));
}

.fcpa-active .fcpa-timesheet .fcpa-timesheet-table thead th {
    background-color: var(--fcpa-surface, var(--ast-global-color-4));
    color: var(--fcpa-text, var(--ast-global-color-2));
    font-weight: 600;
    white-space: nowrap;
}

.fcpa-active .fcpa-timesheet .fcpa-timesheet-table tbody tr:last-child td {
    border-bottom: 0;
}

.fcpa-active .fcpa-timesheet .fcpa-timesheet-table td {
    color: var(--fcpa-muted, var(--ast-global-color-3));
}

.fcpa-active .fcpa-timesheet .fcpa-timesheet-table tfoot .fcpa-timesheet-total-row th,
.fcpa-active .fcpa-timesheet .fcpa-timesheet-table tfoot .fcpa-timesheet-total-row td {
    background-color: var(--fcpa-surface, var(--ast-global-color-4));
    color: var(--fcpa-text, var(--ast-global-color-2));
    font-weight: 600;
    border-bottom: 0;
    border-top: 1px solid var(--fcpa-border, var(--ast-global-color-6));
}

.fcpa-active .fcpa-timesheet .fcpa-timesheet-table tfoot .fcpa-timesheet-total-row th:first-child {
    text-align: right;
}

/* ==========================================================================
   Hours balance card (v1.3.45) — purchased hours (FluentCart ledger) vs.
   logged hours (fbs_time_tracks), rendered above the time-log table by
   FCPA_Hours::render_balance_card(). Same --fcpa-* / Astra policy as the
   rest of this sheet.
   ========================================================================== */

.fcpa-active .fcpa-timesheet .fcpa-hours-card {
    margin: 0 0 20px;
    padding: 16px 18px;
    border: 1px solid var(--fcpa-border, var(--ast-global-color-6));
    border-radius: 10px;
    background-color: var(--fcpa-surface, var(--ast-global-color-4));
}

.fcpa-active .fcpa-timesheet .fcpa-hours-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--fcpa-text, var(--ast-global-color-2));
    margin: 0 0 12px;
}

.fcpa-active .fcpa-timesheet .fcpa-hours-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 28px;
    margin: 0 0 12px;
}

.fcpa-active .fcpa-timesheet .fcpa-hours-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.fcpa-active .fcpa-timesheet .fcpa-hours-stat span {
    font-size: 12px;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--fcpa-muted, var(--ast-global-color-3));
}

.fcpa-active .fcpa-timesheet .fcpa-hours-stat strong {
    font-size: 18px;
    font-weight: 600;
    color: var(--fcpa-text, var(--ast-global-color-2));
}

.fcpa-active .fcpa-timesheet .fcpa-hours-stat small {
    font-size: 12px;
    font-weight: 400;
    color: var(--fcpa-muted, var(--ast-global-color-3));
}

/* Remaining-hour flags (set by FCPA_Hours::render_balance_card()). */
.fcpa-active .fcpa-timesheet .fcpa-hours-warning strong {
    color: #996800;
}

.fcpa-active .fcpa-timesheet .fcpa-hours-danger strong {
    color: #b91c1c;
}

.fcpa-active .fcpa-timesheet .fcpa-hours-bar {
    height: 8px;
    border-radius: 4px;
    background-color: var(--fcpa-border, var(--ast-global-color-6));
    overflow: hidden;
    margin: 0 0 14px;
}

.fcpa-active .fcpa-timesheet .fcpa-hours-bar-fill {
    height: 100%;
    border-radius: 4px;
    background-color: var(--fcpa-accent, var(--ast-global-color-1));
}

.fcpa-active .fcpa-timesheet .fcpa-hours-empty {
    margin: 0;
    font-size: 14px;
    color: var(--fcpa-muted, var(--ast-global-color-3));
}

.fcpa-active .fcpa-timesheet .fcpa-hours-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

/* Neutralise Astra's global table border rules, same as the time-log table. */
.fcpa-active .fcpa-timesheet .fcpa-hours-table,
.fcpa-active .fcpa-timesheet .fcpa-hours-table th,
.fcpa-active .fcpa-timesheet .fcpa-hours-table td {
    border: 0;
}

.fcpa-active .fcpa-timesheet .fcpa-hours-table th,
.fcpa-active .fcpa-timesheet .fcpa-hours-table td {
    padding: 10px 12px;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid var(--fcpa-border, var(--ast-global-color-6));
}

.fcpa-active .fcpa-timesheet .fcpa-hours-table thead th {
    background-color: var(--fcpa-bg, var(--ast-global-color-5));
    color: var(--fcpa-text, var(--ast-global-color-2));
    font-weight: 600;
    white-space: nowrap;
}

.fcpa-active .fcpa-timesheet .fcpa-hours-table tbody tr:last-child td {
    border-bottom: 0;
}

.fcpa-active .fcpa-timesheet .fcpa-hours-table td {
    color: var(--fcpa-muted, var(--ast-global-color-3));
}

.fcpa-active .fcpa-timesheet .fcpa-hours-invoice-link {
    color: var(--fcpa-accent, var(--ast-global-color-1));
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
}

.fcpa-active .fcpa-timesheet .fcpa-hours-invoice-link:hover,
.fcpa-active .fcpa-timesheet .fcpa-hours-invoice-link:focus-visible {
    text-decoration: underline;
}
