@media (max-width: 800px) {
  :root { --mobile-gap: 8px; }
  html { font-size: 14px; }
  body { padding-bottom: calc(58px + env(safe-area-inset-bottom)); font-size: 13px; line-height: 1.35; }
  button, .button { font-size: 13px; }
  input, select, textarea { font-size: 16px; }

  .sidebar { height: calc(56px + env(safe-area-inset-bottom)); padding: 3px 4px env(safe-area-inset-bottom); }
  .sidebar nav { height: 52px; gap: 2px; }
  .sidebar .nav { flex-basis: 70px; padding: 4px 2px; border-radius: 7px; font-size: 14px; }
  .sidebar .nav span { font-size: 9px; line-height: 1.05; }
  .nav-icon { width: 16px; height: 16px; }

  main { padding: max(env(safe-area-inset-top), 6px) 7px 10px; }
  header { min-height: 52px; padding: 4px 1px 6px; align-items: center; }
  header > div:first-child { padding: 0; }
  header h1 { max-width: 118px; font-size: 17px; line-height: 1.08; }
  .header-actions { gap: 4px; }
  .header-settings, .notification-button { width: 35px; height: 35px; border-radius: 8px; }
  .header-settings { font-size: 13px; }
  .notification-button::before { font-size: 15px; }
  .notification-button > span { width: 17px; height: 17px; font-size: 9px; }
  .user-menu { gap: 3px; }
  .user-chip { max-width: 86px; min-height: 35px; padding: 4px 6px; border-radius: 8px; }
  .user-chip strong { font-size: 11px; }
  .user-chip small { font-size: 8px; }
  .user-menu > .secondary { min-height: 35px; padding: 5px 7px; font-size: 10px; }

  .panel { border-radius: 10px; }
  .pos-grid { gap: 7px; }
  .catalog-panel { max-height: 40dvh; min-height: 210px; padding: 7px; }
  .search-wrap { min-height: 40px; padding: 4px 8px; gap: 7px; border-radius: 8px; }
  .search-wrap span { font-size: 18px; }
  .chips { gap: 5px; padding: 7px 0 6px; }
  .chip { padding: 5px 9px; font-size: 11px; }
  .product-grid { gap: 6px; }
  .product-card { min-height: 94px; padding: 8px; border-radius: 8px; }
  .product-card .category { font-size: 9px; }
  .product-card strong { margin: 4px 0; font-size: 12px; line-height: 1.15; }
  .product-card .price { font-size: 15px; }
  .stock { font-size: 9px; }

  .cart-panel { min-height: 51dvh; }
  .cart-panel .panel-title { padding: 8px; gap: 6px; }
  .cart-heading { gap: 5px; }
  .cart-heading h2 { font-size: 14px; }
  .cart-heading small { font-size: 10px; }
  .cart-actions { gap: 4px; }
  .cart-actions > button { min-height: 32px; padding: 5px 7px; font-size: 10px; border-radius: 7px; }
  .cart-actions .icon-btn { width: 32px; }
  .cart-items { min-height: 92px; padding: 3px 9px; }
  .cart-empty { padding: 24px 10px; font-size: 12px; }
  .cart-line { gap: 5px; padding: 8px 0; }
  .cart-line strong { font-size: 12px; }
  .cart-line small { font-size: 10px; }
  .qty { gap: 5px; }
  .qty button { width: 27px; height: 27px; }
  .checkout { padding: 8px; gap: 6px; }
  .sale-customer-row { gap: 6px; }
  .checkout label { gap: 3px; font-size: 10px; }
  .checkout input, .checkout select { min-height: 40px; padding: 6px 8px; }
  .discount-row { font-size: 11px; }
  .discount-row input { width: 68px; }
  .totals { gap: 1px; font-size: 12px; }
  .checkout .grand { font-size: 17px; }
  .checkout #change { font-size: 13px; }
  .primary.large { min-height: 42px; padding: 8px 10px; font-size: 13px; }

  .toolbar { gap: 7px; margin-bottom: 8px; }
  .toolbar .search-wrap { width: 100%; }
  .toolbar button, .toolbar .button { min-height: 39px; padding: 7px 9px; }
  .catalog-section-tabs { gap: 6px; margin-bottom: 8px; }
  .catalog-section-tabs button { padding: 8px; }
  .catalog-section-tabs button span { font-size: 12px; }
  .catalog-section-tabs button strong { font-size: 16px; }
  .catalog-section-tabs button small { display: none; }
  .product-actions { gap: 6px; }
  .product-actions > * { min-height: 38px; padding: 6px 8px; font-size: 11px; }
  .catalog-page-size { min-height: 38px; font-size: 11px; }

  .product-filters, .report-filters { padding: 9px; }
  .filter-grid, .inventory-toolbar { gap: 7px; }
  .filter-grid label, .report-filters label { font-size: 10px; }
  .filter-grid input, .filter-grid select, .inventory-toolbar select, .report-filters input, .report-filters select { min-height: 39px; padding: 6px 8px; }
  .filter-summary { padding-top: 7px; font-size: 10px; }

  .summary-cards, #inventory-cards, .customer-kpis, .quotation-kpis { gap: 6px; margin-bottom: 8px; }
  .summary-card, .customer-kpi, .quotation-kpi { padding: 9px; }
  .summary-card strong, .customer-kpi strong, .quotation-kpi strong { margin-top: 2px; font-size: 17px; }
  .summary-card small, .customer-kpi small, .quotation-kpi small { font-size: 10px; }
  .panel-title { padding: 10px; }
  .panel-title h2 { font-size: 14px; }
  .panel-title small { font-size: 10px; }

  #view-products > .table-panel tbody,
  #view-purchases > .table-panel tbody { gap: 6px; padding: 6px; }
  #view-products > .table-panel tbody tr,
  #view-purchases > .table-panel tbody tr { gap: 6px 9px; padding: 9px; border-radius: 8px; }
  #view-products > .table-panel tbody td,
  #view-purchases > .table-panel tbody td { font-size: 11px; }
  #view-products > .table-panel tbody td::before,
  #view-purchases > .table-panel tbody td::before { font-size: 8px; }
  .catalog-row-actions .link-btn { min-height: 30px; padding: 4px 6px; }
  .badge { padding: 3px 6px; font-size: 9px; }

  .payment-summary { padding: 8px 10px; }
  .payment-row { padding: 7px 0; font-size: 11px; }
  .report-grid, .business-grid { gap: 8px; }
  .chart { min-height: 190px; padding: 8px; }
  .chart-col strong, .chart-col small { font-size: 9px; }
  .metric-buttons { gap: 4px; overflow-x: auto; }
  .metric-buttons button, .quick-ranges button { padding: 5px 7px; font-size: 10px; white-space: nowrap; }

  dialog, dialog.wide-modal, dialog.quotation-modal, dialog.quotation-detail-modal { width: calc(100% - 8px); max-height: calc(100dvh - 8px); border-radius: 10px; }
  dialog form, dialog .dialog-content { padding: 11px; max-height: calc(100dvh - 8px); }
  dialog label { font-size: 10px; }
  dialog input, dialog select, dialog textarea { min-height: 40px; padding: 7px 8px; }
  .modal-head { margin-bottom: 10px; }
  .modal-head h2 { font-size: 15px; }
  .modal-head p { font-size: 10px; }
  .form-grid { gap: 8px; }
  .section-label { margin-top: 8px; font-size: 10px; }
  .modal-actions { bottom: -11px; gap: 6px; padding: 8px 0 11px; margin-top: 10px; }
  .modal-actions > * { min-width: 96px; min-height: 38px; padding: 6px 8px; }
  .quotation-line, .quotation-line.compact-quotation-line, .purchase-line { gap: 6px !important; padding: 7px !important; }
  .quotation-lines { max-height: 42dvh; }
  .quotation-bottom { gap: 8px; margin-top: 8px; }
  .quotation-totals { padding: 9px; }
  .quote-client { gap: 7px; padding: 10px; margin: 10px 0; }
  .quotation-document { padding: 10px; font-size: 10px; }

  .notification-panel { top: 49px; left: 7px; right: 7px; max-height: calc(100dvh - 116px); }
  .notification-head { padding: 10px; }
  .notification-item { padding: 9px 40px 9px 10px; }
  .notification-item span strong { font-size: 11px; }
  .notification-item span small { font-size: 9px; }
}

@media (max-width: 380px) {
  header h1 { max-width: 92px; font-size: 15px; }
  .user-chip { max-width: 70px; }
  .header-settings, .notification-button { width: 33px; height: 33px; }
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .product-card { min-height: 90px; padding: 7px; }
  .cart-actions > button { padding-inline: 6px; }
}
