/* ==== Modo coletor ====
   Coletores de dados (ex.: Motorola com Windows CE) acessam o Propack por RDP
   numa sessão de 240x320, o que deixa ~224px úteis para o navegador. É bem
   menor que um celular, então os ajustes de 600px não bastam.
   Só vale nas telas de operação (o CardOperacao põe a classe "op-coletor")
   e só até 300px, então PC, tablet e celular (360px ou mais) não mudam. */
@media (max-width: 300px) {

    /* --- Fonte ---
       Pela Área de Trabalho Remota o Windows desliga a suavização de fontes e
       a Roboto fica serrilhada. Verdana foi desenhada para ficar legível sem
       suavização (letras largas e espaçadas); Tahoma é a reserva. Tamanhos e
       alturas de linha em px inteiros e sem letter-spacing: valores
       fracionados fazem o texto cair entre pixels e "quadricular".
       Ícones são SVG. */
    body:has(.op-coletor) .op-coletor,
    body:has(.op-coletor) .op-coletor .mud-typography,
    body:has(.op-coletor) .op-coletor .mud-button-root,
    body:has(.op-coletor) .op-coletor .mud-tab,
    body:has(.op-coletor) .op-coletor .mud-table-root,
    body:has(.op-coletor) .op-coletor .mud-table-cell,
    body:has(.op-coletor) .op-coletor .mud-input,
    body:has(.op-coletor) .op-coletor input {
        font-family: Verdana, Tahoma, Arial, sans-serif !important;
        letter-spacing: 0 !important;
        line-height: 17px !important;
        text-rendering: optimizeSpeed;
    }

    .op-coletor {
        font-size: 13px;
    }

    /* --- Contraste ---
       Na sessão RDP do coletor as cores são reduzidas e texto cinza/fino sobre
       branco vira borrão. Tudo em preto puro e negrito; textos sobre fundo
       colorido (faixas azuis, botões) continuam brancos, também em negrito. */
    .op-coletor .mud-typography,
    .op-coletor .mud-tab,
    .op-coletor .mud-table-cell,
    .op-coletor .mud-input,
    .op-coletor input {
        font-weight: 700 !important;
    }

    .op-coletor .mud-card .mud-typography:not(.op-header-bar *),
    .op-coletor .mud-tab:not(.mud-tab-active),
    .op-coletor .mud-table-cell,
    .op-coletor .mud-input,
    .op-coletor input {
        color: #000 !important;
    }

    .op-coletor input::placeholder {
        color: #333 !important;
        opacity: 1;
    }

    .op-coletor .mud-input-outlined-border {
        border-color: #000 !important;
        border-width: 2px !important;
    }

    /* Nada de barra de rolagem horizontal no coletor */
    body:has(.op-coletor),
    body:has(.op-coletor) .mud-main-content {
        overflow-x: hidden !important;
    }

    /* --- Barra superior: vira só um botão de menu no canto do título ---
       Cada pixel de altura conta (224x281). A barra deixa de ocupar uma
       linha; fica só o botão ☰ (o primeiro da barra), pequeno, no canto
       superior direito, por cima do fim da linha do título. */
    body:has(.op-coletor) .mud-appbar {
        left: auto !important;
        right: 0 !important;
        width: 44px !important;
        height: 36px !important;
        box-shadow: none !important;
        border-bottom-left-radius: 6px;
        /* sem a animação de largura do MudBlazor (pelo RDP só pisca) */
        transition: none !important;
    }

    body:has(.op-coletor) .mud-appbar .mud-toolbar {
        min-height: 36px !important;
        height: 36px !important;
        padding: 0 !important;
        justify-content: center;
    }

    body:has(.op-coletor) .mud-appbar .mud-toolbar > :not(:first-child) {
        display: none !important;
    }

    body:has(.op-coletor) .mud-appbar .mud-toolbar > :first-child > :not(:first-child) {
        display: none !important;
    }

    /* O toque vale no quadrado inteiro (44x36), não só no ícone */
    body:has(.op-coletor) .mud-appbar .mud-toolbar > :first-child,
    body:has(.op-coletor) .mud-appbar .mud-icon-button {
        width: 100% !important;
        height: 100% !important;
    }

    body:has(.op-coletor) .mud-appbar .mud-icon-button {
        padding: 0 !important;
        border-radius: 0 !important;
    }

    body:has(.op-coletor) .mud-appbar .mud-icon-button .mud-icon-root {
        width: 28px;
        height: 28px;
    }

    body:has(.op-coletor) .mud-main-content {
        padding-top: 0 !important;
    }

    /* O título não passa por baixo do botão de menu (pode quebrar linha) */
    .op-coletor > .crud-card > .mud-card-header.mud-card-header {
        padding-right: 48px !important;
        min-height: 36px;
    }

    /* O menu lateral volta aberto do localStorage e, nesta largura, cobre a
       tela inteira. No primeiro render (mud-drawer--initial) ele fica escondido;
       quando o operador toca no menu, o MudBlazor tira essa classe e ele aparece. */
    body:has(.op-coletor) .mud-drawer-temporary.mud-drawer--initial,
    body:has(.op-coletor):has(.mud-drawer-temporary.mud-drawer--initial) .mud-drawer-overlay {
        display: none !important;
    }

    body:has(.op-coletor) .mud-drawer-temporary {
        max-width: 85vw;
    }

    /* --- Cards: sem margem e com pouco respiro --- */
    .op-coletor .crud-card {
        margin: 0 !important;
        border-radius: 0;
    }

    .op-coletor .mud-card-header {
        padding: 4px 6px !important;
    }

    .op-coletor .mud-card-header .mud-typography-h5 {
        font-size: 14px !important;
        font-weight: 700;
    }

    .op-coletor .mud-card-content {
        padding: 4px !important;
    }

    .op-coletor .mud-card-actions {
        padding: 4px !important;
    }

    /* --- Faixas de status (Pallet / documentos pendentes) --- */
    .op-coletor .op-header-bar {
        padding: 3px 6px !important;
        margin: 2px 0 !important;
    }

    .op-coletor .op-header-bar > .mud-typography {
        font-size: 13px !important;
    }

    /* Divisórias entre os blocos: no coletor cada pixel de altura conta */
    .op-coletor .mud-card-content > .mud-divider,
    .op-coletor > .mud-divider {
        display: none !important;
    }

    /* Card interno "Itens": o título só ocupa espaço */
    .op-coletor .mud-card-content .crud-card > .mud-card-header {
        display: none !important;
    }

    /* --- Abas: as duas dividem a largura, sem setas de rolagem --- */
    .op-coletor .mud-tabs-scroll-button {
        display: none !important;
    }

    .op-coletor .mud-tabs-tabbar,
    .op-coletor .mud-tabs-tabbar-inner {
        min-height: 30px !important;
        height: 30px;
    }

    .op-coletor .mud-tabs-tabbar-content {
        width: 100%;
    }

    .op-coletor .mud-tabs-tabbar-wrapper {
        display: flex !important;
        width: 100% !important;
        transform: none !important;
    }

    .op-coletor .mud-tabs-tabbar-wrapper > .mud-tooltip-root {
        flex: 1 1 0 !important;
        min-width: 0;
        max-width: none !important;
    }

    .op-coletor .mud-tabs-tabbar .mud-tab {
        min-height: 30px;
        min-width: 0 !important;
        max-width: none !important;
        width: 100% !important;
        padding: 4px 6px;
        font-size: 13px;
        letter-spacing: 0;
        text-transform: none;
    }

    /* O slider é posicionado pelo MudBlazor pela largura antiga das abas e
       fica no lugar errado; a aba ativa ganha o próprio sublinhado. */
    .op-coletor .mud-tab-slider {
        display: none !important;
    }

    .op-coletor .mud-tabs-tabbar .mud-tab-active {
        border-bottom: 2px solid var(--mud-palette-primary);
        font-weight: 700;
    }

    .op-coletor .mud-tabs-panels > * {
        padding: 4px !important;
    }

    /* --- Grids: fonte e espaçamento menores --- */
    .op-coletor .mud-table-root,
    .op-coletor .mud-table-cell {
        font-size: 13px !important;
    }

    .op-coletor .mud-table-cell {
        padding: 2px 4px !important;
    }

    .op-coletor .mud-table-pagination-toolbar {
        min-height: 32px;
        padding: 0 !important;
        flex-wrap: wrap;
    }

    /* Esconde o "itens por página" e mantém só a navegação */
    .op-coletor .mud-table-pagination-toolbar .mud-select,
    .op-coletor .mud-table-pagination-toolbar .mud-table-pagination-caption:first-of-type {
        display: none !important;
    }

    /* --- Botões e campos --- */
    .op-coletor .mud-button-root.mud-button {
        min-height: 32px;
        padding: 2px 8px;
        font-size: 13px;
        font-weight: 700;
        letter-spacing: 0;
    }

    .op-coletor .mud-input {
        font-size: 14px;
    }

    /* --- Paginação numa linha só (o MudBlazor empilha e ocupa 100px) --- */
    .op-coletor .mud-table-pagination-toolbar {
        flex-wrap: nowrap !important;
        height: 30px !important;
        min-height: 30px !important;
        justify-content: flex-end;
    }

    .op-coletor .mud-table-pagination-actions .mud-icon-button {
        padding: 3px !important;
    }

    /* --- Botões de ação (Terminar documento / Confirmar) --- */
    .op-coletor .mud-card-actions {
        padding: 2px 0 0 !important;
    }

    .op-coletor .mud-card-actions .mud-grid {
        margin-top: 0 !important;
    }
}

/* ==== Login no coletor ====
   A tela de login vem do ProjetoBaseWebApp (BaseLogin.razor) e não tem classe
   própria; ela é a única grade com carrossel + formulário. Limite em 300px
   (e não 360px) para não mexer no login de celulares, que têm 360px ou mais.
   Objetivo: caber em 224x281 sem rolagem. */
@media (max-width: 300px) {

    .mud-grid:has(.mud-carousel):has(form) {
        height: auto !important;
    }

    /* Fotos do carrossel e versão: só ocupam espaço */
    .mud-grid:has(.mud-carousel):has(form) > .mud-grid-item:has(.mud-carousel),
    .mud-grid:has(.mud-carousel):has(form) .mud-typography-caption {
        display: none !important;
    }

    .mud-grid:has(.mud-carousel):has(form) > .mud-grid-item {
        padding: 4px 6px !important;
    }

    .mud-grid:has(.mud-carousel):has(form) > .mud-grid-item > .d-flex {
        gap: 4px !important;
        flex-wrap: nowrap !important;
        height: auto !important;
    }

    /* Logos (Propack, empresa e Lenke na tela de bloqueio): sem espaço para eles */
    .mud-grid:has(.mud-carousel):has(form) > .mud-grid-item > .d-flex > img.mud-image {
        display: none !important;
    }

    .mud-grid:has(.mud-carousel):has(form) .mud-paper {
        padding: 6px !important;
        box-shadow: none !important;
        border: 1px solid #000;
    }

    /* Mesma fonte do modo coletor: Verdana, preto e negrito */
    .mud-grid:has(.mud-carousel):has(form) form,
    .mud-grid:has(.mud-carousel):has(form) form .mud-typography,
    .mud-grid:has(.mud-carousel):has(form) form .mud-input,
    .mud-grid:has(.mud-carousel):has(form) form input,
    .mud-grid:has(.mud-carousel):has(form) form .mud-button-root {
        font-family: Verdana, Tahoma, Arial, sans-serif !important;
        font-size: 14px !important;
        font-weight: 700 !important;
        letter-spacing: 0 !important;
        line-height: 16px !important;
    }

    /* O que o operador digita e o botão: um pouco maiores */
    .mud-grid:has(.mud-carousel):has(form) form .mud-input,
    .mud-grid:has(.mud-carousel):has(form) form input,
    .mud-grid:has(.mud-carousel):has(form) form .mud-button-root {
        font-size: 16px !important;
    }

    .mud-grid:has(.mud-carousel):has(form) form .mud-typography,
    .mud-grid:has(.mud-carousel):has(form) form .mud-input,
    .mud-grid:has(.mud-carousel):has(form) form input {
        color: #000 !important;
    }

    .mud-grid:has(.mud-carousel):has(form) form input::placeholder {
        color: #333 !important;
        opacity: 1;
    }

    .mud-grid:has(.mud-carousel):has(form) form .mud-input-outlined-border {
        border-color: #000 !important;
    }

    /* Rótulos dos campos: ícone menor e pouco espaço */
    .mud-grid:has(.mud-carousel):has(form) form > p.mud-typography {
        display: flex;
        align-items: center;
        gap: 2px;
        margin: 4px 0 1px !important;
    }

    .mud-grid:has(.mud-carousel):has(form) form > p.mud-typography .mud-icon-root {
        width: 16px;
        height: 16px;
    }

    .mud-grid:has(.mud-carousel):has(form) form .mud-input-control {
        margin: 0 !important;
    }

    .mud-grid:has(.mud-carousel):has(form) form .mud-input-slot {
        padding-top: 6px !important;
        padding-bottom: 6px !important;
    }

    .mud-grid:has(.mud-carousel):has(form) form .mud-button-root.mud-button {
        margin: 6px 0 0 !important;
        min-height: 40px;
    }

    /* "Esqueceu a senha?" não se usa no coletor */
    .mud-grid:has(.mud-carousel):has(form) form > .d-flex:last-child {
        display: none !important;
    }
}

/* ==== Modais (erro, aviso, pergunta) no coletor ====
   MessageDialog (ProjetoBaseWebApp) e qualquer MudDialog. O modal fica no
   <body>, fora do .op-coletor, então a regra vale por largura: até 300px só
   o coletor chega. Ocupa a tela toda, texto grande em preto e botões
   grandes com borda (o "Ok" do erro é um botão de texto, quase invisível). */
@media (max-width: 300px) {

    .mud-dialog-container .mud-dialog {
        width: calc(100vw - 8px) !important;
        max-width: calc(100vw - 8px) !important;
        max-height: calc(100vh - 8px) !important;
        margin: 4px !important;
        border: 2px solid #000;
        border-radius: 4px;
    }

    .mud-dialog-container .mud-dialog,
    .mud-dialog-container .mud-dialog .mud-typography,
    .mud-dialog-container .mud-dialog .mud-button-root,
    .mud-dialog-container .mud-dialog input {
        font-family: Verdana, Tahoma, Arial, sans-serif !important;
        font-weight: 700 !important;
        letter-spacing: 0 !important;
    }

    .mud-dialog-container .mud-dialog .mud-dialog-title {
        padding: 6px 8px 2px !important;
    }

    /* Ícone do topo menor, sem a margem grande */
    .mud-dialog-container .mud-dialog .mud-dialog-title > div:first-child {
        margin-bottom: 2px !important;
    }

    .mud-dialog-container .mud-dialog .mud-dialog-title .mud-icon-size-large {
        width: 28px;
        height: 28px;
    }

    .mud-dialog-container .mud-dialog .mud-dialog-title .mud-typography {
        font-size: 15px !important;
        line-height: 18px !important;
    }

    .mud-dialog-container .mud-dialog .mud-dialog-content {
        padding: 4px 8px !important;
        overflow-wrap: anywhere;
    }

    .mud-dialog-container .mud-dialog .mud-dialog-content .mud-typography {
        font-size: 14px !important;
        line-height: 18px !important;
        color: #000 !important;
    }

    .mud-dialog-container .mud-dialog .mud-dialog-content .mud-divider {
        display: none;
    }

    /* Botões: dividem a largura, altos e com borda */
    .mud-dialog-container .mud-dialog .mud-dialog-actions {
        padding: 4px 8px 8px !important;
        gap: 6px;
    }

    .mud-dialog-container .mud-dialog .mud-dialog-actions .mud-button-root {
        flex: 1 1 0;
        min-height: 36px;
        margin: 0 !important;
        font-size: 15px !important;
        border: 2px solid currentColor;
    }
}

/* ==== Menu lateral em qualquer tela do coletor ====
   Depois do login o sistema vai para a Home, e o menu volta aberto do
   localStorage cobrindo a tela toda. Igual à Caixa a Caixa: no primeiro
   render (mud-drawer--initial) fica escondido; abre só quando o operador
   toca no botão do menu. */
@media (max-width: 300px) {

    .mud-drawer-temporary.mud-drawer--initial,
    body:has(.mud-drawer-temporary.mud-drawer--initial) .mud-drawer-overlay {
        display: none !important;
    }

    .mud-drawer-temporary {
        max-width: 85vw;
    }
}

/* ==== Peças que só existem no coletor ====
   "so-coletor": aparece só no coletor.
   "coletor-oculta": coluna de grade que some no coletor (só ocupa espaço). */
.so-coletor {
    display: none !important;
}

@media (max-width: 300px) {

    .so-coletor {
        display: flex !important;
    }

    .coletor-oculta {
        display: none !important;
    }

    /* ==== Telas de operação: topo fixo, o resto rola ====
       Título e campo de leitura ficam sempre à vista; se as abas/grades
       passarem da altura, só a área de baixo rola (a página não). */
    body:has(.op-coletor) .mud-main-content {
        height: 100vh;
        overflow: hidden !important;
    }

    .op-coletor {
        height: 100vh;
        display: flex;
        flex-direction: column;
    }

    .op-coletor > .crud-card {
        flex: 1 1 auto;
        min-height: 0;
        display: flex;
        flex-direction: column;
    }

    .op-coletor > .crud-card > .mud-card-content {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        overflow-x: hidden;
    }

    .op-coletor > .crud-card > .mud-card-content > .mud-input-control:first-child {
        position: sticky;
        top: 0;
        z-index: 2;
        background: var(--mud-palette-surface);
        margin-top: 0 !important;
        padding-top: 4px;
    }
}

/* ==== Grades das telas de operação no coletor ====
   No celular/coletor o MudBlazor mostra cada registro como um bloco de
   "rótulo  valor". Aqui a tabela fica na largura da tela, o valor quebra
   linha quando não cabe e os rótulos longos ficam curtos (só no coletor;
   no PC o título da coluna continua o mesmo). */
@media (max-width: 300px) {

    .op-coletor .mud-xs-table .mud-table-root,
    .op-coletor .mud-xs-table .mud-table-body,
    .op-coletor .mud-xs-table .mud-table-row {
        width: 100% !important;
        max-width: 100% !important;
    }

    .op-coletor .mud-xs-table .mud-table-container {
        overflow-x: hidden !important;
    }

    .op-coletor .mud-xs-table .mud-table-cell {
        width: auto !important;
        min-width: 0 !important;
        flex-wrap: wrap;
        justify-content: space-between;
        gap: 0 6px;
        overflow-wrap: anywhere;
        text-align: right;
    }

    .op-coletor .mud-xs-table .mud-table-cell::before {
        width: auto !important;
        flex: 0 1 auto;
        padding-right: 0 !important;
        text-align: left;
        font-weight: 400;
        color: #000;
    }

    /* Rótulos curtos */
    td[data-label="Código de Integração"]::before { content: "Código" !important; }
    td[data-label="Data Planejada"]::before { content: "Data" !important; }
    td[data-label="Data de Emissão"]::before,
    td[data-label="Data Emissão"]::before { content: "Emissão" !important; }
    td[data-label="Número do Documento"]::before,
    td[data-label="Nro. Documento"]::before,
    td[data-label="Nº Documento"]::before { content: "Documento" !important; }
    td[data-label="Placa do Veículo"]::before,
    td[data-label="Placa Veículo"]::before { content: "Placa" !important; }
    td[data-label="Foi Recebido"]::before,
    td[data-label="Foi Recebido?"]::before { content: "Recebido" !important; }
    td[data-label="Está em Inventário"]::before,
    td[data-label="Está em Inventário?"]::before { content: "Inventário" !important; }
    td[data-label="Data Produção"]::before,
    td[data-label="Data de Produção"]::before { content: "Produção" !important; }
    td[data-label="Data Validade"]::before,
    td[data-label="Data de Validade"]::before { content: "Validade" !important; }
    td[data-label="Peso Líquido"]::before { content: "Peso" !important; }
    td[data-label="Data Emissão Documento"]::before { content: "Emissão" !important; }
    td[data-label="SSCC Unidade Logística"]::before { content: "SSCC" !important; }

    /* Setas da paginação dentro da tela */
    .op-coletor .mud-table-pagination-actions {
        flex: 0 0 auto;
        margin: 0 !important;
    }

    .op-coletor .mud-table-pagination-toolbar {
        overflow: hidden;
        gap: 4px;
    }
}

/* ==== Telas de seleção no coletor (câmara, romaneio, ordem, produto...) ====
   No coletor não existe modal: a seleção ocupa a tela inteira como uma tela
   normal, com a busca no topo (ColetorBusca) e a grade rolando embaixo.
   Sem "+ novo", sem filtro em modal e sem escolher colunas; tocar no
   registro seleciona. O "X" do canto volta para a operação. */
@media (max-width: 300px) {

    .mud-dialog-container:has(.mud-dialog .crud-card) .mud-overlay-scrim {
        background: var(--mud-palette-surface) !important;
        opacity: 1 !important;
    }

    .mud-dialog-container .mud-dialog:has(.crud-card) {
        position: fixed !important;
        inset: 0 !important;
        width: 100vw !important;
        max-width: 100vw !important;
        height: 100vh !important;
        max-height: 100vh !important;
        margin: 0 !important;
        border: 0 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    .mud-dialog:has(.crud-card) > .mud-dialog-title {
        position: absolute;
        top: 0;
        right: 0;
        z-index: 3;
        padding: 0 !important;
        height: 0;
    }

    .mud-dialog:has(.crud-card) > .mud-dialog-title .mud-icon-button {
        position: absolute;
        top: 2px;
        right: 2px;
        padding: 4px !important;
        background: var(--mud-palette-surface);
        border: 2px solid #000;
    }

    .mud-dialog:has(.crud-card) .mud-dialog-content {
        flex: 1 1 auto;
        min-height: 0;
        padding: 0 !important;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    .mud-dialog .crud-card {
        flex: 1 1 auto;
        min-height: 0;
        margin: 0 !important;
        box-shadow: none !important;
        border-radius: 0 !important;
        display: flex;
        flex-direction: column;
        width: 100% !important;
    }

    .mud-dialog .crud-card > .mud-card-header {
        flex: 0 0 auto;
        padding: 6px 40px 4px 6px !important;
        min-height: 0;
    }

    .mud-dialog .crud-card > .mud-card-header .mud-typography-h5 {
        font-size: 14px !important;
        line-height: 18px !important;
    }

    .mud-dialog .crud-card > .mud-card-header .mud-card-header-actions,
    .mud-dialog .crud-card > .mud-divider {
        display: none !important;
    }

    .mud-dialog .crud-card > .mud-card-content {
        flex: 1 1 auto;
        min-height: 0;
        padding: 0 6px 4px !important;
        display: flex;
        flex-direction: column;
        gap: 4px;
    }

    .mud-dialog .coletor-busca {
        align-items: center;
        gap: 4px;
        flex: 0 0 auto;
    }

    .mud-dialog .coletor-busca > .mud-input-control {
        flex: 1 1 auto;
        margin: 0 !important;
    }

    .mud-dialog .coletor-busca > .mud-icon-button {
        flex: 0 0 auto;
        width: 36px;
        height: 36px;
    }

    .mud-dialog .crud-card .mud-data-grid {
        flex: 1 1 auto;
        min-height: 0;
        display: flex;
        flex-direction: column;
        box-shadow: none !important;
    }

    .mud-dialog .crud-card .mud-data-grid .mud-table-container {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto !important;
        overflow-x: hidden !important;
    }

    .mud-dialog .crud-card,
    .mud-dialog .crud-card .mud-typography,
    .mud-dialog .crud-card .mud-table-cell,
    .mud-dialog .crud-card input,
    .mud-dialog .crud-card label {
        font-family: Verdana, Tahoma, Arial, sans-serif !important;
        letter-spacing: 0 !important;
    }

    .mud-dialog .crud-card .mud-typography-h5,
    .mud-dialog .crud-card .mud-table-cell,
    .mud-dialog .crud-card input {
        font-weight: 700 !important;
        color: #000 !important;
    }

    .mud-dialog .crud-card .mud-table-cell {
        font-size: 13px !important;
        padding: 2px 6px !important;
    }

    .mud-dialog .crud-card input {
        font-size: 14px !important;
    }

    /* Grade na largura da tela, valor quebra linha, rótulo curto (regras
       de rótulo no bloco "Grades das telas de operação") */
    .mud-dialog .mud-xs-table .mud-table-root,
    .mud-dialog .mud-xs-table .mud-table-body,
    .mud-dialog .mud-xs-table .mud-table-row {
        width: 100% !important;
        max-width: 100% !important;
    }

    .mud-dialog .mud-xs-table .mud-table-cell {
        width: auto !important;
        min-width: 0 !important;
        flex-wrap: wrap;
        justify-content: space-between;
        gap: 0 6px;
        overflow-wrap: anywhere;
        text-align: right;
    }

    .mud-dialog .mud-xs-table .mud-table-cell::before {
        width: auto !important;
        flex: 0 1 auto;
        padding-right: 0 !important;
        text-align: left;
        font-weight: 400;
        color: #000;
    }

    /* Cada registro: bloco com borda, fácil de tocar */
    .mud-dialog .crud-card .mud-xs-table .mud-table-body .mud-table-row {
        border: 2px solid #000 !important;
        border-radius: 4px;
        margin-bottom: 4px;
        display: block;
    }

    /* Paginação numa linha: "1-10 de 30" e setas */
    .mud-dialog .crud-card .mud-table-pagination-toolbar {
        flex-wrap: nowrap !important;
        height: 32px !important;
        min-height: 32px !important;
        padding: 0 !important;
        justify-content: flex-end;
        overflow: hidden;
        gap: 4px;
    }

    .mud-dialog .crud-card .mud-table-pagination-toolbar .mud-select,
    .mud-dialog .crud-card .mud-table-pagination-toolbar .mud-table-pagination-caption:first-of-type {
        display: none !important;
    }

    .mud-dialog .crud-card .mud-table-pagination-caption {
        font-size: 13px !important;
        font-weight: 700 !important;
        color: #000 !important;
    }

    .mud-dialog .crud-card .mud-table-pagination-actions {
        flex: 0 0 auto;
        margin: 0 !important;
    }

    .mud-dialog .crud-card .mud-table-pagination-actions .mud-icon-button {
        padding: 4px !important;
    }
}

@media (max-width: 300px) {

    /* "1-10 de 30" da paginação nas telas de operação: legível */
    .op-coletor .mud-table-pagination-caption {
        font-family: Verdana, Tahoma, Arial, sans-serif !important;
        font-size: 13px !important;
        font-weight: 700 !important;
        color: #000 !important;
        letter-spacing: 0 !important;
    }
}

/* Título curto do coletor (CardOperacao TitleColetor): fora do coletor só
   aparece o título completo */
.op-coletor .titulo-coletor {
    display: none;
}

@media (max-width: 300px) {

    .op-coletor .titulo-pc {
        display: none;
    }

    .op-coletor .titulo-coletor {
        display: inline;
    }

    /* ==== Abas: nome inteiro, em até duas linhas (não corta) ==== */
    .op-coletor .mud-tabs-tabbar,
    .op-coletor .mud-tabs-tabbar-inner {
        height: auto !important;
        min-height: 30px !important;
    }

    .op-coletor .mud-tabs-tabbar .mud-tab {
        height: auto !important;
        white-space: normal !important;
        line-height: 15px !important;
        padding: 3px 4px !important;
        text-align: center;
        overflow-wrap: anywhere;
    }

    /* ==== Botões: texto normal (não CAIXA ALTA), quebra linha ====
       Os botões de seleção (laranja/azul) ficam um embaixo do outro,
       cada um na largura toda, quando não cabem lado a lado. */
    .op-coletor .mud-button-root.mud-button {
        text-transform: none !important;
        white-space: normal !important;
        line-height: 16px !important;
        height: auto !important;
        min-height: 34px;
        font-size: 13px !important;
        font-family: Verdana, Tahoma, Arial, sans-serif !important;
        font-weight: 700 !important;
        letter-spacing: 0 !important;
    }

    .op-coletor .mud-button-root.mud-button .mud-button-label {
        white-space: normal !important;
        text-align: center;
    }

    .op-coletor .op-header-bar {
        flex-wrap: wrap !important;
    }

    .op-coletor .op-header-bar > .mud-button-root,
    .op-coletor .op-header-bar .mud-button-root.mud-button {
        flex: 1 1 100% !important;
        width: 100% !important;
        margin: 2px 0 0 !important;
    }

    /* ==== Campos: rótulo legível ==== */
    .op-coletor .mud-input-label {
        font-family: Verdana, Tahoma, Arial, sans-serif !important;
        font-size: 13px !important;
        font-weight: 700 !important;
        color: #000 !important;
        letter-spacing: 0 !important;
    }

}

@media (max-width: 300px) {

    /* Abas com margem interna grande (ex.: Desmembrar usa Class="pa-6") */
    .op-coletor .mud-tabs.pa-6 {
        padding: 0 !important;
    }

    /* ==== Estorno de Operação ====
       O seletor de tipo de estorno fica fora do CardOperacao: os cards de
       fora perdem a margem e a área toda rola por dentro (a página não). */
    .op-estorno > .crud-card,
    .op-estorno > .crud-card > .crud-card,
    .op-estorno .crud-card .crud-card {
        margin: 0 !important;
        box-shadow: none !important;
        border-radius: 0 !important;
    }

    .op-estorno > .crud-card {
        overflow-y: auto;
        overflow-x: hidden;
    }

    .op-estorno > .crud-card > .crud-card {
        padding: 2px !important;
    }

    /* O CardOperacao de dentro não ocupa a tela inteira de novo */
    .op-estorno .op-coletor {
        height: auto;
    }

    .op-estorno .op-header-bar .mud-select {
        flex: 1 1 100%;
    }

    .op-estorno .op-header-bar .mud-typography,
    .op-estorno .mud-select .mud-input,
    .op-estorno .mud-select input {
        font-family: Verdana, Tahoma, Arial, sans-serif !important;
        font-size: 13px !important;
        font-weight: 700 !important;
        letter-spacing: 0 !important;
    }
}

@media (max-width: 300px) {

    /* ==== Grades de botões/campos (MudGrid xs="6"): um por linha ====
       Em 224px dois botões ou campos lado a lado ficam espremidos. */
    .op-coletor .mud-grid {
        margin: 0 !important;
        width: 100% !important;
    }

    .op-coletor .mud-grid > .mud-grid-item {
        flex: 0 0 100% !important;
        max-width: 100% !important;
        padding: 2px 0 !important;
    }

    /* Textos soltos (interruptores, avisos): nada abaixo de 13px */
    .op-coletor .mud-typography-body1,
    .op-coletor .mud-typography-body2,
    .op-coletor .mud-switch .mud-typography,
    .op-coletor .mud-checkbox .mud-typography {
        font-family: Verdana, Tahoma, Arial, sans-serif !important;
        font-size: 13px !important;
        font-weight: 700 !important;
        letter-spacing: 0 !important;
    }
}

@media (max-width: 300px) {

    /* Cada registro das grades das operações: bloco com borda */
    .op-coletor .mud-xs-table .mud-table-body .mud-table-row {
        display: block;
        border: 2px solid #000 !important;
        border-radius: 4px;
        margin-bottom: 4px;
    }

    .op-coletor .mud-xs-table .mud-table-body .mud-table-cell {
        border-bottom: 0 !important;
        padding: 1px 6px !important;
    }

    /* Estorno de Operação: o ícone da faixa ocupava uma linha sozinho */
    .op-estorno .op-header-bar > .mud-icon-root {
        display: none !important;
    }
}

@media (max-width: 300px) {

    /* ==== Menu lateral no coletor: itens grandes, fáceis de acertar ==== */
    .mud-drawer .mud-navmenu > img.mud-image {
        display: none !important; /* logo: só ocupa espaço */
    }

    .mud-drawer .mud-drawer-content {
        overflow-y: auto;
    }

    .mud-drawer .mud-navmenu .d-flex.flex-column {
        gap: 2px !important;
    }

    .mud-drawer .mud-nav-link {
        min-height: 44px !important;
        padding: 6px 8px !important;
        border-bottom: 1px solid #000;
    }

    .mud-drawer .mud-nav-link-text,
    .mud-drawer .mud-nav-link .mud-typography {
        font-family: Verdana, Tahoma, Arial, sans-serif !important;
        font-size: 14px !important;
        font-weight: 700 !important;
        color: #000 !important;
        letter-spacing: 0 !important;
        white-space: normal !important;
        line-height: 17px !important;
    }

    .mud-drawer .mud-nav-link .mud-icon-root {
        width: 22px;
        height: 22px;
        font-size: 22px;
        color: #000;
    }
}

@media (max-width: 300px) {

    /* ==== Faixa azul no topo ====
       O título da tela vira uma faixa azul de ponta a ponta (como a barra
       superior do sistema) e o botão ☰ fica dentro dela, à direita. */
    .op-coletor > .crud-card > .mud-card-header.mud-card-header {
        background: var(--mud-palette-appbar-background);
        color: var(--mud-palette-appbar-text);
        padding: 0 48px 0 8px !important;
        min-height: 36px;
        height: 36px;
        display: flex;
        align-items: center;
        border-radius: 0 !important;
    }

    .op-coletor > .crud-card > .mud-card-header .mud-typography-h5 {
        color: var(--mud-palette-appbar-text) !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    body:has(.op-coletor) .mud-appbar {
        border-radius: 0 !important;
        background: var(--mud-palette-appbar-background) !important;
        color: var(--mud-palette-appbar-text) !important;
    }

    .op-coletor > .crud-card {
        border-radius: 0 !important;
    }

    /* Respiro entre a faixa e o campo de leitura */
    .op-coletor > .crud-card > .mud-card-content > .mud-input-control:first-child {
        padding-top: 6px !important;
    }
}

@media (max-width: 300px) {

    /* Estorno de Operação: a mesma faixa azul com o título (o ☰ fica nela) */
    .op-estorno::before {
        content: "Estorno Operação";
        flex: 0 0 36px;
        height: 36px;
        line-height: 36px;
        padding: 0 48px 0 8px;
        background: var(--mud-palette-appbar-background);
        color: var(--mud-palette-appbar-text);
        font-family: Verdana, Tahoma, Arial, sans-serif;
        font-size: 14px;
        font-weight: 700;
        white-space: nowrap;
        overflow: hidden;
    }

    /* O CardOperacao de dentro (Perda de Caixa) não repete a faixa */
    .op-estorno .op-coletor > .crud-card > .mud-card-header {
        display: none !important;
    }
}

@media (max-width: 300px) {

    /* Valor da célula quebra linha em vez de cortar com "..." (nomes longos
       de câmara, produto etc.) */
    .op-coletor .mud-xs-table .mud-table-cell,
    .mud-dialog .mud-xs-table .mud-table-cell,
    .op-coletor .mud-xs-table .mud-table-cell *,
    .mud-dialog .mud-xs-table .mud-table-cell * {
        white-space: normal !important;
        text-overflow: clip !important;
        overflow: visible !important;
        max-width: 100% !important;
    }

    .op-coletor .mud-xs-table .mud-table-cell.id-column,
    .mud-dialog .mud-xs-table .mud-table-cell.id-column {
        width: auto !important;
        max-width: none !important;
        display: flex !important;
    }

    td[data-label="Nro. do Documento"]::before { content: "Documento" !important; }
    td[data-label="Está em inventário"]::before,
    td[data-label="Está em Inventário"]::before { content: "Inventário" !important; }
    td[data-label="SSCC Pallet Destino"]::before { content: "Pallet destino" !important; }
    td[data-label="SSCC Pallet Origem"]::before { content: "Pallet origem" !important; }
    td[data-label="Status Documento"]::before { content: "Status" !important; }
}

@media (max-width: 300px) {

    /* ==== Rolagem sem barra ====
       As listas ainda rolam o que der arrastando com o dedo (js/coletor.js),
       mas sem a barra de rolagem ocupando espaço. */
    body:has(.op-coletor) *,
    .mud-dialog-container *,
    .mud-drawer * {
        scrollbar-width: none !important;
    }

    body:has(.op-coletor) *::-webkit-scrollbar,
    .mud-dialog-container *::-webkit-scrollbar,
    .mud-drawer *::-webkit-scrollbar {
        display: none !important;
        width: 0 !important;
        height: 0 !important;
    }

}

/* ==== Menu do coletor por cima da tela inteira (ColetorMenu) ====
   Um nível do menu por vez, sem rolagem. Em 224x281: topo 36 + 6 botões
   de 36 (ou 5 + linha ▲/▼), com 4px entre eles. Cobre a barra superior
   e o menu lateral; fecha no ✕ ou ao escolher uma tela. */
.coletor-menu {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 4px;
    box-sizing: border-box;
    padding: 0 2px 2px;
    overflow: hidden;
    background: #fff;
    letter-spacing: 0;
}

/* o MudBlazor põe Roboto em tudo; aqui Verdana (lê melhor pelo RDP) */
.coletor-menu,
.coletor-menu * {
    font-family: Verdana, Tahoma, Arial, sans-serif !important;
}

.coletor-menu button {
    font-weight: 700;
    letter-spacing: 0;
    cursor: pointer;
    user-select: none;
}

.coletor-menu-topo {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 0 0 36px;
    height: 36px;
}

.coletor-menu-voltar,
.coletor-menu-fechar {
    flex: 0 0 44px;
    height: 36px;
    padding: 0;
    border: 2px solid #000;
    border-radius: 4px;
    background: #fff;
    color: #000;
    font-size: 30px;
    line-height: 28px;
}

.coletor-menu-fechar {
    margin-left: auto;
    font-size: 20px;
}

.coletor-menu-titulo {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 16px;
    line-height: 18px;
    font-weight: 700;
    color: #000;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.coletor-menu-itens {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

.coletor-menu-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: 0 0 36px;
    height: 36px;
    padding: 0 8px;
    border: 0;
    border-radius: 4px;
    background: var(--mud-palette-primary, #1976d2);
    color: #fff;
    font-size: 14px;
    line-height: 16px;
    text-align: left;
}

/* nome comprido quebra em até 2 linhas (2 x 16 cabe nos 36) */
.coletor-menu-nome {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.coletor-menu-seta {
    margin-left: 6px;
    font-size: 26px;
    line-height: 26px;
}

.coletor-menu-vazio {
    font-size: 14px;
    font-weight: 700;
    color: #000;
}

.coletor-menu-paginas {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 0 0 36px;
    height: 36px;
}

.coletor-menu-paginas button {
    flex: 1 1 0;
    height: 36px;
    border: 2px solid #000;
    border-radius: 4px;
    background: #fff;
    color: #000;
    font-size: 18px;
}

.coletor-menu-paginas button:disabled {
    border-color: #999;
    color: #999;
}

.coletor-menu-paginas span {
    min-width: 44px;
    text-align: center;
    font-size: 14px;
    font-weight: 700;
    color: #000;
}
