/* SDR v5.7 mobile-only presentation. All ERP data/action code stays unchanged. */
.mobile-topbar,.mobile-shade{display:none}
@media(max-width:700px){
  html,body{width:100%;max-width:100%;overflow-x:hidden}
  body{font-size:14px;-webkit-text-size-adjust:100%}
  .app{display:block;min-height:100dvh}
  .app main{padding:0 13px 90px;width:100%;min-width:0}
  .mobile-topbar{display:flex;position:sticky;top:0;z-index:35;min-height:58px;align-items:center;gap:11px;margin:0 -13px 16px;padding:9px 14px;background:#142c47;color:white;box-shadow:0 2px 10px #142c4722}
  .mobile-topbar strong{font-size:15px;letter-spacing:-.25px}
  .mobile-topbar-mark{margin-left:auto;font-size:11px;color:#b6d0e8}
  #mobile-menu-open{background:#284967;border:1px solid #55718e;color:white;border-radius:9px;padding:5px;width:40px;height:40px;font-size:23px;line-height:1;flex:0 0 auto}
  .mobile-shade:not([hidden]){display:block;position:fixed;inset:0;background:#061728a8;z-index:79}
  .app .sidebar{position:fixed;left:0;top:0;bottom:0;width:min(304px,86vw);height:100dvh;min-height:0;overflow-y:auto;overscroll-behavior:contain;z-index:80;display:flex;flex-direction:column;padding:23px 13px;transform:translateX(-110%);transition:transform .18s ease;box-shadow:8px 0 35px #0d243c4d}
  .app.mobile-nav-open .sidebar{transform:translateX(0)}
  .app .sidebar nav{display:grid;overflow:visible;gap:4px;padding-bottom:16px}
  .app .sidebar nav button{white-space:normal;padding:11px 13px;min-height:42px}
  .app .sidebar-bottom{display:block;margin-top:auto;padding-bottom:10px}
  .app header{margin:0 0 14px;gap:8px;align-items:flex-start}
  .app header h1{font-size:22px;line-height:1.25}
  .app header p{font-size:11px;line-height:1.5;margin-top:6px}
  .app header .tag{font-size:10px;white-space:nowrap;padding:5px 8px}
  .metrics{grid-template-columns:repeat(2,minmax(0,1fr));gap:9px}
  .metric,.panel{padding:13px;border-radius:11px}
  .metric b{font-size:23px}.rules{grid-template-columns:1fr 1fr;gap:8px}
  .toolbar{display:flex;flex-direction:column;align-items:stretch;gap:9px}
  .toolbar input,.toolbar select,.toolbar button{width:100%;min-width:0;max-width:100%}
  button.primary,button.ghost{min-height:40px}
  input,select,textarea{font-size:16px;min-height:42px}
  .form-grid{grid-template-columns:minmax(0,1fr);gap:12px}
  .form-grid .wide{grid-column:auto}
  .table-scroll{max-height:none;overflow-x:auto;overflow-y:auto;-webkit-overflow-scrolling:touch;border-radius:10px}
  .table-scroll table{min-width:850px} .table-scroll table.sdr-resizable-table{min-width:850px!important}
  .pagination{flex-wrap:wrap}
  .toast{left:12px;right:12px;max-width:none;top:66px}
  dialog{max-width:calc(100vw - 20px);width:calc(100vw - 20px);max-height:calc(100dvh - 30px)}
  #modal-body{padding:14px;max-height:65dvh;overflow-x:auto}
  .modal-head{padding:15px}.modal-actions{padding:11px;flex-wrap:wrap}
  .modal-actions button{min-height:42px}
  .batch-receipt-controls,.batch-receipt-stock,.batch-dispatch-fields,.split-row{grid-template-columns:minmax(0,1fr)!important}
  .perm-page-grid{grid-template-columns:1fr}
  #page-purchases .purchase-filter-grid{grid-template-columns:minmax(0,1fr)!important;gap:9px}
  #page-purchases .purchase-filter-card,#page-purchases .purchase-action-card,#page-purchases .purchase-selection-card{padding:13px}
  #page-purchases .purchase-action-primary,#page-purchases .purchase-action-files,#page-purchases .purchase-operation-buttons{width:100%;display:grid;grid-template-columns:1fr;gap:8px}
  #page-purchases .purchase-action-files{border-left:0;padding:10px 0 0;border-top:1px solid #e5ecf2}
  #page-purchases .purchase-action-row button,#page-purchases .purchase-download-link{width:100%;justify-content:center;min-height:42px}
  #page-purchases .purchase-select-buttons{display:grid;grid-template-columns:1fr 1fr;width:100%;gap:7px}
  #page-purchases .purchase-select-buttons button{min-width:0;padding:8px 5px}
  #page-purchases .purchase-totals{align-items:flex-start}
  #page-purchases .purchase-table-note{margin-left:0}
  /* Dense grids only in read-only inventory & history: preserve existing rows, cells, buttons and IDs. */
  #page-items .table-scroll,#page-movements .table-scroll{border:0;background:transparent;overflow:visible;max-height:none}
  #inventory-items-table,#page-movements .table-scroll table{display:block!important;width:100%!important;min-width:0!important;table-layout:auto!important}
  #inventory-items-table thead,#page-movements .table-scroll thead{display:none!important}
  #inventory-items-table tbody,#page-movements .table-scroll tbody{display:grid!important;gap:11px}
  #inventory-items-table tbody tr,#page-movements .table-scroll tbody tr{display:grid!important;grid-template-columns:1fr 1fr;gap:7px 9px;padding:14px;background:white!important;border:1px solid #dce6f1;border-radius:12px;box-shadow:0 2px 8px #1934510a;min-width:0!important;width:100%!important}
  #inventory-items-table tbody td,#page-movements .table-scroll tbody td{display:block!important;position:relative;min-width:0!important;width:auto!important;height:auto!important;max-width:100%!important;overflow-wrap:anywhere;white-space:normal!important;text-overflow:clip!important;border:0!important;background:transparent!important;padding:0!important;font-size:13px;line-height:1.45}
  #inventory-items-table tbody td::before,#page-movements .table-scroll tbody td::before{display:block;color:#6e8196;font-size:10px;letter-spacing:.1px;font-weight:700;margin-bottom:2px}
  #inventory-items-table tbody td:nth-child(1),#page-movements .table-scroll tbody td:nth-child(3){grid-column:1/-1;font-size:16px;font-weight:800;color:#15375b;padding-bottom:6px!important;border-bottom:1px solid #ecf1f7!important}
  #inventory-items-table tbody td:nth-child(7),#inventory-items-table tbody td:nth-child(8),#page-movements .table-scroll tbody td:nth-child(8){grid-column:1/-1}
  #inventory-items-table tbody td:nth-child(1)::before{content:'품목명'}
  #inventory-items-table tbody td:nth-child(2)::before{content:'PART NO.'}
  #inventory-items-table tbody td:nth-child(3)::before{content:'메이커'}
  #inventory-items-table tbody td:nth-child(4)::before{content:'장비 / 모델'}
  #inventory-items-table tbody td:nth-child(5)::before{content:'신품 재고'}
  #inventory-items-table tbody td:nth-child(6)::before{content:'중고 · 점검'}
  #inventory-items-table tbody td:nth-child(7)::before{content:'구매처별 매입단가'}
  #inventory-items-table tbody td:nth-child(8)::before{content:'품목 수정'}
  #page-movements .table-scroll tbody td:nth-child(1)::before{content:'거래일'}
  #page-movements .table-scroll tbody td:nth-child(2)::before{content:'구분'}
  #page-movements .table-scroll tbody td:nth-child(3)::before{content:'품목명'}
  #page-movements .table-scroll tbody td:nth-child(4)::before{content:'수량'}
  #page-movements .table-scroll tbody td:nth-child(5)::before{content:'선박'}
  #page-movements .table-scroll tbody td:nth-child(6)::before{content:'PJ NO.'}
  #page-movements .table-scroll tbody td:nth-child(7)::before{content:'LOT'}
  #page-movements .table-scroll tbody td:nth-child(8)::before{content:'비고'}
  #inventory-items-table tbody td button,#page-movements .table-scroll tbody td button{max-width:100%;white-space:normal}
  @media(max-width:380px){#inventory-items-table tbody tr,#page-movements .table-scroll tbody tr{grid-template-columns:1fr}}
}
@media(prefers-reduced-motion:reduce){.app .sidebar{transition:none!important}}
