.logbook-report {
    --bg: #f8fafc;
    --card: #ffffff;
    --muted: #5a6570;
    --text: #1a1d21;
    --accent: #0a84ff;
    --accent-2: #26a65b;
    --border: #cdd4db;
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, sans-serif;
    min-height: 100vh;
}

/* HEADER */
.logbook-report .header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 18px;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 5;
}
.logbook-report .header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}
.logbook-report .title {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text);
}
/* Logbook buttons inherit from global .btn system */
.logbook-report .hint {
    font-size: 12px;
    color: var(--muted);
}

/* FILTER BAR */
.logbook-report .filter-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    background: #f2f5f8;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
}
.logbook-report .filter-bar .input {
    background: #fff;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 8px;
    font-size: 14px;
}
.logbook-report .input.compact {
    width: 200px;
}
.logbook-report .input.adjust-hours-input {
    width: 120px;
}
.logbook-report .adjust-hours-label {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.logbook-report .adjust-hours-hint {
    font-size: 11px;
    color: var(--muted);
    line-height: 1.2;
}

/* TOTAL CHIPS */
.logbook-report .chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 16px;
}
.logbook-report .chip {
    background: #f4f7fa;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 5px 10px;
    font-size: 13px;
    color: var(--text);
}
.logbook-report .chip.total {
    font-weight: bold;
    background: lightsteelblue;
    border-color: #cceacc;
}
.logbook-report .chip.grand-total {
    font-weight: bold;
    background: #d8cfae;
    border-color: #8b7e5e;
}
.logbook-report .chip.pic {
    background: #e8f7e8;
    border-color: #cceacc;
}
.logbook-report .chip.dual {
    background: #fff3cd;
    border-color: #ffec9e;
}
.logbook-report .chip.imc {
    background: #f7e8ff;
    border-color: #ead6fa;
}
.logbook-report .chip.night {
    background: #e4f1ff;
    border-color: #c9e4ff;
}

/* TABLE */
.logbook-report .table-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    margin: 0 16px 20px;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}
.logbook-report .table-wrap {
    overflow-x: auto;
}
.logbook-report table.reports-table {
    border-collapse: collapse;
    width: 100%;
    min-width: 1200px;
    font-size: 14px;
    color: var(--text);
}
.logbook-report th,
.logbook-report td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.logbook-report thead th {
    background: var(--color-th-bg);
    color: var(--color-th-text);
    border-bottom: 1px solid var(--color-th-border);
    position: sticky;
    top: 0;
    z-index: 2;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.logbook-report .col-sticky {
    position: sticky;
    left: 0;
    background: #fff;
    z-index: 3;
    font-weight: 500;
}
.logbook-report tbody tr:hover td {
    background: #eef4ff;
}
.logbook-report tbody tr:nth-child(even) td {
    background: #fafcfd;
}

/* MOBILE */
@media (max-width: 900px) {
    .logbook-report .header-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
        padding: 10px 12px;
    }
    .logbook-report .title { font-size: 1.1rem; }
    .logbook-report .hint { font-size: 11px; line-height: 1.3; }
    .logbook-report .filter-bar {
        display: grid;
        grid-template-columns: 1fr 1fr;
        padding: 10px 12px;
        gap: 8px;
        align-items: end;
    }
    .logbook-report .filter-bar input[type="hidden"] {
        display: none;
    }
    .logbook-report .filter-bar .input.compact,
    .logbook-report .filter-bar .input.adjust-hours-input {
        width: 100%;
        box-sizing: border-box;
    }
    .logbook-report .filter-bar .btn {
        padding: 9px 12px;
        font-size: 14px;
        box-sizing: border-box;
        text-align: center;
    }
    .logbook-report .chips {
        padding: 10px 12px;
        gap: 6px;
    }
    .logbook-report .chip {
        font-size: 12px;
        padding: 4px 8px;
    }
    .logbook-report .table-card { margin: 0 8px 12px; border-radius: 6px; }
    .logbook-report table.reports-table { font-size: 13px; }
}

/* --- Dark theme overrides --- */
[data-palette="phpstorm_classic"] .logbook-report,
[data-palette="phpstorm_teal"] .logbook-report {
    --bg: var(--color-page-bg);
    --card: var(--color-surface);
    --muted: var(--color-text-secondary);
    --text: var(--color-text);
    --border: var(--color-border);
}

[data-palette="phpstorm_classic"] .logbook-report .filter-bar,
[data-palette="phpstorm_teal"] .logbook-report .filter-bar {
    background: var(--color-surface);
}

[data-palette="phpstorm_classic"] .logbook-report .filter-bar .input,
[data-palette="phpstorm_teal"] .logbook-report .filter-bar .input {
    background: var(--color-page-bg);
    color: var(--color-text);
    border-color: var(--color-border);
}

[data-palette="phpstorm_classic"] .logbook-report .adjust-hours-hint,
[data-palette="phpstorm_teal"] .logbook-report .adjust-hours-hint {
    color: var(--color-text-secondary);
}

[data-palette="phpstorm_classic"] .logbook-report .chip,
[data-palette="phpstorm_teal"] .logbook-report .chip {
    background: var(--color-surface);
    border-color: var(--color-border);
    color: var(--color-text);
}

[data-palette="phpstorm_classic"] .logbook-report .chip.total,
[data-palette="phpstorm_teal"] .logbook-report .chip.total {
    background: rgba(130, 170, 255, 0.15);
    border-color: var(--color-border);
}

[data-palette="phpstorm_classic"] .logbook-report .chip.grand-total,
[data-palette="phpstorm_teal"] .logbook-report .chip.grand-total {
    background: rgba(255, 198, 109, 0.20);
    border-color: var(--color-border);
}

[data-palette="phpstorm_classic"] .logbook-report .chip.pic,
[data-palette="phpstorm_teal"] .logbook-report .chip.pic {
    background: rgba(110, 231, 183, 0.15);
    border-color: var(--color-border);
}

[data-palette="phpstorm_classic"] .logbook-report .chip.dual,
[data-palette="phpstorm_teal"] .logbook-report .chip.dual {
    background: rgba(255, 216, 102, 0.15);
    border-color: var(--color-border);
}

[data-palette="phpstorm_classic"] .logbook-report .chip.imc,
[data-palette="phpstorm_teal"] .logbook-report .chip.imc {
    background: rgba(195, 130, 255, 0.15);
    border-color: var(--color-border);
}

[data-palette="phpstorm_classic"] .logbook-report .chip.night,
[data-palette="phpstorm_teal"] .logbook-report .chip.night {
    background: rgba(130, 170, 255, 0.10);
    border-color: var(--color-border);
}

[data-palette="phpstorm_classic"] .logbook-report .col-sticky,
[data-palette="phpstorm_teal"] .logbook-report .col-sticky {
    background: var(--color-surface);
}

[data-palette="phpstorm_classic"] .logbook-report tbody tr:hover td,
[data-palette="phpstorm_teal"] .logbook-report tbody tr:hover td {
    background: var(--color-hover) !important;
}

[data-palette="phpstorm_classic"] .logbook-report tbody tr:nth-child(even) td,
[data-palette="phpstorm_teal"] .logbook-report tbody tr:nth-child(even) td {
    background: var(--color-bg-subtle);
}

[data-palette="phpstorm_classic"] .breaksTime,
[data-palette="phpstorm_teal"] .breaksTime {
    background: rgba(130, 170, 255, 0.10);
}

/* .download-bu replaced by .btn-pdf in HTML */

.breaksTime {
    background: lightblue;
}
/* --- Empty-state row (table renders even with no flights) --- */
.logbook-empty-row {
    text-align: center;
    padding: 28px 16px;
    color: #6b7280;
    font-style: italic;
    font-size: 14px;
    background: #f9fafb;
}

/* --- Cross-org flight rows --- */
.logbook-row--restricted td {
    background: #eff6ff;
}
.logbook-org-label {
    display: block;
    font-size: 11px;
    color: #2563eb;
    font-weight: 500;
    margin-top: 2px;
}

/* --- Remarks / Signature editable cell --- */
.logbook-remarks-cell {
    position: relative;
    white-space: normal;
    min-width: 140px;
}
.logbook-remarks-display {
    display: inline;
    vertical-align: middle;
}
.logbook-remarks-pencil {
    margin-left: 4px;
    vertical-align: middle;
    opacity: 0.5;
    cursor: pointer;
}
.logbook-remarks-pencil:hover {
    opacity: 1;
}
.logbook-remarks-input {
    width: 100%;
    box-sizing: border-box;
    font-size: 13px;
    padding: 4px 6px;
    border: 1px solid var(--border, #cdd4db);
    border-radius: 4px;
}

/* ====================================================================
   Pooleys Paper Logbook Styles
   ==================================================================== */
.pooleys-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 16px 20px;
    background: var(--card, #fff);
    border: 1px solid var(--border, #cdd4db);
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}
.pooleys-table {
    width: 100%;
    min-width: 1400px;
    border-collapse: collapse;
    font-size: 13px;
    color: var(--text, #1a1d21);
    background: #fffdf5;
}

/* Header rows */
.pooleys-table thead th {
    background: #f0ece0;
    color: #3a3424;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border: 1px solid #c8c0a8;
    padding: 4px 6px;
    text-align: center;
    white-space: nowrap;
}
.pooleys-th-group {
    background: #e8e2cf !important;
    font-size: 12px !important;
}

/* Spine divider between left-page and right-page */
.pooleys-spine {
    border-left: 3px solid #8b7e5e !important;
}

/* Individual header column widths */
.pooleys-th-date { min-width: 80px; }
.pooleys-th-type { min-width: 70px; }
.pooleys-th-reg { min-width: 60px; }
.pooleys-th-captain { min-width: 100px; }
.pooleys-th-capacity { min-width: 56px; }
.pooleys-th-from { min-width: 50px; }
.pooleys-th-to { min-width: 50px; }
.pooleys-th-depart { min-width: 50px; }
.pooleys-th-arrive { min-width: 50px; }
.pooleys-th-vert {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    white-space: nowrap;
    min-width: 28px;
    max-width: 36px;
    height: 60px;
    vertical-align: bottom;
    padding: 4px 2px;
    font-size: 10px;
}
.pooleys-th-remarks { min-width: 120px; }

/* Body cells */
.pooleys-td {
    border: 1px solid #d4cdb4;
    padding: 5px 6px;
    white-space: nowrap;
    font-size: 13px;
}
.pooleys-td-date {
    font-weight: 500;
    position: sticky;
    left: 0;
    background: #fffdf5;
    z-index: 1;
}
.pooleys-td-cap {
    text-align: center;
    font-weight: 600;
    font-size: 11px;
}
.pooleys-td-time {
    text-align: center;
    font-variant-numeric: tabular-nums;
}
.pooleys-td-num {
    text-align: center;
    font-variant-numeric: tabular-nums;
}
.pooleys-td-remarks {
    white-space: normal;
    min-width: 120px;
}

/* Row styles */
.pooleys-row:nth-child(even) td {
    background: #faf7ed;
}
.pooleys-row:nth-child(odd) td {
    background: #fffdf5;
}
.pooleys-row:hover td {
    background: #f0ebda !important;
}
.pooleys-row:nth-child(even) .pooleys-td-date {
    background: #faf7ed;
}
.pooleys-row:hover .pooleys-td-date {
    background: #f0ebda !important;
}

/* Totals footer row */
.pooleys-totals-row td {
    background: #e8e2cf !important;
    font-weight: 700;
    border-top: 2px solid #8b7e5e;
    font-size: 13px;
}
.pooleys-totals-label {
    text-align: right !important;
    font-size: 12px !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding-right: 12px !important;
}

.pooleys-totals-row--page td {
    background: #f0ece0 !important;
    font-size: 12px;
}
.pooleys-totals-row--filtered td {
    background: #ece5cf !important;
    border-top-width: 1px;
}
.pooleys-totals-row--grand td {
    background: #e3dbc2 !important;
    border-top-width: 1px;
}
.pooleys-totals-row--grand .pooleys-totals-label,
.pooleys-totals-row--grand .pooleys-td-time {
    font-size: 14px !important;
}

/* Certification row */
.pooleys-cert-row td {
    background: #fffdf5 !important;
    font-style: italic;
    color: #6b5f45;
    border-top: none;
}
.pooleys-cert {
    text-align: center !important;
    padding: 8px 12px !important;
    font-size: 12px;
}

/* --- Pooleys dark theme overrides --- */
[data-palette="phpstorm_classic"] .pooleys-table,
[data-palette="phpstorm_teal"] .pooleys-table {
    background: var(--color-surface);
    color: var(--color-text);
}
[data-palette="phpstorm_classic"] .pooleys-table thead th,
[data-palette="phpstorm_teal"] .pooleys-table thead th {
    background: var(--color-th-bg);
    color: var(--color-th-text);
    border-color: var(--color-th-border);
}
[data-palette="phpstorm_classic"] .pooleys-th-group,
[data-palette="phpstorm_teal"] .pooleys-th-group {
    background: var(--color-th-bg) !important;
}
[data-palette="phpstorm_classic"] .pooleys-spine,
[data-palette="phpstorm_teal"] .pooleys-spine {
    border-left-color: var(--color-border) !important;
}
[data-palette="phpstorm_classic"] .pooleys-td,
[data-palette="phpstorm_teal"] .pooleys-td {
    border-color: var(--color-border);
}
[data-palette="phpstorm_classic"] .pooleys-row:nth-child(even) td,
[data-palette="phpstorm_teal"] .pooleys-row:nth-child(even) td {
    background: var(--color-bg-subtle);
}
[data-palette="phpstorm_classic"] .pooleys-row:nth-child(odd) td,
[data-palette="phpstorm_teal"] .pooleys-row:nth-child(odd) td {
    background: var(--color-surface);
}
[data-palette="phpstorm_classic"] .pooleys-row:hover td,
[data-palette="phpstorm_teal"] .pooleys-row:hover td {
    background: var(--color-hover) !important;
}
[data-palette="phpstorm_classic"] .pooleys-td-date,
[data-palette="phpstorm_teal"] .pooleys-td-date {
    background: var(--color-surface);
}
[data-palette="phpstorm_classic"] .pooleys-row:nth-child(even) .pooleys-td-date,
[data-palette="phpstorm_teal"] .pooleys-row:nth-child(even) .pooleys-td-date {
    background: var(--color-bg-subtle);
}
[data-palette="phpstorm_classic"] .pooleys-row:hover .pooleys-td-date,
[data-palette="phpstorm_teal"] .pooleys-row:hover .pooleys-td-date {
    background: var(--color-hover) !important;
}
[data-palette="phpstorm_classic"] .pooleys-totals-row td,
[data-palette="phpstorm_teal"] .pooleys-totals-row td {
    background: var(--color-th-bg) !important;
    border-top-color: var(--color-border);
    color: var(--color-text);
}
[data-palette="phpstorm_classic"] .pooleys-totals-row--page td,
[data-palette="phpstorm_teal"] .pooleys-totals-row--page td,
[data-palette="phpstorm_classic"] .pooleys-totals-row--filtered td,
[data-palette="phpstorm_teal"] .pooleys-totals-row--filtered td,
[data-palette="phpstorm_classic"] .pooleys-totals-row--grand td,
[data-palette="phpstorm_teal"] .pooleys-totals-row--grand td {
    background: var(--color-th-bg) !important;
}

[data-palette="phpstorm_classic"] .pooleys-cert-row td,
[data-palette="phpstorm_teal"] .pooleys-cert-row td {
    background: var(--color-surface) !important;
    color: var(--color-text-secondary);
}
[data-palette="phpstorm_classic"] .pooleys-wrap,
[data-palette="phpstorm_teal"] .pooleys-wrap {
    background: var(--color-surface);
    border-color: var(--color-border);
}

/* Mobile: ensure pooleys table scrolls */
@media (max-width: 900px) {
    .pooleys-wrap { margin: 0 8px 12px; border-radius: 6px; }
    .pooleys-table { font-size: 12px; }
    .pooleys-td { padding: 4px 5px; }
    .pooleys-table thead th { font-size: 10px; padding: 3px 4px; }
}
/* --- Page typeface -------------------------------------------------------
   Nunito Sans, matching the finance and report pages. These views wrap their
   content in .logbook-report rather than .container, so the rule in
   finance.css never reached them and their filters and date fields kept the
   browser's own font beside labels in this one.

   Scoped to the wrapper, not body: this stylesheet is only loaded by the four
   logbook-style reports, and the shared topbar sits outside the wrapper and
   keeps the app-wide font.

   Form controls need it spelled out. A browser uses its UA default for input,
   select, textarea and button unless told to inherit, which is why setting the
   font on a container alone leaves the filters looking foreign. styles.css
   does the same for body.techlog-page.
*/
.logbook-report {
    font-family: 'Nunito Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI',
        Roboto, sans-serif;
}

.logbook-report input,
.logbook-report select,
.logbook-report textarea,
.logbook-report button,
.logbook-report optgroup,
.logbook-report option,
.logbook-report .btn {
    font-family: inherit;
}
