@media (max-width: 640px) {
  :is(html.erp-route-maquinas, html.erp-route-processos, html.erp-route-insumos, html.erp-route-fornecedores, html.erp-route-propostas) .page-container {
    padding: 12px !important;
  }

  :is(html.erp-route-maquinas, html.erp-route-processos, html.erp-route-insumos, html.erp-route-fornecedores, html.erp-route-propostas) .page-header {
    margin-bottom: 12px !important;
    gap: 10px !important;
    align-items: stretch !important;
  }

  :is(html.erp-route-maquinas, html.erp-route-processos, html.erp-route-insumos, html.erp-route-fornecedores, html.erp-route-propostas) .page-title {
    font-size: 24px !important;
    line-height: 1.2 !important;
  }

  :is(html.erp-route-maquinas, html.erp-route-processos, html.erp-route-insumos, html.erp-route-fornecedores, html.erp-route-propostas) .page-header > div,
  :is(html.erp-route-maquinas, html.erp-route-processos, html.erp-route-insumos, html.erp-route-fornecedores, html.erp-route-propostas) .page-header > div > div {
    max-width: 100% !important;
  }

  html.erp-route-maquinas .page-header > div:last-child,
  html.erp-route-insumos .page-header > div:last-child,
  html.erp-route-fornecedores .page-header > div:last-child {
    width: 100% !important;
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
  }

  html.erp-route-maquinas .page-header .btn-primary-action,
  html.erp-route-insumos .page-header .btn-primary-action,
  html.erp-route-fornecedores .page-header .btn-primary-action {
    flex: 1 0 100% !important;
    width: 100% !important;
    justify-content: center !important;
    min-height: 48px !important;
  }

  html.erp-route-insumos .page-header > div:last-child > :not(.btn-primary-action):not(.btn-trash-toolbar),
  html.erp-route-fornecedores .page-header > div:last-child > :not(.btn-primary-action):not(.btn-trash-toolbar) {
    flex: 1 1 0 !important;
    min-width: 0 !important;
  }

  :is(html.erp-route-maquinas, html.erp-route-processos, html.erp-route-insumos, html.erp-route-fornecedores, html.erp-route-propostas) .toolbar-row {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    align-items: center !important;
    margin-bottom: 12px !important;
  }

  :is(html.erp-route-maquinas, html.erp-route-processos, html.erp-route-insumos, html.erp-route-fornecedores, html.erp-route-propostas) .toolbar-row input[type="text"],
  html.erp-route-propostas .toolbar-row > input {
    order: 1 !important;
    flex: 1 0 100% !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    font-size: 16px !important;
    min-height: 46px !important;
  }

  html.erp-route-processos .toolbar-row > div[style*="flex: 1"],
  html.erp-route-propostas .toolbar-row > div[style*="flex: 1"] {
    display: none !important;
  }

  :is(html.erp-route-maquinas, html.erp-route-processos, html.erp-route-insumos, html.erp-route-fornecedores, html.erp-route-propostas) .toolbar-row .btn-refresh,
  :is(html.erp-route-maquinas, html.erp-route-processos, html.erp-route-insumos, html.erp-route-fornecedores, html.erp-route-propostas) .toolbar-row .btn-icon-outline {
    order: 2 !important;
    min-width: 48px !important;
    width: 48px !important;
    height: 48px !important;
  }

  html.erp-route-processos .toolbar-row .btn-primary-action,
  html.erp-route-propostas .toolbar-row .btn-primary-action {
    order: 3 !important;
    flex: 1 1 auto !important;
    min-height: 48px !important;
    justify-content: center !important;
  }

  html.erp-route-processos .toolbar-row .btn-trash-toolbar,
  html.erp-route-propostas .toolbar-row .btn-trash-toolbar {
    order: 4 !important;
    width: 48px !important;
    height: 48px !important;
    min-width: 48px !important;
  }

  :is(html.erp-route-maquinas, html.erp-route-processos, html.erp-route-insumos, html.erp-route-fornecedores, html.erp-route-propostas) .table-wrapper {
    overflow: visible !important;
    border: 0 !important;
    background: transparent !important;
    border-radius: 0 !important;
  }

  :is(html.erp-route-maquinas, html.erp-route-processos, html.erp-route-insumos, html.erp-route-fornecedores, html.erp-route-propostas) .table-wrapper table {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    table-layout: auto !important;
    border-collapse: separate !important;
  }

  :is(html.erp-route-maquinas, html.erp-route-processos, html.erp-route-insumos, html.erp-route-fornecedores, html.erp-route-propostas) .table-wrapper thead,
  :is(html.erp-route-maquinas, html.erp-route-processos, html.erp-route-insumos, html.erp-route-fornecedores, html.erp-route-propostas) .table-wrapper colgroup {
    display: none !important;
  }

  :is(html.erp-route-maquinas, html.erp-route-processos, html.erp-route-insumos, html.erp-route-fornecedores, html.erp-route-propostas) .table-wrapper tbody {
    display: block !important;
    width: 100% !important;
  }

  :is(html.erp-route-maquinas, html.erp-route-processos, html.erp-route-insumos, html.erp-route-fornecedores, html.erp-route-propostas) .table-wrapper tr.table-row {
    width: 100% !important;
    margin: 0 0 10px !important;
    padding: 12px !important;
    background: var(--bg-card, #fff) !important;
    border: 1px solid var(--border-color, #e5e7eb) !important;
    border-radius: 14px !important;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .03) !important;
    overflow: hidden !important;
  }

  :is(html.erp-route-maquinas, html.erp-route-processos, html.erp-route-insumos, html.erp-route-fornecedores, html.erp-route-propostas) .table-wrapper tr.table-row > td {
    display: block !important;
    min-width: 0 !important;
    width: auto !important;
    max-width: none !important;
    padding: 4px 0 !important;
    border: 0 !important;
    text-align: left !important;
    white-space: normal !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  :is(html.erp-route-maquinas, html.erp-route-processos, html.erp-route-insumos, html.erp-route-fornecedores, html.erp-route-propostas) .table-wrapper .table-empty {
    display: block !important;
    width: 100% !important;
    padding: 24px !important;
    border: 1px solid var(--border-color, #e5e7eb) !important;
    border-radius: 14px !important;
    background: var(--bg-card, #fff) !important;
  }

  /* MÁQUINAS */
  html.erp-route-maquinas .table-wrapper tr.table-row {
    display: grid !important;
    grid-template-columns: 36px 44px minmax(0, 1fr) auto !important;
    grid-template-areas:
      "check num name status"
      ". . model actions"
      ". . fabricante actions"
      ". . setor actions"
      ". . custo actions" !important;
    column-gap: 8px !important;
    align-items: center !important;
  }
  html.erp-route-maquinas .table-row > td:nth-child(1) { grid-area: check; }
  html.erp-route-maquinas .table-row > td:nth-child(2) { grid-area: num; }
  html.erp-route-maquinas .table-row > td:nth-child(3) { grid-area: name; font-size: 16px !important; }
  html.erp-route-maquinas .table-row > td:nth-child(4) { grid-area: model; color: #6b7280 !important; }
  html.erp-route-maquinas .table-row > td:nth-child(5) { grid-area: fabricante; color: #6b7280 !important; }
  html.erp-route-maquinas .table-row > td:nth-child(6) { grid-area: setor; color: #6b7280 !important; }
  html.erp-route-maquinas .table-row > td:nth-child(7) { grid-area: custo; color: #374151 !important; }
  html.erp-route-maquinas .table-row > td:nth-child(8) { grid-area: status; text-align: right !important; }
  html.erp-route-maquinas .table-row > td:nth-child(9) { grid-area: actions; align-self: end !important; text-align: right !important; }
  html.erp-route-maquinas .table-row > td:nth-child(4)::before { content: "Modelo: "; font-weight: 600; color: #374151; }
  html.erp-route-maquinas .table-row > td:nth-child(5)::before { content: "Fabricante: "; font-weight: 600; color: #374151; }
  html.erp-route-maquinas .table-row > td:nth-child(6)::before { content: "Setor: "; font-weight: 600; color: #374151; }
  html.erp-route-maquinas .table-row > td:nth-child(7)::before { content: "Custo/h: "; font-weight: 600; color: #374151; }

  /* PROCESSOS */
  html.erp-route-processos .table-wrapper tr.table-row {
    display: grid !important;
    grid-template-columns: 36px 44px minmax(0, 1fr) auto !important;
    grid-template-areas:
      "check num name status"
      ". code code actions"
      ". tecnica tecnica actions"
      ". cobranca cobranca actions"
      ". custoh custoun actions" !important;
    column-gap: 8px !important;
    align-items: center !important;
  }
  html.erp-route-processos .table-row > td:nth-child(1) { grid-area: check; }
  html.erp-route-processos .table-row > td:nth-child(2) { grid-area: num; }
  html.erp-route-processos .table-row > td:nth-child(3) { grid-area: code; color: #6b7280 !important; }
  html.erp-route-processos .table-row > td:nth-child(4) { grid-area: name; font-size: 16px !important; }
  html.erp-route-processos .table-row > td:nth-child(5) { grid-area: tecnica; color: #6b7280 !important; }
  html.erp-route-processos .table-row > td:nth-child(6) { grid-area: cobranca; color: #6b7280 !important; }
  html.erp-route-processos .table-row > td:nth-child(7) { grid-area: custoh; color: #374151 !important; }
  html.erp-route-processos .table-row > td:nth-child(8) { grid-area: custoun; color: #374151 !important; }
  html.erp-route-processos .table-row > td:nth-child(9) { grid-area: status; text-align: right !important; }
  html.erp-route-processos .table-row > td:nth-child(10) { grid-area: actions; align-self: end !important; text-align: right !important; }
  html.erp-route-processos .table-row > td:nth-child(3)::before { content: "Código: "; font-family: inherit; font-weight: 600; color: #374151; }
  html.erp-route-processos .table-row > td:nth-child(5)::before { content: "Técnica: "; font-weight: 600; color: #374151; }
  html.erp-route-processos .table-row > td:nth-child(6)::before { content: "Cobrança: "; font-weight: 600; color: #374151; }
  html.erp-route-processos .table-row > td:nth-child(7)::before { content: "Custo/h: "; font-weight: 600; }
  html.erp-route-processos .table-row > td:nth-child(8)::before { content: "Custo/un: "; font-weight: 600; }

  /* INSUMOS */
  html.erp-route-insumos .table-wrapper tr.table-row {
    display: grid !important;
    grid-template-columns: 36px 44px minmax(0, 1fr) auto !important;
    grid-template-areas:
      "check num name status"
      ". tipo tipo actions"
      ". unidade unidade actions"
      ". custo estoque actions"
      ". minimo minimo actions" !important;
    column-gap: 8px !important;
    align-items: center !important;
  }
  html.erp-route-insumos .table-row > td:nth-child(1) { grid-area: check; }
  html.erp-route-insumos .table-row > td:nth-child(2) { grid-area: num; }
  html.erp-route-insumos .table-row > td:nth-child(3) { grid-area: name; font-size: 16px !important; }
  html.erp-route-insumos .table-row > td:nth-child(4) { grid-area: tipo; }
  html.erp-route-insumos .table-row > td:nth-child(5) { grid-area: unidade; color: #6b7280 !important; }
  html.erp-route-insumos .table-row > td:nth-child(6) { grid-area: custo; color: #374151 !important; }
  html.erp-route-insumos .table-row > td:nth-child(7) { grid-area: estoque; color: #374151 !important; }
  html.erp-route-insumos .table-row > td:nth-child(8) { grid-area: minimo; color: #6b7280 !important; }
  html.erp-route-insumos .table-row > td:nth-child(9) { grid-area: status; text-align: right !important; }
  html.erp-route-insumos .table-row > td:nth-child(10) { grid-area: actions; align-self: end !important; text-align: right !important; }
  html.erp-route-insumos .table-row > td:nth-child(5)::before { content: "Unidade: "; font-weight: 600; color: #374151; }
  html.erp-route-insumos .table-row > td:nth-child(6)::before { content: "Custo: "; font-weight: 600; }
  html.erp-route-insumos .table-row > td:nth-child(7)::before { content: "Estoque: "; font-weight: 600; }
  html.erp-route-insumos .table-row > td:nth-child(8)::before { content: "Mínimo: "; font-weight: 600; color: #374151; }

  /* FORNECEDORES */
  html.erp-route-fornecedores .table-wrapper tr.table-row {
    display: grid !important;
    grid-template-columns: 36px 44px minmax(0, 1fr) auto !important;
    grid-template-areas:
      "check num name status"
      ". cnpj cnpj actions"
      ". email email actions"
      ". telefone telefone actions"
      ". categoria categoria actions" !important;
    column-gap: 8px !important;
    align-items: center !important;
  }
  html.erp-route-fornecedores .table-row > td:nth-child(1) { grid-area: check; }
  html.erp-route-fornecedores .table-row > td:nth-child(2) { grid-area: num; }
  html.erp-route-fornecedores .table-row > td:nth-child(3) { grid-area: name; font-size: 16px !important; }
  html.erp-route-fornecedores .table-row > td:nth-child(4) { grid-area: cnpj; color: #6b7280 !important; font-family: inherit !important; }
  html.erp-route-fornecedores .table-row > td:nth-child(5) { grid-area: email; color: #6b7280 !important; overflow-wrap: anywhere !important; }
  html.erp-route-fornecedores .table-row > td:nth-child(6) { grid-area: telefone; color: #6b7280 !important; }
  html.erp-route-fornecedores .table-row > td:nth-child(7) { grid-area: categoria; color: #6b7280 !important; }
  html.erp-route-fornecedores .table-row > td:nth-child(8) { grid-area: status; text-align: right !important; }
  html.erp-route-fornecedores .table-row > td:nth-child(9) { grid-area: actions; align-self: end !important; text-align: right !important; }
  html.erp-route-fornecedores .table-row > td:nth-child(4)::before { content: "CNPJ: "; font-weight: 600; color: #374151; }
  html.erp-route-fornecedores .table-row > td:nth-child(5)::before { content: "E-mail: "; font-weight: 600; color: #374151; }
  html.erp-route-fornecedores .table-row > td:nth-child(6)::before { content: "Telefone: "; font-weight: 600; color: #374151; }
  html.erp-route-fornecedores .table-row > td:nth-child(7)::before { content: "Categoria: "; font-weight: 600; color: #374151; }

  /* PROPOSTAS */
  html.erp-route-propostas .table-wrapper tr.table-row {
    display: grid !important;
    grid-template-columns: 36px 36px minmax(0, 1fr) auto !important;
    grid-template-areas:
      "expand check numero status"
      "cliente cliente valor valor"
      "data validade vendedor actions"
      "indicadores indicadores indicadores indicadores" !important;
    gap: 6px 8px !important;
    align-items: center !important;
  }
  html.erp-route-propostas .table-row > td:nth-child(1) { grid-area: expand; }
  html.erp-route-propostas .table-row > td:nth-child(2) { grid-area: check; }
  html.erp-route-propostas .table-row > td:nth-child(3) { grid-area: numero; text-align: left !important; }
  html.erp-route-propostas .table-row > td:nth-child(4) { grid-area: status; text-align: right !important; overflow: visible !important; }
  html.erp-route-propostas .table-row > td:nth-child(5) { grid-area: data; color: #6b7280 !important; }
  html.erp-route-propostas .table-row > td:nth-child(6) { grid-area: cliente; font-size: 15px !important; font-weight: 600 !important; padding: 6px 0 !important; }
  html.erp-route-propostas .table-row > td:nth-child(7) { grid-area: validade; color: #6b7280 !important; }
  html.erp-route-propostas .table-row > td:nth-child(8) { grid-area: indicadores; overflow: visible !important; }
  html.erp-route-propostas .table-row > td:nth-child(9) { grid-area: valor; text-align: right !important; }
  html.erp-route-propostas .table-row > td:nth-child(10) { grid-area: vendedor; }
  html.erp-route-propostas .table-row > td:nth-child(11) { grid-area: actions; text-align: right !important; overflow: visible !important; }
  html.erp-route-propostas .table-row > td:nth-child(5)::before { content: "Data: "; font-weight: 600; color: #374151; }
  html.erp-route-propostas .table-row > td:nth-child(7)::before { content: "Validade: "; font-weight: 600; color: #374151; }
  html.erp-route-propostas .table-row > td:nth-child(9)::before { content: "Valor: "; font-weight: 600; color: #374151; }
  html.erp-route-propostas .table-row > td:nth-child(4) > * { max-width: 150px !important; }
  html.erp-route-propostas .table-wrapper tbody > tr:not(.table-row) {
    display: block !important;
    width: 100% !important;
    margin: -6px 0 10px !important;
  }
  html.erp-route-propostas .table-wrapper tbody > tr:not(.table-row) > td {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 10px !important;
    box-sizing: border-box !important;
  }

  :is(html.erp-route-maquinas, html.erp-route-processos, html.erp-route-insumos, html.erp-route-fornecedores, html.erp-route-propostas) .table-row input[type="checkbox"] {
    width: 22px !important;
    height: 22px !important;
  }

  :is(html.erp-route-maquinas, html.erp-route-processos, html.erp-route-insumos, html.erp-route-fornecedores, html.erp-route-propostas) .action-btn,
  :is(html.erp-route-maquinas, html.erp-route-processos, html.erp-route-insumos, html.erp-route-fornecedores, html.erp-route-propostas) .action-btn--danger {
    min-width: 40px !important;
    min-height: 40px !important;
  }

  :is(html.erp-route-maquinas, html.erp-route-processos, html.erp-route-insumos, html.erp-route-fornecedores, html.erp-route-propostas) .pagination,
  :is(html.erp-route-maquinas, html.erp-route-processos, html.erp-route-insumos, html.erp-route-fornecedores, html.erp-route-propostas) [class*="pagin"] {
    max-width: 100% !important;
  }
}
