/* Desktop remains untouched. Mobile rules are scoped to buses and buses_mapa. */
.mobile-transport .mobile-menu-toggle,
.mobile-transport .mobile-nav-backdrop { display: none; }
.mobile-transport .mobile-only { display: none; }
@media (max-width: 760px) {
    .mobile-transport { overflow-x: hidden; }
    .mobile-transport .topbar { position: sticky; top: 0; z-index: 1100; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; min-height: 44px; }
    .mobile-transport .topbar h1 { font-size: 20px; margin: 0; }
    .mobile-transport .mobile-menu-toggle { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px 16px; border: 1px solid #64748b; border-radius: 9px; color: #fff; background: #334155; font-size: 15px; flex-shrink: 0; }
    .mobile-transport .layout { display: block; min-height: 0; }
    .mobile-transport .content { min-width: 0; padding: 12px; }
    .mobile-transport .sidebar { display: none; }
    .mobile-transport.mobile-nav-open { overflow: hidden; }
    .mobile-transport.mobile-nav-open .sidebar { display: block; position: fixed; top: 64px; bottom: 0; left: 0; z-index: 1100; width: min(320px, 86vw); box-sizing: border-box; overflow-y: auto; padding: 8px 0 24px; }
    .mobile-transport.mobile-nav-open .mobile-nav-backdrop:not([hidden]) { display: block; position: fixed; inset: 64px 0 0; z-index: 1050; background: rgba(15,23,42,.45); border: 0; padding: 0; }
    .mobile-transport .sidebar a { min-height: 44px; box-sizing: border-box; padding: 13px 18px; }
    .mobile-transport .ux-wrap, .mobile-transport .map-page { width: 100%; max-width: 100%; min-width: 0; }
    .mobile-transport .ux-toolbar, .mobile-transport .map-toolbar { padding: 12px; }
    .mobile-transport .ux-toolbar form, .mobile-transport .map-toolbar form { display: flex; flex-direction: column; gap: 10px; }
    .mobile-transport .ux-toolbar p, .mobile-transport .map-toolbar p { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
    .mobile-transport .ux-toolbar label, .mobile-transport .map-toolbar label { width: 100%; margin: 0; }
    .mobile-transport .ux-toolbar select, .mobile-transport .map-toolbar select { width: 100%; min-width: 0; min-height: 46px; font-size: 16px; }
    .mobile-transport .ux-toolbar button, .mobile-transport .map-toolbar button,
    .mobile-transport .ux-toolbar a, .mobile-transport .map-toolbar a,
    .mobile-transport .show-more-btn { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box; margin: 0; padding: 10px 14px; }
    .mobile-transport .source-badge, .mobile-transport .live-status { max-width: 100%; white-space: normal; }
    .mobile-transport .live-status { flex-basis: 100%; font-size: 13px; }
    .mobile-transport .ux-note, .mobile-transport .map-note { font-size: 13px; line-height: 1.5; padding: 10px 12px; }
    .mobile-transport .summary-title, .mobile-transport .summary-title-flex { flex-wrap: wrap; gap: 10px; padding: 12px; }
    .mobile-transport .summary-title-left { flex-wrap: wrap; gap: 8px; }
    .mobile-transport .summary-search, .mobile-transport .ux-search-box { width: 100%; min-width: 0; }
    .mobile-transport input[type="search"], .mobile-transport .ux-search-box input { width: 100%; box-sizing: border-box; min-height: 46px; font-size: 16px; }
    .mobile-transport .map-wrap { height: 55vh; height: 55svh; min-height: 300px; max-height: 540px; border-radius: 12px; }
    .mobile-transport .locate-btn { top: 10px; right: 10px; min-height: 44px; }
    .mobile-transport .selected-line-box { top: auto; bottom: 10px; left: 10px; right: 10px; max-width: none; max-height: 35%; overflow-y: auto; box-sizing: border-box; font-size: 12px; line-height: 1.5; }
    .mobile-transport .selected-line-box button { min-height: 40px; }
    .mobile-transport .leaflet-popup-content { max-width: min(260px, 70vw); }
    .mobile-transport .ux-table-wrap { border: 0; background: transparent; overflow-x: visible !important; }
    .mobile-transport .summary-card { overflow: hidden; }
    .mobile-transport .ux-table, .mobile-transport .summary-table { display: block; table-layout: auto; width: 100%; font-size: 14px; }
    .mobile-transport .ux-table tbody, .mobile-transport .summary-table tbody { display: block; width: 100%; }
    .mobile-transport .ux-table tbody tr, .mobile-transport .summary-table tr { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 0; margin: 10px; border: 1px solid #dbe3ee; border-radius: 12px; overflow: hidden; background: #fff; }
    .mobile-transport .ux-table tbody tr { margin: 10px 0; }
    .mobile-transport .ux-table tbody td, .mobile-transport .summary-table td { display: block; width: auto !important; padding: 10px 12px; white-space: normal !important; text-overflow: clip; overflow-wrap: anywhere; border: 0; border-bottom: 1px solid #f1f5f9; line-height: 1.4; min-width: 0; }
    .mobile-transport .ux-table tbody td::before, .mobile-transport .summary-table td::before { display: block; font-size: 11px; font-weight: 600; color: #64748b; margin-bottom: 4px; }
    .mobile-transport .ux-table td.c-bus::before { content: 'Veículo'; }
    .mobile-transport .ux-table td.c-operador::before { content: 'Operador'; }
    .mobile-transport .ux-table td.c-matricula::before { content: 'Matrícula'; }
    .mobile-transport .ux-table td.c-chassis::before { content: 'Modelo'; }
    .mobile-transport .ux-table td.c-linha::before { content: 'Linha'; }
    .mobile-transport .ux-table td.c-destino::before { content: 'Destino'; }
    .mobile-transport .ux-table td.c-min::before { content: 'Última informação'; }
    .mobile-transport .ux-table td.c-detalhe::before { content: 'Detalhe'; }
    .mobile-transport .ux-table td.c-foto::before { content: 'Fotografia'; }
    .mobile-transport .ux-table td.c-bus { order: 0; font-size: 17px; font-weight: 700; }
    .mobile-transport .ux-table td.c-min { order: 1; }
    .mobile-transport .ux-table td.c-operador { order: 2; }
    .mobile-transport .ux-table td.c-matricula { order: 3; }
    .mobile-transport .ux-table td.c-chassis { order: 4; grid-column: 1 / -1; }
    .mobile-transport .ux-table td.c-linha { order: 5; }
    .mobile-transport .ux-table td.c-destino { order: 6; }
    .mobile-transport .ux-table td.c-detalhe { order: 7; }
    .mobile-transport .ux-table td.c-foto { order: 8; }
    .mobile-transport .ux-table thead { display: block; overflow-x: auto; overscroll-behavior-x: contain; }
    .mobile-transport .ux-table thead tr { display: flex; width: max-content; }
    .mobile-transport .ux-table thead th { width: auto !important; min-width: 86px; flex: none; box-sizing: border-box; font-size: 12px; padding: 0; border: 0; }
    .mobile-transport .ux-table thead th a { display: flex; align-items: center; min-height: 44px; padding: 0 12px; }
    .mobile-transport #vehiclesTable thead { display: none; }
    .mobile-transport .operator-summary tr:first-child, .mobile-transport .summary-table.lines tr:first-child { display: none; }
    .mobile-transport .summary-table tr.hidden-line-row { display: none; }
    .mobile-transport .summary-table td[data-label]::before { content: attr(data-label); }
    .mobile-transport .operator-summary td:nth-child(1) { grid-column: 1 / -1; font-weight: 700; font-size: 15px; }
    .mobile-transport .operator-summary td:nth-child(2)::before { content: 'Veículos ativos'; }
    .mobile-transport .operator-summary td:nth-child(3)::before { content: 'Máximo veículos'; }
    .mobile-transport .operator-summary td:nth-child(4) { grid-column: 1 / -1; }
    .mobile-transport .operator-summary td:nth-child(4)::before { content: 'Último update'; }
    .mobile-transport .operator-summary td:nth-child(5) { grid-column: 1 / -1; }
    .mobile-transport .summary-table.lines td:nth-child(1)::before { content: 'Linha'; }
    .mobile-transport .summary-table.lines td:nth-child(2)::before { content: 'Veículos'; }
    .mobile-transport .summary-table.lines td:nth-child(3)::before { content: 'Última observação'; }
    .mobile-transport .summary-table.lines td:nth-child(4)::before { content: 'Tempo decorrido'; }
    .mobile-transport .summary-table.vehicles td:nth-child(1) { font-size: 17px; font-weight: 700; }
    .mobile-transport .summary-table td[colspan] { grid-column: 1 / -1; }
    .mobile-transport .ux-table a, .mobile-transport .summary-table a { min-height: 44px; display: inline-flex; align-items: center; flex-wrap: wrap; }
    .mobile-transport .ux-photo-btn, .mobile-transport .ux-photo-ok { font-size: 12px; min-height: 44px; box-sizing: border-box; white-space: normal; }
    .mobile-transport .subcontract-fleet { flex-basis: 100%; }
    .mobile-transport .show-more-wrap { padding: 12px; }
    .mobile-transport .show-more-btn { width: 100%; }
    .mobile-transport .photo-modal-backdrop, .mobile-transport .stats-modal-backdrop { padding: 10px; box-sizing: border-box; }
    .mobile-transport .photo-modal, .mobile-transport .stats-modal { width: 100%; max-width: 100%; max-height: 90vh; max-height: 90dvh; overflow-y: auto; box-sizing: border-box; padding: 16px; }
    .mobile-transport .photo-modal-actions { flex-wrap: wrap; }
    .mobile-transport .photo-modal-actions button { flex: 1; min-height: 44px; }
    .mobile-transport .photo-modal input { font-size: 16px; }
    .mobile-transport .stats-modal-body { grid-template-columns: minmax(0,1fr); }

    /* Compact flowing cards: optional fields cannot leave unused grid slots. */
    .mobile-transport .ux-table tbody tr,
    .mobile-transport .summary-table tr { display: flex; flex-wrap: wrap; align-items: center; margin: 8px; }
    .mobile-transport .ux-table tbody tr { margin: 8px 0; }
    .mobile-transport .ux-table tbody tr.ux-row-photo { background: #eff6ff; }
    .mobile-transport .ux-table tbody tr.ux-row-subcontract,
    .mobile-transport .summary-table tr.subcontract-row { background: #fff7ed; }
    .mobile-transport .ux-table tbody td,
    .mobile-transport .summary-table td { flex: 1 1 42%; box-sizing: border-box; padding: 6px 10px; font-size: 13px; border: 0; background: transparent !important; }
    .mobile-transport .ux-table tbody td::before,
    .mobile-transport .summary-table td::before { display: inline; margin-right: 6px; font-size: 10px; }
    .mobile-transport .ux-table tbody td.mobile-field-empty,
    .mobile-transport .summary-table td:empty { display: none; }
    .mobile-transport .ux-table td.c-bus,
    .mobile-transport .summary-table.vehicles td:nth-child(1) { font-size: 16px; padding-top: 9px; padding-bottom: 7px; }
    .mobile-transport .ux-table td.c-bus::before,
    .mobile-transport .summary-table.vehicles td:nth-child(1)::before { display: none; }
    .mobile-transport .ux-table td.c-min { text-align: right; }
    .mobile-transport .ux-table td.c-operador,
    .mobile-transport .ux-table td.c-chassis,
    .mobile-transport .ux-table td.c-destino { flex-basis: 100%; }
    .mobile-transport .operator-summary td:nth-child(1),
    .mobile-transport .operator-summary td:nth-child(4),
    .mobile-transport .operator-summary td:nth-child(5),
    .mobile-transport .summary-table td[colspan] { flex-basis: 100%; }
    .mobile-transport .ux-table a, .mobile-transport .summary-table a { min-height: 30px; }
    .mobile-transport .ux-table td.c-detalhe,
    .mobile-transport .ux-table td.c-foto { padding-top: 5px; padding-bottom: 8px; }
    .mobile-transport .ux-table td.c-detalhe::before,
    .mobile-transport .ux-table td.c-foto::before { display: none; }
    .mobile-transport .ux-photo-btn, .mobile-transport .ux-photo-ok { min-height: 36px; padding: 8px 10px; }
    .mobile-transport .ux-table thead tr { display: flex; flex-wrap: nowrap; margin: 0; padding: 0; border: 0; border-radius: 0; }
    .mobile-transport .ux-table thead th { width: auto !important; min-width: 76px; padding: 0; }
    .mobile-transport .ux-table thead th a { min-height: 38px; padding: 0 10px; }
    .mobile-transport .ux-kpis { margin: 8px 0; }
    .mobile-transport .ux-kpi { padding: 8px 12px; }
    .mobile-transport .ux-note, .mobile-transport .map-note { font-size: 12px; line-height: 1.4; padding: 8px 10px; }
    .mobile-transport .summary-table td.last-update.update-delayed { color: #a16207; }
    .mobile-transport .summary-table td.last-update.update-old { color: #dc2626; }
    .mobile-transport .ux-kpis { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
    .mobile-transport .mobile-active-filter { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 12px; font-size: 15px; font-weight: 600; color: #334155; cursor: pointer; }
    .mobile-transport .mobile-active-filter input { width: 20px; height: 20px; margin: 0; accent-color: #16a34a; }
    .mobile-transport .ux-table tbody tr { border: 1px solid #b6c6da; border-radius: 10px; box-shadow: 0 2px 5px rgba(15,23,42,.06); }
    .mobile-transport .ux-table tbody tr.ux-row-photo { border-color: #93b5e2; }
    .mobile-transport .ux-table tbody tr.ux-row-subcontract { border-color: #dfb78b; }
    .mobile-transport .ux-table tbody tr.ux-row-retired { background: #e5e7eb; border-color: #aeb5bf; }
    .mobile-transport .ux-table thead,
    .mobile-transport .ux-search-count { display: none; }
    .mobile-transport .ux-table td.c-min::before { display: none; }
    .mobile-transport .ux-table tbody td { padding: 4px 10px; }
    .mobile-transport .ux-table td.c-bus,
    .mobile-transport .ux-table td.c-matricula { font-size: 16px; font-weight: 600; }
    .mobile-transport .ux-table td.c-bus { padding-top: 8px; }
    .mobile-transport .ux-table td.c-min { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
    .mobile-transport .mobile-live-dot { display: inline-block; order: 2; width: 9px; height: 9px; border-radius: 50%; background: #22c55e; flex-shrink: 0; }
    .mobile-transport .ux-table td.c-linha { flex-basis: 100%; }
    .mobile-transport .mobile-destination { display: inline; margin-left: 8px; color: #475569; }
    .mobile-transport .ux-table td.c-destino { display: none; }
    .mobile-transport .ux-table td.c-map,
    .mobile-transport .ux-table td.c-foto,
    .mobile-transport .ux-table td.c-detalhe { display: flex; flex: 1 1 28%; padding: 8px 6px; align-items: center; }
    .mobile-transport .ux-table td.c-map { order: 7; }
    .mobile-transport .ux-table td.c-foto { order: 8; }
    .mobile-transport .ux-table td.c-detalhe { order: 9; justify-content: flex-end; }
    .mobile-transport .ux-table td.c-detalhe a,
    .mobile-transport .ux-table .mobile-map-btn,
    .mobile-transport .ux-photo-btn,
    .mobile-transport .ux-photo-ok { display: inline-flex; justify-content: center; align-items: center; width: 100%; min-width: 0; min-height: 40px; box-sizing: border-box; border: 0; border-radius: 9px; padding: 8px 6px; font-size: 14px; font-weight: 600; line-height: 1.2; white-space: normal; text-decoration: none; }
    .mobile-transport .ux-table td.c-detalhe a { background: #2563eb; color: #fff; text-transform: capitalize; }
    .mobile-transport .ux-table .mobile-map-btn { background: #e2e8f0; color: #1e3a8a; }
    .mobile-transport .ux-table .mobile-map-btn:disabled { opacity: .5; color: #64748b; }
}
