/*
 * Camada responsiva da Central de Embarques.
 * Este arquivo é carregado somente abaixo de 992 px; nenhuma regra alcança o desktop.
 */

@media (max-width: 991.98px) {
    :root {
        --mobile-gutter: clamp(.65rem, 2.8vw, 1rem);
        --mobile-radius: .78rem;
        --mobile-line: #dbe5f0;
        --mobile-shadow: 0 .18rem .7rem rgba(15, 43, 73, .075);
    }

    html,
    body { max-width: 100%; overflow-x: clip; }
    *,
    *::before,
    *::after { box-sizing: border-box; }
    body.authenticated { background: #f4f7fb; }
    .app-shell,
    .app-content { width: 100%; min-width: 0; max-width: 100%; }
    .app-content { margin-left: 0 !important; }

    .app-topbar {
        min-height: 64px;
        gap: .55rem;
        padding: .55rem max(var(--mobile-gutter), env(safe-area-inset-right)) .55rem max(var(--mobile-gutter), env(safe-area-inset-left));
        background: rgba(255,255,255,.98);
        box-shadow: 0 .12rem .6rem rgba(12,45,78,.055);
    }
    .app-topbar .topbar-title,
    .app-topbar .topbar-global-search-shell { display: none !important; }
    .mobile-menu-trigger {
        width: 42px;
        height: 42px;
        flex: 0 0 42px;
        display: grid;
        place-items: center;
        padding: 0;
        color: #0b3768;
        background: #f8fafc;
        border: 1px solid #e6edf5;
        border-radius: .65rem;
    }
    .mobile-menu-trigger svg { width: 1.35rem; height: 1.35rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
    .mobile-topbar-brand {
        min-width: 0;
        align-items: center;
        gap: .55rem;
        color: #0a3566;
        text-decoration: none;
    }
    .mobile-topbar-brand .brand-mark {
        width: 38px;
        height: 38px;
        flex: 0 0 38px;
        border-radius: .65rem;
        font-size: 1rem;
    }
    .mobile-topbar-brand > span:last-child { min-width: 0; line-height: 1; }
    .mobile-topbar-brand strong,
    .mobile-topbar-brand small { display: block; white-space: nowrap; }
    .mobile-topbar-brand strong { font-size: .98rem; font-weight: 850; }
    .mobile-topbar-brand small { margin-top: .12rem; color: #52708f; font-size: .58rem; font-weight: 750; letter-spacing: .055em; text-transform: uppercase; }
    .app-topbar .topbar-actions { gap: .45rem !important; }
    .app-topbar .theme-toggle,
    .app-topbar .page-help-trigger--icon {
        width: 42px;
        height: 42px;
        min-height: 42px;
        flex: 0 0 42px;
    }
    .app-topbar .topbar-actions form { margin: 0; }
    .app-topbar .topbar-actions form .btn { min-height: 42px; padding-inline: .75rem; border-radius: .58rem; font-weight: 700; }

    .app-offcanvas { width: min(86vw, 21rem) !important; }
    .app-offcanvas .offcanvas-header { min-height: 68px; padding: .7rem 1rem; }
    .app-offcanvas .sidebar-brand { min-height: 0; }
    .app-offcanvas .sidebar-nav { padding: .65rem; }
    .app-offcanvas .sidebar-heading { min-height: 2.5rem; }
    .app-offcanvas .sidebar-link { min-height: 46px; font-size: .9rem; }

    .app-main { width: 100%; min-width: 0; max-width: 100vw; padding: var(--mobile-gutter); }
    .app-main > * { min-width: 0; max-width: 100%; }
    .app-main :where(.row, .d-flex, [class*="-grid"], [class*="-card"]) > * { min-width: 0; max-width: 100%; }
    .app-main img,
    .app-main svg { max-width: 100%; }

    .mobile-page-heading {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 1rem;
        margin-bottom: .75rem;
    }
    .mobile-page-heading h1 { margin: 0; color: #0a3566; font-size: 1.45rem; font-weight: 850; letter-spacing: -.035em; }
    .mobile-page-heading p { margin: .1rem 0 0; color: #667e98; font-size: .76rem; }
    .mobile-page-clock { flex: 0 0 auto; text-align: right; }
    .mobile-page-clock span,
    .mobile-page-clock strong { display: block; white-space: nowrap; }
    .mobile-page-clock span { color: #607994; font-size: .63rem; }
    .mobile-page-clock strong { margin-top: .05rem; color: #082f61; font-size: 1.35rem; line-height: 1; }

    .card,
    .content-card,
    .quote-filter-card,
    .quote-list-card,
    .provider-list-card { border-radius: var(--mobile-radius); box-shadow: var(--mobile-shadow); }
    .card-header { min-width: 0; }
    .card-header > * { min-width: 0; }
    .card-header h1,
    .card-header h2,
    .card-header h3 { overflow-wrap: anywhere; }

    .nav-tabs,
    [role="tablist"],
    .quote-status-tabs,
    .provider-directory-tabs {
        flex-wrap: nowrap !important;
        overflow-x: auto;
        overscroll-behavior-inline: contain;
        scrollbar-width: none;
        scroll-snap-type: x proximity;
    }
    .nav-tabs::-webkit-scrollbar,
    [role="tablist"]::-webkit-scrollbar,
    .quote-status-tabs::-webkit-scrollbar,
    .provider-directory-tabs::-webkit-scrollbar { display: none; }
    .nav-tabs > *,
    [role="tablist"] > *,
    .quote-status-tabs > *,
    .provider-directory-tabs > * { flex: 0 0 auto; scroll-snap-align: start; }

    .modal-dialog { margin: .5rem; }
    .modal-content { max-height: calc(100dvh - 1rem); border-radius: 1rem; }
    .modal-body { min-width: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; }
    .modal-footer { position: sticky; bottom: 0; z-index: 2; flex-wrap: wrap; background: var(--bs-body-bg); }
    .modal-footer .btn { flex: 1 1 9rem; }
    .offcanvas { max-width: 90vw; }

    .table-responsive,
    .modal-body,
    .offcanvas-body,
    .dropdown-menu {
        scrollbar-width: thin;
        scrollbar-color: rgba(70, 101, 132, .45) transparent;
    }
    .table-responsive::-webkit-scrollbar,
    .modal-body::-webkit-scrollbar,
    .offcanvas-body::-webkit-scrollbar,
    .dropdown-menu::-webkit-scrollbar { width: 6px; height: 6px; }
    .table-responsive::-webkit-scrollbar-thumb,
    .modal-body::-webkit-scrollbar-thumb,
    .offcanvas-body::-webkit-scrollbar-thumb,
    .dropdown-menu::-webkit-scrollbar-thumb { background: rgba(70, 101, 132, .45); border-radius: 999px; }

    html[data-theme="dark"] body.authenticated { background: var(--gh-canvas); }
    html[data-theme="dark"] .app-topbar { background: rgba(13,17,23,.98); box-shadow: 0 1px 0 var(--gh-border); }
    html[data-theme="dark"] .mobile-menu-trigger { color: var(--gh-text-strong); background: var(--gh-canvas-subtle); border-color: var(--gh-border); }
    html[data-theme="dark"] .mobile-topbar-brand { color: var(--gh-text-strong); }
    html[data-theme="dark"] .mobile-topbar-brand small { color: var(--gh-text-muted); }
    html[data-theme="dark"] .mobile-page-heading h1,
    html[data-theme="dark"] .mobile-page-clock strong { color: var(--gh-text-strong); }
    html[data-theme="dark"] .mobile-page-heading p,
    html[data-theme="dark"] .mobile-page-clock span { color: var(--gh-text-muted); }
}

@media (max-width: 767.98px) {
    :root { --mobile-gutter: .65rem; }
    body { font-size: .875rem; }
    .app-topbar { min-height: 62px; gap: .4rem; }
    .app-topbar .topbar-back-link { display: none; }
    .mobile-topbar-brand { margin-right: auto; }
    .app-topbar .topbar-actions { margin-left: 0 !important; }

    .app-main { padding-bottom: max(1rem, env(safe-area-inset-bottom)); }
    .page-title,
    .quote-page-header h1,
    .provider-directory__heading h1,
    .central-today-heading h1,
    .shipment-detail-heading .page-title { font-size: clamp(1.3rem, 6vw, 1.6rem); line-height: 1.08; }
    .quote-page-header p,
    .provider-directory__heading p,
    .central-today-heading p { font-size: .76rem; line-height: 1.35; }

    .app-main .btn:not(.btn-close),
    .app-main .form-control,
    .app-main .form-select,
    .app-main .search-select-input { min-height: 44px; }
    .app-main .btn { white-space: normal; }
    .app-main .text-truncate,
    .app-main [class*="-card"] .text-truncate {
        overflow: visible !important;
        text-overflow: clip !important;
        white-space: normal !important;
    }
    .app-main :where(.card, [class*="-card"]) :where(h1, h2, h3, h4, h5, h6, p, small, strong, a, span) {
        min-width: 0;
        max-width: 100%;
        overflow-wrap: anywhere;
    }
    .input-group > .form-control,
    .input-group > .form-select { min-width: 0; }
    textarea.form-control { min-height: 6rem; }

    .card-header,
    .content-card > .card-header { padding: .78rem .82rem; }
    .card-body,
    .content-card > .card-body { padding: .82rem; }
    .card-footer { padding: .75rem .82rem; }
    .row { --bs-gutter-x: .8rem; --bs-gutter-y: .8rem; }

    .d-flex.justify-content-between:not(.topbar-actions),
    .d-flex.justify-content-end { min-width: 0; }
    .btn-group { max-width: 100%; }
    .dropdown-menu {
        max-width: calc(100vw - 1.3rem);
        white-space: normal;
    }

    /* Dashboard analítico */
    main.app-main.dashboard-main { padding: var(--mobile-gutter); }
    .dashboard-shell { width: 100%; min-width: 0; max-width: 100%; gap: .65rem; }
    .dashboard-hero { padding: .7rem; border-radius: .72rem; }
    .dashboard-hero-company { gap: .65rem; }
    .dashboard-client-logo { width: 5.6rem; height: 3.5rem; flex-basis: 5.6rem; }
    .dashboard-hero-company > div > span { font-size: .61rem; }
    .dashboard-hero-company h1 { font-size: 1.05rem; }
    .dashboard-hero-company p { font-size: .66rem; }
    .dashboard-kpi-grid,
    .dashboard-alert-grid,
    .dashboard-financial-grid {
        width: 100%;
        min-width: 0;
        max-width: 100%;
        grid-template-columns: repeat(2, calc((100% - .5rem) / 2)) !important;
        gap: .5rem;
    }
    .dashboard-kpi { width: 100%; min-width: 0; max-width: 100%; min-height: 6rem; gap: .55rem; padding: .7rem .62rem; overflow: visible; border-radius: .68rem; }
    .dashboard-kpi-icon { width: 2.4rem; height: 2.4rem; flex-basis: 2.4rem; }
    .dashboard-kpi-copy small { min-height: 2em; font-size: .66rem; }
    .dashboard-kpi-copy strong { font-size: 1.25rem; }
    .dashboard-kpi-copy em { font-size: .59rem; white-space: normal; }
    .dashboard-alert-strip { padding: .7rem; overflow: visible; }
    .dashboard-alert-strip > header,
    .dashboard-queue > header {
        height: auto;
        min-height: 2.65rem;
        align-items: center;
        gap: .45rem;
        padding-block: .45rem;
        flex-wrap: wrap;
    }
    .dashboard-alert-strip > header h2,
    .dashboard-queue > header h2 { min-width: 0; flex: 1 1 10rem; line-height: 1.25; }
    .dashboard-alert-strip > header a,
    .dashboard-queue > header a {
        min-width: 0;
        max-width: 100%;
        flex: 0 1 auto;
        white-space: normal;
        overflow-wrap: anywhere;
        text-align: right;
    }
    .dashboard-alert-strip h2 { font-size: .98rem; }
    .dashboard-alert-card { width: 100%; min-width: 0; max-width: 100%; min-height: 4.4rem; padding: .6rem; overflow: visible; }
    .dashboard-alert-card small { font-size: .62rem; }
    .dashboard-alert-card strong { font-size: 1.1rem; }
    .dashboard-queues { gap: .65rem; }
    .dashboard-queue { height: auto; min-height: 0; overflow: visible; }
    .dashboard-queue-body { overflow: visible; }
    .dashboard-queue-row {
        min-height: 0;
        grid-template-columns: minmax(4.7rem,.72fr) minmax(0,1.28fr);
        align-items: start;
        gap: .28rem .55rem;
        padding-block: .52rem;
    }
    .dashboard-queue-row span:last-child { display: block; }
    .dashboard-load-row { grid-template-columns: minmax(0,1fr) auto; }
    .dashboard-load-row > span { grid-column: 1 / -1; }
    .dashboard-load-row > b { grid-column: 2; grid-row: 1; }
    .dashboard-analysis-grid { display: block; }
    .dashboard-analysis-card { height: auto; min-height: 15rem; margin-bottom: .65rem; }
    .dashboard-operational-filters { grid-template-columns: 1fr; }

    /* Central Hoje */
    .central-today-page { gap: .65rem; }
    .central-today-heading { padding: 0; }
    .central-today-heading-actions { display: none; }
    .central-today-metrics { width: 100%; min-width: 0; max-width: 100%; grid-template-columns: repeat(2,calc((100% - .5rem) / 2)) !important; gap: .5rem; }
    .central-today-metric { min-height: 6.7rem; grid-template-columns: 2.25rem 1fr; gap: .45rem; padding: .65rem .55rem; }
    .central-today-metric-icon { width: 2.2rem; height: 2.2rem; }
    .central-today-metric small { min-height: 2em; font-size: .6rem; }
    .central-today-metric strong { font-size: 1.35rem; }
    .central-today-filter-tabs { overflow-x: auto; }
    .central-today-filters { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .central-action-mobile article { border: 1px solid var(--mobile-line); border-radius: .72rem; margin-bottom: .55rem; background: var(--bs-body-bg); box-shadow: var(--mobile-shadow); }

    /* Orçamentos */
    .quote-dashboard { min-width: 0; }
    .quote-breadcrumb { display: none; }
    .quote-page-header { margin-bottom: .75rem; }
    .quote-page-actions {
        display: flex;
        width: 100%;
        margin-top: .1rem;
    }
    .quote-page-actions > .dropdown { display: none; }
    .quote-page-actions .btn-group { display: flex; width: 100%; }
    .quote-page-actions .quote-new-button {
        min-width: 0;
        flex: 1 1 auto;
    }
    .quote-page-actions .quote-new-split { flex: 0 0 3rem; }
    .quote-metric-grid { width: 100%; min-width: 0; max-width: 100%; grid-template-columns: repeat(2,calc((100% - .5rem) / 2)) !important; gap: .5rem; margin-bottom: .7rem; }
    .quote-metric-card { min-height: 6.45rem !important; gap: .55rem; padding: .7rem .62rem; }
    .quote-metric-icon { width: 2.35rem; height: 2.35rem; flex-basis: 2.35rem; }
    .quote-metric-icon svg { width: 1.25rem; height: 1.25rem; }
    .quote-metric-content > strong { font-size: 1.05rem; }
    .quote-metric-content > u,
    .quote-metric-content > .metric-name { margin-top: .12rem; font-size: .69rem; }
    .quote-metric-content > small { padding-top: .2rem; font-size: .63rem; }
    .quote-metric-content > span:not(.metric-name):not(.quote-progress) { font-size: .59rem; }
    .quote-filter-card { padding: .75rem; }
    .quote-filter-grid { grid-template-columns: 1fr !important; gap: .65rem; }
    .quote-period-field > div { flex-wrap: nowrap !important; }
    .quote-status-tabs { gap: .4rem; margin-bottom: .7rem; }
    .quote-status-tabs a { min-height: 2.4rem; padding: .45rem .65rem; }
    .quote-list-card > header { padding: .75rem; }
    .quote-list-tools { display: grid; grid-template-columns: 1fr auto; align-items: end; }
    .quote-list-tools form,
    .quote-list-tools form label { width: auto; min-width: 0; }
    .quote-view-toggle { display: none; }
    .quote-table-wrap { overflow: visible; }
    .quote-table.is-grid tbody { display: grid; grid-template-columns: 1fr; gap: .55rem; padding: .55rem; }
    .quote-table.is-grid tbody tr:not(.quote-empty-row) { grid-template-columns: repeat(2,minmax(0,1fr)); gap: .55rem; padding: .7rem; }
    .quote-table.is-grid tbody td:nth-child(1),
    .quote-table.is-grid tbody td:nth-child(5),
    .quote-table.is-grid tbody td:last-child { grid-column: 1 / -1; }
    .quote-table.is-grid tbody td::before { font-size: .56rem; }
    .quote-stage-list { overflow-x: auto; flex-wrap: nowrap !important; }

    /* Pátio, prestadores e cadastros */
    .provider-directory__heading { gap: .7rem; margin-bottom: .7rem; }
    .provider-new-button { width: 100%; }
    .provider-metrics,
    .betim-yard-directory .provider-metrics { width: 100%; min-width: 0; max-width: 100%; grid-template-columns: repeat(2,calc((100% - .5rem) / 2)) !important; gap: .5rem; }
    .provider-metric { grid-template-columns: 2.65rem 1fr; padding: .65rem; gap: .08rem .55rem; }
    .provider-metric__icon { width: 2.6rem; height: 2.6rem; }
    .provider-metric__copy { display: grid; }
    .provider-metric__copy > span { font-size: .64rem; }
    .provider-metric__copy > strong { font-size: 1.2rem; }
    .provider-metric small { font-size: .58rem; }
    .provider-directory-tabs a { padding: .7rem .75rem; }
    .provider-filters,
    .betim-yard-directory-filters { grid-template-columns: repeat(2,minmax(0,1fr)) !important; padding: .75rem; }
    .provider-filters .provider-filter-search,
    .betim-yard-directory-filters .provider-filter-search { grid-column: 1 / -1 !important; }
    .provider-filters > .btn { width: 100%; }
    .provider-editor { width: 100vw; max-width: 100vw; }
    .provider-editor__header { padding: .85rem; }
    .provider-editor__body { padding: .85rem; }
    .provider-editor__footer { padding: .75rem; padding-bottom: max(.75rem,env(safe-area-inset-bottom)); }

    /* Frete e fluxo operacional */
    .shipment-detail-heading { align-items: flex-start !important; gap: .65rem; }
    .shipment-detail-heading > div:last-child { width: auto; }
    .shipment-summary-grid { grid-template-columns: repeat(2,minmax(0,1fr)) !important; }
    .shipment-summary-item { min-height: 5rem; padding: .65rem !important; border-top: 1px solid var(--bs-border-color) !important; }
    .shipment-summary-item:nth-child(odd) { border-left: 0 !important; }
    .shipment-summary-item:nth-child(even) { border-left: 1px solid var(--bs-border-color) !important; }
    .shipment-summary-item:nth-child(-n+2) { border-top: 0 !important; }
    .shipment-summary-vehicle-thumb { width: 3.7rem; height: 2.45rem; flex-basis: 3.7rem; }
    .shipment-summary-item .detail-label { font-size: .57rem; }
    .shipment-summary-item .detail-value { font-size: .76rem; overflow-wrap: anywhere; }
    .shipment-date-timeline { grid-template-columns: repeat(2,minmax(0,1fr)) !important; gap: .5rem; }
    .shipment-date-control { padding: .58rem; }
    .shipment-date-label { align-items: flex-start; flex-direction: column; gap: .2rem; }
    .shipment-date-readonly { min-height: 2.8rem; padding: .35rem .5rem; }
    .shipment-date-readonly strong { font-size: .74rem; }
    .shipment-overview-grid,
    .shipment-overview-edit-grid { grid-template-columns: repeat(2,minmax(0,1fr)) !important; }
    .shipment-flow-card > .card-header { align-items: flex-start; }
    .shipment-flow-card .quote-flow-heading { align-items: stretch; }
    .shipment-flow-card .quote-flow-add-actions { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }
    .shipment-flow-card .quote-flow-add-actions .btn:first-child:last-child { grid-column: 1/-1; }
    .shipment-flow-card .quote-flow-grid { gap: .6rem; }
    .shipment-flow-card .quote-flow-card { border-radius: .7rem; }
    .shipment-flow-expenses { margin-left: 0; }

    /* Rotas, mapas e cargas */
    .route-map-toolbar { align-items: stretch; }
    .route-map-toolbar .btn-group { grid-template-columns: 1fr; }
    .route-map-canvas { height: min(56vh, 24rem); }
    .route-map-summary { grid-template-columns: repeat(2,minmax(0,1fr)); padding: .7rem; gap: .5rem; }
    .route-create-modal-dialog,
    .route-quick-modal-dialog { margin: 0; width: 100%; min-height: 100dvh; border-radius: 0; }
    .route-create-modal-dialog .modal-content,
    .route-quick-modal-dialog .modal-content { min-height: 100dvh; max-height: 100dvh; border-radius: 0; }
    .load-overview-stats { grid-template-columns: repeat(3,minmax(0,1fr)); }
    .load-workspace,
    .load-route-content { display: block; }
    .load-create-panel { margin-top: .7rem; }
    .load-simulator-workspace,
    .load-map-layout { min-width: 0; overflow: hidden; }

    /* No celular, conteudo relevante sempre quebra linha; reticencias ficam restritas ao desktop. */
    .dashboard-hero-company h1,
    .dashboard-kpi-copy strong,
    .dashboard-queue-row strong,
    .dashboard-queue-row span,
    .dashboard-donut-legend-row span,
    .dashboard-bar-label,
    .dashboard-finance-card strong,
    .load-metric-card strong,
    .load-route-identity strong,
    .load-route-identity small,
    .load-detail-facts em,
    .load-progress-step em,
    .load-simulator-vehicle-name strong,
    .load-simulator-vehicle-name small,
    .shipment-summary-item .detail-value,
    .shipment-summary-meta,
    .central-today-metric em,
    .central-transit-row small,
    .shipment-index-kpi strong,
    .shipment-index-kpi small,
    .quote-metric-content > strong,
    .quote-editor-steps button small,
    .quote-editor-section > .card-header p,
    .quote-rate-suggestion > div strong,
    .quote-editor .quote-flow-card__identity strong,
    .quote-editor .quote-flow-card__identity small,
    .quote-editor .quote-flow-card__hint,
    .quote-summary-stage small,
    .provider-route-chip strong,
    .provider-route-chip small,
    .route-evidence-point small,
    .shipment-route-choice-card__content strong,
    .shipment-route-choice-card__content small,
    .shipment-batch-item dd,
    .shipment-batch-stage small {
        max-width: 100%;
        overflow: visible !important;
        text-overflow: clip !important;
        white-space: normal !important;
        overflow-wrap: anywhere;
    }

    .operation-route-acronym,
    .shipment-status-pill,
    .load-unloaded-location,
    .provider-type,
    .provider-service,
    .provider-status,
    .provider-route-acronym {
        max-width: 100%;
        height: auto;
        white-space: normal;
        overflow-wrap: anywhere;
        text-align: center;
    }

    /* Tabelas comuns viram cartões legíveis no celular. */
    .mobile-card-table-wrap { overflow: visible !important; border: 0; background: transparent; }
    .mobile-card-table {
        display: block;
        width: 100% !important;
        min-width: 0 !important;
        table-layout: fixed;
        background: transparent;
        border: 0;
    }
    .mobile-card-table colgroup,
    .mobile-card-table > thead { display: none; }
    .mobile-card-table > tbody { display: grid; gap: .6rem; width: 100%; }
    .mobile-card-table > tbody > tr {
        position: relative;
        display: grid;
        grid-template-columns: repeat(2,minmax(0,1fr));
        width: 100%;
        overflow: visible;
        background: var(--bs-body-bg);
        border: 1px solid var(--mobile-line);
        border-radius: .72rem;
        box-shadow: var(--mobile-shadow);
    }
    .mobile-card-table > tbody > tr > td {
        display: block;
        min-width: 0;
        max-width: 100%;
        padding: .62rem .68rem;
        overflow-wrap: anywhere;
        white-space: normal !important;
        background: transparent !important;
        border: 0;
        border-bottom: 1px solid #edf2f7;
        vertical-align: top;
    }
    .mobile-card-table > tbody > tr > td::before {
        content: attr(data-mobile-label);
        display: block;
        margin-bottom: .22rem;
        color: #71849a;
        font-size: .58rem;
        font-weight: 800;
        letter-spacing: .045em;
        line-height: 1.2;
        text-transform: uppercase;
    }
    .mobile-card-table > tbody > tr > td[data-mobile-primary="true"] {
        grid-column: 1 / -1;
        background: #f8fbff !important;
        border-radius: .7rem .7rem 0 0;
    }
    .mobile-card-table > tbody > tr > td[data-mobile-primary="true"] > a,
    .mobile-card-table > tbody > tr > td[data-mobile-primary="true"] > strong { color: #0b5fac; font-weight: 800; }
    .mobile-card-table > tbody > tr > td[data-mobile-actions="true"] {
        grid-column: 1 / -1;
        display: flex;
        align-items: center;
        justify-content: flex-end;
        gap: .45rem;
        border-bottom: 0;
    }
    .mobile-card-table > tbody > tr > td[data-mobile-actions="true"]::before,
    .mobile-card-table > tbody > tr > td[data-mobile-selector="true"]::before { display: none; }
    .mobile-card-table > tbody > tr > td[data-mobile-actions="true"] form { margin: 0; }
    .mobile-card-table > tbody > tr > td[data-mobile-actions="true"] .btn { min-height: 40px; }
    .mobile-card-table > tbody > tr[data-mobile-empty-row="true"] { display: block; }
    .mobile-card-table > tbody > tr[data-mobile-empty-row="true"] > td { display: block; border: 0; }
    .mobile-card-table > tbody > tr[data-mobile-empty-row="true"] > td::before { display: none; }
    .mobile-card-table .text-end { text-align: left !important; }
    .mobile-card-table .d-flex { flex-wrap: wrap; }
    .mobile-card-table .form-control,
    .mobile-card-table .form-select,
    .mobile-card-table .search-select-input { width: 100%; }
    .mobile-card-table :where(a, span, strong, small, p, div, form, label, .input-group) {
        min-width: 0;
        max-width: 100%;
    }
    .mobile-card-table .dropdown,
    .mobile-card-table .provider-row-actions {
        max-width: none;
    }
    .mobile-card-table .dropdown-menu {
        width: min(18rem, calc(100vw - 1.3rem));
        min-width: min(14rem, calc(100vw - 1.3rem));
        max-width: calc(100vw - 1.3rem);
        padding-block: .4rem;
        white-space: normal;
    }
    .mobile-card-table .dropdown-menu :where(.dropdown-item, .dropdown-item-text, button, label) {
        width: 100%;
        min-width: 0;
        white-space: normal !important;
        word-break: normal;
        overflow-wrap: anywhere;
    }
    .mobile-card-table .dropdown-menu form,
    .mobile-card-table .betim-yard-status-form {
        width: 100%;
        min-width: 0 !important;
        max-width: 100%;
    }
    .mobile-card-table > tbody > tr > td :where(a, span, strong, small, p) {
        overflow: visible !important;
        text-overflow: clip !important;
        white-space: normal !important;
        overflow-wrap: anywhere;
    }
    .search-select-option-label { white-space: normal; overflow-wrap: anywhere; }

    /* Login e autenticação */
    .auth-shell { width: 100%; min-width: 0; max-width: 100vw; min-height: 100dvh; padding: 1rem; overflow-x: hidden; }
    .auth-card { width: min(100%, 27.5rem) !important; min-width: 0; max-width: 100% !important; border-radius: 1rem; }
    .auth-card .card-body,
    .auth-card form,
    .auth-card .form-control,
    .auth-card .form-select,
    .auth-card .input-group { width: 100%; min-width: 0; max-width: 100%; }
    .auth-card .card-body { padding: 1.1rem; }

    html[data-theme="dark"] .mobile-card-table > tbody > tr { background: var(--gh-canvas-subtle); border-color: var(--gh-border); box-shadow: none; }
    html[data-theme="dark"] .mobile-card-table > tbody > tr > td { color: var(--gh-text); border-color: var(--gh-border-muted); }
    html[data-theme="dark"] .mobile-card-table > tbody > tr > td::before { color: var(--gh-text-muted); }
    html[data-theme="dark"] .mobile-card-table > tbody > tr > td[data-mobile-primary="true"] { background: var(--gh-surface-raised) !important; }
    html[data-theme="dark"] .mobile-card-table > tbody > tr > td[data-mobile-primary="true"] > a,
    html[data-theme="dark"] .mobile-card-table > tbody > tr > td[data-mobile-primary="true"] > strong { color: var(--gh-accent-hover); }
}

@media (max-width: 419.98px) {
    .mobile-topbar-brand small { display: none; }
    .mobile-topbar-brand .brand-mark { width: 36px; height: 36px; flex-basis: 36px; }
    .app-topbar .theme-toggle,
    .app-topbar .page-help-trigger--icon { width: 38px; height: 38px; flex-basis: 38px; }
    .app-topbar .topbar-actions form .btn { min-height: 38px; padding-inline: .55rem; }
    .mobile-page-clock span { display: none; }
    .dashboard-kpi-copy strong,
    .central-today-metric strong { font-size: 1.15rem; }
    .quote-metric-card,
    .provider-metric { padding: .58rem; }
    .quote-metric-icon,
    .provider-metric__icon { width: 2.2rem; height: 2.2rem; flex-basis: 2.2rem; }
    .provider-filters,
    .betim-yard-directory-filters { grid-template-columns: 1fr !important; }
    .provider-filters .provider-filter-search,
    .betim-yard-directory-filters .provider-filter-search { grid-column: auto !important; }
    .load-overview-stats { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .shipment-summary-grid,
    .shipment-date-timeline,
    .shipment-overview-grid,
    .shipment-overview-edit-grid { grid-template-columns: 1fr !important; }
    .shipment-summary-item { border-left: 0 !important; }
    .shipment-summary-item:nth-child(2) { border-top: 1px solid var(--bs-border-color) !important; }
}

@media (max-width: 359.98px) {
    .dashboard-kpi-grid,
    .dashboard-alert-grid,
    .dashboard-financial-grid,
    .central-today-metrics,
    .quote-metric-grid,
    .provider-metrics,
    .betim-yard-directory .provider-metrics { grid-template-columns: 1fr !important; }
    .load-overview-stats { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) and (max-width: 991.98px) {
    .nav-tabs,
    [role="tablist"],
    .quote-status-tabs,
    .provider-directory-tabs { scroll-behavior: auto; }
}

/* Central Hoje agrupada: o espaçamento pertence aos blocos internos do cartão. */
.central-today-metric { min-height: 0; padding: 0; }
.central-today-metric__main { grid-template-columns: 2.25rem minmax(0,1fr) auto; }
.central-today-metric__breakdown a { min-height: 2.25rem; }
