/* ─── Tourenplan Frontend CSS ─── */
:root {
    --tp-header: #FFCC99;
    --tp-main: #FFFF99;
    --tp-extra: #BEFBFE;
    --tp-holiday: #FFD4D4;
    --tp-lock-own: #2196F3;
    --tp-lock-other: #FF9800;
    --tp-highlight: #FF00FF;
    --tp-border: #ccc;
    --tp-bg: #fff;
    --tp-text: #333;
    --tp-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --tp-radius: 4px;
}

/* ─── Layout ─── */
.tourenplan-wrap {
    font-family: var(--tp-font);
    font-size: 13px;
    color: var(--tp-text);
    position: relative;
    max-width: 100%;
    overflow: hidden;
}

/* ─── User Selection Overlay ─── */
.tp-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.tp-overlay-box {
    background: #fff;
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    max-width: 400px;
    width: 90%;
}
.tp-overlay-box h2 { margin: 0 0 8px; font-size: 22px; }
.tp-overlay-box p { margin: 0 0 20px; color: #666; }
.tp-user-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.tp-user-btn {
    padding: 12px 20px;
    font-size: 16px;
    border: 2px solid #ddd;
    border-radius: 8px;
    background: #f9f9f9;
    cursor: pointer;
    transition: all 0.15s;
}
.tp-user-btn:hover {
    background: #e8f4fd;
    border-color: var(--tp-lock-own);
    transform: translateY(-1px);
}

/* ─── Toolbar ─── */
.tp-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: #f5f5f5;
    border-bottom: 2px solid var(--tp-header);
    gap: 10px;
    flex-wrap: wrap;
    position: sticky;
    top: 0;
    z-index: 100;
}
.tp-toolbar-left, .tp-toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}
.tp-toolbar-center { flex: 1; text-align: center; }
.tp-title { font-size: 18px; margin: 0; font-weight: 700; }
.tp-current-label { font-weight: 600; font-size: 14px; white-space: nowrap; }

.tp-btn {
    padding: 6px 12px;
    border: 1px solid #ccc;
    border-radius: var(--tp-radius);
    background: #fff;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.15s;
    white-space: nowrap;
}
.tp-btn:hover { background: #e8e8e8; }
.tp-btn-primary { background: var(--tp-lock-own); color: #fff; border-color: var(--tp-lock-own); }
.tp-btn-primary:hover { background: #1976D2; }
.tp-btn-danger { background: #d63638; color: #fff; border-color: #d63638; }
.tp-btn-danger:hover { background: #b32d2f; }

.tp-view-select {
    padding: 6px 10px;
    border: 1px solid #ccc;
    border-radius: var(--tp-radius);
    font-size: 13px;
}

.tp-user-name {
    font-weight: 600;
    padding: 4px 10px;
    background: #e8f4fd;
    border-radius: 12px;
    font-size: 12px;
}

/* ─── Online Users ─── */
.tp-online-users {
    display: flex;
    gap: 4px;
    align-items: center;
}
.tp-online-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4caf50;
    display: inline-block;
}
.tp-online-name {
    font-size: 11px;
    color: #666;
}

/* ─── Loading ─── */
.tp-loading {
    text-align: center;
    padding: 40px;
    color: #666;
}
.tp-spinner {
    display: inline-block;
    width: 30px;
    height: 30px;
    border: 3px solid #ddd;
    border-top-color: var(--tp-lock-own);
    border-radius: 50%;
    animation: tp-spin 0.8s linear infinite;
    margin-bottom: 10px;
}
@keyframes tp-spin { to { transform: rotate(360deg); } }

/* ─── Table ─── */
.tp-table-container {
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    position: relative;
    scrollbar-width: thin;
    scrollbar-color: #bbb #f0f0f0;
}
.tp-table-container::-webkit-scrollbar { height: 8px; }
.tp-table-container::-webkit-scrollbar-track { background: #f0f0f0; border-radius: 4px; }
.tp-table-container::-webkit-scrollbar-thumb { background: #bbb; border-radius: 4px; }
.tp-table-container::-webkit-scrollbar-thumb:hover { background: #999; }
.tp-table {
    border-collapse: collapse;
    width: 100%;
    min-width: 900px;
    table-layout: fixed;
}
.tp-table th, .tp-table td {
    border: 1px solid var(--tp-border);
    padding: 3px 5px;
    vertical-align: top;
    font-size: 12px;
    position: relative;
}

/* Header */
.tp-table thead th {
    background: var(--tp-header);
    font-weight: 700;
    text-align: center;
    position: sticky;
    top: 52px; /* below toolbar */
    z-index: 20;
    padding: 6px 4px;
}
.tp-table thead th.tp-col-vehicle,
.tp-table thead th.tp-col-driver {
    position: sticky;
    z-index: 30;
}
.tp-table thead th.tp-col-vehicle { left: 0; min-width: 100px; width: 100px; }
.tp-table thead th.tp-col-driver { left: 100px; min-width: 80px; width: 80px; }

/* Sticky left columns */
.tp-table td.tp-col-vehicle,
.tp-table td.tp-col-driver {
    position: sticky;
    z-index: 10;
    font-weight: 600;
    font-size: 11px;
    white-space: nowrap;
}
.tp-table td.tp-col-vehicle { left: 0; min-width: 100px; width: 100px; }
.tp-table td.tp-col-driver { left: 100px; min-width: 80px; width: 80px; }

/* Vehicle group colors */
.tp-row-main td.tp-col-vehicle,
.tp-row-main td.tp-col-driver { background: var(--tp-main); }
.tp-row-extra td.tp-col-vehicle,
.tp-row-extra td.tp-col-driver { background: var(--tp-extra); }

/* Day headers */
.tp-day-header { font-size: 11px; line-height: 1.3; }
.tp-day-header .tp-day-name { display: block; font-weight: 700; }
.tp-day-header .tp-day-date { display: block; font-weight: 400; color: #555; }
.tp-day-header .tp-holiday-name { display: block; font-size: 9px; color: #c00; font-weight: 400; }

/* Holiday columns */
.tp-holiday { background: var(--tp-holiday) !important; }

/* ─── Entry cells ─── */
.tp-entry-cell {
    cursor: pointer;
    min-height: 36px;
    transition: background 0.1s;
    font-size: 11px;
    line-height: 1.3;
}
.tp-entry-cell:hover { background: #f0f7ff; }
.tp-entry-cell.tp-has-entry { background: #fff; }
.tp-entry-cell .tp-action { font-weight: 700; color: #333; }
.tp-entry-cell .tp-desc { color: #555; }
.tp-entry-cell .tp-client { font-style: italic; color: #777; font-size: 10px; }
.tp-entry-cell.tp-highlighted { background: var(--tp-highlight) !important; color: #fff; }
.tp-entry-cell.tp-highlighted .tp-desc,
.tp-entry-cell.tp-highlighted .tp-client { color: #fff; }

/* ─── Locking ─── */
.tp-locked-own {
    outline: 2px solid var(--tp-lock-own);
    outline-offset: -2px;
}
.tp-locked-other {
    outline: 2px solid var(--tp-lock-other);
    outline-offset: -2px;
    cursor: not-allowed;
    opacity: 0.85;
}
.tp-lock-badge {
    position: absolute;
    top: 1px;
    right: 1px;
    font-size: 8px;
    padding: 1px 4px;
    border-radius: 3px;
    background: var(--tp-lock-other);
    color: #fff;
    white-space: nowrap;
    z-index: 5;
    pointer-events: none;
}
.tp-request-btn {
    display: inline-block;
    font-size: 9px;
    padding: 2px 6px;
    margin-top: 2px;
    background: var(--tp-lock-other);
    color: #fff;
    border: none;
    border-radius: 3px;
    cursor: pointer;
}

/* ─── Notes row ─── */
.tp-notes-row td { background: #f9f9f9; }
.tp-notes-label { font-weight: 700; background: #eee !important; font-size: 11px; }
.tp-note-cell {
    cursor: pointer;
    min-height: 24px;
    font-size: 11px;
}
.tp-note-cell:hover { background: #f0f7ff; }

/* ─── Vehicle edit icon ─── */
.tp-vehicle-edit {
    display: inline-block;
    cursor: pointer;
    font-size: 10px;
    opacity: 0;
    transition: opacity 0.15s;
    margin-left: 4px;
}
.tp-col-vehicle:hover .tp-vehicle-edit,
.tp-col-driver:hover .tp-vehicle-edit { opacity: 1; }

/* ─── Inline Editing ─── */
.tp-inline-edit {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 1px;
}
.tp-inline-edit input {
    width: 100%;
    border: 1px solid var(--tp-lock-own);
    outline: none;
    padding: 2px 4px;
    font-size: 10px;
    font-family: inherit;
    background: #fff;
    box-sizing: border-box;
    border-radius: 2px;
}
.tp-inline-edit input:focus { box-shadow: 0 0 0 2px rgba(33,150,243,0.3); }
.tp-inline-edit input::placeholder { color: #aaa; font-size: 9px; }
.tp-inline-input {
    width: 100%;
    border: 1px solid var(--tp-lock-own);
    outline: none;
    padding: 2px 3px;
    font-size: 11px;
    font-family: inherit;
    background: #fff;
    box-sizing: border-box;
}
.tp-inline-input:focus { box-shadow: 0 0 0 2px rgba(33,150,243,0.3); }

/* ─── Note Input ─── */
.tp-note-input {
    width: 100%;
    border: 1px solid var(--tp-lock-own);
    outline: none;
    padding: 3px 5px;
    font-size: 11px;
    font-family: inherit;
    background: #fff;
    box-sizing: border-box;
    border-radius: 2px;
    resize: vertical;
    min-height: 28px;
}
.tp-note-input:focus { box-shadow: 0 0 0 2px rgba(33,150,243,0.3); }

/* ─── Toast Notifications ─── */
.tp-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 8px;
    color: #fff;
    font-size: 13px;
    font-family: var(--tp-font);
    box-shadow: 0 4px 16px rgba(0,0,0,0.25);
    z-index: 10002;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s, transform 0.3s;
    max-width: 360px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.tp-toast-show { opacity: 1; transform: translateY(0); }
.tp-toast-info { background: #333; }
.tp-toast-success { background: #2e7d32; }
.tp-toast-error { background: #c62828; }
.tp-toast-btn {
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.4);
    color: #fff;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    white-space: nowrap;
}
.tp-toast-btn:hover { background: rgba(255,255,255,0.35); }

/* ─── Popups ─── */
.tp-popup {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
}
.tp-popup-content {
    background: #fff;
    border-radius: 8px;
    padding: 24px;
    max-width: 420px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}
.tp-popup-content h3 { margin: 0 0 16px; font-size: 18px; }
.tp-popup-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
    justify-content: flex-end;
}

/* ─── Edit Form ─── */
.tp-edit-form .tp-form-row {
    margin-bottom: 12px;
}
.tp-edit-form label {
    display: block;
    font-weight: 600;
    font-size: 12px;
    margin-bottom: 4px;
    color: #555;
}
.tp-edit-form input[type="text"],
.tp-edit-form textarea,
.tp-edit-form select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: var(--tp-radius);
    font-size: 13px;
    font-family: inherit;
}
.tp-edit-form textarea { resize: vertical; }
.tp-edit-form input:focus,
.tp-edit-form textarea:focus,
.tp-edit-form select:focus {
    border-color: var(--tp-lock-own);
    outline: none;
    box-shadow: 0 0 0 2px rgba(33,150,243,0.2);
}

/* ─── Print options ─── */
.tp-print-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 12px 0;
}
.tp-print-options label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: var(--tp-radius);
    cursor: pointer;
    transition: background 0.1s;
}
.tp-print-options label:hover { background: #f5f5f5; }

/* ═══════════════════════════════════════════
   PRINT BUTTON – Prominent & Touch-Friendly
   ═══════════════════════════════════════════ */
.tp-btn-print {
    font-size: 22px;
    padding: 8px 16px;
    line-height: 1;
    border: 2px solid #555;
    border-radius: 8px;
    background: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 48px;
    min-height: 48px;
    transition: all 0.15s;
}
.tp-btn-print .tp-print-label {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.3px;
}
.tp-btn-print:hover {
    background: #f0f0f0;
    border-color: #333;
    transform: scale(1.05);
}
.tp-btn-print:active {
    transform: scale(0.97);
}

/* ═══════════════════════════════════════════
   RESPONSIVE – Tablet Landscape (≤ 1280px)
   ═══════════════════════════════════════════ */
@media (max-width: 1280px) {
    .tp-table { min-width: 850px; }
    .tp-table th, .tp-table td { font-size: 11px; padding: 2px 4px; }
    .tp-entry-cell { font-size: 10px; }
    .tp-entry-cell .tp-client { font-size: 9px; }
    .tp-day-header .tp-day-name { font-size: 10px; }
    .tp-day-header .tp-day-date { font-size: 9px; }
    .tp-title { font-size: 16px; }
}

/* ═══════════════════════════════════════════
   RESPONSIVE – Tablet Portrait (≤ 1024px)
   ═══════════════════════════════════════════ */
@media (max-width: 1024px) {
    .tp-toolbar {
        flex-wrap: wrap;
        padding: 8px 10px;
        gap: 6px;
    }
    .tp-toolbar-center { order: -1; flex-basis: 100%; text-align: center; }
    .tp-toolbar-left, .tp-toolbar-right {
        flex: 1;
        justify-content: center;
    }
    .tp-title { font-size: 15px; }
    .tp-current-label { font-size: 12px; }
    .tp-btn { padding: 6px 10px; font-size: 12px; }
    .tp-btn-print { font-size: 20px; min-width: 44px; min-height: 44px; }
    .tp-btn-print .tp-print-label { display: none; } /* Only icon on tablet */
    .tp-view-select { padding: 6px 8px; font-size: 12px; }

    .tp-table { min-width: 780px; }
    .tp-table td.tp-col-vehicle { min-width: 85px; width: 85px; font-size: 10px; }
    .tp-table td.tp-col-driver { left: 85px; min-width: 70px; width: 70px; font-size: 10px; }
    .tp-table thead th.tp-col-vehicle { min-width: 85px; width: 85px; }
    .tp-table thead th.tp-col-driver { left: 85px; min-width: 70px; width: 70px; }
    .tp-entry-cell { min-height: 40px; font-size: 10px; }
}

/* ═══════════════════════════════════════════
   RESPONSIVE – Tablet Portrait Narrow (≤ 768px)
   ═══════════════════════════════════════════ */
@media (max-width: 768px) {
    .tp-toolbar {
        flex-direction: column;
        align-items: stretch;
        padding: 8px;
    }
    .tp-toolbar-center { order: -1; }
    .tp-toolbar-left, .tp-toolbar-right {
        justify-content: center;
        flex-wrap: wrap;
    }
    .tp-title { font-size: 15px; }
    .tp-current-label { font-size: 12px; display: block; text-align: center; margin-top: 4px; }

    /* Table compacts but stays scrollable */
    .tp-table { min-width: 700px; }
    .tp-table td.tp-col-vehicle { min-width: 75px; width: 75px; }
    .tp-table td.tp-col-driver { left: 75px; min-width: 65px; width: 65px; }
    .tp-table thead th.tp-col-vehicle { min-width: 75px; width: 75px; }
    .tp-table thead th.tp-col-driver { left: 75px; min-width: 65px; width: 65px; }

    /* Bigger touch targets for cells */
    .tp-entry-cell { min-height: 44px; padding: 4px 5px; }
    .tp-note-cell { min-height: 36px; padding: 4px 5px; }

    /* Popups full-width */
    .tp-popup-content { max-width: 95%; padding: 16px; }
    .tp-edit-form input[type="text"],
    .tp-edit-form textarea,
    .tp-edit-form select { font-size: 16px; padding: 10px; } /* 16px prevents iOS zoom */

    /* Online users compact */
    .tp-online-name { display: none; }
    .tp-online-dot { width: 10px; height: 10px; }

    /* User selection bigger buttons */
    .tp-user-btn { padding: 16px 20px; font-size: 18px; }
}

/* ═══════════════════════════════════════════
   RESPONSIVE – Phone Landscape (≤ 667px)
   Typically 667×375 (iPhone) or similar
   ═══════════════════════════════════════════ */
@media (max-width: 667px) {
    .tp-toolbar {
        padding: 6px;
        gap: 4px;
    }
    .tp-toolbar-center { margin-bottom: 2px; }
    .tp-title { font-size: 14px; }
    .tp-current-label { font-size: 11px; }
    .tp-btn { padding: 5px 8px; font-size: 12px; }
    .tp-btn-print { font-size: 18px; min-width: 40px; min-height: 40px; padding: 6px 12px; }

    .tp-table { min-width: 600px; }
    .tp-table th, .tp-table td { font-size: 9px; padding: 2px 3px; }
    .tp-entry-cell { font-size: 9px; line-height: 1.2; min-height: 38px; }
    .tp-entry-cell .tp-action { font-size: 9px; }
    .tp-entry-cell .tp-desc { font-size: 8px; }
    .tp-entry-cell .tp-client { font-size: 8px; }

    .tp-day-header .tp-holiday-name { font-size: 7px; }
    .tp-lock-badge { font-size: 7px; padding: 1px 3px; }

    /* Vehicle column even narrower */
    .tp-table td.tp-col-vehicle { min-width: 65px; width: 65px; font-size: 9px; }
    .tp-table td.tp-col-driver { left: 65px; min-width: 55px; width: 55px; font-size: 9px; }
    .tp-table thead th.tp-col-vehicle { min-width: 65px; width: 65px; }
    .tp-table thead th.tp-col-driver { left: 65px; min-width: 55px; width: 55px; }

    /* Hide vehicle subinfo */
    .tp-col-vehicle small { display: none; }
}

/* ═══════════════════════════════════════════
   RESPONSIVE – Phone Portrait (≤ 480px)
   Single-day focus mode
   ═══════════════════════════════════════════ */
@media (max-width: 480px) {
    /* Toolbar stacks fully */
    .tp-toolbar {
        padding: 6px;
        gap: 4px;
    }
    .tp-toolbar-left {
        order: 0;
        gap: 4px;
    }
    .tp-toolbar-right {
        order: 2;
        gap: 6px;
        justify-content: space-between;
    }
    .tp-toolbar-center { order: -1; }
    .tp-title { font-size: 13px; }
    .tp-current-label { font-size: 11px; }
    .tp-btn { padding: 6px 8px; font-size: 11px; min-height: 36px; }
    .tp-btn-print {
        font-size: 20px;
        min-width: 44px;
        min-height: 44px;
        padding: 8px;
    }
    .tp-nav-today { font-size: 10px; }
    .tp-view-select { font-size: 12px; padding: 6px; }
    .tp-user-name { font-size: 10px; padding: 3px 8px; }

    /* Table: very compact, scrollable */
    .tp-table-container {
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x proximity;
    }
    .tp-table { min-width: 550px; table-layout: auto; }
    .tp-table th, .tp-table td { font-size: 9px; padding: 2px; }

    /* Sticky columns narrower */
    .tp-table td.tp-col-vehicle { min-width: 58px; width: 58px; font-size: 8px; }
    .tp-table td.tp-col-driver { left: 58px; min-width: 50px; width: 50px; font-size: 8px; }
    .tp-table thead th.tp-col-vehicle { min-width: 58px; width: 58px; font-size: 8px; }
    .tp-table thead th.tp-col-driver { left: 58px; min-width: 50px; width: 50px; font-size: 8px; }

    .tp-entry-cell {
        min-height: 44px; /* Touch-friendly */
        font-size: 9px;
        padding: 3px;
    }
    .tp-note-cell { min-height: 36px; font-size: 9px; }

    /* Inline editing bigger inputs for touch */
    .tp-inline-edit input {
        font-size: 14px; /* Prevents iOS zoom */
        padding: 6px;
        min-height: 32px;
    }
    .tp-note-input {
        font-size: 14px;
        padding: 6px;
    }

    /* Popups full screen on phone */
    .tp-popup-content {
        max-width: 100%;
        width: 100%;
        border-radius: 12px 12px 0 0;
        max-height: 85vh;
        overflow-y: auto;
        padding: 16px;
    }
    .tp-popup {
        align-items: flex-end; /* Slide up from bottom */
    }
    .tp-popup-content h3 { font-size: 16px; }
    .tp-edit-form input[type="text"],
    .tp-edit-form textarea,
    .tp-edit-form select {
        font-size: 16px; /* Prevents iOS zoom */
        padding: 12px 10px;
    }
    .tp-popup-actions {
        flex-direction: column;
        gap: 8px;
    }
    .tp-popup-actions .tp-btn {
        width: 100%;
        padding: 12px;
        font-size: 14px;
        text-align: center;
    }

    /* User selection: full width buttons */
    .tp-overlay-box { padding: 24px 16px; }
    .tp-user-btn {
        padding: 16px;
        font-size: 16px;
    }

    /* Toast at bottom, full width */
    .tp-toast {
        left: 10px;
        right: 10px;
        bottom: 10px;
        max-width: none;
        border-radius: 8px;
    }
}

/* ═══════════════════════════════════════════
   RESPONSIVE – Very small phones (≤ 360px)
   ═══════════════════════════════════════════ */
@media (max-width: 360px) {
    .tp-title { font-size: 12px; }
    .tp-current-label { font-size: 10px; }
    .tp-toolbar-left { gap: 2px; }
    .tp-btn { padding: 5px 6px; font-size: 10px; min-height: 32px; }
    .tp-btn-print { font-size: 18px; min-width: 40px; min-height: 40px; }
    .tp-table { min-width: 480px; }
    .tp-table td.tp-col-vehicle { min-width: 50px; width: 50px; }
    .tp-table td.tp-col-driver { left: 50px; min-width: 45px; width: 45px; }
    .tp-table thead th.tp-col-vehicle { min-width: 50px; width: 50px; }
    .tp-table thead th.tp-col-driver { left: 50px; min-width: 45px; width: 45px; }
    .tp-view-select { font-size: 11px; max-width: 70px; }
}

/* ═══════════════════════════════════════════
   ORIENTATION HELPERS
   ═══════════════════════════════════════════ */

/* Tablet landscape: maximize horizontal space */
@media (min-width: 769px) and (max-width: 1280px) and (orientation: landscape) {
    .tp-toolbar { padding: 6px 12px; }
    .tp-toolbar-center { flex: 0 0 auto; }
    .tp-table thead th { position: sticky; top: 44px; } /* Tighter toolbar = lower sticky offset */
    .tp-entry-cell { min-height: 34px; }
}

/* Tablet portrait: give more space to content */
@media (min-width: 601px) and (max-width: 1024px) and (orientation: portrait) {
    .tp-table-container { max-height: calc(100vh - 120px); overflow-y: auto; }
    .tp-table thead th { position: sticky; top: 0; z-index: 20; }
}

/* Phone landscape: thin toolbar, maximize table */
@media (max-width: 900px) and (orientation: landscape) {
    .tp-toolbar {
        flex-direction: row;
        flex-wrap: nowrap;
        padding: 4px 8px;
        gap: 6px;
        align-items: center;
    }
    .tp-toolbar-center { order: 0; flex: 1; }
    .tp-toolbar-left, .tp-toolbar-right { flex: 0 0 auto; }
    .tp-title { font-size: 13px; }
    .tp-current-label { font-size: 10px; }
    .tp-btn { padding: 4px 8px; font-size: 11px; min-height: 30px; }
    .tp-btn-print { font-size: 16px; min-width: 36px; min-height: 36px; padding: 4px 8px; }
    .tp-view-select { padding: 4px 6px; font-size: 11px; }
    .tp-user-name { font-size: 9px; }

    .tp-table-container { max-height: calc(100vh - 50px); overflow-y: auto; }
    .tp-table thead th { position: sticky; top: 0; z-index: 20; }
    .tp-entry-cell { min-height: 30px; }
}

/* ═══════════════════════════════════════════
   PRINT STYLES
   ═══════════════════════════════════════════ */
@media print {
    .tp-toolbar, .tp-overlay, .tp-popup, .tp-loading, .tp-toast { display: none !important; }
    .tp-table-container { overflow: visible; max-height: none; }
    .tp-table { min-width: auto; }
    .tp-table th, .tp-table td { position: static !important; }
    .tp-lock-badge, .tp-vehicle-edit { display: none !important; }
    .tp-entry-cell { min-height: auto; }
}
