/* NKF Pharmacy | universal mobile/tablet interface | 2026-10-30
   CSS only: preserves PHP forms, MySQL, invoices and all branch permissions. */
:root {--ph-mobile-header-height:100px;--ph-safe-bottom:env(safe-area-inset-bottom,0px)}
html{-webkit-text-size-adjust:100%;text-size-adjust:100%}
body.app-body{max-width:100%}
body.app-body :is(.workspace,.panel-body,.page-panel,.classic-register,.phd-root,.ph-context-header){min-width:0;max-width:100%}
body.app-body :is(img,video){max-width:100%;height:auto}
body.app-body :is(.table-wrap,.cp-scroll,.compact-line-table-wrap,.line-table-wrap){max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch;overscroll-behavior-x:contain}
body.app-body :is(.table-wrap,.cp-scroll,.compact-line-table-wrap,.line-table-wrap):focus-visible{outline:2px solid #2179c9;outline-offset:1px}
body.app-body .ph-mobile-table-hint,body.app-body .ph-mobile-drawer-shade,body.app-body .ph-mobile-bottom{display:none}
@media screen and (max-width:1100px){
 body.app-body :is(.panel-titlebar,.page-tools,.pro-actionbar,.cp-actions){height:auto;min-height:42px;flex-wrap:wrap;gap:8px}
 body.app-body .panel-titlebar .actions{flex-wrap:wrap;max-width:100%;gap:7px}
 body.app-body .ph-context-scroll{min-width:0;max-width:100%}
 body.app-body .classic-register .actions form.search{max-width:100%;min-width:0}
}
@media screen and (max-width:900px){
 body.app-body,body.app-body:has(.invoice-professional){min-width:0!important;width:100%;overflow-x:clip}
 body.app-body .shell,body.app-body:has(.invoice-professional) .shell{display:block!important;min-width:0!important;margin:8px 6px 18px!important;min-height:calc(100dvh - var(--ph-mobile-header-height) - 80px)!important;border-radius:7px!important}
 body.app-body .workspace,body.app-body:has(.invoice-professional) .workspace{width:100%;min-width:0;max-width:100%;padding:12px 10px 23px!important}
 body.app-body .topbar{z-index:105;height:auto!important;min-height:55px;align-items:center;display:flex;flex-wrap:wrap;gap:0;background:#fff}
 body.app-body .mobile-menu{order:0;display:flex!important;width:46px;height:50px;min-width:46px!important;padding:0!important;align-items:center;justify-content:center;color:#1a5084;font-size:23px;touch-action:manipulation}
 body.app-body .top-business{order:1;display:flex!important;flex:1;min-width:0;max-width:calc(100% - 103px);padding:0 6px!important;overflow:hidden}
 body.app-body .top-business strong{display:block;font-size:14px;color:#173f65;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
 body.app-body .top-business span,body.app-body .top-spacer,body.app-body .top-item,body.app-body .top-user{display:none!important}
 body.app-body .ph-fullscreen-btn{order:2;flex:0 0 40px!important;height:38px;min-width:40px;margin:0 6px!important;padding:6px!important}
 body.app-body .ph-fullscreen-btn .ph-fs-label{display:none!important}
 body.app-body .ph-quick-actions{order:3;display:flex!important;flex:0 0 100%;width:100%;height:43px;margin:0!important;padding:4px 9px 6px!important;gap:7px!important;overflow-x:auto;overflow-y:hidden;scrollbar-width:none;border-top:1px solid #edf1f5;background:#fff}
 body.app-body .ph-quick-actions::-webkit-scrollbar{display:none}
 body.app-body .ph-quick-actions .ph-quick-link{flex:0 0 auto;min-height:32px;padding:6px 12px!important;font-size:12px!important}
 body.app-body .sidebar,body.app-body:has(.invoice-professional) .sidebar{display:block!important;position:fixed!important;left:0!important;top:var(--ph-mobile-header-height)!important;bottom:0!important;width:min(290px,86vw)!important;max-height:calc(100dvh - var(--ph-mobile-header-height));z-index:104!important;overflow-y:auto;overscroll-behavior:contain;visibility:hidden;transform:translateX(-105%);pointer-events:none;transition:transform .2s ease,visibility .2s ease;border-radius:0!important;box-shadow:8px 8px 25px #14335333!important}
 body.app-body.menu-open .sidebar,body.app-body.menu-open:has(.invoice-professional) .sidebar{visibility:visible;transform:translateX(0);pointer-events:auto;left:0!important}
 body.app-body .sidebar .nav-list a{min-height:43px!important}
 body.app-body .ph-mobile-drawer-shade{display:block;position:fixed;inset:var(--ph-mobile-header-height) 0 0;z-index:103;background:#102b496d;opacity:0;visibility:hidden;pointer-events:none;transition:opacity .2s ease,visibility .2s ease}
 body.app-body.menu-open .ph-mobile-drawer-shade{opacity:1;visibility:visible;pointer-events:auto}
 body.app-body.menu-open{overflow:hidden}
 body.app-body .ph-mobile-bottom{display:grid;position:fixed;bottom:0;left:0;right:0;z-index:102;grid-template-columns:repeat(5,minmax(0,1fr));gap:0;min-height:61px;padding:5px 3px calc(5px + var(--ph-safe-bottom));background:#fff;border-top:1px solid #d8e3ef;box-shadow:0 -4px 16px #173c6121}
 body.app-body .ph-mobile-bottom :is(a,button){display:flex;align-items:center;justify-content:center;flex-direction:column;gap:2px;width:100%;min-height:46px;padding:2px 1px;background:transparent;border:0;border-radius:7px;font:600 10px/1.2 system-ui,Arial,sans-serif;text-align:center;color:#406080;text-decoration:none;cursor:pointer;touch-action:manipulation}
 body.app-body .ph-mobile-bottom .ph-mobile-ico{font-size:20px;line-height:22px}
 body.app-body .ph-mobile-bottom .is-current{background:#e9f2ff;color:#1457a0}
 body.app-body .ph-mobile-bottom :is(a,button):focus-visible{outline:2px solid #277ddd;outline-offset:-2px}
 body.app-body:has(.modal.open) .ph-mobile-bottom{display:none}
 body.app-body{padding-bottom:calc(68px + var(--ph-safe-bottom))!important}
 body.app-body .ph-context-header{display:block;padding:9px!important;margin-bottom:11px!important}
 body.app-body .ph-context-label{display:block;margin-bottom:6px}
 body.app-body .ph-context-scroll{display:flex;overflow-x:auto;gap:6px;-webkit-overflow-scrolling:touch;padding-bottom:3px}
 body.app-body .ph-context-scroll>a{flex:0 0 auto;padding:8px 10px;min-height:36px}
 body.app-body .panel-titlebar{min-height:43px;padding:10px 12px!important;gap:8px}
 body.app-body :is(.page-tools,.panel-titlebar .actions,.panel-footer,.pro-buttons){flex-wrap:wrap;gap:8px}
 body.app-body .page-tools .search{flex:1 1 200px;min-width:0;max-width:100%}
 body.app-body .page-tools .search input{min-width:0;width:100%}
 body.app-body .form-grid,body.app-body .invoice-form-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
 body.app-body .form-grid>.field,body.app-body .form-grid>.field.small,body.app-body .form-grid>.field.wide,body.app-body .invoice-form-grid>.field{grid-column:span 1;min-width:0;margin:0}
 body.app-body .form-grid>.field.full,body.app-body .invoice-form-grid>.field.full{grid-column:1/-1}
 body.app-body :is(.report-grid,.summary-columns,.phd-grid){grid-template-columns:1fr!important}
 body.app-body .classic-reports .rp-grid{grid-template-columns:1fr!important;gap:12px!important}
 body.app-body .modal-card{width:min(720px,calc(100vw - 16px));max-height:calc(100dvh - 90px);overflow:auto}
 body.app-body .totals-box{width:min(100%,350px)}
 body.app-body :is(.cp-form-head,.cp-payment,.cp-due-fields){grid-template-columns:repeat(2,minmax(0,1fr))}
 body.app-body .cp-edit-table{min-width:1280px!important}
 body.app-body .invoice-professional .compact-line-table-wrap{overflow:auto!important}
 body.app-body .invoice-professional .compact-line-table{min-width:700px!important}
 body.app-body .line-table{min-width:750px}
 body.app-body .table-wrap .data-table{min-width:740px}
 body.app-body .ph-mobile-table-hint{display:block;color:#4d6c8e;font-size:11px;line-height:1.3;background:#edf6ff;border:1px solid #dbe9f6;border-bottom:0;padding:5px 9px}
 body.app-body .ph-mobile-table-hint[hidden]{display:none!important}
 body.app-body .classic-register .panel-titlebar .actions{width:100%;margin:0!important}
 body.app-body .classic-register .actions form.search{flex:1;max-width:100%}
 body.app-body .classic-register .actions form.search input{width:100%!important;max-width:none;min-width:100px;flex:1}
 body.app-body .classic-register .table-wrap{overflow:auto!important}
 body.app-body .invoice-frame-wrap{max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch}
}
@media screen and (max-width:600px){
 body.app-body .shell,body.app-body:has(.invoice-professional) .shell{margin:5px 4px 12px!important}
 body.app-body .workspace,body.app-body:has(.invoice-professional) .workspace{padding:9px 7px 23px!important}
 body.app-body .panel-body,body.app-body .invoice-edit-body{padding:12px!important}
 body.app-body :is(.form-grid,.invoice-form-grid,.cp-form-head,.cp-payment,.cp-due-fields,.ph-quick-item-grid,.settings-grid,.pro-side-column){display:grid;grid-template-columns:minmax(0,1fr)!important}
 body.app-body .ph-customize-workspace .ph-module-grid{grid-template-columns:1fr!important}
 body.app-body .form-grid>.field,body.app-body .invoice-form-grid>.field{grid-column:1/-1!important}
 body.app-body :is(input:not([type=checkbox]):not([type=radio]):not([type=hidden]),select,textarea){font-size:16px;max-width:100%}
 body.app-body :is(.field input,.field select,.search input,.cp-form input,.cp-form select,.invoice-professional input,.invoice-professional select){min-height:40px}
 body.app-body .btn{min-height:38px}
 body.app-body .panel-footer{padding:12px}
 body.app-body .classic-register .actions form.search{width:100%;flex:1}
 body.app-body .classic-register .actions form.search input{height:40px!important;font-size:16px!important}
 body.app-body .classic-register .actions form.search button{height:40px!important;font-size:13px!important}
 body.app-body .classic-register .panel-titlebar :is(button,.btn){min-height:36px!important;font-size:12px!important}
 body.app-body :is(.kpi-row,.phd-stats){grid-template-columns:repeat(2,minmax(0,1fr))}
 body.app-body .kpi{padding:10px}
 body.app-body .kpi strong{font-size:17px}
 body.app-body .totals-box{width:100%;margin:10px 0 0}
 body.app-body .invoice-professional :is(.pro-transaction-grid,.pro-side-column,.pro-head-meta,.pro-info-fields,.quick-patient-grid){grid-template-columns:1fr!important}
 body.app-body .invoice-professional .compact-line-table{min-width:690px!important}
 body.app-body .cp-form form{padding:10px}
 body.app-body .cp-supplier-suggestions{max-height:46dvh}
 body.app-body :is(.cp-suggestions,.autocomplete-results){max-width:calc(100vw - 28px)}
 body.app-body :is(.cp-live-payment,.cp-summary-strip){padding:10px;gap:8px}
 body.app-body .cp-summary{flex-wrap:wrap}
 body.app-body .pagination{flex-wrap:wrap;justify-content:center}
}
@media screen and (max-width:365px){body.app-body .ph-mobile-bottom :is(a,button){font-size:9px}body.app-body :is(.kpi-row,.phd-stats){grid-template-columns:1fr}}
@media (prefers-reduced-motion:reduce){body.app-body :is(.sidebar,.ph-mobile-drawer-shade){transition:none!important}}
@media print{body.app-body :is(.ph-mobile-bottom,.ph-mobile-drawer-shade,.ph-mobile-table-hint){display:none!important}body.app-body{padding-bottom:0!important}}


/* V3 Mobile inventory: server-rendered cards default, unchanged desktop table.
   CSS is intentional: display mode never relies on JS to create/read the rows. */
body.app-body .ph-inv-server-switch,
body.app-body .ph-inv-server-cards {display:none}
@media screen and (max-width:900px){
 body.app-body .inventory-list .ph-inv-server-switch{display:flex!important;align-items:center;flex-wrap:wrap;gap:8px;padding:12px;background:#f5f8fd;border-bottom:1px solid #dde7f3}
 body.app-body .inventory-list .ph-inv-switch-btn{border:1px solid #b9cfe5;border-radius:9px;min-height:42px;padding:8px 12px;background:#fff;font-weight:700;color:#244c77;font-size:13px;white-space:nowrap;cursor:pointer}
 body.app-body .inventory-list .ph-inv-switch-btn[aria-pressed="true"]{background:#1469c1;color:#fff;border-color:#1469c1}
 body.app-body .inventory-list .ph-inv-switch-hint{font-size:11px;color:#647c91;flex:1 1 100%;line-height:1.5}
 body.app-body .inventory-list:not(.ph-inventory-table-view) .table-wrap{display:none!important}
 body.app-body .inventory-list .ph-inv-server-cards{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;padding:12px;background:#f3f7fb;max-width:100%;min-width:0}
 body.app-body .inventory-list.ph-inventory-table-view .ph-inv-server-cards{display:none!important}
 body.app-body .inventory-list.ph-inventory-table-view .table-wrap{display:block!important;width:100%!important;max-width:100%!important;overflow-x:auto!important;-webkit-overflow-scrolling:touch;overscroll-behavior-x:contain}
 body.app-body .inventory-list.ph-inventory-table-view .table-wrap>.data-table{table-layout:fixed!important;width:1640px!important;min-width:1640px!important;max-width:none!important}
 body.app-body .inventory-list.ph-inventory-table-view .data-table th{white-space:nowrap!important;word-break:normal!important;overflow-wrap:normal!important;font-size:11px!important;line-height:1.35!important}
 body.app-body .inventory-list.ph-inventory-table-view .data-table th .inv-sort-heading{white-space:nowrap!important;word-break:normal!important;overflow-wrap:normal!important}
 body.app-body .inventory-list.ph-inventory-table-view .data-table th:nth-child(1){width:42px!important}
 body.app-body .inventory-list.ph-inventory-table-view .data-table th:nth-child(2){width:78px!important}
 body.app-body .inventory-list.ph-inventory-table-view .data-table th:nth-child(3){width:90px!important}
 body.app-body .inventory-list.ph-inventory-table-view .data-table th:nth-child(4){width:240px!important}
 body.app-body .inventory-list.ph-inventory-table-view .data-table th:nth-child(5){width:205px!important}
 body.app-body .inventory-list.ph-inventory-table-view .data-table th:nth-child(6){width:160px!important}
 body.app-body .inventory-list.ph-inventory-table-view .data-table th:nth-child(7){width:115px!important}
 body.app-body .inventory-list.ph-inventory-table-view .data-table th:nth-child(8){width:140px!important}
 body.app-body .inventory-list.ph-inventory-table-view .data-table th:nth-child(9){width:120px!important}
 body.app-body .inventory-list.ph-inventory-table-view .data-table th:nth-child(10){width:90px!important}
 body.app-body .inventory-list.ph-inventory-table-view .data-table th:nth-child(11){width:90px!important}
 body.app-body .inventory-list.ph-inventory-table-view .data-table th:nth-child(12){width:90px!important}
 body.app-body .inventory-list.ph-inventory-table-view .data-table th:nth-child(13){width:90px!important}
 body.app-body .inventory-list.ph-inventory-table-view .data-table th:nth-child(14){width:90px!important}
 body.app-body .ph-inv-server-card{min-width:0;max-width:100%;border:1px solid #d6e2ef;border-radius:12px;background:#fff;padding:13px;box-shadow:0 1px 4px #1638590d;box-sizing:border-box}
 body.app-body .ph-inv-server-heading{display:flex;align-items:flex-start;gap:10px;min-width:0}
 body.app-body .ph-inv-server-pick{width:22px;height:22px;flex:none;accent-color:#1871c9;margin:2px 0 0}
 body.app-body .ph-inv-server-name-group{flex:1;min-width:0}
 body.app-body .ph-inv-server-number{display:block;color:#607b95;font-size:11px;line-height:1.4;font-weight:700;margin-bottom:4px}
 body.app-body .ph-inv-server-name{display:block;color:#155da7;font-size:16px;font-weight:750;line-height:1.4;text-decoration:none;overflow-wrap:break-word;word-break:normal;white-space:normal}
 body.app-body .ph-inv-server-edit{flex:none;display:inline-flex;align-items:center;justify-content:center;border-radius:8px;border:1px solid #b8cde3;padding:7px 11px;min-height:35px;box-sizing:border-box;background:#f8fbff;color:#185997;font-weight:700;font-size:13px;text-decoration:none}
 body.app-body .ph-inv-server-company{padding:9px 0;color:#455c72;font-size:12px;line-height:1.45;overflow-wrap:break-word}
 body.app-body .ph-inv-server-company span{color:#657e95}
 body.app-body .ph-inv-server-stats{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:7px}
 body.app-body .ph-inv-server-stat{padding:9px 7px;background:#f0f5fb;border-radius:8px;min-width:0;box-sizing:border-box}
 body.app-body .ph-inv-server-stat span{display:block;font-size:11px;color:#617992;line-height:1.3}
 body.app-body .ph-inv-server-stat strong{display:block;font-variant-numeric:tabular-nums;font-size:14px;font-weight:750;color:#203b5a;margin-top:4px;line-height:1.35;overflow-wrap:break-word}
 body.app-body .ph-inv-server-stock{background:#e8f3ff}
 body.app-body .ph-inv-server-details{margin-top:10px;border-top:1px solid #e4edf6;padding-top:7px}
 body.app-body .ph-inv-server-details summary{padding:6px 0;cursor:pointer;color:#1460aa;font-weight:700;font-size:12px}
 body.app-body .ph-inv-server-details dl{margin:4px 0}
 body.app-body .ph-inv-server-details dl>div{display:grid;grid-template-columns:105px minmax(0,1fr);gap:8px;padding:7px 0;border-top:1px solid #edf2f7;font-size:12px;line-height:1.45}
 body.app-body .ph-inv-server-details dt{color:#657e91}
 body.app-body .ph-inv-server-details dd{margin:0;color:#25405d;overflow-wrap:break-word;min-width:0}
 body.app-body .ph-inv-server-detail-link{display:inline-block;margin:8px 0 2px;color:#1161aa;font-weight:700;font-size:12px}
 body.app-body .ph-inv-server-empty{grid-column:1/-1;text-align:center;padding:18px;margin:0;background:white;border-radius:9px}
 body.app-body .inventory-list .inventory-sort-tools{flex-wrap:wrap;gap:7px;padding:10px}
}
@media screen and (max-width:650px){
 body.app-body .inventory-list .ph-inv-server-cards{grid-template-columns:minmax(0,1fr)}
 body.app-body .inventory-list .panel-titlebar{height:auto!important;display:flex!important;flex-wrap:wrap;gap:9px;padding:12px!important}
 body.app-body .inventory-list .panel-titlebar .actions{display:block!important;flex:1 1 100%;max-width:100%!important;margin:0!important}
 body.app-body .inventory-list form.inventory-live-search{display:flex!important;gap:8px!important;align-items:stretch;width:100%;max-width:100%;min-width:0}
 body.app-body .inventory-list form.inventory-live-search>input[name="q"]{min-width:0!important;width:1%!important;flex:1 1 0!important;max-width:none!important}
 body.app-body .inventory-list form.inventory-live-search>.btn{flex:0 0 auto}
 body.app-body .inventory-list .inventory-sort-tools .inv-sort-note{flex-basis:100%}
}
@media print{
 body.app-body .inventory-list .ph-inv-server-switch,body.app-body .inventory-list .ph-inv-server-cards{display:none!important}
 body.app-body .inventory-list .table-wrap{display:block!important}
}
