/* SARA-64 step 3: list/form hierarchy; printed documents do not use this layer. */
@media screen{
 .session-dialog{width:min(90vw,420px);max-width:90vw;padding:24px;border:1px solid var(--ui-line);border-radius:10px}
 .session-dialog::backdrop{background:rgb(0 0 0 / .45)}
 .catalog-pagination{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;margin:16px 0}
 .catalog-pagination>div{display:flex;align-items:center;gap:6px;flex-wrap:wrap}
 .catalog-pagination :is(a,span){display:inline-flex;align-items:center;justify-content:center;min-width:44px;min-height:44px;padding:8px;border:1px solid var(--ui-line);border-radius:6px}
 .catalog-pagination [aria-current=page]{background:var(--ui-brand);color:#fff}
 .catalog-pagination [aria-disabled=true]{color:var(--ui-muted)}
 .branch-hidden-badge{color:var(--ui-brand);font-weight:600}
 :root .staff-workspace:not(.view-pos){--control-height:44px}
 :root .staff-workspace:not(.view-pos)>.container{padding-top:var(--ui-space-16);padding-bottom:var(--ui-space-32)}
 :root .staff-workspace:not(.view-pos) .page-heading{margin-bottom:var(--ui-space-16)}
 :root .staff-workspace:not(.view-pos) :is(.page-heading p,.page-heading .eyebrow){margin:0 0 var(--ui-space-8)}
 :root .staff-workspace:not(.view-pos) .card{padding:var(--ui-space-16);margin:var(--ui-space-16) 0;border-color:var(--ui-line);box-shadow:none}
 :root .staff-workspace:not(.view-pos) .card>h2{margin:0 0 var(--ui-space-12);font-size:var(--ui-text-20);font-weight:500}
 :root .staff-workspace:not(.view-pos) :is(.form-grid,.inline-form,.search-form){gap:var(--ui-space-16);align-items:end;margin-bottom:var(--ui-space-16)}
 :root .staff-workspace:not(.view-pos) :is(.form-grid,.inline-form,.search-form) label{font-size:var(--ui-text-14);font-weight:500;gap:var(--ui-space-8)}
 :root .staff-workspace:not(.view-pos)>.container :is(button,input:not([type=checkbox]):not([type=radio]):not([type=hidden]),select){min-height:44px;font-size:var(--ui-text-14)}
 :root .staff-workspace:not(.view-pos)>.container button:not(.primary):not(.small-button){font-weight:400}
 :root .staff-workspace:not(.view-pos) .table-wrap{border:1px solid var(--ui-line);border-radius:8px;background:var(--ui-surface);overflow:auto}
 :root .staff-workspace:not(.view-pos) .table-wrap table{margin:0;width:100%;border-collapse:collapse;font-size:var(--ui-text-14);line-height:1.5}
 :root .staff-workspace:not(.view-pos) .table-wrap :is(th,td){padding:var(--ui-space-8) var(--ui-space-12);border-color:var(--ui-line);vertical-align:middle;overflow-wrap:normal}
 :root .staff-workspace:not(.view-pos) .table-wrap th{height:48px;font-weight:500;background:var(--ui-canvas);color:var(--ui-ink)}
 :root .staff-workspace:not(.view-pos) .table-wrap tbody tr{height:48px}
 :root .staff-workspace:not(.view-pos) .table-wrap tbody tr:hover{background:var(--ui-subtle)}
 :root .staff-workspace:not(.view-pos) .table-wrap td strong{font-weight:500}
 :root .staff-workspace:not(.view-pos) .table-wrap small{display:block;font-size:var(--ui-text-13);font-weight:400;color:var(--ui-muted);line-height:1.5;margin-top:var(--ui-space-4)}
 :root .staff-workspace:not(.view-pos) .table-wrap :is(.numeric,[data-sort-type=number]){text-align:right;font-variant-numeric:tabular-nums}
 :root .staff-workspace:not(.view-pos) .table-wrap .numeric{white-space:nowrap}
 :root .staff-workspace:not(.view-pos) .table-wrap .numeric small{white-space:normal}
 :root .staff-workspace:not(.view-pos) .table-wrap input:is([inputmode=decimal],[type=number]){text-align:right}
 :root .staff-workspace:not(.view-pos) .table-wrap .table-sort{min-height:44px;font-size:var(--ui-text-14);font-weight:500;padding:var(--ui-space-8) 0}
 :root .staff-workspace:not(.view-pos) th[data-sort-type=number] .table-sort{justify-content:flex-end;text-align:right}
 :root :is(.view-products,.view-stock) .table-wrap table{min-width:1080px}
 :root :is(.view-products,.view-stock) .table-wrap :is(th,td):first-child{min-width:240px;max-width:360px;white-space:normal}
 :root :is(.view-products,.view-stock) .table-wrap :is(th,td):nth-child(3){min-width:160px}
 :root :is(.view-purchases,.view-payables,.view-receivables,.view-stock_ledger,.view-sales_history) .table-wrap table{min-width:940px}
 :root .staff-workspace:not(.view-pos) .report-grid{grid-template-columns:repeat(4,minmax(0,1fr));gap:var(--ui-space-12);margin:var(--ui-space-16) 0}
 :root .staff-workspace:not(.view-pos) :is(.report-grid,.dashboard-metrics,.dashboard-channel-grid) .card{margin:0;padding:var(--ui-space-16)}
 :root .staff-workspace:not(.view-pos) :is(.report-grid,.dashboard-metrics,.dashboard-channel-grid) :is(h2,h3){font-size:var(--ui-text-14);font-weight:500;line-height:1.5;margin:0 0 var(--ui-space-8)}
 :root .staff-workspace:not(.view-pos) :is(.report-grid,.dashboard-metrics,.dashboard-channel-grid) strong{font-size:var(--ui-text-20);font-weight:600;line-height:1.5}
 :root .view-product_branch_matrix .matrix-scroll{border-color:var(--ui-line);border-radius:8px}
 :root .view-product_branch_matrix .matrix-table{font-size:var(--ui-text-14);line-height:1.5}
 :root .view-product_branch_matrix .matrix-table :is(th,td){padding:var(--ui-space-8) var(--ui-space-12);border-color:var(--ui-line);vertical-align:middle}
 :root .view-product_branch_matrix .matrix-table th{background:var(--ui-canvas);font-weight:500}
 :root .view-product_branch_matrix .matrix-table th>button{min-height:44px;padding:var(--ui-space-8) 0;border:0;border-radius:0;background:transparent;color:var(--ui-ink);font-size:var(--ui-text-14);font-weight:500;white-space:normal;line-height:1.5}
 :root .view-product_branch_matrix .matrix-table th>button:hover{text-decoration:underline}
 :root .view-product_branch_matrix .matrix-bulk{flex-direction:row;gap:var(--ui-space-4);min-width:216px;margin-top:var(--ui-space-4)}
 :root .view-product_branch_matrix .matrix-bulk button{flex:1;min-height:44px;padding:var(--ui-space-4) var(--ui-space-8);border:1px solid var(--ui-line);border-radius:8px;background:var(--ui-surface);color:var(--ui-muted);font-size:var(--ui-text-13);font-weight:400;line-height:1.5;white-space:normal}
 :root .view-product_branch_matrix .matrix-bulk button:hover{background:var(--ui-subtle);color:var(--ui-ink)}
 :root .view-product_branch_matrix .matrix-table tbody tr{height:48px}
 :root .view-product_branch_matrix .matrix-table tbody tr:hover>td{background:var(--ui-subtle)}
 :root .view-product_branch_matrix .matrix-table td:first-child{min-width:240px;max-width:360px}
 :root .view-product_branch_matrix .matrix-table td:first-child small{font-size:var(--ui-text-13);font-weight:400;color:var(--ui-muted)}
 :root .view-product_branch_matrix .matrix-toggle{min-height:44px}
 @media(min-width:768px) and (max-width:1099px){:root .staff-workspace:not(.view-pos) .report-grid{grid-template-columns:repeat(3,minmax(0,1fr))}}
 @media(max-width:767px){
  :root .staff-workspace:not(.view-pos) .report-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  :root .staff-workspace:not(.view-pos) :is(.report-grid,.dashboard-metrics,.dashboard-channel-grid) .card{padding:var(--ui-space-12)}
 }
 @media(max-width:420px){:root .staff-workspace:not(.view-pos) .report-grid{grid-template-columns:minmax(0,1fr)}}
}

@media screen{
 :root .view-waste_report .table-wrap table{min-width:1080px}
 :root .view-products #product-branch-ticks table{min-width:1180px}
 :root .view-products #product-branch-ticks :is(th,td){padding-left:8px;padding-right:8px}
 :root .view-products #product-branch-ticks :is(th,td):first-child{min-width:180px}
 :root .view-products #product-branch-ticks :is(th,td):nth-child(3){min-width:120px}
 :root .view-products #product-branch-ticks th:has(a[href*="sort=branch_"]){text-align:center}
 :root .view-products #product-branch-ticks th a[href*="sort=branch_"]{justify-content:center;text-align:center;white-space:normal;overflow-wrap:anywhere}
 :root .view-products .branch-tick-cell{min-width:80px;text-align:center}
 :root .view-products .branch-tick-cell label{display:inline-flex;align-items:center;justify-content:center;min-width:44px;min-height:44px;cursor:pointer}
 :root .view-products .branch-tick-cell input{width:22px;height:22px;min-height:0;margin:0;accent-color:var(--ui-brand)}
 :root .view-reorder .table-wrap table{min-width:1120px}
 :root .view-reorder .table-wrap :is(th,td):nth-child(2){min-width:200px}
 :root .view-reorder .table-wrap :is(th,td):nth-child(4){min-width:160px}
 :root .view-stock_adjustment_detail .table-wrap table{min-width:780px}
 :root .view-stock_adjustment_detail .adjustment-value-total{text-align:right;font-size:var(--ui-text-16)}
 :root .view-stock_adjustment_detail .adjustment-value-total strong{color:var(--ui-brand);font-size:var(--ui-text-20)}
}

.audit-log pre{white-space:pre-wrap;overflow-wrap:anywhere;max-width:32rem}

/* Keep item identity above the count fields while walking the shop on a phone. */
@media(max-width:600px){
 .stock-count-table,.stock-count-table tbody,.stock-count-table tr,.stock-count-table td{display:block;width:100%;min-width:0;box-sizing:border-box}
 .stock-count-table thead{display:none}
 :root .view-stock_adjustment_form .table-wrap .stock-count-table tbody tr{height:auto;min-height:0;padding:14px;border-bottom:1px solid var(--border,#ddd)}
 .stock-count-table td{padding:7px 0;border:0;white-space:normal;overflow-wrap:anywhere}
 .stock-count-table td:first-child{font-weight:700;font-size:16px}
 .stock-count-table td:nth-child(2)::before{content:'ยอดในระบบ: ';font-weight:600}
 .stock-count-table td:nth-child(4)::before{content:'รวม: ';font-weight:600}
 .stock-count-table td input{width:100%;min-width:0!important}
}

/* SARA-80: shared data-table presentation; this stylesheet is screen-only. */
:root .staff-workspace table.data-table :is(th,td){border:1px solid var(--ui-line)}
:root .staff-workspace table.data-table :is(th,td)[data-table-align=left]{text-align:left}
:root .staff-workspace table.data-table :is(th,td)[data-table-align=right]{text-align:right;font-variant-numeric:tabular-nums}
:root .staff-workspace table.data-table :is(th,td)[data-table-align=center]{text-align:center}
:root .staff-workspace table.data-table th[data-table-align] :is(.table-sort,[data-matrix-sort]){width:100%;text-align:inherit}
:root .staff-workspace table.data-table th[data-table-align=left] :is(.table-sort,[data-matrix-sort]){justify-content:flex-start}
:root .staff-workspace table.data-table th[data-table-align=right] :is(.table-sort,[data-matrix-sort]){justify-content:flex-end}
:root .staff-workspace table.data-table th[data-table-align=center] :is(.table-sort,[data-matrix-sort]){justify-content:center}


/* SARA-75: make the editable name use its column; keep the row selector compact. */
[data-selected-batch] [data-batch-field="name"]{width:100%;min-width:12rem}
[data-selected-batch] [data-batch-field="sort_order"]{width:7rem}
[data-selected-batch] th:first-child{width:8rem}

:root .view-sales_history .sale-void-all { display: inline-block; white-space: nowrap; }
