/* Mobile layout only. Physical receipt and barcode print media are untouched. */
@media screen and (max-width:760px) {
  html {scroll-padding-top:85px}
  body {min-width:0!important}
  #app,.main,.content,.card,.card-body,.table-wrap {min-width:0!important;max-width:100%;box-sizing:border-box}
  .main {margin-inline-start:0!important;width:100%!important}
  .content {padding:14px 12px 30px!important;font-size:14px!important}
  #app .content p {font-size:14px!important;line-height:1.8!important}
  .content h1,.content h2 {font-size:21px!important;line-height:1.6!important}
  .topbar {height:auto!important;min-height:66px;padding:10px 12px!important;gap:8px!important}
  .topbar-title {min-width:0}.topbar-title h1 {font-size:18px!important}.topbar .crumb {display:none!important}
  .top-actions {gap:6px!important}.user-chip {max-width:145px}.user-chip .user-text{display:none}
  .mobile-toggle {display:grid!important;min-width:44px;min-height:44px}
  .sidebar {width:min(300px,88vw)!important;max-height:100dvh;z-index:100}
  .page-head,.card-head,.v640-page-head {flex-wrap:wrap!important;gap:12px!important}
  .page-actions,.toolbar,.report-filters,.v640-filters {display:flex!important;flex-wrap:wrap!important;gap:10px!important;min-width:0!important}
  .page-actions>*,.toolbar>*,.report-filters>*,.v640-filters>* {flex:1 1 140px!important;min-width:0!important;max-width:100%!important}
  .content :is(input:not([type=checkbox]):not([type=radio]),select,textarea),.modal:not(:has(#thermal-receipt)) :is(input:not([type=checkbox]):not([type=radio]),select,textarea) {font-size:16px!important;min-height:44px!important;max-width:100%!important;box-sizing:border-box}
  .content :is(button,.primary,.secondary),.modal:not(:has(#thermal-receipt)) :is(button,.primary,.secondary) {min-height:44px!important;font-size:14px!important;white-space:normal!important}
  .content :is(label,small),.modal:not(:has(#thermal-receipt)) :is(label,small) {font-size:12px!important;line-height:1.7!important}
  .content :is(.grid-2,.grid-3,.report-grid,.form-grid,.product-editor,.v637-order-grid,.order-detail-grid,.v640-invoice-meta,.v640-payment-detail),.modal:not(:has(#thermal-receipt)) :is(.form-grid,.product-editor,.order-detail-grid,.v640-invoice-meta,.v640-payment-detail) {display:grid!important;grid-template-columns:minmax(0,1fr)!important;gap:12px!important}
  .content .stats,.content .v640-summary {grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:10px!important}
  .product-grid {grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:10px!important}
  .product-card {min-width:0!important}.product-card :is(h3,b) {overflow-wrap:anywhere;font-size:14px!important}
  .product-image-editor {position:static!important}.product-preview {max-height:220px}
  .v624-category-row,.v624-category-link {min-width:0!important;white-space:normal!important;overflow-wrap:anywhere}
  .content :is(.card,.card-body,.v640-panel) {padding:14px!important;border-radius:14px!important}
  .table-wrap:has(.qm-mobile-table) {overflow:visible!important;max-height:none!important}
  table.qm-mobile-table {display:block!important;min-width:0!important;width:100%!important;border-collapse:separate!important}
  .qm-mobile-table>thead {position:absolute!important;clip-path:inset(50%);width:1px;height:1px;overflow:hidden}
  .qm-mobile-table>tbody {display:grid!important;gap:12px!important;width:100%!important}
  .qm-mobile-table>tbody>tr {display:grid!important;grid-template-columns:minmax(0,1fr)!important;gap:0!important;border:1px solid var(--line,#ddd)!important;border-radius:12px!important;background:var(--panel,#fff)!important;padding:10px!important;min-width:0!important}
  .qm-mobile-table>tbody>tr>td {display:flex!important;align-items:flex-start;gap:10px!important;flex-wrap:wrap!important;padding:8px 2px!important;border:0!important;min-width:0!important;max-width:100%!important;white-space:normal!important;overflow-wrap:anywhere!important;text-align:start!important;font-size:14px!important}
  .qm-mobile-table>tbody>tr>td::before {content:attr(data-qm-label);flex:0 0 98px;color:var(--muted,#666);font-size:12px;line-height:1.7}
  .qm-mobile-table>tbody>tr>td[colspan]::before {display:none}
  .qm-mobile-table td :is(input,select) {min-width:0!important;width:auto!important;flex:1 1 100px}
  .qm-mobile-table td>small {flex-basis:100%;margin:0!important}
  .qm-mobile-state {border-style:dashed!important}.qm-mobile-state td {display:block!important}
  .qm-mobile-matrix {overflow-x:auto!important;max-width:100%!important;overscroll-behavior-inline:contain}
  .qm-invoice-items {flex:1 0 100%;border-top:1px solid var(--line,#ddd);margin-top:8px;padding-top:12px;display:grid;gap:10px;direction:inherit;text-align:start;cursor:default}
  .qm-invoice-items>strong {color:var(--gold-2,#785915)}
  .qm-invoice-item {display:grid;grid-template-columns:minmax(0,1fr) auto;gap:4px 8px;border-bottom:1px solid var(--line,#ddd);padding-bottom:10px}
  .qm-invoice-item>b,.qm-invoice-item>small,.qm-invoice-item>span {grid-column:1/-1;white-space:normal;overflow-wrap:anywhere}
  .qm-invoice-item>strong {grid-column:2;justify-self:end;font-size:15px}
  .v640-invoice-link {font-size:18px!important}
  .modal-backdrop:not(:has(#thermal-receipt)) {padding:8px!important;align-items:center!important}
  .modal:not(:has(#thermal-receipt)) {width:100%!important;max-width:100%!important;max-height:calc(100dvh - 16px)!important;padding:16px!important;box-sizing:border-box;overflow:auto!important;overscroll-behavior:contain}
  .modal-head {gap:10px}.modal-head h3 {font-size:18px!important}.modal-actions {flex-wrap:wrap!important;gap:10px!important}.modal-actions>* {flex:1 1 120px!important}
  .modal:not(:has(#thermal-receipt)) .span-2 {grid-column:1/-1!important}
  .order-lines>div {display:flex!important;flex-wrap:wrap!important;gap:8px!important}.order-lines>div>span:first-child {flex:1 0 100%}
  .pos-layout {display:flex!important;flex-direction:column!important;height:auto!important;max-height:none!important;overflow:visible!important}
  .pos-layout>* {width:100%!important;min-width:0!important;max-height:none!important;height:auto!important;box-sizing:border-box}
  .cart-row {grid-template-columns:minmax(0,1fr)!important;gap:8px!important}.cart-row b {font-size:14px!important}
  .cart-summary {position:static!important}.toast {inset-inline:12px!important;bottom:16px!important;width:auto!important;font-size:14px!important}
  #app .content[data-m2-pos],#app .content[data-r36-pos] {height:auto!important;min-height:0!important;max-height:none!important;overflow:visible!important;padding-bottom:24px!important}
  #app .content .pos-layout {display:flex!important;flex-direction:column!important;height:auto!important;overflow:visible!important}
  #app .content .pos-layout .cart-card {height:auto!important;max-height:none!important;overflow:visible!important}
  #app .content .pos-layout .cart-card .cart-summary {position:static!important;inset:auto!important;max-height:none!important;overflow:visible!important}
  #app .content .pos-layout .m2-side {display:flex!important;max-height:none!important;overflow:visible!important}
  .content :is(.role-picker,.access-grid) {grid-template-columns:1fr!important;max-width:100%!important}
}
@media print { .qm-invoice-items {display:none!important} }
@media screen and (max-width:380px) {
 .product-grid,.content .stats,.content .v640-summary {grid-template-columns:minmax(0,1fr)!important}
 .qm-mobile-table>tbody>tr>td::before {flex-basis:85px}
}

/* P2: contain complete financial values, category disclosure, theme contrast. */
@media screen {
  #app .content .stat {min-width:0!important;box-sizing:border-box}
  #app .content .stat>strong {box-sizing:border-box;max-width:100%;width:100%;min-width:0;white-space:nowrap;direction:ltr;unicode-bidi:isolate;line-height:1.4!important;font-variant-numeric:tabular-nums;position:relative;z-index:1}
  #app .content .stat>strong.qm-number-wrap {white-space:normal;overflow-wrap:anywhere}
  #app .content .stat>.label {display:block;min-height:38px;font-size:13px!important;padding-inline-end:44px;white-space:normal;line-height:1.7}
  #app #stock-category-filter {display:block!important;position:relative!important;min-width:0!important;width:min(100%,420px)!important;box-sizing:border-box;z-index:35}
  #app #stock-category-filter>summary {display:flex!important;align-items:center;justify-content:space-between;gap:12px;list-style:none!important;cursor:pointer;min-height:48px;padding:10px 14px;border:1px solid var(--line,#9199a3);border-radius:12px;background:var(--panel,#fff);color:var(--text,#17212d);font-size:15px!important;font-weight:700}
  #app #stock-category-filter>summary::-webkit-details-marker {display:none}
  #app #stock-category-filter>summary::after {content:'⌄';font-size:20px;flex:0 0 auto}
  #app #stock-category-filter[open]>summary::after {content:'⌃'}
  #app #stock-category-filter:not([open])>.v63-category-options {display:none!important}
  #app #stock-category-filter[open]>.v63-category-options {display:grid!important;grid-template-columns:minmax(0,1fr)!important;position:absolute!important;inset-inline:0!important;top:calc(100% + 6px)!important;min-width:0!important;max-width:100%!important;max-height:300px!important;overflow:auto!important;padding:8px!important;margin:0!important;border:1px solid var(--line,#9199a3);border-radius:12px;background:var(--panel,#fff);color:var(--text,#17212d);box-shadow:0 12px 28px #0003;z-index:100;box-sizing:border-box}
  #app #stock-category-filter .v63-category-options>label {display:grid!important;grid-template-columns:24px minmax(0,1fr) auto!important;align-items:center!important;gap:10px!important;min-height:46px!important;margin:0!important;padding:8px!important;background:var(--panel,#fff)!important;color:var(--text,#17212d)!important;font-size:14px!important;border-bottom:1px solid var(--line,#ccc);cursor:pointer;white-space:normal}
  #app #stock-category-filter input[type=checkbox] {width:20px!important;height:20px!important;min-height:20px!important;margin:0!important;accent-color:var(--gold,#8b6417)}
  #app #stock-category-filter .v63-category-options b {background:var(--panel-2,#f3eee5)!important;color:var(--text,#17212d)!important;border-radius:8px;padding:3px 8px}
  #app .content .fa6275-report-tabs {flex-wrap:wrap!important;overflow:visible!important;gap:8px!important;max-width:100%!important}
  #app .content .fa6275-report-tabs button {background:#fff!important;color:#273342!important;border:1px solid #7b8794!important;min-height:44px!important;white-space:normal!important;line-height:1.6!important}
  #app .content .fa6275-report-tabs button.active {background:#825b11!important;color:#fff!important;border-color:#825b11!important}
  html[data-theme=dark] #app .content .fa6275-report-tabs button {background:#1c2430!important;color:#f3f5fa!important;border-color:#738399!important}
  html[data-theme=dark] #app .content .fa6275-report-tabs button.active {background:#e2bc6a!important;color:#17120a!important;border-color:#e2bc6a!important}
  #app .content .badge.warn {background:#fff0c2!important;color:#664500!important;border:1px solid #af7a16}
  #app .content .badge.danger {background:#ffe4e4!important;color:#8b1515!important;border:1px solid #ba4545}
  html[data-theme=dark] #app .content .badge.warn {background:#43320c!important;color:#ffe39b!important;border-color:#c59736}
  html[data-theme=dark] #app .content .badge.danger {background:#451a20!important;color:#ffbdc3!important;border-color:#da7a83}
}
@media screen and (max-width:760px) {
  html,body {width:100%!important;margin:0!important;padding:0!important;box-sizing:border-box}
  #app,#app .shell,#app .main {width:100%!important;max-width:100%!important;min-width:0!important;box-sizing:border-box}
  #app .content .stats.inventory-financial-stats {grid-template-columns:minmax(0,1fr)!important;gap:12px!important}
  #app .content .stat>strong {font-size:clamp(18px,6vw,28px)}
  #app .content .hero-strip,#app .content .grid-2,#app .content .grid-3 {grid-template-columns:minmax(0,1fr)!important}
  #app .login {width:100%!important;max-width:100%!important;min-width:0!important;grid-template-columns:minmax(0,1fr)!important;grid-template-areas:'form'!important;min-height:100dvh;box-sizing:border-box}
  #app .login-panel {width:100%!important;min-width:0!important;max-width:100%!important;box-sizing:border-box}
  #app .login-hero {display:none!important}
  #app .login-toolbar {width:100%!important;max-width:100%!important;box-sizing:border-box;display:flex;flex-wrap:wrap!important;gap:8px!important;padding:12px!important}
  #app .login-control-group {min-width:0!important;max-width:100%!important;flex:1 1 130px!important}
  #app .login-choice {min-width:0!important;white-space:normal!important;font-size:13px!important;padding:8px!important}
  #app .login-card-wrap {width:100%!important;min-width:0!important;max-width:100%!important;padding:20px 14px!important;box-sizing:border-box}
  #app .login-card {width:100%!important;max-width:420px!important;min-width:0!important;padding:24px 18px!important;box-sizing:border-box}
  #app .login-card h3 {font-size:24px!important}
  #app .login-card .input-shell {min-width:0!important;max-width:100%!important;box-sizing:border-box}
  #app .login-card input {font-size:16px!important;min-width:0!important;max-width:100%!important}
  #app #stock-category-filter {width:100%!important}
  #app .content input[type=date],#app .content input[type=datetime-local] {width:100%!important;min-width:0!important;box-sizing:border-box}
}
@media screen and (max-width:760px) {
 #app .qm-mobile-table>tbody>tr[hidden] {display:none!important}
}
