/* MultiTex Stock Manager · web
   Indigo-dye accent on a cool greige page; one family (IBM Plex Sans) with tabular figures; compact density. */

@font-face { font-family: "Plex"; font-weight: 400; font-display: swap; src: url("../fonts/plex-400.woff2") format("woff2"); }
@font-face { font-family: "Plex"; font-weight: 500; font-display: swap; src: url("../fonts/plex-500.woff2") format("woff2"); }
@font-face { font-family: "Plex"; font-weight: 600; font-display: swap; src: url("../fonts/plex-600.woff2") format("woff2"); }

:root {
    --page: #F3F4F2;
    --surface: #FFFFFF;
    --ink: #1B2430;
    --muted: #5B6573;
    --line: #DCE0E3;
    --line-soft: #ECEEEF;
    --indigo: #1F4E8C;
    --indigo-deep: #16325A;
    --indigo-wash: #E6EDF6;
    --focus: #7D9CC7;
    --rail-text: #D9E2EE; --rail-muted: #8496AE; --rail-group: #8FA4C0; --rail-mark: #8DB4E8;
    --on-accent: #FFFFFF;
    --accent-rgb: 31, 78, 140;
    --ok: #2E7D4F;   --ok-wash: #E3F1E8;
    --warn: #9A5B00; --warn-wash: #FBEBD3;
    --bad: #B3261E;  --bad-wash: #FBE6E4;
    --rail-w: 248px;

    --bs-body-font-family: "Plex", "Segoe UI", system-ui, sans-serif;
    --bs-body-font-size: .875rem;
    --bs-body-color: var(--ink);
    --bs-body-bg: var(--page);
    --bs-primary: var(--indigo);
    --bs-primary-rgb: var(--accent-rgb);
    --bs-link-color: var(--indigo);
    --bs-link-color-rgb: var(--accent-rgb);
    --bs-link-hover-color: var(--indigo-deep);
    --bs-border-color: var(--line);
    --bs-border-radius: .375rem;
    --bs-secondary-color: var(--muted);
}

body { font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-weight: 600; letter-spacing: -.01em; }
:focus-visible { outline: 2px solid var(--indigo); outline-offset: 2px; }

/* ---------- buttons & forms (compact) ---------- */
.btn { --bs-btn-padding-y: .3rem; --bs-btn-padding-x: .75rem; --bs-btn-font-size: .875rem; font-weight: 500; }
.btn-primary { --bs-btn-color: var(--on-accent); --bs-btn-hover-color: #fff; --bs-btn-active-color: #fff; --bs-btn-disabled-color: var(--on-accent); --bs-btn-bg: var(--indigo); --bs-btn-border-color: var(--indigo); --bs-btn-hover-bg: var(--indigo-deep); --bs-btn-hover-border-color: var(--indigo-deep); --bs-btn-active-bg: var(--indigo-deep); --bs-btn-disabled-bg: var(--indigo); --bs-btn-disabled-border-color: var(--indigo); }
.btn-outline-secondary { --bs-btn-color: var(--ink); --bs-btn-border-color: var(--line); --bs-btn-hover-bg: var(--indigo-wash); --bs-btn-hover-color: var(--indigo-deep); --bs-btn-hover-border-color: var(--focus); --bs-btn-active-bg: var(--indigo-wash); --bs-btn-active-color: var(--indigo-deep); background: var(--surface); }
.btn-outline-danger { background: var(--surface); }
.btn-icon { border: 0; font-size: 1.35rem; line-height: 1; padding: .25rem .4rem; color: var(--ink); }
.form-control, .form-select { font-size: .875rem; padding: .3rem .55rem; border-color: var(--line); background-color: var(--surface); }
.form-select { padding-right: 2rem; background-position: right .55rem center; }
.form-control[readonly], .form-select:disabled, .form-control:disabled { background-color: #F1F2F0; color: #4A5462; }
.ts-wrapper.disabled .ts-control { background-color: #F1F2F0; opacity: 1; }
.ts-control, .ts-wrapper.single .ts-control { background-color: var(--surface); }
.form-control:focus, .form-select:focus { border-color: var(--focus); box-shadow: 0 0 0 .2rem rgba(var(--accent-rgb),.15); }
.form-label { font-weight: 500; margin-bottom: .2rem; color: var(--ink); }
.form-text { color: var(--muted); font-size: .8rem; margin-top: .15rem; }
.form-check-input:checked { background-color: var(--indigo); border-color: var(--indigo); }
.required-mark { color: var(--bad); margin-left: .15rem; }
.is-invalid ~ .ts-wrapper .ts-control, .ts-wrapper.is-invalid .ts-control { border-color: var(--bad); }

/* searchable dropdowns */
.ts-wrapper.form-select { padding: 0; border: 1px solid var(--line); border-radius: var(--bs-border-radius); background-color: var(--surface); }
.ts-wrapper.form-select .ts-control { padding-right: 2rem; }
.ts-wrapper.form-select.focus { border-color: var(--focus); box-shadow: 0 0 0 .2rem rgba(var(--accent-rgb),.15); }
.ts-wrapper.form-select.disabled { background-color: #F1F2F0; }
.ts-wrapper.form-select.is-invalid, .is-invalid ~ .ts-wrapper.form-select { border-color: var(--bad); }
.ts-control { min-height: calc(1.5em + .6rem + 2px); padding: .3rem .55rem; border-color: var(--line); font-size: .875rem; }
.ts-dropdown { font-size: .875rem; }
.lookup { display: flex; gap: .35rem; align-items: stretch; }
.lookup > .ts-wrapper, .lookup > select { flex: 1 1 auto; min-width: 0; }
.lookup .btn-add { flex: 0 0 auto; padding: 0 .55rem; }

/* ---------- application frame ---------- */
body.app { display: flex; min-height: 100vh; }
.rail { width: var(--rail-w); background: var(--indigo-deep); color: var(--rail-text); flex: 0 0 var(--rail-w); }
@media (min-width: 992px) {
    /* Bootstrap makes .offcanvas-lg transparent on wide screens; the rail keeps its indigo */
    .rail.offcanvas-lg { position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; background-color: var(--indigo-deep) !important; }
}
.rail.offcanvas-lg { --bs-offcanvas-width: 280px; --bs-offcanvas-bg: var(--indigo-deep); }
.rail-brand { display: flex; align-items: center; justify-content: space-between; padding: .9rem 1rem .8rem; border-bottom: 1px solid rgba(255,255,255,.08); }
.rail-home { display: flex; align-items: center; gap: .6rem; color: #fff; text-decoration: none; font-weight: 600; font-size: 1rem; line-height: 1.2; }
.rail-logo { height: 30px; width: auto; border-radius: 4px; background: #fff; padding: 2px; }
.rail-nav { padding: .5rem .5rem 2rem; overflow-y: auto; }
.rail-link, .rail-module > summary { display: flex; align-items: center; gap: .65rem; padding: .45rem .6rem; border-radius: .375rem; color: var(--rail-text); text-decoration: none; cursor: pointer; font-weight: 500; }
.rail-link i, .rail-module > summary i { font-size: 1.05rem; opacity: .85; width: 1.1rem; text-align: center; }
.rail-link:hover, .rail-module > summary:hover { background: rgba(255,255,255,.07); color: #fff; }
.rail-link.active { background: rgba(255,255,255,.12); color: #fff; }
.rail-module > summary { list-style: none; }
.rail-module > summary::-webkit-details-marker { display: none; }
.rail-module > summary::after { content: "\F282"; font-family: "bootstrap-icons"; margin-left: auto; font-size: .7rem; opacity: .6; transition: transform .15s; }
.rail-module[open] > summary::after { transform: rotate(180deg); }
.rail-group { font-size: .72rem; color: var(--rail-group); padding: .55rem .6rem .15rem 2.35rem; }
.rail-item { display: block; padding: .3rem .6rem .3rem 2.35rem; color: var(--rail-text); opacity: .92; text-decoration: none; border-radius: .375rem; font-size: .84rem; position: relative; }
.rail-item:hover { color: #fff; background: rgba(255,255,255,.06); }
.rail-item.active { color: #fff; background: rgba(255,255,255,.12); }
.rail-item.active::before { content: ""; position: absolute; left: 1.4rem; top: .45rem; bottom: .45rem; width: 3px; border-radius: 2px; background: var(--rail-mark); }
.rail-item.soon { color: var(--rail-muted); opacity: 1; }
.rail-item.soon::after { content: "soon"; font-size: .65rem; margin-left: .4rem; padding: 0 .3rem; border: 1px solid rgba(255,255,255,.2); border-radius: 3px; vertical-align: 1px; }
.rail-error { color: #FFD3CF; font-size: .8rem; padding: .5rem .6rem; }

.main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 1020; display: flex; align-items: center; gap: .5rem; height: 52px; padding: 0 1rem; background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btn-user { display: flex; align-items: center; gap: .5rem; border: 0; padding: .25rem .4rem; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--indigo); color: var(--on-accent); display: inline-flex; align-items: center; justify-content: center; font-size: .8rem; font-weight: 600; }
.content { padding: 1rem 1.25rem 3rem; }
@media screen and (max-width: 575.98px) { .content { padding: .75rem .75rem 4.5rem; } }
.flash { margin-bottom: .75rem; }

/* ---------- page parts ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .5rem 1rem; margin-bottom: .85rem; }
.page-head h1 { font-size: 1.3rem; margin: 0; }
.page-head .sub { color: var(--muted); font-size: .85rem; width: 100%; margin-top: -.15rem; order: 3; }
.page-actions { margin-left: auto; display: flex; flex-wrap: wrap; gap: .4rem; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: .5rem; padding: 1rem; }
.panel + .panel { margin-top: .85rem; }
.panel-title { font-size: .95rem; font-weight: 600; margin: 0 0 .75rem; }
.toolbar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: .6rem; }
.toolbar .search { max-width: 280px; }
.muted { color: var(--muted); }

/* swatch-tag chips for statuses (a notch on the left, like a fabric swatch tag) */
.chip { display: inline-flex; align-items: center; gap: .3rem; padding: .05rem .5rem .05rem .55rem; border-radius: 3px 999px 999px 3px; font-size: .76rem; font-weight: 500; white-space: nowrap; background: var(--line-soft); color: var(--muted); border-left: 3px solid #AEB6BF; }
.chip-ok { background: var(--ok-wash); color: var(--ok); border-left-color: var(--ok); }
.chip-warn { background: var(--warn-wash); color: var(--warn); border-left-color: #D18A1F; }
.chip-bad { background: var(--bad-wash); color: var(--bad); border-left-color: var(--bad); }
.chip-info { background: var(--indigo-wash); color: var(--indigo); border-left-color: var(--indigo); }

/* ---------- tables: dense, sticky header, cards on phones ---------- */
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: .5rem; overflow: auto; max-height: calc(100vh - 210px); }
.grid { width: 100%; margin: 0; border-collapse: separate; border-spacing: 0; }
.grid th { position: sticky; top: 0; z-index: 1; background: #F7F8F8; color: var(--muted); font-weight: 500; font-size: .8rem; text-align: left; padding: .45rem .6rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.grid td { padding: .38rem .6rem; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.grid tbody tr:hover td { background: #F8FAFC; }
.grid tbody tr.inactive td { color: #8A939E; }
.grid .num { text-align: right; }
.grid a.row-link { color: inherit; text-decoration: none; font-weight: 500; }
.grid a.row-link:hover { color: var(--indigo); text-decoration: underline; }
.grid-empty { padding: 2.5rem 1rem; text-align: center; color: var(--muted); }
.count-line { color: var(--muted); font-size: .8rem; margin-top: .4rem; }
@media screen and (max-width: 767.98px) {
    .table-wrap.cards-sm { background: none; border: 0; max-height: none; overflow: visible; }
    .cards-sm .grid thead { display: none; }
    .cards-sm .grid, .cards-sm .grid tbody, .cards-sm .grid tr, .cards-sm .grid td { display: block; width: 100%; }
    .cards-sm .grid tr { background: var(--surface); border: 1px solid var(--line); border-radius: .5rem; margin-bottom: .5rem; padding: .35rem .2rem; }
    .cards-sm .grid td { border: 0; padding: .2rem .65rem; display: flex; gap: .75rem; }
    .cards-sm .grid td::before { content: attr(data-label); flex: 0 0 40%; color: var(--muted); font-size: .8rem; }
    .cards-sm .grid td.num { text-align: left; }
    .cards-sm .grid td:empty { display: none; }
}

/* ---------- edit forms: two columns on wide screens, sticky actions on phones ---------- */
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: .75rem 1.25rem; }
.fields .wide { grid-column: 1 / -1; }
.form-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; padding-top: .85rem; border-top: 1px solid var(--line-soft); }
@media screen and (max-width: 575.98px) {
    .form-actions.sticky { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030; margin: 0; padding: .6rem .75rem; background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -2px 8px rgba(0,0,0,.08); }
    .form-actions.sticky .btn { flex: 1 1 auto; }
    body:has(.form-actions.sticky) .content { padding-bottom: 5rem; }
    .content .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
    .content .tile-value { font-size: 1.35rem; }
}
.record-meta { color: var(--muted); font-size: .8rem; }
.multi-box { max-height: 180px; overflow-y: auto; border: 1px solid var(--line); border-radius: .375rem; padding: .35rem .6rem; background: var(--surface); }

/* ---------- dashboard ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: .5rem; padding: .8rem .95rem; text-decoration: none; color: inherit; display: block; }
a.tile:hover { border-color: var(--focus); }
.tile-value { font-size: 1.6rem; font-weight: 600; color: var(--indigo-deep); line-height: 1.15; }
.tile-label { color: var(--muted); font-size: .82rem; }
.tile.alert-tile .tile-value { color: var(--bad); }
.shortcut-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: .5rem; }
.shortcut { display: flex; align-items: center; gap: .6rem; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: .5rem; background: var(--surface); color: var(--ink); text-decoration: none; }
.shortcut:hover { border-color: var(--focus); color: var(--indigo); }
.shortcut i { color: var(--indigo); font-size: 1.1rem; }

.empty-state { max-width: 520px; margin: 3rem auto; text-align: center; }
.empty-state i { font-size: 2.4rem; color: var(--indigo); }
.empty-state h1 { font-size: 1.25rem; margin: .6rem 0 .4rem; }
.empty-state p { color: var(--muted); }

/* ---------- sign-in ---------- */
body.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(280px, 42%) 1fr; }
.auth-side { background: var(--indigo-deep); color: var(--rail-text); padding: 3rem 2.5rem; display: flex; flex-direction: column; justify-content: flex-end; gap: .4rem;
             background-image: repeating-linear-gradient(90deg, rgba(255,255,255,.035) 0 1px, transparent 1px 7px), repeating-linear-gradient(0deg, rgba(255,255,255,.025) 0 1px, transparent 1px 7px); }
.auth-logo { width: 72px; height: auto; background: #fff; border-radius: 8px; padding: 6px; margin-bottom: 1rem; }
.auth-company { font-size: 1.9rem; font-weight: 600; color: #fff; line-height: 1.15; }
.auth-tagline { color: var(--rail-group); }
.auth-welcome { margin-top: 1.5rem; max-width: 34ch; color: var(--rail-text); }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 2rem 1.25rem; background: var(--surface); }
.auth-form { width: 100%; max-width: 340px; }
.auth-title { font-size: 1.35rem; margin-bottom: 1.25rem; }
@media screen and (max-width: 767.98px) {
    body.auth { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
    .auth-side { padding: 1.5rem 1.25rem; justify-content: flex-start; }
    .auth-logo { width: 48px; margin-bottom: .5rem; }
    .auth-company { font-size: 1.35rem; }
    .auth-welcome { display: none; }
}

/* ---------- print: what's on the page, without the app frame ---------- */
@media print {
    .rail, .topbar, .page-actions, .toolbar, .form-actions, .no-print, .flash { display: none !important; }
    body.app { display: block; background: #fff; }
    .content { padding: 0; }
    .table-wrap { max-height: none; overflow: visible; border: 0; }
    .grid th { position: static; }
    .print-only { display: block !important; }
}
.print-only { display: none; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* Theme colour (Settings) */
.theme-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 1rem; }
#themePicker { width: 3.25rem; height: 2.4rem; padding: 2px; border: 1px solid var(--line); border-radius: .375rem; background: var(--surface); cursor: pointer; }
.theme-swatches { display: flex; flex-wrap: wrap; gap: .4rem; padding-bottom: .2rem; }
.swatch { width: 1.9rem; height: 1.9rem; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line); cursor: pointer; padding: 0; }
.swatch:hover, .swatch:focus-visible { box-shadow: 0 0 0 2px var(--ink); }

/* =====================================================================
   Phase 1 · products & stock
   ===================================================================== */
.min-w-0 { min-width: 0; }
.text-warn { color: var(--warn); }
.eyebrow { font-size: .78rem; color: var(--muted); margin-bottom: .15rem; display: flex; align-items: center; gap: .4rem; }
.meta-line { display: flex; flex-wrap: wrap; gap: .1rem .5rem; }
.meta-line > * + *::before { content: "·"; margin-right: .5rem; color: #9AA3AD; }
.page-head .sub.small { order: 4; font-size: .78rem; }
.model-head h1 { max-width: 60ch; }

/* field layouts */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .75rem 1.1rem; }
.form-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid .wide { grid-column: 1 / -1; }
@media screen and (max-width: 991.98px) { .form-grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media screen and (max-width: 575.98px) { .form-grid.cols-4, .form-grid.cols-2 { grid-template-columns: 1fr; } }
.ref-no { font-size: 1.15rem; font-weight: 600; color: var(--indigo); padding-top: .2rem; font-variant-numeric: tabular-nums; }

/* panels and bars */
.panel-flush { padding: 0; overflow: hidden; }
.panel-flush > .table-wrap { border: 0; border-radius: 0; }
.grid-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem .6rem; padding: .6rem .85rem; border-bottom: 1px solid var(--line-soft); }
.panel-flush > .grid-toolbar:last-child { border-bottom: 0; border-top: 1px solid var(--line-soft); }
.grid-hint { color: var(--muted); font-size: .8rem; }
.search-row { display: flex; gap: .5rem; align-items: center; }
.search-row .form-control { min-width: 0; }
.open-po { display: flex; gap: .35rem; }
.open-po .form-control { width: 11rem; }
.filters .more-filters summary { margin-top: .6rem; font-size: .85rem; color: var(--indigo); cursor: pointer; width: max-content; }
.result-line { color: var(--muted); font-size: .84rem; margin: .7rem .1rem .45rem; }
.toolbar-form { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; }
.pick-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .35rem; }
.pick-list a { display: block; padding: .45rem .65rem; border: 1px solid var(--line); border-radius: .375rem; text-decoration: none; color: var(--ink); }
.pick-list a:hover { border-color: var(--focus); color: var(--indigo); }
.notice { background: var(--indigo-wash); color: var(--ink); border-left: 3px solid var(--indigo); border-radius: .375rem; padding: .55rem .8rem; margin-bottom: .75rem; font-size: .86rem; }
.notice-warn { background: var(--warn-wash); border-left-color: #D18A1F; }
.notice-bad { background: var(--bad-wash); border-left-color: var(--bad); }
.hint-box { background: var(--indigo-wash); border-radius: .375rem; padding: .55rem .8rem; margin-top: .75rem; font-size: .84rem; }
.step-intro { color: var(--muted); font-size: .86rem; margin: 0 0 .75rem; }
.sub-h { font-size: .88rem; font-weight: 600; margin: 1rem 0 .5rem; }
.empty-grid { padding: 2rem 1rem; text-align: center; color: var(--muted); }
.pre { white-space: pre-wrap; }
.seg-control { display: inline-flex; flex-wrap: wrap; gap: .25rem; }
.mini-progress { display: inline-block; width: 60px; height: 6px; background: var(--line-soft); border-radius: 3px; overflow: hidden; vertical-align: middle; margin-right: .35rem; }
.mini-progress span { display: block; height: 100%; background: var(--indigo); }
.list-nav { list-style: none; margin: 0; padding: .25rem 0; }
.list-nav li a { display: flex; align-items: center; gap: .4rem; padding: .5rem .85rem; color: var(--ink); text-decoration: none; border-left: 3px solid transparent; }
.list-nav li a:hover { background: #F8FAFC; }
.list-nav li.active a { background: var(--indigo-wash); border-left-color: var(--indigo); }
.list-nav li.inactive a { color: #8A939E; }

/* facts (label / value pairs) */
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .6rem 1rem; margin: 0; }
.facts.facts-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.facts.facts-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.facts dt { font-weight: 400; color: var(--muted); font-size: .76rem; }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.facts .wide { grid-column: 1 / -1; }
@media screen and (max-width: 767.98px) { .facts.facts-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* two-column work areas */
.split { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: .85rem; align-items: start; }
.split > .panel + .panel, .split-main > .panel + .panel { margin-top: 0; }
.split-main > * + * { margin-top: .85rem; }
.split-side { position: sticky; top: 64px; }
.split-foot { padding: .5rem .85rem; border-top: 1px solid var(--line-soft); }
@media screen and (max-width: 991.98px) { .split { grid-template-columns: minmax(0, 1fr); } .split-side { position: static; } }

/* editable grids (intake rows, price lines) */
.grid .form-control-sm, .grid .form-select-sm { min-width: 4.5rem; }
.grid.intake td { padding: .25rem .3rem; }
.grid.intake .form-control-sm, .grid.intake .form-select-sm { font-size: .82rem; }
.grid.intake .form-select-sm { padding-right: 1.7rem; background-position: right .4rem center; }
.grid.intake [data-f="program"] { min-width: 9.5rem; }
.grid.intake [data-f="cat"] { min-width: 10rem; }
.grid.intake [data-f="w"], .grid.intake [data-f="l"], .grid.intake [data-f="gsm"], .grid.intake [data-f="perCtn"], .grid.intake [data-f="ctn"] { min-width: 3.9rem; width: 3.9rem; }
.grid.intake [data-f="uom"] { min-width: 3.9rem; }
.grid.intake [data-f="colour"] { min-width: 7.5rem; }
.grid.intake [data-f="loc"] { min-width: 13rem; }
.grid.intake [data-f="wt"] { min-width: 4.6rem; width: 4.6rem; }
.grid.intake [data-f="pcs"], .grid.intake [data-f="kg"] { min-width: 5.4rem; width: 5.4rem; }
.grid.intake td.code { white-space: nowrap; }
@media (min-width: 768px) {
    /* the model number stays in view while the grid scrolls sideways */
    .grid.intake th:first-child, .grid.intake td.code { position: sticky; left: 0; z-index: 2; background: var(--surface); box-shadow: 1px 0 0 var(--line-soft); }
    .grid.intake th:first-child { z-index: 3; background: #F7F8F8; }
}
.grid.intake tr.row-error td { background: var(--bad-wash); }
/* sets: a pieces button in place of size / GSM, and the pieces of the set in a row under it */
.grid.intake [data-f="kind"] { min-width: 5.2rem; }
.grid.intake td.pieces-cell { min-width: 17rem; }
.pieces-btn { display: flex; align-items: center; gap: .4rem; width: 100%; text-align: left; font-size: .8rem; padding: .25rem .5rem; }
.pieces-btn > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 26rem; }
.grid.intake tr.set-row td { background: #FBFAF6; }
.grid.intake tr.pieces-row > td { background: #F6F4EC; padding: .35rem .5rem .6rem 2rem; }
.pieces-box { max-width: 52rem; position: sticky; left: 1rem; }   /* stays in view when the grid scrolls sideways */
.grid.pieces-grid { background: var(--surface); border: 1px solid var(--line); border-radius: .375rem; }
.grid.pieces-grid th { font-size: .74rem; padding: .3rem .4rem; }
.grid.pieces-grid td { padding: .2rem .3rem; }
.grid.pieces-grid [data-p="cat"] { min-width: 11rem; }
.grid.pieces-grid [data-p="qty"], .grid.pieces-grid [data-p="gsm"], .grid.pieces-grid [data-p="wt"] { min-width: 4rem; width: 4.4rem; }
.piece-size { display: inline-flex; align-items: center; gap: .2rem; }
.piece-size input { min-width: 3.6rem !important; width: 3.8rem; }
.piece-size select { min-width: 3.9rem !important; width: 4.2rem; }
.pieces-foot { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; margin-top: .4rem; font-size: .84rem; }
.grid.edit-grid .form-select-sm { padding-right: 1.7rem; background-position: right .4rem center; min-width: 5.5rem; }
.grid.edit-grid .form-control-sm { min-width: 6rem; }
.grid .actions { white-space: nowrap; text-align: right; width: 1%; }
.grid tr.selected td { background: var(--indigo-wash); }
.ro-text { display: inline-block; padding: .2rem .25rem; white-space: nowrap; }
.intake-wrap { max-height: calc(100vh - 330px); min-height: 160px; }
.totals-bar { align-items: center; justify-content: space-between; }
.totals { font-size: .86rem; }
@media (min-width: 576px) { .totals-bar { position: sticky; bottom: 0; background: var(--page); padding-bottom: .4rem; z-index: 5; } }
@media screen and (max-width: 767.98px) {
    /* each intake row becomes a small card of fields */
    .intake-wrap { max-height: none; background: none; border: 0; overflow: visible; }
    .grid.intake thead { display: none; }
    .grid.intake, .grid.intake tbody { display: block; }
    .grid.intake tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .25rem .4rem; background: var(--surface); border: 1px solid var(--line); border-radius: .5rem; padding: .5rem; margin-bottom: .6rem; }
    .grid.intake td { display: flex; flex-direction: column; border: 0; padding: 0; }
    .grid.intake td::before { content: attr(data-label); font-size: .7rem; color: var(--muted); }
    .grid.intake td.wide-cell, .grid.intake td.code { grid-column: span 3; }
    .grid.intake td.actions { grid-column: span 3; flex-direction: row; justify-content: flex-end; width: auto; gap: .25rem; border-top: 1px solid var(--line-soft); padding-top: .35rem; margin-top: .15rem; }
    .grid.intake td.actions::before { content: none; }
    .grid.intake .form-control-sm, .grid.intake .form-select-sm { min-width: 0; font-size: 16px; }   /* 16px: no zoom on iPhone */
    .grid.intake [data-f] { width: 100% !important; min-width: 0 !important; }
    .grid.edit-grid .form-control-sm, .grid.edit-grid .form-select-sm { font-size: 16px; min-width: 0; flex: 1 1 auto; }
    .cards-sm .grid.edit-grid td { align-items: center; }
    .grid.intake td.pieces-cell { grid-column: span 3; min-width: 0; }
    .grid.intake tr.set-row { background: #FBFAF6; }
    .grid.intake tr.set-row td { background: none; }
    .pieces-btn > span { white-space: normal; }
    .grid.intake tr.pieces-row { display: block; margin-top: -.5rem; border-top-left-radius: 0; border-top-right-radius: 0; background: #F6F4EC; }
    .grid.intake tr.pieces-row > td { display: block; padding: 0; background: none; }
    .grid.intake tr.pieces-row > td::before { content: none; }
    .grid.pieces-grid { background: none; border: 0; }
    .grid.pieces-grid thead { display: none; }
    .grid.pieces-grid tbody tr { display: grid; grid-template-columns: 1fr 1fr; gap: .25rem .4rem; background: var(--surface); border: 1px solid var(--line); border-radius: .4rem; padding: .4rem; margin-bottom: .4rem; }
    .grid.pieces-grid tbody td:first-child, .grid.pieces-grid tbody td:nth-child(3) { grid-column: span 2; }
    .grid.pieces-grid td.actions { grid-column: span 2; }
    .piece-size { display: grid; grid-template-columns: 1fr auto 1fr 5rem; }
    .piece-size input, .piece-size select { width: 100%; font-size: 16px; }
    .grid.pieces-grid [data-p] { width: 100% !important; min-width: 0 !important; font-size: 16px; }
}

/* Model Details: step rail + body */
.model-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 1rem; align-items: start; }
.step-rail { position: sticky; top: 64px; background: var(--surface); border: 1px solid var(--line); border-radius: .5rem; padding: .75rem .5rem; }
.step-progress { font-size: .78rem; color: var(--muted); padding: 0 .5rem .5rem; }
.step-rail ol { list-style: none; margin: 0; padding: 0; }
.step a, .step-link-na { display: flex; gap: .6rem; padding: .45rem .5rem; border-radius: .375rem; color: var(--ink); text-decoration: none; }
.step a:hover { background: #F6F8FB; }
.step.current a { background: var(--indigo-wash); }
.step-dot { flex: 0 0 1.6rem; height: 1.6rem; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: .78rem; font-weight: 600;
            border: 1.5px solid var(--line); color: var(--muted); background: var(--surface); }
.step.done .step-dot { background: var(--ok); border-color: var(--ok); color: #fff; }
.step.started .step-dot { border-color: #D18A1F; color: var(--warn); }
.step.current .step-dot { border-color: var(--indigo); color: var(--indigo); }
.step.current.done .step-dot { background: var(--indigo); border-color: var(--indigo); color: var(--on-accent); }
.step.na { opacity: .55; }
.step-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.step-title { font-weight: 500; }
.step-sub { font-size: .74rem; color: var(--muted); }
.submit-box { border-top: 1px solid var(--line-soft); margin-top: .6rem; padding: .75rem .5rem 0; }
.step-head { display: flex; align-items: center; gap: .5rem; margin-bottom: .4rem; }
.step-head h2 { font-size: 1.05rem; margin: 0; }
.step-nav { margin-left: auto; display: flex; gap: .35rem; }
@media screen and (max-width: 991.98px) {
    .model-layout { grid-template-columns: minmax(0, 1fr); }
    .step-rail { position: static; padding: .5rem; }
    .step-rail ol { display: flex; gap: .25rem; overflow-x: auto; scroll-snap-type: x proximity; padding-bottom: .25rem; }
    .step { flex: 0 0 auto; scroll-snap-align: start; }
    .step a, .step-link-na { padding: .35rem .5rem; }
    .step-sub { display: none; }
    .submit-box { display: flex; align-items: center; gap: .75rem; padding-top: .5rem; }
    .submit-box .btn { width: auto !important; flex: 0 0 auto; }
    .submit-box .form-text { margin: 0; }
}

/* photos */
.upload-row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-end; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: .6rem; }
.photo-tile { display: flex; flex-direction: column; gap: .2rem; padding: .35rem; border: 1px solid var(--line); border-radius: .5rem; text-decoration: none; color: var(--ink); background: var(--surface); margin: 0; }
.photo-tile img, .photo-tile .photo-link { width: 100%; aspect-ratio: 1; object-fit: contain; background: #F1F2F0; border-radius: .35rem; }
.photo-tile .photo-link { display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--muted); }
.photo-tile.selected { border-color: var(--indigo); box-shadow: 0 0 0 2px var(--indigo-wash); }
.photo-cap { font-size: .76rem; display: block; }
.photo-tile figcaption { font-size: .76rem; }
.photo-preview { width: 100%; max-height: 280px; object-fit: contain; background: #F1F2F0; border-radius: .375rem; margin-bottom: .5rem; }
.photo-cell { width: 56px; padding: .25rem .4rem !important; }
.photo-cell img, .no-thumb { width: 44px; height: 44px; object-fit: cover; border-radius: .3rem; background: #F1F2F0; display: flex; align-items: center; justify-content: center; color: #B0B7BF; }
@media screen and (max-width: 767.98px) {
    .product-grid tr { position: relative; padding-left: 64px !important; min-height: 72px; }
    .product-grid td.photo-cell { position: absolute; left: .35rem; top: .5rem; width: auto; }
    .product-grid td.photo-cell::before, .product-grid td.actions::before { content: none !important; }
    .product-grid td.actions { position: absolute; right: .25rem; top: .25rem; width: auto; }
}

/* product summary */
.summary-tabs { margin-bottom: .75rem; flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; }
.summary-tabs .nav-link { white-space: nowrap; }
.summary-overview { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 1rem; }
.summary-photo img, .no-photo { width: 100%; aspect-ratio: 1; object-fit: contain; background: #F1F2F0; border-radius: .5rem; }
.no-photo { display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--muted); gap: .25rem; font-size: .8rem; }
.no-photo i { font-size: 2rem; }
@media screen and (max-width: 575.98px) { .summary-overview { grid-template-columns: 1fr; } .summary-photo { max-width: 240px; } }

/* approval: queue and review */
.master-detail { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 1rem; align-items: start; }
.md-list { position: sticky; top: 64px; max-height: calc(100vh - 90px); overflow: auto; }
.md-detail > * + * { margin-top: .85rem; }
.master-detail .panel + .panel { margin-top: 0; }
@media screen and (max-width: 991.98px) {
    .master-detail { grid-template-columns: minmax(0, 1fr); }
    .md-list { position: static; max-height: 240px; }
}
.lot-card { background: var(--indigo-wash); border-radius: .5rem; padding: .65rem .8rem; margin-bottom: .85rem; }

/* print documents */
body.print-doc { background: #E9EAE7; }
.print-bar { position: sticky; top: 0; z-index: 10; display: flex; gap: .4rem; align-items: center; padding: .5rem .75rem; background: var(--surface); border-bottom: 1px solid var(--line); }
/* the sheet on screen is the printed page: A4 with the same 12 mm margins, so the preview shows what prints */
.sheet { background: #fff; width: 210mm; max-width: calc(100% - 2rem); min-height: 297mm; margin: 1rem auto; padding: 12mm; box-sizing: border-box; box-shadow: 0 1px 4px rgba(0,0,0,.12); }
body.landscape .sheet { width: 297mm; min-height: 210mm; }
.page-size { display: inline-flex; margin-left: auto; }
.doc-head { display: flex; align-items: flex-start; gap: 1rem; padding-bottom: .75rem; margin-bottom: 1rem; border-bottom: 2px solid var(--indigo); }
.doc-logo { height: 52px; width: auto; }
.doc-company { font-size: .78rem; color: var(--muted); line-height: 1.35; }
.doc-company-name { font-size: 1.05rem; font-weight: 600; color: var(--ink); }
.doc-title { margin-left: auto; text-align: right; font-size: .82rem; color: var(--muted); }
.doc-title-main { font-size: 1.15rem; font-weight: 600; color: var(--indigo); }
.doc-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .4rem 1rem; margin: 0 0 1rem; font-size: .84rem; }
.doc-facts dt { font-weight: 400; color: var(--muted); font-size: .72rem; }
.doc-facts dd { margin: 0; }
.doc-facts .wide { grid-column: 1 / -1; }
.doc-table { width: 100%; border-collapse: collapse; font-size: .8rem; }
.doc-table th { text-align: left; font-weight: 600; color: var(--muted); border-bottom: 1.5px solid var(--ink); padding: .3rem .4rem; }
.doc-table td { padding: .28rem .4rem; border-bottom: 1px solid #E3E5E7; vertical-align: top; }
.doc-table .num { text-align: right; }
.doc-table tfoot td { font-weight: 600; border-top: 1.5px solid var(--ink); border-bottom: 0; }
.doc-table .group-row td { background: #F4F6F9; border-bottom: 0; padding-top: .4rem; }
.doc-table .sub-row td { font-style: italic; color: var(--muted); }
.doc-table .photo-col { width: 46px; }
.doc-table .photo-col img { width: 40px; height: 40px; object-fit: cover; border-radius: 3px; }
body.no-photos .photo-col { display: none; }
.doc-h { font-size: .95rem; font-weight: 600; margin: 1.1rem 0 .5rem; padding-bottom: .2rem; border-bottom: 1px solid var(--line); }
.summary-print .tab-pane { display: block; opacity: 1; }
.summary-print .table-wrap { border: 0; }
.summary-print .summary-overview { grid-template-columns: 160px minmax(0, 1fr); }
.summary-print .photo-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.doc-foot { display: flex; justify-content: space-between; gap: 1rem; margin-top: 1.25rem; padding-top: .5rem; border-top: 1px solid var(--line); font-size: .72rem; color: var(--muted); }
@media screen and (max-width: 767.98px) { .sheet { margin: 0; padding: 1rem; } .doc-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); } .doc-head { flex-wrap: wrap; } .doc-title { margin-left: 0; text-align: left; } }
@media print {
    body.print-doc { background: #fff; }
    .sheet { margin: 0; padding: 0; width: auto; min-height: 0; max-width: none; box-shadow: none; }
    .doc-table thead { display: table-header-group; }
    .doc-table tbody.keep, .doc-table tr { break-inside: avoid; }
    .summary-print .tab-pane { display: block !important; opacity: 1 !important; }
    /* on-screen pages printed directly: show every tab */
    .tab-content > .tab-pane { display: block !important; opacity: 1 !important; }
    .nav-tabs, .summary-tabs, .step-rail, .grid-toolbar .btn { display: none !important; }
    .model-layout, .split, .master-detail { display: block; }
}

/* ---------- Phase 2: catalogue builder ---------- */
.cat-builder { display: grid; grid-template-columns: 370px minmax(0, 1fr); gap: .85rem; align-items: start; }
.cat-side { padding: 0; position: sticky; top: 64px; max-height: calc(100vh - 76px); display: flex; flex-direction: column; overflow: hidden; }
.cat-side > form { display: contents; }
.cat-tabs { display: flex; border-bottom: 1px solid var(--line); background: var(--surface); flex: none; }
.cat-tabs button { flex: 1 1 0; border: 0; background: none; padding: .65rem .4rem .55rem; font-weight: 500; color: var(--muted); border-bottom: 2px solid transparent; display: inline-flex; align-items: center; justify-content: center; gap: .35rem; white-space: nowrap; }
.cat-tabs button[aria-selected="true"] { color: var(--indigo-deep); border-bottom-color: var(--indigo); }
.cat-tabs .n { width: 1.25rem; height: 1.25rem; border-radius: 50%; background: var(--line-soft); font-size: .72rem; display: inline-flex; align-items: center; justify-content: center; }
.cat-tabs [aria-selected="true"] .n { background: var(--indigo); color: var(--on-accent); }
.cat-tabs .count { font-size: .72rem; background: var(--indigo-wash); color: var(--indigo-deep); border-radius: 1rem; padding: 0 .4rem; }
.cat-pane { padding: .85rem 1rem 1rem; overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.cat-pane[data-pane="models"] { display: flex; flex-direction: column; padding-bottom: 0; }
.cat-pane[data-pane="models"][hidden] { display: none; }
.cat-listhead { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin: .7rem 0 .4rem; font-size: .82rem; color: var(--muted); }
.cat-list { overflow-y: auto; margin: 0 -1rem; border-top: 1px solid var(--line-soft); flex: 1 1 auto; min-height: 160px; }
.cat-item { display: grid; grid-template-columns: auto 40px minmax(0, 1fr) auto; gap: .6rem; align-items: center; padding: .45rem 1rem; border-bottom: 1px solid var(--line-soft); cursor: pointer; }
.cat-item:hover { background: #FAFBFA; }
.cat-item:not(.on) .t, .cat-item:not(.on) img, .cat-item:not(.on) .q { opacity: .5; }
.cat-item img, .cat-item .noimg { width: 40px; height: 40px; border-radius: .3rem; object-fit: cover; background: var(--line-soft); display: flex; align-items: center; justify-content: center; color: #9AA3AE; }
.cat-item .t { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.cat-item .t > * { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat-item .t span { font-size: .82rem; }
.cat-item .t small { color: var(--muted); font-size: .74rem; }
.cat-item .q { text-align: right; font-weight: 500; font-size: .82rem; line-height: 1.1; }
.cat-item .q small { display: block; color: var(--muted); font-weight: 400; font-size: .7rem; }
.cat-empty { padding: 1.5rem 1rem; color: var(--muted); text-align: center; }
.choice-cards { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.choice { position: relative; cursor: pointer; margin: 0; }
.choice input { position: absolute; opacity: 0; }
.choice > span { display: flex; flex-direction: column; gap: .15rem; height: 100%; border: 1px solid var(--line); border-radius: .45rem; padding: .6rem .65rem; background: var(--surface); }
.choice i { font-size: 1.15rem; color: var(--indigo); }
.choice b { font-weight: 600; }
.choice small { color: var(--muted); font-size: .75rem; line-height: 1.3; }
.choice input:checked + span { border-color: var(--indigo); box-shadow: 0 0 0 1px var(--indigo) inset; background: var(--indigo-wash); }
.choice input:focus-visible + span { outline: 2px solid var(--indigo); outline-offset: 2px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: .4rem; overflow: hidden; background: var(--surface); }
.seg label { margin: 0; cursor: pointer; }
.seg input { position: absolute; opacity: 0; }
.seg span { display: block; padding: .3rem .75rem; font-size: .84rem; border-left: 1px solid var(--line); }
.seg label:first-child span { border-left: 0; }
.seg input:checked + span { background: var(--indigo); color: var(--on-accent); }
.seg input:focus-visible + span { outline: 2px solid var(--indigo); outline-offset: -3px; }
.toggles { display: flex; flex-direction: column; gap: .4rem; }
fieldset legend.form-label { font-size: .875rem; float: none; margin-bottom: .35rem; }
.cat-preview { min-width: 0; background: #DFE2E5; border: 1px solid var(--line); border-radius: .5rem; overflow: hidden; display: flex; flex-direction: column; position: sticky; top: 64px; height: calc(100vh - 76px); }
.cat-toolbar { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .45rem .6rem; background: var(--surface); border-bottom: 1px solid var(--line); }
.cat-status { display: inline-flex; align-items: center; gap: .45rem; font-size: .84rem; color: var(--muted); }
.cat-status .dot { width: .55rem; height: .55rem; border-radius: 50%; background: #B7BEC6; }
.cat-status[data-state="ok"] .dot { background: var(--ok); }
.cat-status[data-state="busy"] .dot { background: var(--warn); animation: catpulse 1s ease-in-out infinite; }
@keyframes catpulse { 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { .cat-status[data-state="busy"] .dot { animation: none; } }
.cat-zoom { display: inline-flex; gap: .25rem; }
.cat-zoom .btn { min-width: 2.2rem; }
.cat-frame { flex: 1 1 auto; min-height: 0; }
.cat-frame iframe { width: 100%; height: 100%; border: 0; display: block; background: #DFE2E5; }
.cat-hint { font-size: .75rem; color: var(--muted); padding: .3rem .6rem; background: var(--surface); border-top: 1px solid var(--line); }
@media screen and (max-width: 991.98px) {
    .cat-builder { grid-template-columns: 1fr; }
    .cat-side { position: static; max-height: none; overflow: visible; }
    .cat-tabs { position: sticky; top: 52px; z-index: 5; border-radius: .5rem .5rem 0 0; }
    .cat-tabs button { font-size: .82rem; padding: .6rem .25rem; }
    .cat-tabs .n { display: none; }
    .cat-list { max-height: none; overflow: visible; }
    /* kept laid out off-screen (Paged.js can't paginate inside a display:none frame) */
    .cat-builder:not([data-view="preview"]) .cat-preview { position: absolute; left: -10000px; top: 0; width: 100%; visibility: hidden; }
    .cat-builder[data-view="preview"] .cat-side .cat-pane { display: none !important; }
    .cat-builder[data-view="preview"] .cat-side { border-bottom-left-radius: 0; border-bottom-right-radius: 0; border-bottom: 0; }
    .cat-preview { position: static; height: calc(100vh - 170px); min-height: 420px; border-top-left-radius: 0; border-top-right-radius: 0; }
}

/* ---------- Phase 2: reports ---------- */
.report-params { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; padding: .7rem 1rem; }
.report-params .form-select { width: auto; min-width: 220px; max-width: 100%; }
.report-params .ts-wrapper { min-width: 240px; }
.result-line .sep { color: var(--muted); }
.report-grid td.neg { color: var(--bad); font-weight: 500; }
.report-grid tfoot td { font-weight: 600; background: #F7F8F7; border-top: 2px solid var(--line); }
.doc-note { color: #4A5462; font-size: .82rem; margin: 0 0 .6rem; }
@media screen and (max-width: 575.98px) {
    .report-params .form-select, .report-params .ts-wrapper { min-width: 0; width: 100%; }
    .cards-sm tfoot td.empty-sm { display: none; }
}

/* ---------- Phase 3: mill orders ---------- */
.ok-text { color: var(--ok); }
.bad-text { color: var(--bad); }
.warn-text { color: var(--warn); }
.phase-chips { display: inline-flex; gap: .25rem; flex-wrap: wrap; }
.phase-chip { display: inline-block; font-size: .72rem; font-weight: 600; padding: .1rem .45rem; border-radius: .3rem; white-space: nowrap; background: #E8EBEF; color: #646E7A; font-variant-numeric: tabular-nums; }
.phase-chip.done { background: var(--ok-wash); color: var(--ok); }
.phase-chip.started { background: var(--warn-wash); color: var(--warn); }
.phase-chip.wide { min-width: 3.4rem; text-align: center; }
.waiting { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .9rem; font-size: .86rem; }
.waiting-item { color: var(--muted); }
.waiting-item b { color: var(--ink); margin-left: .2rem; }

.po-layout { grid-template-columns: 270px minmax(0, 1fr); }
.po-layout .step-rail { max-height: calc(100vh - 76px); overflow-y: auto; }
.step-phase { display: flex; justify-content: space-between; font-size: .72rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; padding: .6rem .5rem .25rem; }
.step-phase:first-child { padding-top: 0; }
.step.locked { opacity: .5; }
.po-layout .step-dot { font-size: .68rem; }
.step-intro { color: var(--muted); font-size: .86rem; margin: -.1rem 0 .6rem; }
.po-fields { min-width: 0; border: 0; padding: 0; margin: 0; }
.po-fields:disabled .btn { display: none; }
.step-status { margin-bottom: .75rem; padding: .7rem .9rem; }
.step-status textarea { resize: vertical; min-height: calc(1.5em + .6rem + 2px); }
.po-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin-bottom: .6rem; }
.po-toolbar .form-text { margin: 0; }
.po-lines { display: flex; flex-direction: column; gap: .75rem; }
.po-line { padding: .75rem .9rem; }
.po-line-head { display: grid; grid-template-columns: minmax(0, 2fr) 7rem 6.5rem minmax(0, 2fr) auto; gap: .5rem .75rem; align-items: end; }
.po-line-actions { display: flex; gap: .3rem; }
.po-pieces { margin: .6rem 0 0; border: 1px solid var(--line-soft); border-radius: .375rem; }
.po-pieces .grid td { padding: .25rem .35rem; }
.po-line-foot { display: flex; align-items: center; gap: .5rem; margin-top: .5rem; color: var(--muted); }
.po-totals { margin-top: .75rem; padding: .6rem .9rem; font-size: .86rem; }
.edit-grid input.num { text-align: right; }
.po-weaving tr.group-start td { border-top: 2px solid var(--line); }
.po-weaving td.spec { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .8rem; white-space: nowrap; }
.po-matrix { overflow-x: auto; }
.po-matrix .form-control-sm { min-width: 4.5rem; max-width: 6.5rem; margin-left: auto; }
.po-matrix tbody th, .po-matrix tfoot th { font-weight: 500; text-align: left; padding: .38rem .6rem; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
.po-matrix tfoot td, .po-matrix tfoot th { background: #F7F8F7; font-weight: 600; border-top: 2px solid var(--line); }
.po-cartons .form-control-sm.num { min-width: 4.2rem; }

.po-files-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; flex-wrap: wrap; margin-bottom: .5rem; }
.po-files-head .count { font-size: .75rem; font-weight: 600; background: var(--line-soft); color: var(--muted); border-radius: 1rem; padding: 0 .45rem; vertical-align: 1px; }
.po-drop { border: 1.5px dashed var(--line); border-radius: .45rem; padding: .55rem .75rem; color: var(--muted); font-size: .82rem; text-align: center; margin-bottom: .5rem; }
.po-files.dragging .po-drop { border-color: var(--indigo); background: var(--indigo-wash); color: var(--indigo-deep); }
.po-files-progress { display: flex; align-items: center; gap: .5rem; color: var(--muted); font-size: .85rem; margin-bottom: .5rem; }
.po-file-list { list-style: none; margin: 0; padding: 0; }
.po-file-list li { display: flex; align-items: center; gap: .65rem; padding: .4rem 0; border-top: 1px solid var(--line-soft); }
.po-file-thumb { flex: 0 0 2.75rem; height: 2.75rem; border-radius: .3rem; background: var(--line-soft); display: flex; align-items: center; justify-content: center; overflow: hidden; color: var(--muted); font-size: 1.25rem; text-decoration: none; }
.po-file-thumb img { width: 100%; height: 100%; object-fit: cover; }
.po-file-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.po-file-text a { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.po-file-text span { font-size: .75rem; color: var(--muted); }
.po-file-actions { display: flex; gap: .25rem; }
.print-steps { border: 1px solid var(--line); border-radius: .45rem; padding: .4rem .75rem; max-height: 46vh; overflow-y: auto; }
.print-phase { font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); margin: .45rem 0 .15rem; }
.po-log td { vertical-align: top; }
@media screen and (max-width: 991.98px) {
    .po-layout { grid-template-columns: minmax(0, 1fr); }
    .po-layout .step-rail { max-height: none; overflow: visible; }
    .step-phase { display: none; }
    .step-rail .submit-box { display: none; }
}
@media screen and (max-width: 767.98px) {
    .po-line-head { grid-template-columns: 1fr 1fr; }
    .po-line-head .po-f-name, .po-line-head .po-f-rem { grid-column: span 2; }
    .po-line-actions { grid-column: span 2; justify-content: flex-end; }
    .po-pieces { border: 0; }
}
.po-pieces [data-field="ItemTypeId"] { min-width: 9.5rem; }
.po-pieces input.num { min-width: 4.5rem; }
.po-weaving select { min-width: 7.5rem; }
.po-weaving td:nth-child(2) { white-space: nowrap; }
.po-cartons td:first-child { min-width: 9rem; }
.po-cartons [data-field="Style"], .po-cartons [data-field="PolyType"] { min-width: 8rem; }

/* ================= Phase 4: setup & admin ================= */
.split-layout { display: grid; grid-template-columns: minmax(260px, 320px) minmax(0, 1fr); gap: .85rem; align-items: start; }
.split-layout > * { min-width: 0; }
#detail > .panel + .panel, #detail > details.panel { margin-top: .85rem; }
.empty-pick { display: flex; align-items: center; gap: .9rem; color: var(--muted); min-height: 8rem; justify-content: center; text-align: left; }
.empty-pick > i { font-size: 1.8rem; color: var(--focus); }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; font-size: .8rem; color: var(--muted); margin-bottom: .35rem; }
.crumbs i { font-size: .65rem; }
.stat-line { display: flex; flex-wrap: wrap; gap: .35rem 1.1rem; font-size: .82rem; color: var(--muted); margin-bottom: .85rem; }
.stat-line b { color: var(--ink); font-weight: 600; }
.detail-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .85rem; }
.sub-title { font-size: .82rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; margin: .25rem 0 .5rem; }
table.print-only { display: none; }
@media print { table.print-only { display: table !important; } }

/* category tree */
.cat-tree-panel { position: sticky; top: .75rem; padding: .75rem; max-height: calc(100vh - 7rem); display: flex; flex-direction: column; }
.cat-tree-tools { display: flex; gap: .6rem; align-items: center; }
.cat-tree-tools .form-control { flex: 1 1 auto; }
.cat-tree-actions { display: flex; gap: .85rem; align-items: center; margin: .45rem 0 .35rem; padding-bottom: .4rem; border-bottom: 1px solid var(--line-soft); }
.cat-tree { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1 1 auto; font-size: .86rem; }
.cat-tree ul { list-style: none; margin: 0; padding: 0 0 0 1.05rem; display: none; border-left: 1px dotted var(--line); margin-left: .55rem; }
.cat-node.open > ul, .cat-tree.filtering .cat-node.hit > ul { display: block; }
.cat-tree:not(.show-inactive) .cat-node.inactive:not(.current) { display: none; }
.cat-tree.filtering .cat-node.miss { display: none; }
.cat-item { display: flex; align-items: center; gap: .3rem; padding: .12rem .25rem; border-radius: .3rem; min-height: 1.85rem; }
.cat-item:hover { background: #F4F6F8; }
.cat-node.current > .cat-item { background: var(--indigo-wash); }
.cat-node.current > .cat-item .cat-link { color: var(--indigo); font-weight: 600; }
.cat-node.inactive > .cat-item .cat-link { color: #8A939E; text-decoration: line-through; text-decoration-color: #C3C9D0; }
.cat-toggle { flex: 0 0 1.25rem; width: 1.25rem; height: 1.25rem; border: 0; background: none; padding: 0; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; border-radius: .25rem; }
button.cat-toggle:hover { background: var(--line-soft); color: var(--ink); }
.cat-toggle i { font-size: .7rem; transition: transform .12s; }
.cat-node.open > .cat-item .cat-toggle i { transform: rotate(90deg); }
.cat-link { color: var(--ink); text-decoration: none; flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-link:hover { color: var(--indigo); }
.cat-meta { font-size: .7rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.cat-count { font-size: .68rem; min-width: 1.4rem; text-align: center; padding: 0 .35rem; border-radius: 999px; background: var(--line-soft); color: var(--muted); font-variant-numeric: tabular-nums; }
.cat-group-icon { font-size: .75rem; color: var(--rail-muted); }

/* category attributes */
.attr-table .form-select-sm { min-width: 10rem; }
.attr-table input[type=number] { width: 5rem; }
.attr-add { display: flex; gap: .5rem; margin-top: .75rem; max-width: 520px; }
.attr-add > :first-child { flex: 1 1 auto; min-width: 0; }

/* users */
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .35rem 1rem; }
details.history > summary { cursor: pointer; margin: 0; list-style: none; display: flex; align-items: center; gap: .4rem; }
details.history > summary::before { content: "\F285"; font-family: "bootstrap-icons"; font-size: .7rem; transition: transform .12s; }
details.history[open] > summary::before { transform: rotate(90deg); }
details.history[open] > summary { margin-bottom: .75rem; }
.grid.compact td, .grid.compact th { padding: .3rem .5rem; font-size: .82rem; }
.audit-val { max-width: 22rem; overflow-wrap: anywhere; white-space: pre-line; }

/* rights grids */
.rights-pick { display: flex; align-items: center; gap: .5rem; }
.rights-pick .form-select, .rights-pick .ts-wrapper { min-width: 240px; }
.rights-copy .form-select { min-width: 180px; }
.rights-wrap { max-height: calc(100vh - 250px); }
.rights-grid th.rg-cell, .rights-grid td.rg-cell { text-align: center; width: 4.1rem; padding-left: .25rem; padding-right: .25rem; }
.rights-grid .rg-name { min-width: 14rem; }
.rights-grid td.rg-name, .rights-grid tr.rg-module th.rg-name { position: sticky; left: 0; background: var(--surface); z-index: 1; }
.rights-grid thead th.rg-name { position: sticky; left: 0; z-index: 3; }
.rights-grid tr.rg-module th { position: static; background: #F2F4F6; color: var(--ink); font-weight: 600; font-size: .8rem; border-top: 1px solid var(--line); }
.rights-grid tr.rg-module th.rg-name { position: sticky; left: 0; background: #F2F4F6; }
.rights-grid tbody tr[data-form]:hover td { background: #F8FAFC; }
.rights-grid .rg-group { display: block; color: var(--muted); font-size: .72rem; }
.rights-grid .form-check-input { margin: 0; width: 1.05rem; height: 1.05rem; cursor: pointer; }
.rg-na { color: #B5BCC4; }
.rights-grid.is-special th.rg-role { white-space: normal; min-width: 5.5rem; width: auto; line-height: 1.15; }
.print-mark { display: none; }
@media print { .rights-grid .form-check-input { display: none; } .print-mark { display: inline; } }

/* tri-state box: as roles (faint) / allow / don't allow */
.rg-tri { width: 1.55rem; height: 1.55rem; border-radius: .3rem; border: 1px dashed #C3CAD2; background: #fff; display: inline-flex; align-items: center; justify-content: center; padding: 0; color: var(--muted); font-size: .85rem; line-height: 1; vertical-align: middle; cursor: pointer; }
.rg-tri:disabled { cursor: default; }
.rg-tri::before { font-family: "bootstrap-icons"; }
.rg-tri[data-v=""][data-role="1"]::before { content: "\F26E"; color: #7BA88F; }       /* check: from roles */
.rg-tri[data-v=""][data-role="0"]::before { content: "\F63B"; color: #C3CAD2; font-size: .7rem; } /* dash */
.rg-tri[data-v="1"] { border: 1px solid var(--ok); background: var(--ok-wash); }
.rg-tri[data-v="1"]::before { content: "\F633"; color: var(--ok); font-weight: 700; }
.rg-tri[data-v="0"] { border: 1px solid var(--bad); background: var(--bad-wash); }
.rg-tri[data-v="0"]::before { content: "\F659"; color: var(--bad); font-size: .75rem; }
.rg-tri.demo { cursor: default; width: 1.3rem; height: 1.3rem; margin-right: .35rem; }
.rights-legend { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; align-items: center; margin-top: .65rem; font-size: .8rem; }
.rights-legend > span { display: inline-flex; align-items: center; }
.rights-summary { margin-bottom: .75rem; }
.special-pick { min-width: 12rem; }

/* company profile */
.company-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: .85rem; align-items: start; }
.company-fields { min-width: 0; }
.company-preview { position: sticky; top: .75rem; }
.company-preview .form-actions { margin-top: .75rem; border-top: 0; padding-top: 0; }
.logo-row { display: flex; gap: 1rem; align-items: flex-start; flex-wrap: wrap; }
.logo-row > div:last-child { flex: 1 1 240px; }
.logo-box { width: 160px; height: 90px; border: 1px dashed var(--line); border-radius: .4rem; display: flex; align-items: center; justify-content: center; background: repeating-conic-gradient(#F4F5F6 0 25%, #fff 0 50%) 0 0 / 14px 14px; }
.logo-box img { max-width: 92%; max-height: 80px; object-fit: contain; }
.doc-preview { border: 1px solid var(--line); border-radius: .3rem; background: #fff; padding: .85rem; box-shadow: 0 1px 3px rgba(0,0,0,.05); font-size: .72rem; aspect-ratio: 1 / 1.1; display: flex; flex-direction: column; }
.doc-preview-head { display: flex; gap: .6rem; align-items: flex-start; padding-bottom: .5rem; border-bottom: 2px solid var(--indigo); }
.doc-preview-logo img { max-height: 38px; max-width: 70px; object-fit: contain; }
.doc-preview-name { font-weight: 600; font-size: .9rem; color: var(--ink); }
.doc-preview-line { color: var(--muted); }
.doc-preview-line:empty { display: none; }
.doc-preview-body { flex: 1 1 auto; display: flex; flex-direction: column; gap: .4rem; padding: .7rem 0; }
.doc-preview-body span { height: .45rem; background: var(--line-soft); border-radius: 2px; }
.doc-preview-body span:nth-child(2) { width: 80%; } .doc-preview-body span:nth-child(3) { width: 55%; }
.doc-preview-foot { border-top: 1px solid var(--line-soft); padding-top: .35rem; color: var(--muted); min-height: 1.2rem; }

/* backup */
.backup-layout { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: .85rem; align-items: start; }
.backup-layout > .panel + .panel { margin-top: 0; }
.backup-status { display: flex; gap: .75rem; align-items: center; padding: .7rem .85rem; border-radius: .4rem; }
.backup-status > i { font-size: 1.5rem; }
.backup-status.is-ok { background: var(--ok-wash); color: var(--ok); }
.backup-status.is-old { background: var(--warn-wash); color: var(--warn); }
.callout { background: #F7F8F8; border-left: 3px solid var(--focus); border-radius: .3rem; padding: .6rem .8rem; }

/* parameter bar (audit log, login history) */
.param-bar { display: flex; flex-wrap: wrap; gap: .6rem .85rem; align-items: flex-end; background: var(--surface); border: 1px solid var(--line); border-radius: .5rem; padding: .7rem .85rem; margin-bottom: .75rem; }
.param-bar > div { min-width: 150px; }
.param-bar .form-label { font-size: .76rem; color: var(--muted); margin-bottom: .2rem; }
.param-bar .grow { flex: 1 1 220px; }

@media screen and (max-width: 991.98px) {
    .company-layout { grid-template-columns: minmax(0, 1fr); }
    .company-preview { position: static; order: -1; }
    .company-preview .doc-preview { aspect-ratio: auto; min-height: 9rem; }
}
@media screen and (max-width: 767.98px) {
    .split-layout { grid-template-columns: minmax(0, 1fr); }
    .cat-tree-panel { position: static; max-height: 55vh; }
    .rights-pick { flex: 1 1 100%; }
    .rights-pick .form-select, .rights-pick .ts-wrapper { min-width: 0; flex: 1 1 auto; }
    .rights-copy { flex: 1 1 100%; }
    .rights-wrap { max-height: calc(100vh - 210px); }
    .rights-grid .rg-name { min-width: 8.5rem; max-width: 9.5rem; white-space: normal; font-size: .8rem; }
    .rights-grid th.rg-cell, .rights-grid td.rg-cell { width: 2.6rem; font-size: .68rem; }
    .param-bar > div { min-width: calc(50% - .5rem); flex: 1 1 calc(50% - .5rem); }
    .attr-add { max-width: none; }
    .audit-val { max-width: none; }
}
.facts.kv { grid-template-columns: max-content minmax(0, 1fr); gap: .35rem 1.25rem; }
.facts.kv dt { font-size: .8rem; }
.facts code { color: inherit; font-size: .78rem; }
.attr-add .btn { white-space: nowrap; align-self: flex-start; }
.form-check-input[type=checkbox]:indeterminate { background-color: var(--indigo); border-color: var(--indigo); }

/* ================= v3.5 ================= */
.grid.intake [data-f="cartonSize"] { min-width: 7.5rem; }
.grid.intake .ind-cell { min-width: 11rem; }
.grid.intake .ts-wrapper.form-select-sm .ts-control { min-height: calc(1.5em + .5rem + 2px); padding: .2rem 1.7rem .2rem .45rem; font-size: .82rem; }
.grid.intake .ts-wrapper.form-select-sm { background-position: right .4rem center; }
.ts-dropdown { z-index: 1060; }
.po-drop.over { border-color: var(--indigo); background: var(--indigo-wash); color: var(--indigo-deep); }
.moq-group { min-width: 8.5rem; flex-wrap: nowrap; }
.moq-group .input-group-text { font-size: .75rem; padding: .2rem .45rem; }


/* folded menu groups (Setup) */
.rail-sub > summary, .rail-more > summary { list-style: none; display: flex; align-items: center; gap: .4rem; cursor: pointer; border-radius: .375rem; }
.rail-sub > summary::-webkit-details-marker, .rail-more > summary::-webkit-details-marker { display: none; }
.rail-sub > summary { padding: .32rem .6rem .32rem 2.35rem; font-size: .84rem; color: var(--rail-text); position: relative; }
.rail-sub > summary::before { content: "\F285"; font-family: "bootstrap-icons"; position: absolute; left: 1.35rem; font-size: .62rem; opacity: .7; transition: transform .15s; }
.rail-sub[open] > summary::before { transform: rotate(90deg); }
.rail-sub[open] > summary { color: #fff; font-weight: 500; }
.rail-sub > summary:hover, .rail-more > summary:hover { background: rgba(255,255,255,.06); color: #fff; }
.rail-sub > .rail-item, .rail-more > .rail-item { padding-left: 3.1rem; }
.rail-sub > .rail-item.active::before, .rail-more > .rail-item.active::before { left: 2.2rem; }
.rail-more > summary { padding: .28rem .6rem .28rem 3.1rem; font-size: .8rem; color: var(--rail-group); }
.rail-more[open] > summary { color: var(--rail-text); }
.rail-more > .rail-item { padding-left: 3.6rem; font-size: .82rem; }
.rail-more > .rail-item.active::before { left: 2.7rem; }
.rail-count { font-size: .66rem; color: var(--rail-muted); margin-left: auto; font-variant-numeric: tabular-nums; }
#saleGrid tbody tr:not(.price-extra) td { border-bottom: 0; }
#saleGrid tr.price-extra td { padding-top: 0; background: transparent; }
#saleGrid tbody tr.price-extra:hover td { background: transparent; }
.price-extra-row { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .6rem; padding: .1rem 0 .35rem; }
.price-extra-row .moq-group { width: 9.5rem; }
.price-extra-row .price-rem { flex: 1 1 14rem; min-width: 10rem; }
@media screen and (max-width: 767.98px) {
    .cards-sm #saleGrid tr:not(.price-extra) { border-bottom-left-radius: 0; border-bottom-right-radius: 0; border-bottom: 0; margin-bottom: 0; }
    .cards-sm #saleGrid tr.price-extra { border-top: 1px dashed var(--line); border-top-left-radius: 0; border-top-right-radius: 0; }
    .cards-sm #saleGrid tr.price-extra td::before { display: none; }
    .price-extra-row .moq-group { width: auto; flex: 1 1 8rem; }
}
.grid.intake td:not(.code), .grid.edit-grid td { position: relative; }

/* single searchable dropdowns stay one line: the chosen text and the typing box share it
   (the theme lets the typing box, 7rem wide, wrap below the text in narrow columns) */
.ts-wrapper.single .ts-control { flex-wrap: nowrap; padding-right: 2rem !important; }
.ts-wrapper.single .ts-control > .item { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ts-wrapper.single .ts-control > input { flex: 1 1 0; min-width: 1.5rem; }
.ts-wrapper.single.has-items .ts-control > input { margin: 0 0 0 .25rem !important; }
.storage-now { display: flex; gap: .75rem; align-items: center; padding: .65rem .85rem; border-radius: .4rem; margin-bottom: .9rem; }
.storage-now > i { font-size: 1.35rem; }
.storage-now.is-drive { background: var(--ok-wash); color: var(--ok); }
.storage-now.is-local { background: var(--indigo-wash); color: var(--indigo-deep); }
.form-check-input:not(:checked):not(:disabled) { border-color: #9AA4AF; }

/* upload progress window */
.upload-overlay { position: fixed; inset: 0; z-index: 2100; background: rgba(15, 23, 34, .45); display: flex; align-items: center; justify-content: center; padding: 1rem; }
.upload-overlay[hidden] { display: none; }
.upload-card { background: var(--surface); border-radius: .6rem; box-shadow: 0 10px 30px rgba(0,0,0,.25); padding: 1.1rem 1.2rem 1rem; width: min(420px, 100%); }
.upload-title { display: flex; align-items: center; gap: .55rem; font-weight: 600; margin-bottom: .75rem; }
.upload-title i { font-size: 1.3rem; color: var(--indigo); }
.upload-overlay[data-phase="done"] .upload-title i { color: var(--ok); }
.upload-card .progress { height: .65rem; }
.upload-card .progress-bar { background-color: var(--indigo); transition: width .2s; }
.upload-card .progress-bar.bg-success { background-color: var(--ok) !important; }
.upload-line { display: flex; justify-content: space-between; gap: 1rem; font-size: .82rem; color: var(--muted); margin-top: .4rem; font-variant-numeric: tabular-nums; }
.upload-note { font-size: .78rem; color: var(--muted); margin-top: .5rem; }

/* app pages printed directly look like the report documents */
.app-print-head, .app-print-foot { display: none; }
@media print {
    @page { size: A4; margin: 12mm; }
    body.app .app-print-head, body.app .app-print-foot { display: flex; }
    body.app .page-head { display: none; }
    /* the page's own print heading (with dates or filters) replaces the plain title */
    body.app:has(.content .print-only) .app-print-head .doc-title { display: none; }
    body.app .print-only h2 { font-size: 1.1rem; color: var(--indigo); margin: 0 0 .6rem; }
    .chip { border-left-width: 2px; }
}

/* tick-lists as check boxes (certifications …) */
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: .4rem; }
.check-tile { display: flex; align-items: flex-start; gap: .5rem; padding: .45rem .6rem; border: 1px solid var(--line); border-radius: .4rem; background: var(--surface); cursor: pointer; font-size: .88rem; line-height: 1.3; }
.check-tile .form-check-input { margin-top: .1rem; flex: 0 0 auto; }
.check-tile.on { border-color: var(--indigo); background: var(--indigo-wash); }
.check-tile:has(input:disabled) { cursor: default; }
.check-add { justify-self: start; align-self: center; }
.check-grid.is-invalid { outline: 1px solid var(--bad); outline-offset: 3px; border-radius: .4rem; }
@media screen and (max-width: 575.98px) { .check-grid { grid-template-columns: 1fr 1fr; } .check-tile { font-size: 14px; } }

/* specification chooser (catalogue builder, quote request) */
.spec-chooser { border: 1px solid var(--line); border-radius: .45rem; background: var(--surface); overflow: hidden; }
.spec-group + .spec-group { border-top: 1px solid var(--line-soft); }
.spec-group > summary { display: flex; align-items: center; gap: .5rem; padding: .45rem .65rem; cursor: pointer; list-style: none; font-size: .88rem; }
.spec-group > summary::-webkit-details-marker { display: none; }
.spec-group > summary .form-check-input { margin: 0; flex: 0 0 auto; }
.spec-group-name { font-weight: 600; }
.spec-count { font-size: .74rem; color: var(--muted); }
.spec-group > summary .bi { transition: transform .15s; color: var(--muted); }
.spec-group[open] > summary .bi { transform: rotate(180deg); }
.spec-group.off .spec-group-name { color: var(--muted); font-weight: 500; }
.spec-fields { padding: .1rem .65rem .5rem 2.1rem; display: grid; grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); gap: .1rem .75rem; font-size: .86rem; }
.spec-fields .form-check { margin: 0; }
.spec-wrap.is-off { opacity: .45; pointer-events: none; }

/* quote request */
.quote-layout { display: grid; grid-template-columns: minmax(0, 1fr) 21rem; gap: 1rem; align-items: start; }
.quote-side { position: sticky; top: 64px; }
.quote-side .form-actions { margin-top: .5rem; }
.quote-side .form-actions .btn { width: 100%; }
.quote-find { min-width: 14rem; flex: 0 1 16rem; }
.quote-item { border: 1px solid var(--line); border-radius: .5rem; padding: .6rem .75rem; margin-bottom: .6rem; background: var(--surface); }
.quote-item-head { display: flex; align-items: center; gap: .75rem; }
.quote-thumb { width: 52px; height: 52px; flex: 0 0 52px; border-radius: .35rem; border: 1px solid var(--line-soft); background: #F6F7F9; display: flex; align-items: center; justify-content: center; overflow: hidden; color: var(--muted); }
.quote-thumb img { width: 100%; height: 100%; object-fit: cover; }
.quote-item-title { min-width: 0; }
.quote-item-title .small { overflow: hidden; text-overflow: ellipsis; }
.quote-item-body { display: grid; grid-template-columns: minmax(0, 1.4fr) 12rem minmax(0, 1fr); gap: .75rem; margin-top: .6rem; align-items: start; }
.quote-colours { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; }
.quote-colours .form-label { width: 100%; }
.quote-colours .check-tile { padding: .25rem .5rem; font-size: .82rem; }
@media screen and (max-width: 1199.98px) { .quote-layout { grid-template-columns: minmax(0, 1fr); } .quote-side { position: static; } }
@media screen and (max-width: 767.98px) {
    .quote-item-body { grid-template-columns: minmax(0, 1fr); }
    .quote-find { flex: 1 1 100%; }
    .quote-item .form-control, .quote-item .form-select, .quote-find .form-control { font-size: 16px; }
}

/* stage tabs (proforma invoices) */
.stage-tabs { display: flex; flex-wrap: wrap; gap: .3rem; margin: 0 0 .75rem; }
.stage-tabs a { display: inline-flex; align-items: center; gap: .45rem; padding: .4rem .8rem; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); text-decoration: none; font-size: .86rem; }
.stage-tabs a .count { font-size: .74rem; background: var(--line-soft); border-radius: 999px; padding: 0 .45rem; color: var(--muted); }
.stage-tabs a:hover { border-color: var(--focus); }
.stage-tabs a.active { background: var(--indigo); border-color: var(--indigo); color: var(--on-accent); }
.stage-tabs a.active .count { background: rgba(255,255,255,.2); color: var(--on-accent); }
.stage-tabs a.is-expired:not(.active) { color: var(--bad); }
@media screen and (max-width: 575.98px) { .stage-tabs { flex-wrap: nowrap; overflow-x: auto; padding-bottom: .25rem; } .stage-tabs a { flex: 0 0 auto; } }

/* proforma invoice */
.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-3 { grid-column: span 3; }
.form-grid .span-4 { grid-column: 1 / -1; }
@media screen and (max-width: 991.98px) { .form-grid .span-3 { grid-column: 1 / -1; } }
@media screen and (max-width: 575.98px) { .form-grid .span-2, .form-grid .span-3 { grid-column: 1 / -1; } }
.panel-subtitle { font-size: .92rem; font-weight: 600; margin: 1rem 0 .5rem; }
.pi-stages { display: flex; flex-wrap: wrap; gap: .3rem 1.25rem; list-style: none; padding: .6rem .9rem; margin: 0 0 .9rem; background: var(--surface); border: 1px solid var(--line); border-radius: .5rem; }
.pi-stages li { display: flex; align-items: center; gap: .45rem; font-size: .85rem; color: var(--muted); }
.pi-stages .dot { width: 1.45rem; height: 1.45rem; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: .72rem; font-weight: 600; border: 1.5px solid var(--line); background: var(--surface); }
.pi-stages li.done { color: var(--ink); }
.pi-stages li.done .dot { background: var(--ok); border-color: var(--ok); color: #fff; }
.pi-stages li.current { color: var(--ink); font-weight: 600; }
.pi-stages li.current .dot { border-color: var(--indigo); color: var(--indigo); background: var(--indigo-wash); }
.pi-terms { margin-top: .8rem; border-top: 1px solid var(--line-soft); padding-top: .6rem; }
.pi-terms > summary { cursor: pointer; font-weight: 600; font-size: .9rem; color: var(--indigo); }
.expire-box { border-color: var(--bad); }
.col-chips { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: .5rem; }
.col-chips:empty { display: none; }
.col-chips span { display: inline-flex; align-items: center; gap: .3rem; background: var(--indigo-wash); color: var(--indigo-deep, var(--indigo)); border-radius: 999px; padding: .1rem .3rem .1rem .65rem; font-size: .8rem; }
.col-chips button { border: 0; background: none; color: inherit; padding: 0 .2rem; line-height: 1; }
.pi-lines { display: grid; gap: .7rem; }
.pi-line { border: 1px solid var(--line); border-radius: .5rem; background: var(--surface); }
.pi-line-head { display: flex; align-items: center; gap: .5rem; padding: .55rem .7rem; border-bottom: 1px solid var(--line-soft); background: #FAFBFC; border-radius: .5rem .5rem 0 0; }
.pi-line-no { font-weight: 700; color: var(--muted); min-width: 1.6rem; }
.pi-line-head .form-control { font-weight: 600; flex: 1 1 auto; min-width: 0; }
.pi-line-head .seg, .pi-line-head .btn { flex: 0 0 auto; }
.pi-line-body { padding: .6rem .7rem .7rem; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: .55rem .7rem; }
.pi-line-body .f { display: flex; flex-direction: column; min-width: 0; }
.pi-line-body .f > label, .pi-line-body .f > .lbl { font-size: .74rem; color: var(--muted); margin-bottom: .15rem; }
.pi-line-body .f-2 { grid-column: span 2; }
.pi-line-body .f-3 { grid-column: span 3; }
.pi-line-body .f-6 { grid-column: 1 / -1; }
.pi-line-total { text-align: right; font-weight: 700; font-size: 1rem; padding-top: 1.1rem; }
.pi-line-total small { display: block; font-weight: 400; color: var(--muted); font-size: .74rem; }
.colour-mode { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.colour-mode .seg span { padding: .25rem .6rem; font-size: .8rem; }
.pi-pieces { width: 100%; border-collapse: collapse; font-size: .86rem; }
.pi-pieces th { font-size: .72rem; color: var(--muted); font-weight: 600; text-align: left; padding: .15rem .3rem; }
.pi-pieces td { padding: .15rem .3rem; vertical-align: middle; }
.pi-pieces .sz { display: inline-flex; align-items: center; gap: .2rem; }
.pi-pieces .sz input { width: 4.4rem; }
.pi-pieces .sz select { width: 4.6rem; }
.pi-pieces [data-p="item"] { min-width: 10rem; }
.pi-pieces [data-p="pcs"] { width: 4.2rem; }
.pi-ro { padding: .3rem 0; font-size: .9rem; white-space: pre-line; }
.pi-charges .charge { display: grid; grid-template-columns: minmax(0, 1fr) 10rem auto; gap: .5rem; margin-bottom: .4rem; }
.money-strip { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; font-size: .9rem; }
.pay-form { display: grid; grid-template-columns: 10rem 10rem 9rem 12rem minmax(10rem, 1fr) auto; gap: .5rem; align-items: end; border-top: 1px solid var(--line-soft); padding-top: .7rem; }
.mill-steps { margin: 0 0 .8rem; padding-left: 1.2rem; font-size: .9rem; }
.mill-steps li { margin-bottom: .2rem; }
.price-change { border-top: 1px solid var(--line-soft); margin-top: .8rem; }
@media screen and (max-width: 991.98px) {
    .pi-line-body { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .pi-line-body .f-2, .pi-line-body .f-3 { grid-column: 1 / -1; }
    .pay-form { grid-template-columns: 1fr 1fr; }
    .pay-form .span-wide { grid-column: 1 / -1; }
}
@media screen and (max-width: 575.98px) {
    .pi-line-body .form-control, .pi-line-body .form-select, .pi-line-head .form-control, .pay-form .form-control, .pay-form .form-select { font-size: 16px; }
    .pi-line-head { flex-wrap: wrap; }
    .pi-line-head .form-control { flex: 1 1 calc(100% - 2.5rem); }
    .pi-line-head .seg { margin-right: auto; }
    .pi-pieces thead { display: none; }
    .pi-pieces, .pi-pieces tbody { display: block; }
    .pi-pieces tr { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: .3rem; padding: .35rem 0; border-bottom: 1px solid var(--line-soft); }
    .pi-pieces td { padding: 0; min-width: 0; }
    .pi-pieces td.szc { grid-column: 1 / -1; order: 5; }
    .pi-pieces td.pcc input { width: 4.5rem; }
    .pi-pieces [data-p="item"] { min-width: 0; width: 100%; }
    .pi-pieces .sz { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) 4.6rem; width: 100%; }
    .pi-pieces .sz input, .pi-pieces .sz select { width: 100%; min-width: 0; }
    .pi-charges .charge { grid-template-columns: 1fr 7rem auto; }
}

/* ---------- Setup › Product Details ---------- */
.pd-layout { grid-template-columns: minmax(230px, 280px) minmax(0, 1fr); }
.pd-heads { padding: .75rem; position: sticky; top: .75rem; }
.pd-heads-title { font-weight: 600; font-size: .85rem; margin: 0 0 .4rem .2rem; }
.pd-head-list { list-style: none; margin: 0 0 .6rem; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.pd-head-list li { display: flex; align-items: center; border-radius: .35rem; }
.pd-head-list li a { flex: 1; display: flex; align-items: center; gap: .4rem; padding: .42rem .55rem; color: var(--ink); text-decoration: none; border-radius: .35rem; min-width: 0; }
.pd-head-list li a:hover { background: var(--line-soft); }
.pd-head-list li.current { background: var(--indigo-wash); }
.pd-head-list li.current a { font-weight: 600; color: var(--indigo); }
.pd-head-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pd-move { display: inline-flex; gap: 0; flex-shrink: 0; }
.pd-move form { display: inline; margin: 0; }
.pd-move .btn-icon { font-size: .9rem; padding: .2rem .3rem; color: var(--muted); }
.pd-move .btn-icon:hover:not(:disabled) { color: var(--indigo); }
.pd-add-head { display: flex; gap: .35rem; }
.pd-hidden { margin-top: .6rem; font-size: .85rem; }
.pd-hidden summary { cursor: pointer; color: var(--muted); }
.pd-hidden ul { list-style: none; padding: 0; margin: .4rem 0 0; display: flex; flex-direction: column; gap: .3rem; }
.pd-hidden li { display: flex; justify-content: space-between; gap: .5rem; align-items: baseline; }
.pd-hidden form { display: inline; margin: 0; }
.pd-note { font-size: .75rem; color: var(--muted); margin: .7rem .2rem 0; }
.pd-title { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: .75rem; }
.pd-title form { margin: 0; }
.pd-rename { position: relative; }
.pd-rename summary { list-style: none; }
.pd-rename summary::-webkit-details-marker { display: none; }
.pd-rename[open] form { position: absolute; right: 0; top: calc(100% + .3rem); z-index: 5; display: flex; gap: .35rem; background: var(--surface); border: 1px solid var(--line); border-radius: .45rem; padding: .5rem; box-shadow: 0 6px 18px rgba(0,0,0,.1); width: min(22rem, 80vw); }
.pd-empty { text-align: center; color: var(--muted); padding: 1.5rem .5rem; }
.pd-list { list-style: none; margin: 0; padding: 0; }
.pd-item { display: flex; align-items: flex-start; gap: .6rem; padding: .7rem .2rem; border-top: 1px solid var(--line-soft); scroll-margin-top: 5rem; }
.pd-item:first-child { border-top: 0; }
.pd-item:target { background: var(--indigo-wash); border-radius: .4rem; }
.pd-item .pd-move { flex-direction: column; margin-top: -.1rem; }
.pd-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .3rem; }
.pd-name { display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem .6rem; }
.pd-kind { font-size: .78rem; color: var(--muted); white-space: nowrap; }
.pd-choices { display: flex; flex-wrap: wrap; gap: .25rem; }
.pd-choices span { font-size: .76rem; background: var(--line-soft); border-radius: 999px; padding: .05rem .5rem; }
.pd-choices span.more { background: none; color: var(--muted); padding-left: .2rem; }
.pd-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .6rem; font-size: .8rem; }
.pd-edit { flex-shrink: 0; }
.pd-editor { scroll-margin-top: 4rem; }
.pd-section { margin-top: 1.1rem; }
.pd-section > legend, fieldset.pd-section > legend { font-size: .9rem; font-weight: 600; margin-bottom: .45rem; float: none; }
.pd-kinds { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.pd-kind-fixed { display: flex; flex-wrap: wrap; align-items: baseline; gap: .3rem .6rem; }
.pd-kind-fixed i { color: var(--indigo); }
.pd-number { margin-top: 1rem; }
.pd-choice-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .3rem; max-height: 22rem; overflow: auto; }
.pd-choice-list li { display: flex; align-items: center; gap: .4rem; }
.pd-choice-list li .form-control { flex: 1; min-width: 0; }
.pd-choice-list li.off .form-control { text-decoration: line-through; color: var(--muted); }
.pd-hide-choice { display: inline-flex; align-items: center; gap: .25rem; font-size: .8rem; color: var(--muted); margin: 0; white-space: nowrap; }
.pd-tree-box { border: 1px solid var(--line); border-radius: .45rem; padding: .6rem; max-height: 22rem; overflow: auto; }
.pd-tree, .pd-tree ul { list-style: none; margin: 0; padding: 0; }
.pd-tree ul { padding-left: 1.35rem; }
.pd-tree label { display: flex; align-items: center; gap: .35rem; padding: .18rem 0; margin: 0; cursor: pointer; }
.pd-tree label small { color: var(--muted); font-size: .72rem; }
.pd-tree li.covered > label { color: var(--muted); }
.pd-tree li.covered > label input { opacity: .55; }
.pd-tree li.covered > label input:not(:checked) + span::after { content: " · included"; font-size: .72rem; }
.pd-danger { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem; font-size: .88rem; }
.pd-danger form { margin: 0; }
.step-intro .pd-add-link, .pd-add-link { font-size: .85rem; }
@media (max-width: 991.98px) {
    .pd-layout { grid-template-columns: minmax(0, 1fr); }
    .pd-heads { position: static; }
    .pd-head-list { flex-direction: row; overflow-x: auto; gap: .3rem; padding-bottom: .2rem; }
    .pd-head-list li { flex-shrink: 0; border: 1px solid var(--line); }
    .pd-head-list li.current { border-color: var(--indigo); }
    .pd-note { display: none; }
}
@media (max-width: 575.98px) {
    .pd-item { flex-wrap: wrap; }
    .pd-item .pd-move { flex-direction: row; order: 3; }
    .pd-item .pd-edit { order: 4; margin-left: auto; }
    .pd-main { flex-basis: 100%; }
    .pd-kinds { grid-template-columns: 1fr 1fr; }
}
.pd-add-head .btn { white-space: nowrap; }
.row-cancelled td { opacity: .55; } .row-cancelled td:last-child, .row-cancelled td:nth-last-child(2) { opacity: 1; }
.cancel-model { margin-top: .6rem; text-align: center; }

/* ---------- guidance: where am I / what's next, and the help panel ---------- */
.btn-help { color: var(--indigo); border: 1px solid var(--line); border-radius: 999px; padding: .25rem .7rem; font-size: .88rem; margin-right: .5rem; background: var(--surface); }
.btn-help:hover { background: var(--indigo-wash); color: var(--indigo); }
.help-panel { width: min(420px, 100vw) !important; }
.help-panel h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 1.2rem 0 .5rem; }
.help-purpose { font-size: .95rem; }
.help-steps, .help-tips { padding-left: 1.2rem; margin: 0; display: flex; flex-direction: column; gap: .45rem; font-size: .9rem; }
.help-words dt { font-weight: 600; font-size: .88rem; margin-top: .55rem; }
.help-words dd { margin: 0; font-size: .87rem; color: var(--ink); }
.guide { border: 1px solid var(--line); border-radius: .6rem; background: var(--surface); padding: .6rem .8rem; margin: 0 0 .9rem; }
.guide-path { list-style: none; margin: 0; padding: 0 0 .1rem; display: flex; align-items: flex-start; overflow-x: auto; gap: 0; }
.guide-path li { flex: 1 1 0; min-width: 5.5rem; display: flex; flex-direction: column; align-items: center; text-align: center; position: relative; font-size: .78rem; color: var(--muted); }
.guide-path li::before { content: ""; position: absolute; top: .7rem; left: -50%; right: 50%; height: 2px; background: var(--line); z-index: 0; }
.guide-path li:first-child::before { display: none; }
.guide-path li.done::before, .guide-path li.current::before { background: var(--ok, #2e7d32); }
.guide-path .dot { width: 1.4rem; height: 1.4rem; border-radius: 50%; border: 2px solid var(--line); background: var(--surface); display: inline-flex; align-items: center; justify-content: center; font-size: .75rem; position: relative; z-index: 1; }
.guide-path li.done .dot { background: var(--ok, #2e7d32); border-color: var(--ok, #2e7d32); color: #fff; }
.guide-path li.current .dot { border-color: var(--indigo); box-shadow: 0 0 0 3px var(--indigo-wash); }
.guide-path li.current .dot::after { content: ""; width: .5rem; height: .5rem; border-radius: 50%; background: var(--indigo); }
.guide-path li.bad .dot { background: #c62828; border-color: #c62828; color: #fff; }
.guide-path li.current .lbl { color: var(--ink); font-weight: 600; }
.guide-path li.done .lbl { color: var(--ink); }
.guide-path .lbl { margin-top: .3rem; line-height: 1.2; padding: 0 .2rem; }
.guide-next { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .6rem; margin-top: .55rem; padding-top: .55rem; border-top: 1px solid var(--line-soft); font-size: .9rem; }
.guide-next > i { color: var(--indigo); font-size: 1.05rem; }
.guide-ok .guide-next > i { color: var(--ok, #2e7d32); }
.guide-wait .guide-next > i { color: #b26a00; }
.guide-bad { border-color: #f1c4c4; }
.guide-bad .guide-next > i { color: #c62828; }
.guide-next span { flex: 1 1 16rem; min-width: 0; }
@media (max-width: 575.98px) {
    .guide { padding: .5rem .55rem; }
    .guide-path li { min-width: 4.4rem; font-size: .72rem; }
    .guide-next .btn { margin-left: 0 !important; }
}

/* ---------- Packing: cartons, bags, planner ---------- */
.pk-layout { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
.pk-table tbody tr:hover { background: var(--line-soft); }
.pk-dims { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .6rem; }
.pk-other { margin-top: .8rem; padding: .5rem .7rem; background: var(--indigo-wash); border-radius: .45rem; font-size: .9rem; }
.pk-other:empty { display: none; }
.pk-svg { width: 100%; height: 300px; display: block; background: linear-gradient(#fbfbfd, #f1f3f7); border-radius: .5rem; }
.pk-bag { height: 260px; }
.pk-preview { margin-top: .9rem; }
.pp-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 1rem; align-items: start; }
.pp-steps { display: flex; flex-direction: column; gap: .9rem; }
.pp-steps .panel { margin: 0; }
.pp-result { display: flex; flex-direction: column; gap: .9rem; position: sticky; top: .75rem; }
.pp-result .panel { margin: 0; }
.pp-no { display: inline-flex; align-items: center; justify-content: center; width: 1.5rem; height: 1.5rem; border-radius: 50%; background: var(--indigo); color: #fff; font-size: .8rem; margin-right: .35rem; }
.pp-folds { display: grid; grid-template-columns: 1fr; gap: .45rem; }
.pp-fold { display: flex; align-items: center; gap: .6rem; border: 1px solid var(--line); border-radius: .5rem; padding: .45rem .6rem; cursor: pointer; margin: 0; }
.pp-fold input { flex-shrink: 0; }
.pp-fold.on { border-color: var(--indigo); background: var(--indigo-wash); }
.pp-fold-svg { width: 120px; height: 52px; flex-shrink: 0; }
.pp-fold-svg .flat { fill: #eef3fb; stroke: #5B8DEF; stroke-width: 1; }
.pp-fold-svg .cut line { stroke: #5B8DEF; stroke-width: .8; stroke-dasharray: 2 1.5; }
.pp-fold-svg .folded { fill: #5B8DEF; stroke: #2f5fb8; stroke-width: 1; }
.pp-fold-svg .arrow { fill: none; stroke: #888; stroke-width: 1.2; }
.pp-fold-text { display: flex; flex-direction: column; min-width: 0; }
.pp-fold-text small { line-height: 1.25; }
.pp-press label span { white-space: nowrap; }
.pp-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr)); gap: .5rem; margin: .7rem 0 .5rem; }
.pp-stat { border: 1px solid var(--line); border-radius: .5rem; padding: .45rem .6rem; }
.pp-stat .lbl { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.pp-stat .val { font-size: 1.35rem; font-weight: 700; line-height: 1.2; }
.pp-stat .sub { font-size: .75rem; color: var(--muted); }
.pp-svg { height: 360px; }
.pp-words { margin: .5rem 0 0; font-size: .92rem; }
.pp-table tr[data-carton] { cursor: pointer; }
.pp-table tr.is-shown td { background: var(--indigo-wash); }
@media (max-width: 1199.98px) { .pp-layout { grid-template-columns: minmax(0, 1fr); } .pp-result { position: static; } }
@media (max-width: 991.98px) { .pk-layout { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 575.98px) {
    .pk-dims { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .35rem; }
    .pk-dims .input-group-text { padding: .25rem .35rem; font-size: .75rem; }
    .pk-svg { height: 240px; }
    .pp-svg { height: 280px; }
    .pp-fold-svg { width: 92px; }
    .pp-stat .val { font-size: 1.1rem; }
}
.pp-steps .seg { flex-wrap: wrap; max-width: 100%; height: auto; }
.pp-steps .seg label span { white-space: nowrap; }
.pp-mini { display: none; }
@media (max-width: 1199.98px) {
    .pp-mini:not([hidden]) { display: flex; align-items: center; gap: .45rem; position: sticky; bottom: .5rem; z-index: 20;
        background: var(--indigo); color: #fff; border-radius: .6rem; padding: .6rem .8rem; text-decoration: none; box-shadow: 0 6px 18px rgba(0,0,0,.18); font-size: .9rem; }
    .pp-mini:hover { color: #fff; }
}
