/* Salgados da Lê - telas menores. Prioriza notebook/computador, sem quebrar em tablet e celular. */
@media (max-width: 1100px) {
  .editor-grid { grid-template-columns: 1fr; }
  .editor-side { position: static; }
  .calc-grid { grid-template-columns: 1fr; }
  .action-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 860px) {
  .layout { display: block; min-height: 0; }
  /* menu vira uma barra fixa na parte de baixo */
  .nav {
    position: fixed; top: auto; bottom: 0; left: 0; right: 0; z-index: 30; height: auto; flex-direction: row; gap: 0;
    padding: .25rem; border-right: 0; border-top: 1px solid var(--line); overflow-x: auto; overflow-y: hidden;
  }
  .nav a { flex: 1 0 auto; flex-direction: column; gap: 0; padding: .35rem .6rem; font-size: .7rem; min-width: 64px; text-align: center; }
  .nav-label { white-space: nowrap; }
  #view { padding: 1rem 1rem 5.5rem; }
  .topbar { padding: .5rem 1rem; }
  .field-row, .field-row.three { grid-template-columns: 1fr; }
  .field-row-tight { grid-template-columns: 1fr 1fr; }
  .toast-root { bottom: 4.5rem; }

  /* tabelas viram cartões */
  .table.stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .table.stack, .table.stack tbody, .table.stack tr, .table.stack td { display: block; width: 100%; }
  .table.stack tr { padding: .6rem .85rem; border-bottom: 1px solid var(--line); }
  .table.stack td { border: 0; padding: .2rem 0; display: flex; justify-content: space-between; gap: 1rem; text-align: right; }
  .table.stack td::before { content: attr(data-label); color: var(--muted); font-size: .85rem; text-align: left; flex: none; }
  .table.stack td.row-actions { justify-content: flex-end; padding-top: .5rem; }
  .table.stack td.row-actions::before { content: none; }
  .table.stack td:first-child { text-align: left; display: block; }
  .table.stack td:first-child::before { content: none; }

  .line { grid-template-columns: 1fr 1fr 1fr 36px; }
  .line-main { grid-column: 1 / -1; }
  .line-cost { text-align: left; grid-column: 3; }
  .line-extra { grid-template-columns: 1fr 1fr 36px; }
  .line-extra .line-type { grid-column: 1 / -1; }
  .line-extra .line-wide { grid-column: 1 / -1; }
  .line-extra .line-cost { grid-column: auto; }
  .sim-table th:nth-child(2), .sim-table td:nth-child(2) { display: none; }
}

@media (max-width: 520px) {
  h1 { font-size: 1.4rem; }
  .brand-name { font-size: 1rem; }
  .action-grid { grid-template-columns: 1fr 1fr; gap: .6rem; }
  .action { padding: .85rem; }
  .stat-grid { grid-template-columns: 1fr; }
  .sync-chip span { max-width: 6.5rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .card { padding: 1rem; }
  .modal-body, .modal-head { padding: 1rem; }
  .preview-grid { grid-template-columns: 1fr; }
  .form-actions .btn { flex: 1; }
}

@media print {
  .nav, .topbar, .toast-root, .btn, .icon-btn { display: none !important; }
  body { background: #fff; }
  #view { padding: 0; }
}
