/* R15 – item card (tabs, stock & warehouses, history) and barcode labels (designer, QR, A4 sheets) */
.item-tabs { margin-bottom: 0; }
.item-tabs .tab .chip { margin-inline-start: 6px; }
.item-card { margin: 0; min-width: 0; }
.item-section-title { font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 4px 0 -4px; }
.item-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.item-facts .fact { border: 1px solid var(--border); border-radius: var(--radius-sm, 8px); padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.item-facts .fact span { font-size: 12px; color: var(--muted); }
.item-facts .fact strong { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-photo { width: 160px; height: 160px; border: 1px solid var(--border); border-radius: var(--radius-sm, 8px); object-fit: contain; background: #fff; }
.item-photo-empty { width: 160px; height: 160px; border: 1px dashed var(--border); border-radius: var(--radius-sm, 8px); display: flex; align-items: center; justify-content: center; color: var(--muted); text-align: center; padding: 12px; font-size: 13px; }
.item-media { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.item-media .grow { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.pic-list { display: flex; gap: 10px; flex-wrap: wrap; }
.pic-pick { border: 2px solid var(--border); border-radius: 8px; padding: 2px; background: #fff; cursor: pointer; width: 76px; height: 76px; }
.pic-pick img { width: 100%; height: 100%; object-fit: contain; }
.pic-pick.on { border-color: var(--primary); }
.bc-preview { width: 220px; height: 70px; background: #fff; padding: 4px; border: 1px solid var(--border); border-radius: 6px; }
.bc-preview .barcode-svg { width: 100%; height: 100%; }
.bc-ok { color: var(--primary); font-size: 12px; }
.bc-bad { color: var(--danger); font-size: 12px; }
.scale-box { border: 1px dashed var(--border); border-radius: var(--radius-sm, 8px); padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.table-scroll .grid input, .table-scroll .grid select { min-width: 84px; }
.table-scroll .grid input.wide { min-width: 140px; }
.muted-row td { opacity: .65; }
.label-designer { display: flex; flex-direction: column; gap: 12px; }
.preset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.preset { border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; background: var(--surface); color: var(--text); text-align: start; cursor: pointer; font: inherit; display: flex; flex-direction: column; gap: 2px; }
.preset small { color: var(--muted); }
.preset.on { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.label-line { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--row-line, var(--border)); }
.label-line .ll-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.label-line .ll-opts { display: flex; gap: 6px; flex-wrap: wrap; }
.label-line select, .label-line input[type=date] { height: 30px; font-size: 13px; }
/* QR labels: symbol on the start side, text next to it */
.blabel-qr .bl-qr-row { flex: 1 1 auto; min-height: 0; display: flex; gap: 1.5mm; align-items: center; }
.blabel-qr .bl-qr { flex: 0 0 auto; height: 100%; aspect-ratio: 1 / 1; }
.blabel-qr .bl-qr .barcode-svg { width: 100%; height: 100%; }
.blabel-qr .bl-qr-text { display: flex; flex-direction: column; gap: .6mm; min-width: 0; font-size: 2.4mm; overflow: hidden; }
.bl-exp { white-space: nowrap; }
.label-sheet.sheets { display: block; }
.label-page { display: grid; justify-content: start; align-content: start; }
.label-page + .label-page { margin-top: 6mm; }
.blabel.blank { border-style: dotted; opacity: .35; }
@media print {
    .label-page + .label-page { margin-top: 0; }
    .label-page { break-after: page; }
    .label-page:last-child { break-after: auto; }
    .blabel.blank { visibility: hidden !important; }
}
@media (max-width: 900px) {
    .item-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .label-line { grid-template-columns: minmax(0, 1fr) auto; }
}

/* R20 two-stage inventory posting: stock posting → accounting posting (voucher editors, pending accounting posting screen) */
.posting-stages { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 4px 0 12px; }
.posting-stage { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; background: var(--surface); }
.posting-stage.done { border-color: color-mix(in srgb, var(--green, #1a7f4b) 45%, var(--border)); }
.posting-stage.waiting { border-color: color-mix(in srgb, var(--amber, #b7791f) 55%, var(--border)); }
.posting-stage .ps-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.posting-stage .ps-head strong { flex: 1; min-width: 0; }
.posting-stage .ps-step { width: 22px; height: 22px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 12px; font-weight: 700;
    background: var(--primary); color: #fff; flex: none; }
.posting-stage .ps-meta { color: var(--muted); font-size: .88em; }
.gl-type-totals { display: flex; flex-wrap: wrap; gap: 8px; }
.gl-type-totals button { border: 1px solid var(--border); border-radius: 999px; background: var(--surface); padding: 6px 12px; cursor: pointer; font: inherit; }
.gl-type-totals button.on { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.gl-type-totals .muted { margin-inline-start: 6px; }
.grid tr.gl-ok td { background: color-mix(in srgb, var(--green-bg, #e3f5ec) 60%, transparent); }
.grid tr.gl-fail td { background: color-mix(in srgb, var(--red-bg, #fde8e8) 60%, transparent); }
@media (max-width: 760px) { .posting-stages { grid-template-columns: 1fr; } }
/* R22 posting settings: resolved preview and kind groups; document stock journals */
.pr-group td { background: var(--gray-bg); color: var(--gray-fg); font-weight: 700; }
.pv-side { display: flex; flex-direction: column; gap: 2px; font-size: .88em; line-height: 1.35; }
.pv-side .pv-dc { font-weight: 700; margin-inline-end: 4px; }
.pv-side .pv-from { color: var(--muted); font-size: .9em; }
.pr-inv { color: var(--muted); font-size: .88em; }
.sj-lines { margin-top: 6px; }
.sj-lines summary { cursor: pointer; color: var(--primary); font-size: .9em; }
/* R23 posting settings: the only source of the inventory journals' accounts – one block per movement, stacked on a phone */
.pr-gaps { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.pr-gaps ul { margin: 0; padding-inline-start: 18px; display: grid; gap: 2px; }
.pr-gaps .link-btn { color: inherit; text-align: start; padding: 0; }
.pr-group-title { margin: 0; padding: 8px 12px; background: var(--gray-bg); color: var(--gray-fg); font-size: .95em; }
.pr-kind { display: grid; grid-template-columns: minmax(170px, 1fr) minmax(0, 2fr) minmax(200px, 1.3fr); gap: 12px; padding: 12px; border-top: 1px solid var(--border); align-items: start; }
.pr-kind-head { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pr-kind-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 8px; min-width: 0; }
.pr-kind-fields .check { grid-column: 1 / -1; }
.pr-kind-preview { display: flex; flex-direction: column; gap: 4px; min-width: 0; overflow-wrap: anywhere; }
.pr-wh td:last-child { min-width: 220px; }
@media (max-width: 900px) { .pr-kind { grid-template-columns: 1fr; } }
/* R24 posting screens layout: no overlapping columns – fixed-content cells never wrap, names wrap or clip with a tooltip, numbers are
   isolated LTR runs with tabular digits, wide lists scroll inside their wrapper and the setting blocks stack on a phone */
.gl-type-totals button { display: inline-flex; align-items: baseline; flex-wrap: wrap; gap: 2px 8px; max-width: 100%; text-align: start; color: var(--text); }
.gl-type-totals .muted { margin-inline-start: 0; }
.gl-type-totals .mono, .gl-type-totals .muted, .gl-pending td.num, .gl-result td.mono, .sj-lines td.num, .gl-amt { unicode-bidi: isolate; font-variant-numeric: tabular-nums; }
.grid td.sel input[type=checkbox], .table-scroll .grid input[type=checkbox], .table-scroll .grid input[type=radio] { min-width: 0; min-height: 0; width: 18px; height: 18px; padding: 0; margin: 0; accent-color: var(--primary); }
.grid td.sel, .grid th.sel { width: 36px; text-align: center; }
.gl-pending { min-width: 980px; }
.gl-pending th, .gl-pending td { padding-inline: 8px; }
.gl-pending td { vertical-align: top; }
.gl-pending .gl-doc, .gl-result .gl-doc, .gl-date, .gl-when, .gl-vno { white-space: nowrap; }
.gl-pending .gl-doc a { font-size: 13px; }
.gl-pending .gl-type { min-width: 100px; }
.gl-pending .gl-wh { min-width: 140px; }
.gl-pending .gl-name { min-width: 100px; }
/* long names: wrap to two lines at most, the rest is cut with an ellipsis and shown in the title tooltip */
.gl-clip { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; }
.gl-pending .gl-when .muted { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gl-result { min-width: 560px; }
.gl-result td:last-child { min-width: 240px; }
.gl-gl { white-space: nowrap; }
.gl-list th, .gl-list td { padding-inline: 8px; }
.gl-list .gl-vno a { font-size: 13px; }
.gl-list .gl-sup { min-width: 140px; }
.gl-list .gl-gl .small .mono { font-size: 12px; }
.gl-list .gl-sup .muted { display: block; white-space: nowrap; }
.posting-stage { min-width: 0; }
.posting-stage .ps-meta { overflow-wrap: anywhere; }
.posting-stage .ps-head strong { flex: 1 1 auto; }
.posting-stage .ps-head .mono { white-space: nowrap; }
.sj-lines .grid { min-width: 420px; }
.sj-lines .sj-sku { white-space: nowrap; }
.sj-lines td.sj-item { min-width: 180px; }
.pr-head { flex-wrap: wrap; }
@media (min-width: 901px) { .pr-kind { grid-template-columns: minmax(150px, .8fr) minmax(0, 2.2fr) minmax(200px, 1.2fr); } }
.pr-kind-fields { grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
.pr-kind-fields .acc-pick, .pr-kind-fields .field.compact { min-width: 0; }
.pr-wh td:first-child { min-width: 200px; }
@media (max-width: 760px) {
    .posting-stages { grid-template-columns: minmax(0, 1fr); }
    .form-grid.pr-modes { grid-template-columns: minmax(0, 1fr); }
    .pr-wh thead { display: none; }
    .pr-wh, .pr-wh tbody, .pr-wh tr, .pr-wh td { display: block; width: 100%; }
    .pr-wh tr { padding: 8px 0; border-bottom: 1px solid var(--row-line); }
    .pr-wh td { padding: 4px 0; border-bottom: 0; }
    .pr-wh td:first-child, .pr-wh td:last-child { min-width: 0; }
    .pr-wh td .acc-pick { min-width: 0; }
}
