
@media screen and (max-width:640px){
  /* ---- Pagina Gerenciador de Faturas ---- */
  #invoices > div:first-child{flex-direction:column !important;align-items:stretch !important;gap:10px !important;}
  #invoices > div:first-child h1{font-size:1.3rem !important;line-height:1.2 !important;}
  #invoices .gch-fin-filter-wrap{width:100% !important;display:flex !important;justify-content:space-between !important;gap:10px !important;}
  #invoices .gch-fin-filter{flex:1 1 auto !important;min-width:0 !important;}
  #invoiceSummary{grid-template-columns:1fr 1fr !important;gap:10px !important;margin-bottom:2px !important;}
  #invoiceSummary > div{padding:12px !important;border-radius:14px !important;}
  #invoiceSummary > div > div:first-child{font-size:10.5px !important;line-height:1.25 !important;margin-bottom:2px !important;}
  #invoiceSummary > div > div:nth-child(2){font-size:1.05rem !important;}
  #invoiceSummary > div > div:nth-child(3){margin-top:8px !important;height:6px !important;}
  #invoiceGrid{gap:10px !important;}
  #invoiceGrid > div{padding:14px !important;border-radius:14px !important;}
  /* ---- Editor de fatura (modal) ---- */
  html body #invoiceModal{padding:0 !important;align-items:stretch !important;justify-content:stretch !important;}
  html body #invoiceModal .invoice-sheet{width:100% !important;max-width:100% !important;min-height:0 !important;height:100vh !important;height:100svh !important;max-height:100svh !important;margin:0 !important;border-radius:0 !important;box-shadow:none !important;display:flex !important;flex-direction:column !important;overflow:hidden !important;}
  html body #invoiceModal #invoiceContent{padding:14px 14px 12px !important;flex:1 1 auto !important;overflow-y:auto !important;-webkit-overflow-scrolling:touch;}
  /* rodape sempre visivel */
  html body #invoiceModal .invoice-sheet > div.no-print{position:sticky !important;bottom:0 !important;flex:0 0 auto !important;display:flex !important;flex-wrap:wrap !important;justify-content:stretch !important;gap:8px !important;padding:10px 12px calc(10px + env(safe-area-inset-bottom)) !important;border-top:1px solid #dbe3ec !important;}
  html body #invoiceModal .invoice-sheet > div.no-print > button{flex:1 1 calc(33.333% - 8px) !important;min-width:92px !important;min-height:46px !important;font-size:11.5px !important;line-height:1.2 !important;border-radius:12px !important;padding:8px 6px !important;display:inline-flex !important;align-items:center !important;justify-content:center !important;text-align:center !important;}
  html body #invoiceModal .invoice-sheet > div.no-print > button[onclick="invSaveChanges()"]{flex:1 1 100% !important;order:-1 !important;background:#10B981 !important;color:#04231a !important;border:0 !important;font-weight:800 !important;font-size:14px !important;}
  /* campos ocupam a largura toda */
  html body #invoiceModal #invoiceContent input,
  html body #invoiceModal #invoiceContent select,
  html body #invoiceModal #invoiceContent textarea{width:100% !important;min-width:0 !important;max-width:100% !important;font-size:16px !important;padding:9px 10px !important;border-radius:8px !important;}
  html body #invoiceModal #invoiceContent [data-gdm-labelrow]{flex-direction:column !important;gap:12px !important;}
  html body #invoiceModal #invoiceContent [data-gdm-labelrow] > div{width:100% !important;min-width:0 !important;max-width:100% !important;flex:1 1 auto !important;}
  html body #invoiceModal #invoiceContent [data-gdm-metagrid]{grid-template-columns:96px 1fr !important;}
  html body #invoiceModal #invoiceContent #invTotalsBox{width:100% !important;min-width:0 !important;}
  /* tabela de itens vira cartoes empilhados */
  html body #invoiceModal #invoiceContent table{display:block !important;width:100% !important;}
  html body #invoiceModal #invoiceContent table thead{display:none !important;}
  html body #invoiceModal #invoiceContent table tbody{display:block !important;width:100% !important;}
  html body #invoiceModal #invoiceContent table tbody tr{display:grid !important;grid-template-columns:1fr 1fr !important;gap:8px 10px !important;border:1px solid #e5e5e5 !important;border-radius:12px !important;padding:10px 12px !important;margin-bottom:10px !important;background:#fbfcfe !important;}
  html body #invoiceModal #invoiceContent table tbody td{display:block !important;width:auto !important;padding:0 !important;text-align:left !important;border:0 !important;}
  html body #invoiceModal #invoiceContent table tbody td::before{display:block;font-size:9.5px;font-weight:700;color:#5b8db8;letter-spacing:.05em;text-transform:uppercase;margin-bottom:3px;}
  html body #invoiceModal #invoiceContent table tbody td:nth-child(1){grid-column:1;grid-row:1;align-self:center;font-size:11px;font-weight:700;color:#8aa0b5;}
  html body #invoiceModal #invoiceContent table tbody td:nth-child(1)::before{content:var(--lb,'Item');display:inline;margin:0 4px 0 0;}
  html body #invoiceModal #invoiceContent table tbody td:nth-child(2){grid-column:1 / -1;}
  html body #invoiceModal #invoiceContent table tbody td:nth-child(2)::before{content:var(--lb,'Product/service');}
  html body #invoiceModal #invoiceContent table tbody td:nth-child(3){grid-column:1 / -1;}
  html body #invoiceModal #invoiceContent table tbody td:nth-child(3)::before{content:var(--lb,'Description');}
  html body #invoiceModal #invoiceContent table tbody td:nth-child(4)::before{content:var(--lb,'Qty');}
  html body #invoiceModal #invoiceContent table tbody td:nth-child(5)::before{content:var(--lb,'Rate');}
  html body #invoiceModal #invoiceContent table tbody td:nth-child(6){align-self:center;font-weight:700;color:#1a1a1a;}
  html body #invoiceModal #invoiceContent table tbody td:nth-child(6)::before{content:var(--lb,'Amount');}
  html body #invoiceModal #invoiceContent table tbody td:nth-child(7){grid-column:1 / -1;}
  html body #invoiceModal #invoiceContent table tbody td:nth-child(7)::before{content:var(--lb,'Sales tax');}
  html body #invoiceModal #invoiceContent table tbody td:nth-child(8){grid-column:2;grid-row:1;justify-self:end;align-self:center;}
  html body #invoiceModal #invoiceContent table tbody td:nth-child(8) span{font-size:19px !important;}
  /* botoes de linha */
  html body #invoiceModal #invoiceContent button{min-height:40px !important;font-size:12.5px !important;flex:1 1 auto !important;}
}
