/* ═══════════════════════════════════════════════════════════════════
   tripLogbook.css — Trip Logbook page styles
   Dependencies: shared-panels.css (panel header, resize handle, toggle)
   ═══════════════════════════════════════════════════════════════════ */

/* ── Layout ─────────────────────────────────────────────────────── */
.tl-container {
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
}

/* ── Map (full background) ──────────────────────────────────────── */
.tl-panel-right {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 0;
}
.tl-map { width: 100%; height: 100%; position: relative; }

/* ── Floating Panel ─────────────────────────────────────────────── */
.tl-panel-left {
    position: relative;
    z-index: 2;
    width: 440px;
    min-width: 300px;
    margin: 12px 0 12px 12px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.12);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

/* Scrollable content inside panel */
.tl-panel-scroll {
    flex: 1;
    overflow-y: auto;
    overflow-x: auto;
    padding: 10px;
}

/* Resize handle positioning within tl-container flex */
.tl-container .sidebar-resize-handle {
    z-index: 3;
    margin: 12px 0;
}

/* ── Calendar + Summary (stacked) ─────────────────────────────────── */
.tl-calendar-panel {
    width: 100%;
}
.tl-summary-panel {
    width: 100%;
}

/* ── Summary: Primary row (always visible, toggle) ───────────────── */
.tl-stats-primary {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 4px 12px;
    cursor: pointer;
    position: relative;
    padding-right: 20px;
    border-radius: 6px;
    transition: background .15s;
}
.tl-stats-primary:hover { background: #f8fafc; }
.tl-summary-toggle {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    color: #94a3b8;
}

/* ── Stats Grid (detail, expandable) ─────────────────────────────── */
.tl-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 4px 12px;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid #f0f2f5;
}
.tl-stat-item {
    padding: 2px 0;
}
.tl-stat-title {
    color: #6c7a91;
    font-size: .75rem;
    white-space: nowrap;
}
.tl-stat-val {
    font-weight: 700;
    color: #1e293b;
    font-size: .9rem;
    white-space: nowrap;
}

/* ── Calendar ────────────────────────────────────────────────────── */
.tl-calendar { width: 100%; border-collapse: collapse; font-size: .75rem; text-align: left; table-layout: fixed; }
.tl-calendar th { padding: 2px 3px; color: #6c7a91; font-weight: 500; text-align: center; }
.tl-calendar th.tl-week-num { width: 28px; }
.tl-calendar td {
    padding: 1px;
    vertical-align: top;
    height: 52px;
    border: 1px solid #f0f2f5;
    cursor: pointer;
    position: relative;
}
.tl-calendar td.tl-week-num {
    font-size: .6rem;
    color: #a0aec0;
    vertical-align: middle;
    text-align: center;
    padding: 0;
    cursor: pointer;
    border: none;
    transition: background .15s, color .15s;
}
.tl-calendar td.tl-week-num:hover {
    background: #e8f4fd;
    color: var(--brand-primary);
}

/* Cell inner structure */
.tl-cal-cell {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

/* Day number: top-left */
.tl-cal-num {
    display: inline-block;
    font-size: .7rem;
    line-height: 1;
    padding: 2px 3px;
    cursor: pointer;
    border-radius: 3px;
    min-width: 16px;
    text-align: center;
}
.tl-cal-num:hover { background: #e8f4fd; }

/* Km label */
.tl-cal-km {
    font-size: .5rem;
    color: var(--brand-primary);
    font-weight: 600;
    line-height: 1;
    padding: 0 3px;
    white-space: nowrap;
}

/* Engine hours label */
.tl-cal-eh {
    font-size: .5rem;
    color: #6c757d;
    font-weight: 600;
    line-height: 1;
    padding: 0 3px;
    white-space: nowrap;
}
.tl-cal-eh::before {
    content: 'MH ';
}

/* Indicators area */
.tl-cal-indicators {
    display: flex;
    flex-direction: column;
    gap: 1px;
    margin-top: auto;
    padding: 0 2px 2px;
}

/* Individual indicator items */
.tl-cal-ind {
    display: flex;
    align-items: center;
    gap: 2px;
    font-size: 8px;
    line-height: 1;
    height: 10px;
}
.tl-cal-ind-business::before {
    content: '';
    width: 6px; height: 6px;
    border-radius: 50%;
    background: #2fb344;
    flex-shrink: 0;
}
.tl-cal-ind-private::before {
    content: '';
    width: 6px; height: 6px;
    border-radius: 50%;
    background: #f76707;
    flex-shrink: 0;
}
.tl-cal-ind-fuel {
    color: #2fb344;
}
.tl-cal-ind-fuel .material-icons {
    font-size: 9px;
    vertical-align: middle;
}
.tl-cal-fuel-vol {
    font-size: 7px;
    font-weight: 600;
}

/* ── State classes ────────────────────────────────────────────────── */

/* Today: orange circle — always distinguishable from blue range */
.tl-cal-today .tl-cal-num {
    background: var(--brand-accent, #e8530e);
    color: #fff !important;
    font-weight: 600;
    border-radius: 50%;
    width: 20px; height: 20px; line-height: 20px;
    padding: 0; text-align: center;
}

/* Days with data: bold blue number */
.tl-cal-has-data .tl-cal-num { font-weight: 700; color: var(--brand-primary); }

/* Today + has data: orange circle wins */
.tl-cal-today.tl-cal-has-data .tl-cal-num { background: var(--brand-accent, #e8530e); color: #fff !important; }

/* Selected range: light blue cell background */
.tl-cal-range { background: #e8f4fd; }

/* Range endpoints: blue circle on number */
.tl-cal-range-end .tl-cal-num {
    background: var(--brand-primary);
    color: #fff !important;
    font-weight: 600;
    border-radius: 50%;
    width: 20px; height: 20px; line-height: 20px;
    padding: 0; text-align: center;
}

/* Today + in range: blue cell bg + orange circle on number */
.tl-cal-range.tl-cal-today .tl-cal-num { background: var(--brand-accent, #e8530e); color: #fff !important; }

/* Today + range endpoint: orange circle + blue ring */
.tl-cal-range-end.tl-cal-today .tl-cal-num {
    background: var(--brand-accent, #e8530e);
    box-shadow: 0 0 0 2px var(--brand-primary);
}

/* Overflow: grayed out prev/next month days */
.tl-cal-overflow { background: #fafbfc; }
.tl-cal-overflow .tl-cal-num { color: #cbd5e0; cursor: default; }
.tl-cal-overflow .tl-cal-num:hover { background: transparent; }
.tl-cal-overflow .tl-cal-indicators { display: none; }
.tl-cal-overflow .tl-cal-km { display: none; }
.tl-cal-overflow .tl-cal-eh { display: none; }

/* ── Drag preview classes (JS-only, no server state) ──────────────── */
.tl-cal-drag-range { background: #dbeafe !important; }
.tl-cal-drag-end .tl-cal-num {
    background: var(--brand-primary) !important;
    color: #fff !important;
    border-radius: 50%;
    width: 20px; height: 20px; line-height: 20px;
    padding: 0; text-align: center;
}
.tl-calendar.tl-cal-dragging { user-select: none; }

/* Closure state: Locked (golden/gray background) */
.tl-cal-locked { background: #f5f0e1; }
.tl-cal-locked .tl-cal-num { color: #8b7e2f; }

/* Closure state: Closed (light green background) */
.tl-cal-closed { background: #e8f5e9; }
.tl-cal-closed .tl-cal-num { color: #2e7d32; }

/* Today always wins over locked/closed */
.tl-cal-locked.tl-cal-today .tl-cal-num,
.tl-cal-closed.tl-cal-today .tl-cal-num { background: var(--brand-accent, #e8530e); color: #fff !important; }

/* Mini lock/check icons in calendar cells */
.tl-cal-lock-icon, .tl-cal-check-icon {
    position: absolute; top: 1px; right: 2px;
    font-size: 10px; line-height: 1; opacity: 0.6;
}
.tl-cal-lock-icon { color: #8b7e2f; }
.tl-cal-check-icon { color: #2e7d32; }
.tl-cal-cell { position: relative; }

/* Fuel marker on map — styled like vehicle markers */
.tl-fuel-marker { cursor: pointer; }
.tl-fuel-marker .marker-main { filter: drop-shadow(0 1px 3px rgba(0,0,0,0.2)); }
.tl-fuel-marker .marker-name { color: #1e293b; }

/* ── Quick Buttons ───────────────────────────────────────────────── */
.tl-quick-btns {
    display: flex;
    gap: 4px;
    margin-top: 6px;
}
.tl-quick-btns .btn {
    flex: 1;
    font-size: .7rem;
    padding: 2px 4px;
}
.tl-quick-btns .btn.active {
    background: var(--brand-primary);
    color: #fff;
    border-color: var(--brand-primary);
}
.tl-quick-btns .btn.active:hover {
    filter: brightness(0.9);
}

/* ── Trip List (card-based layout) ──────────────────────────────── */
.tl-list {
    width: 100%;
    font-size: .8rem;
}
.tl-list-header {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f1f5f9;
    border-bottom: 2px solid #e2e8f0;
    padding: 6px 8px;
    font-weight: 600;
    font-size: .75rem;
    color: #475569;
}
.tl-th-cb { width: 32px; text-align: center; flex-shrink: 0; }
.tl-th-cb input { width: 16px; height: 16px; cursor: pointer; accent-color: var(--brand-primary); vertical-align: middle; }
.tl-check-btn { color: var(--brand-primary); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; padding: 0; border: none; background: none; line-height: 1; width: 24px; height: 24px; border-radius: 4px; }
.tl-check-btn:hover { background: rgba(32,107,196,0.08); }
.tl-check-btn .material-icons { font-size: 20px; }
.tl-hdr-toggle { cursor: pointer; font-size: .65rem; display: inline-block; width: 14px; user-select: none; }
.tl-hdr-toggle:hover { color: var(--brand-primary); }

/* ── Day Row (group header, sticky) ────────────────────────────── */
.tl-day-row {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #e8f4fd;
    cursor: pointer;
    user-select: none;
    padding: 6px 8px;
    font-size: .8rem;
    border-bottom: 1px solid #c8e0f0;
    position: sticky;
    top: 0;
    z-index: 2;
}
.tl-day-row:hover { background: #d6ecfa; }
.tl-day-cb { width: 16px; height: 16px; cursor: pointer; accent-color: var(--brand-primary); vertical-align: middle; flex-shrink: 0; }
.tl-day-arrow { display: inline-block; width: 14px; font-size: .65rem; flex-shrink: 0; }
.tl-day-info { flex: 1; }
.tl-day-stat { font-size: .75rem; color: #49566c; white-space: nowrap; margin-left: auto; flex-shrink: 0; }

/* ── Trip Card (3-line layout) ─────────────────────────────────── */
.tl-trip-card {
    display: flex;
    flex-direction: column;
    padding: 6px 8px;
    border-bottom: 1px solid #f0f0f0;
    cursor: default;
}
.tl-trip-card:hover { background: #f8fafc; }
.tl-trip-card-hover {
    background: #e8f4fd !important;
}

/* Line 1: checkbox, eco badge, end time, end address, actions */
.tl-trip-line1 {
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 22px;
}

/* Line 2: start time, start address, purpose */
.tl-trip-line2 {
    display: flex;
    align-items: center;
    gap: 6px;
    padding-left: 54px; /* align under time (cb 32 + eco 20 + gap) */
    color: #6c7a91;
    font-size: .75rem;
    min-height: 18px;
}

/* Line 3: type badge, stats, driver */
.tl-trip-line3 {
    display: flex;
    align-items: center;
    gap: 6px;
    padding-left: 32px; /* align under eco badge */
    font-size: .75rem;
    color: #49566c;
    min-height: 20px;
    margin-top: 1px;
}

.tl-trip-check { display: flex; align-items: center; justify-content: center; width: 32px; flex-shrink: 0; }
.tl-trip-check input { width: 16px; height: 16px; cursor: pointer; accent-color: var(--brand-primary); }

/* ECO Score Badge */
.tl-eco-badge {
    width: 22px; height: 20px; border-radius: 4px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: .7rem; font-weight: 700; color: #fff;
    flex-shrink: 0; line-height: 1;
}
.eco-a { background: #2fb344; }
.eco-b { background: #5ca13a; }
.eco-c { background: #8b8f30; }
.eco-d { background: #b87d26; }
.eco-e { background: #e56b1c; }
.eco-f { background: #f44336; }
.eco-g { background: #d32f2f; }
.eco-na { background: #cbd5e1; color: #94a3b8; }

/* Time */
.tl-time { font-weight: 500; white-space: nowrap; flex-shrink: 0; min-width: 36px; }
.tl-time-secondary { white-space: nowrap; flex-shrink: 0; min-width: 36px; }

/* Address */
.tl-addr { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* Type badge (on line 3) */
.tl-type-badge {
    width: 14px; height: 14px; border-radius: 50%;
    display: inline-block; cursor: pointer; flex-shrink: 0;
}
.tl-type-badge-locked { cursor: default; }
.bg-highway-yellow { background-color: #FFD100; }

/* Stats on line 3 */
.tl-stats-inline {
    display: flex;
    align-items: center;
    gap: 2px;
    flex: 1;
    min-width: 0;
}
.tl-stat-sep { color: #cbd5e1; }

/* Purpose text (truncated, with tooltip) */
.tl-purpose-text {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #6c7a91;
    font-size: .7rem;
    cursor: default;
}

/* Driver on line 3 */
.tl-driver-inline {
    margin-left: auto;
    max-width: 80px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: .75rem;
    font-weight: 500;
    color: #334155;
    flex-shrink: 0;
}
.tl-assign-driver-btn { color: var(--brand-primary); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; }
.tl-assign-driver-btn .material-icons { font-size: 16px; }
.tl-assign-driver-btn:hover { color: #1a56a0; }
.tl-passenger-inline { display: inline-flex; align-items: center; gap: 1px; color: #6c7a91; font-size: .7rem; }
.tl-passenger-inline .material-icons { font-size: 13px; }

/* Actions (end of line 1) */
.tl-actions { margin-left: auto; flex-shrink: 0; }
.tl-actions-btn { padding: 2px; min-width: 0; line-height: 1; background: none; border: none; cursor: pointer; border-radius: 4px; display: flex; align-items: center; }
.tl-actions-btn:hover { background: #e9ecef; }
.tl-actions-btn .material-icons { font-size: 18px; color: #6c7a91; }
.tl-actions .dropdown-item { font-size: 13px; padding: 6px 12px; display: flex; align-items: center; }
.tl-actions .dropdown-item .material-icons { color: #666; }

/* Purpose Modal */
.tl-purpose-modal .form-label { font-size: .8rem; font-weight: 500; color: #475569; }
.tl-purpose-modal .form-select { font-size: .8rem; }
.tl-purpose-modal .form-control { font-size: .8rem; }
.tl-purpose-divider { display: flex; align-items: center; gap: 8px; color: #94a3b8; font-size: .75rem; margin: 12px 0; }
.tl-purpose-divider::before,
.tl-purpose-divider::after { content: ''; flex: 1; border-top: 1px solid #e2e8f0; }

/* ── Sensor Chart Modal ──────────────────────────────────────────── */
.tl-chart-icon {
    font-size: 16px;
    color: #6c7a91;
    cursor: pointer;
    vertical-align: middle;
    transition: color .15s;
}
.tl-chart-icon:hover { color: var(--brand-primary); }
.tl-sensor-checks { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.tl-sensor-checks .form-check-label { font-size: .8rem; }
.tl-chart-wrap { position: relative; height: 350px; width: 100%; }

/* ── Panel Collapse/Expand ────────────────────────────────────────── */
.tl-container.panel-collapsed .tl-panel-left {
    transform: translateX(calc(-100% - 12px));
    opacity: 0;
    pointer-events: none;
}
.tl-container.panel-collapsed .sidebar-resize-handle {
    display: none;
}
.tl-panel-left {
    transition: transform 0.3s cubic-bezier(.4,0,.2,1), opacity 0.3s ease;
}

/* Panel expand button — visible when collapsed */
.tl-expand-btn {
    display: none;
    position: fixed;
    top: 80px;
    left: 12px;
    z-index: 3;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 2px 12px rgba(0,0,0,0.15);
    border: none;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    color: #555;
    transition: background 0.15s;
}
.tl-expand-btn:hover {
    background: #f0f0f0;
}
.tl-container.panel-collapsed ~ .tl-expand-btn {
    display: flex;
}

/* Pod 1200 px má lišta GPS druhý řádek s výběry (92 px místo 56), viz clientMap.css
   u .mapSideBarWrapper. Bez posunu by horní okraj knihy jízd ležel pod ní. */
@media screen and (min-width: 801px) and (max-width: 1199.98px) {
    body:has(.navbar-selectors-row) .tl-container { top: 92px; }
    body:has(.navbar-selectors-row) .tl-expand-btn { top: 116px; }
    body:has(.navbar-selectors-row) .tl-speed-legend { top: 108px; }
}

/* ── Responsive (mobile < 800px) ─────────────────────────────────── */
@media screen and (max-width: 800px) {
    .tl-container {
        top: 94px;
        flex-direction: column;
        padding-bottom: 40px;
    }

    .tl-panel-left {
        position: relative;
        width: 100% !important;
        min-width: 0;
        margin: 0;
        border-radius: 0;
        box-shadow: none;
        flex: 1;
        overflow-y: auto;
    }

    .tl-panel-right {
        position: relative;
        width: 100% !important;
        min-width: 0;
        flex: 1;
    }

    .sidebar-resize-handle {
        display: none;
    }

    .tl-mobile-toggle.mobile-toggle-bar {
        display: flex;
    }

    .tl-hidden-mobile {
        display: none !important;
    }

    .tl-addr { max-width: 120px; }
    .tl-trip-line2 { padding-left: 48px; }
    .tl-trip-line3 { padding-left: 26px; }
    .tl-driver-inline { display: none; }
    .tl-purpose-text { max-width: 80px; }
    .tl-stats-grid { grid-template-columns: 1fr 1fr; gap: 2px 8px; }
    .tl-chart-wrap { height: 250px; }
    .tl-chart-icon { font-size: 14px; }

    .panel-header .panel-collapse-btn {
        display: none;
    }
}

/* ── Map control buttons ──────────────────────────────────────── */
.maplibregl-ctrl-heatmap-toggle {
    display: flex; align-items: center; justify-content: center;
    width: 29px; height: 29px; padding: 0; border: none; background: none; cursor: pointer; outline: none;
}
.maplibregl-ctrl-heatmap-toggle:hover { background: rgba(0,0,0,0.05); }
.maplibregl-ctrl-heatmap-toggle.tl-ctrl-active { background: #e3f2fd; }
.maplibregl-ctrl-heatmap-toggle.tl-ctrl-active .material-icons { color: var(--brand-primary); }

/* ── Position Popup (hover + playback) ────────────────────────── */
.tl-hover-popup .maplibregl-popup-content { padding: 0; border-radius: 10px; box-shadow: 0 4px 20px rgba(0,0,0,0.15); overflow: hidden; }
.tl-pos-popup { font-size: 12px; color: #222; min-width: 220px; max-width: 300px; }
.tl-pos-header { padding: 8px 12px; background: #f8f9fa; border-bottom: 1px solid #eee; display: flex; align-items: center; gap: 6px; font-size: 13px; }
.tl-pos-row { display: flex; align-items: center; padding: 4px 12px; gap: 6px; border-bottom: 1px solid #f5f5f5; }
.tl-pos-row:last-child { border-bottom: none; }
.tl-pos-icon { font-size: 14px; color: #999; flex-shrink: 0; }
.tl-pos-label { color: #888; flex: 1; }
.tl-pos-val { font-weight: 500; text-align: right; white-space: nowrap; }

/* ── Playback Bar ─────────────────────────────────────────────── */
.tl-playback-bar {
    position: fixed; bottom: 12px;
    left: 480px; right: 16px; /* left dynamically set by JS _syncPlaybackBarPosition */
    z-index: 5;
    background: rgba(255,255,255,0.95);
    -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
    border-radius: 10px; box-shadow: 0 2px 16px rgba(0,0,0,0.15);
    padding: 8px 16px;
    display: flex; flex-direction: column; gap: 6px;
}
/* Row 1: start-time | controls+current | end-time */
.tl-pb-row1 { display: flex; align-items: center; gap: 4px; width: 100%; }
.tl-pb-center { display: flex; align-items: center; gap: 4px; flex: 1; justify-content: center; }
.tl-pb-time-edge { flex-shrink: 0; }
/* Row 2: slider full width */
.tl-pb-row2 { display: flex; align-items: center; width: 100%; }
.tl-pb-btn { background: none; border: none; cursor: pointer; padding: 4px; border-radius: 6px; display: flex; align-items: center; }
.tl-pb-btn:hover { background: #e9ecef; }
.tl-pb-btn .material-icons { font-size: 22px; color: var(--brand-primary); }
.tl-pb-speed { display: flex; gap: 2px; margin-left: 2px; }
.tl-pb-speed button { background: #f0f0f0; border: none; border-radius: 4px; font-size: 11px; padding: 2px 6px; cursor: pointer; font-weight: 500; }
.tl-pb-speed button.active { background: var(--brand-primary); color: #fff; }
.tl-pb-speed button:hover:not(.active) { background: #ddd; }
.tl-pb-slider { flex: 1; height: 4px; cursor: pointer; accent-color: var(--brand-primary); }
.tl-pb-time { font-size: 11px; color: #666; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tl-pb-time-current { font-weight: 600; color: var(--brand-primary); min-width: 52px; text-align: center; }
.tl-pb-close {
    position: absolute; top: 6px; right: 6px;
    background: none; border: none; cursor: pointer; padding: 2px;
    border-radius: 4px; display: flex; align-items: center;
    opacity: 0.5; transition: opacity 0.15s;
}
.tl-pb-close:hover { opacity: 1; background: #fee; }
.tl-pb-close .material-icons { font-size: 16px; color: #666; }

/* Desktop: single row — start | controls | current | slider | end | close */
@media (min-width: 801px) {
    .tl-playback-bar { flex-direction: row; align-items: center; padding-right: 28px; gap: 8px; }
    .tl-pb-row1 { width: auto; flex-shrink: 0; }
    .tl-pb-row2 { flex: 1; }
}

/* ── Speed Legend ─────────────────────────────────────────────── */
.tl-speed-legend {
    position: fixed; top: 72px; right: 12px; z-index: 5;
    background: rgba(255,255,255,0.95);
    -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
    border-radius: 8px; box-shadow: 0 2px 12px rgba(0,0,0,0.12);
    padding: 8px 12px; min-width: 150px;
}
.tl-sl-title { font-size: 12px; font-weight: 600; color: #555; display: flex; align-items: center; gap: 4px; margin-bottom: 6px; }
.tl-sl-item { display: flex; align-items: center; gap: 6px; font-size: 12px; padding: 2px 0; }
.tl-sl-color { width: 14px; height: 14px; border-radius: 3px; flex-shrink: 0; }

/* ── Speed Threshold Editor ───────────────────────────────────── */
.tl-st-header { display: grid; grid-template-columns: 80px 50px 1fr 32px; gap: 6px; font-size: 11px; color: #999; font-weight: 600; padding-bottom: 4px; border-bottom: 1px solid #eee; margin-bottom: 6px; }
.tl-st-row { display: grid; grid-template-columns: 80px 50px 1fr 32px; gap: 6px; align-items: center; margin-bottom: 4px; }
.tl-st-row input { font-size: 12px; }
.tl-st-color { width: 32px; height: 32px; padding: 2px; }

/* ── Mobile: overlays only visible in Map tab, 2-row playback ── */
@media (max-width: 800px) {
    /* Hide map overlays when List tab is active (map panel has tl-hidden-mobile) */
    .tl-panel-right.tl-hidden-mobile ~ .tl-map-overlay { display: none !important; }

    /* Playback bar: full width, 2 rows, above mobile toggle bar */
    .tl-playback-bar {
        left: 12px !important; right: 12px;
        bottom: 56px; padding: 8px 10px;
        padding-right: 28px;
    }

    /* Speed legend: above mobile toggle, pushed up when playback is active */
    .tl-speed-legend { top: auto !important; bottom: 56px; right: 8px; }
    /* When playback bar is visible (sibling before legend), push legend above it */
    .tl-playback-bar:not([style*="none"]) ~ .tl-speed-legend { bottom: 140px; }
}

/* ── Safari: canvas overlay fixes ─────────────────────────────── */
.tl-arrow-anim-canvas {
    position: absolute; top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none; z-index: 10;
    /* Safari needs explicit transform to create compositing layer */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

/* ── ECO Badge Visibility ────────────────────────────────────────── */
body.tl-eco-never .tl-eco-badge { display: none !important; }
body.tl-eco-when-value .tl-eco-badge.eco-na { display: none !important; }

/* Zastaveni uvnitr jizdy (TRIP-STOPS-FEATURE-2026-08) */
.tl-trip-stops { padding: 2px 8px 2px 48px; }
.tl-stops-toggle { text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
.tl-stops-list { margin-top: 4px; display: flex; flex-direction: column; gap: 2px; }
.tl-stop-row { display: flex; align-items: center; gap: 6px; font-size: 0.85rem; min-width: 0; }
.tl-stop-row .tl-addr { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-stop-badge { min-width: 20px; text-align: center; }

/* ═══════════════════════════════════════════════════════════════════
   tl-mp — Kniha jizd ve vzhledu hlavni stranky monitoringu (panel vozidel)
   Plovouci panel .mapSideBar 400 px: zahlavi, vyber vozidla na miste hledani,
   pilulky obdobi, kalendar, souhrn a seznam jizd az k okraji panelu.
   Pravidla: Views/MonitoringPanel/JEDNOTNOST.docs.md (M1–M8). Kniha jizd ridice
   (DriverTripLogbook) muze prevzit pridanim tridy tl-mp na .tl-container.
   ═══════════════════════════════════════════════════════════════════ */
.tl-mp .tl-panel-left { width: 400px; min-width: 300px; }
.tl-mp ~ .tl-expand-btn { top: 68px; }

/* Pilulky obdobi — jako Slozky / Stitky */
.tl-mp .tl-quick-btns {
    margin: 0;
    padding: 6px 14px;
    border-bottom: 1px solid #f0f0f0;
    background: #fff;
    flex-shrink: 0;
}

/* Obsah panelu az k okraji, oddily oddelene carou */
.tl-mp .tl-panel-scroll { padding: 0; overflow-x: hidden; }
.tl-mp .tl-calendar-panel { padding: 6px 14px 10px; border-bottom: 1px solid #f0f0f0; }
.tl-cal-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}
.tl-cal-month { font-size: 14px; font-weight: 700; color: #222; }
.tl-mp .tl-summary-panel { padding: 8px 14px; border-bottom: 1px solid #f0f0f0; }
.tl-mp .tl-stats-primary { display: flex; flex-wrap: wrap; gap: 4px 18px; padding-right: 24px; }
.tl-mp .tl-stats-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
.tl-mp .tl-stat-title { color: var(--mp-muted, #888); }
.tl-mp .tl-stat-val { color: var(--mp-text, #222); }
.tl-alert { margin: 8px 14px; font-size: 13px; }

/* Seznam jizd — skupiny po dnech jako slozky, jizdy jako radky vozidel */
.tl-mp .tl-list-header {
    gap: 6px;
    padding: 6px 14px;
    background: #fff;
    border-bottom: 1px solid #f0f0f0;
    font-size: 12px;
    color: var(--mp-group-text, #475569);
}
.tl-mp .tl-th-cb { width: 24px; }
.tl-mp .tl-hdr-toggle,
.tl-mp .tl-day-arrow {
    width: auto;
    display: inline-flex;
    font-size: 18px;
    color: #64748b;
    text-decoration: none;
}
.tl-mp .tl-hdr-toggle .material-icons { font-size: 18px; }
.tl-mp .tl-day-row {
    gap: 6px;
    padding: 7px 14px;
    background: var(--mp-group-bg, #f1f5f9);
    border-bottom: 1px solid var(--mp-group-line, #e2e8f0);
    font-size: .8rem;
    font-weight: 600;
    color: var(--mp-group-text, #475569);
}
.tl-mp .tl-day-row:hover { background: #e8f0f8; }
.tl-mp .tl-day-info {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
}
.tl-day-count { margin-left: 4px; font-size: .7rem; font-weight: 400; color: #94a3b8; }
.tl-mp .tl-day-stat { flex-shrink: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; font-weight: 400; color: #64748b; }
.tl-mp .tl-trip-card { padding: 8px 14px; border-bottom: 1px solid var(--mp-row-line, #f5f5f5); }
.tl-mp .tl-trip-card:hover { background: var(--mp-hover, #f8f9fb); }
.tl-mp .tl-trip-line2 { padding-left: 48px; }
/* Poznamka k jizde z mobilni aplikace: pod radkem 2, zarovnana s nim, nejvys dva radky */
.tl-mp .tl-trip-note { padding-left: 48px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.tl-mp .tl-trip-note .material-icons { vertical-align: -2px; }
.tl-mp .tl-trip-line3 { padding-left: 24px; }
.tl-mp .tl-trip-stops { padding: 2px 0 2px 48px; }
.tl-mp .tl-stops-toggle { color: var(--brand-primary); }
.tl-stop-located { color: var(--brand-primary); }
.tl-mp .tl-actions-btn {
    width: 28px;
    height: 28px;
    padding: 0;
    justify-content: center;
    border-radius: 6px;
}
.tl-mp .tl-actions-btn:hover { background: #e8f0fe; }
.tl-mp .tl-actions-btn:hover .material-icons { color: var(--brand-primary); }
.tl-mp .tl-actions .dropdown-item .material-icons { color: #666; }
.tl-modal-icon { color: var(--brand-primary); }

@media screen and (min-width: 801px) and (max-width: 1199.98px) {
    body:has(.navbar-selectors-row) .tl-mp ~ .tl-expand-btn { top: 104px; }
}

@media screen and (max-width: 800px) {
    /* Panel pres celou sirku jako hlavni stranka; roluje obsah, zahlavi a vyber vozidla zustavaji */
    .tl-mp .tl-panel-left { overflow: hidden; min-height: 0; }
    .tl-mp .tl-addr { max-width: none; }
    .tl-mp .tl-actions-btn { width: 36px; height: 36px; }
    .tl-mp .tl-check-btn { width: 32px; height: 32px; }
}
