:root {
  color-scheme: light;
  --shell: #241937;
  --shell-line: #4d3c63;
  --shell-muted: #c7b8dd;
  --shell-selected: #493668;
  --ground: #f7f6fa;
  --paper: #ffffff;
  --tint: #f2edf9;
  --ink: #241d30;
  --muted: #645b72;
  --line: #e5e0eb;
  --control: #d9d1e4;
  --input-border: #8f7da1;
  --accent: #603ba1;
  --accent-hover: #4e2d8b;
  --error: #a32b45;
  --success: #28684c;
  --radius: 14px;
  --field-radius: 8px;
  --sidebar: 232px;
  --font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--ground); color: var(--ink); font: 1rem/1.5 var(--font); }
button, input { font: inherit; }
button, a, input { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: var(--accent); text-underline-offset: .18em; }
button:enabled, summary, .nav-link { cursor: pointer; }
button:disabled { cursor: not-allowed; }
::selection { background: #e2d4fa; color: var(--shell); }
:focus-visible { outline: 2px solid #8556ca; outline-offset: 3px; }
.skip { position: fixed; z-index: 10; top: 10px; left: 10px; padding: 10px 14px; background: var(--paper); transform: translateY(-150%); }
.skip:focus { transform: none; }
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
svg { display: block; width: 20px; height: 20px; flex: none; }
.small-icon svg { width: 16px; height: 16px; }

.shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; overflow-y: auto; padding: 26px 18px 20px; background: var(--shell); color: #fbf8ff; }
.sidebar-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.navigation-toggle { display: none; }
.brand { display: block; min-width: 0; padding: 4px 7px; }
.brand img { display: block; max-width: 100%; height: auto; }
.sidebar-footer small { display: block; color: var(--shell-muted); font-size: .8125rem; font-weight: 450; margin-top: 3px; }
.navigation { margin-top: 28px; }
.nav-group + .nav-group { margin-top: 15px; }
.nav-label { margin: 0 0 5px 10px; color: var(--shell-muted); font-size: .8125rem; font-weight: 650; }
.nav-link { display: flex; align-items: center; gap: 11px; min-height: 45px; padding: 10px 11px; margin-bottom: 4px; border-radius: 8px; text-decoration: none; color: #e4d9f5; font-size: .9375rem; }
.nav-link:hover { background: #35264a; }
.nav-link[aria-current="page"] { background: var(--shell-selected); color: #fff; font-weight: 650; }
.nav-link[aria-current="page"] svg { color: #e1ceff; }
.sidebar-footer { display: flex; align-items: center; gap: 11px; margin-top: auto; padding: 16px 8px 2px; border-top: 1px solid var(--shell-line); font-size: .875rem; font-weight: 650; }
.sidebar-footer svg { color: var(--shell-muted); }

.topbar { min-height: 65px; padding: 0 34px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); background: var(--paper); }
.breadcrumb { display: flex; align-items: center; gap: 10px; font-size: .875rem; color: var(--muted); }
.breadcrumb svg { width: 14px; height: 14px; }
.breadcrumb strong { color: var(--ink); font-weight: 650; }
.catalog-badge { display: inline-flex; gap: 7px; align-items: center; white-space: nowrap; padding: 4px 10px; border: 1px solid #e7dcf4; border-radius: 99px; background: #f7f2fc; color: #5b3c7e; font-size: .8125rem; font-weight: 600; }
.catalog-dot { width: 7px; height: 7px; border-radius: 50%; background: #895ab6; }

main { max-width: 1344px; margin: 0 auto; padding: 29px 34px 40px; }
.page-heading { margin: 0 0 23px; }
h1, h2, p { margin: 0; }
h1 { font-size: 2.25rem; line-height: 1.16; letter-spacing: -.035em; font-weight: 750; }
.page-heading p { margin-top: 8px; color: var(--muted); }
h2 { font-size: 1.125rem; line-height: 1.35; letter-spacing: -.018em; font-weight: 700; }
.intake-layout { display: grid; grid-template-columns: minmax(0, 1.85fr) minmax(292px, 1fr); align-items: start; gap: 22px; }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
.form-section { padding: 19px 24px 20px; }
.form-section + .form-section { border-top: 1px solid var(--line); }
.section-heading, .receipt-heading { display: flex; align-items: center; gap: 12px; }
.section-heading { margin-bottom: 15px; }
.section-heading p, .receipt-heading p { margin-top: 3px; color: var(--muted); font-size: .875rem; }
.section-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 9px; flex: none; color: var(--accent); background: var(--tint); }

.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.field { position: relative; }
label { display: block; margin-bottom: 6px; color: var(--ink); font-size: .875rem; font-weight: 650; }
.required { color: var(--accent); }
.combo, .text-control { position: relative; display: flex; align-items: center; min-height: 43px; border: 1px solid var(--input-border); border-radius: var(--field-radius); background: var(--paper); }
.combo:hover, .text-control:hover { border-color: var(--accent); }
.combo:focus-within, .text-control:focus-within { border-color: var(--accent); outline: 2px solid #e1d4f5; }
.field:has([aria-invalid="true"]) :is(.combo, .text-control) { border-color: var(--error); }
.combo input, .text-control input { width: 100%; min-width: 0; height: 41px; padding: 0 12px; border: 0; border-radius: inherit; outline: 0; color: var(--ink); background: transparent; caret-color: var(--accent); font-size: .9375rem; }
input::placeholder { color: #6f657d; opacity: 1; }
.combo input { padding-inline-end: 42px; cursor: pointer; text-overflow: ellipsis; }
.combo[data-swatch] input { padding-left: 34px; }
.combo-swatch { position: absolute; left: 12px; pointer-events: none; }
.combo input:focus { cursor: text; }
.combo button { position: absolute; inset-inline-end: 5px; top: 3px; width: 34px; height: 35px; border: 0; border-radius: 5px; display: grid; place-items: center; color: var(--muted); background: transparent; }
.combo button:hover { background: var(--tint); }
.combo.is-disabled { background: #f6f4f8; }
.combo.is-disabled input, .combo.is-disabled button { cursor: not-allowed; }
.combo input[aria-expanded="true"] + button svg { transform: rotate(180deg); }
.text-control .item-code-scan { flex: none; min-height: 36px; padding: 4px 8px; margin-right: 3px; }
.item-code-scanner { width: min(420px, calc(100% - 32px)); max-height: calc(100% - 32px); padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); background: var(--paper); }
.item-code-scanner::backdrop { background: #24193780; }
.item-code-scanner video { display: block; width: 100%; max-height: 50dvh; margin-top: 12px; border-radius: var(--field-radius); background: var(--shell); }
.item-code-scanner p { margin: 12px 0 16px; color: var(--muted); }
.text-control > span { padding: 0 12px 0 2px; flex: none; color: var(--muted); font-size: .8125rem; }
.field-error { margin-top: 6px; color: var(--error); font-size: .8125rem; font-weight: 550; }

.options { position: absolute; top: 72px; left: 0; right: 0; z-index: 4; border: 1px solid var(--control); border-radius: 9px; background: var(--paper); box-shadow: 0 7px 20px #29194520; overflow: hidden; }
.options ul { list-style: none; margin: 0; padding: 4px; max-height: 216px; overflow: auto; scrollbar-color: #c3addf transparent; }
.options li { display: flex; align-items: center; gap: 8px; min-height: 37px; padding: 6px 9px; border-radius: 5px; cursor: pointer; font-size: .9375rem; overflow-wrap: anywhere; }
.options li:is(:hover, .active) { background: var(--tint); color: var(--accent-hover); }
.options li[aria-selected="true"] { font-weight: 650; }
.option-check { margin-left: auto; color: var(--accent); }
.swatch { display: inline-block; width: 14px; height: 14px; flex: none; border-radius: 50%; border: 1px solid #21182f26; }
.no-options { padding: 11px 12px; color: var(--muted); font-size: .875rem; }

.model-picker { margin-top: 16px; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--field-radius); background: var(--ground); }
.model-picker summary { font-size: .875rem; font-weight: 650; color: var(--accent-hover); }
.model-options { display: grid; gap: 5px; max-height: 216px; overflow: auto; list-style: none; margin: 8px 0; padding: 3px; }
.model-option { display: flex; align-items: center; gap: 9px; width: 100%; min-height: 43px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 7px; background: var(--paper); font-size: .875rem; text-align: left; overflow-wrap: anywhere; }
.model-option:hover { border-color: var(--control); background: var(--tint); }
.photo-field { margin-top: 17px; }
.photo-drop { width: 100%; display: flex; justify-content: center; align-items: center; gap: 12px; min-height: 77px; padding: 12px; border: 1px dashed #baabd0; border-radius: var(--field-radius); background: #faf8fd; font-size: .875rem; text-align: left; color: var(--muted); }
.photo-drop:hover, .photo-drop.is-dragging { background: var(--tint); border-color: var(--accent); }
.photo-drop strong { color: var(--accent); font-weight: 700; }
.photo-drop small { display: block; margin-top: 2px; font-size: .8125rem; }
.upload-icon { display: grid; place-items: center; width: 34px; height: 34px; color: var(--accent); background: #efe6fa; border-radius: 8px; flex: none; }
#photo:focus-visible + .photo-drop { outline: 2px solid #8556ca; outline-offset: 3px; }
.photo-preview { display: flex; align-items: center; gap: 12px; min-height: 77px; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--field-radius); background: #faf8fd; }
.photo-preview img, .line-image { width: 52px; height: 52px; border-radius: 7px; object-fit: cover; background: var(--tint); flex: none; }
.photo-filename { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: .875rem; }
.photo-feedback { display: flex; gap: 8px; align-items: baseline; justify-content: space-between; }
.photo-feedback .button { padding: 4px 6px; }
.form-actions { display: flex; justify-content: end; flex-wrap: wrap; gap: 8px; padding: 15px 24px; border-top: 1px solid var(--line); }
.button { display: inline-flex; justify-content: center; align-items: center; gap: 8px; min-height: 44px; padding: 9px 14px; border: 1px solid transparent; border-radius: 8px; text-decoration: none; font-size: .875rem; font-weight: 680; white-space: nowrap; }
.button svg { width: 17px; height: 17px; }
.primary { background: var(--accent); color: #fff; }
.primary:is(:enabled, a):hover { background: var(--accent-hover); }
.primary:disabled { background: #e9dff6; color: #6b527f; }
.secondary { background: var(--tint); border-color: var(--input-border); color: var(--accent-hover); }
.secondary:is(:enabled, a[href]):hover { background: #eae0f7; border-color: var(--accent); }
.secondary:disabled, .plain:disabled { opacity: .65; }
.plain { color: var(--muted); background: transparent; border-color: var(--input-border); }
.plain:enabled:hover { background: var(--tint); color: var(--accent-hover); border-color: var(--accent); }
.icon-button { display: grid; place-items: center; width: 36px; height: 36px; padding: 0; flex: none; border: 0; border-radius: 7px; background: transparent; color: var(--muted); }
.icon-button svg { width: 17px; height: 17px; }
.icon-button:enabled:hover { color: var(--accent); background: var(--tint); }

.receipt-column { position: sticky; top: 20px; min-width: 0; }
.receipt-mobile-bar { display: none; }
#receipt-draft-status { color: var(--accent-hover); font-size: .875rem; }
.receipt-heading { padding: 19px 20px 17px; border-bottom: 1px solid var(--line); }
#receipt-creator { overflow-wrap: anywhere; }
.receipt-heading > div { min-width: 0; }
.receipt-empty { padding: 27px 16px 26px; text-align: center; }
.empty-icon { display: grid; place-items: center; width: 52px; height: 52px; margin: 0 auto 11px; border: 1px solid #e9dff3; border-radius: 12px; background: #f7f2fb; color: #78599d; }
.empty-icon svg { width: 25px; height: 25px; }
.receipt-empty strong { display: block; font-size: .9375rem; font-weight: 700; }
.receipt-empty p { margin: 3px auto 0; max-width: 28ch; color: var(--muted); font-size: .875rem; }
.receipt-totals { display: grid; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); background: #faf8fd; font-size: .875rem; }
.receipt-totals div { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; color: var(--muted); }
.receipt-totals strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.receipt-totals strong span { font-weight: 500; }
#total-count { font-size: 1.125rem; color: var(--accent-hover); }
#price-total-row > span { flex-shrink: 0; }
#price-total { overflow-wrap: anywhere; }
#price-total-row strong { min-width: 0; text-align: right; }
.receipt-actions { padding: 16px 20px 20px; }
.receipt-actions .button { width: 100%; }
#save-error { margin: 0 0 8px; }
.local-note { display: flex; align-items: flex-start; gap: 9px; margin-top: 14px; padding: 12px 14px; background: var(--tint); border: 1px solid #e9e0f2; border-radius: 9px; color: #604c76; font-size: .8125rem; }
.local-note svg { width: 16px; height: 16px; margin-top: 2px; color: var(--accent); }
.local-note a { font-weight: 650; }
.line-list { padding: 0; margin: 0; list-style: none; max-height: 326px; overflow: auto; scrollbar-color: #c3addf transparent; }
.receipt-line { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 10px; align-items: start; padding: 12px 16px; }
.receipt-line + .receipt-line { border-top: 1px solid var(--line); }
.receipt-line.is-editing { background: var(--tint); }
.line-main { display: flex; align-items: center; gap: 9px; min-width: 0; }
.line-image { width: 38px; height: 38px; }
.line-name { font-weight: 700; font-size: .875rem; overflow-wrap: anywhere; }
.line-meta { color: var(--muted); font-size: .8125rem; overflow-wrap: anywhere; }
.line-prices { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 3px 12px; font-variant-numeric: tabular-nums; }
.line-qty { justify-self: end; font-size: .9375rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.line-tools { display: flex; justify-content: end; grid-column: 1 / -1; gap: 3px; }
.line-tools .icon-button { width: 36px; height: 32px; }

.history-heading { display: flex; justify-content: space-between; gap: 14px; align-items: end; }
.history { padding: 0 22px; }
.history .receipt-empty { padding: 58px 12px; }
.receipt-record + .receipt-record { border-top: 1px solid var(--line); }
.receipt-record summary { list-style: none; display: grid; grid-template-columns: minmax(160px, 1fr) auto auto; align-items: center; gap: 20px; padding: 16px 5px; }
.receipt-record summary::-webkit-details-marker { display: none; }
.receipt-record summary:hover { color: var(--accent-hover); }
.receipt-record[open] summary .record-chevron { transform: rotate(180deg); }
.record-id { display: block; color: var(--accent); font-size: .8125rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.record-supplier { display: block; font-weight: 680; overflow-wrap: anywhere; }
.record-reference { display: block; color: var(--muted); font-size: .875rem; overflow-wrap: anywhere; }
.record-meta { display: grid; text-align: right; color: var(--muted); font-size: .875rem; font-variant-numeric: tabular-nums; }
.record-lines { list-style: none; margin: 0 0 14px; padding: 0 12px; background: #f9f7fc; border-radius: 8px; }
.record-lines .receipt-line { padding-inline: 0; align-items: center; }
.record-lines a { display: block; flex: none; }
.record-price-total { display: flex; justify-content: flex-end; align-items: baseline; gap: 10px; margin: 0 0 14px; padding: 0 12px; color: var(--muted); font-size: .875rem; }
.record-price-total strong { color: var(--ink); text-align: right; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }

.inspection { padding: 0 22px; }
.inspection-filters { display: flex; gap: 6px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.inspection-filter { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 7px 12px; border: 1px solid var(--input-border); border-radius: var(--field-radius); background: transparent; color: var(--muted); text-decoration: none; font-size: .875rem; font-weight: 650; }
.inspection-filter:is([aria-pressed="true"], [aria-current="true"]) { border-color: var(--accent); background: var(--tint); color: var(--accent-hover); }
.inspection-filter:hover { border-color: var(--accent); background: #eae0f7; color: var(--accent-hover); }
.filter-count { min-width: 24px; padding: 1px 5px; border-radius: 99px; background: var(--ground); text-align: center; font-size: .8125rem; font-variant-numeric: tabular-nums; }
.inspection-filter[aria-pressed="true"] .filter-count { background: #e9dff6; }
.filter-count:empty { display: none; }
.inspection .receipt-empty { padding: 50px 12px; }
.inspection-result { font-weight: 700; }
.inspection-details { margin: 0 0 14px; border: 1px solid var(--line); border-radius: var(--field-radius); }
.inspection-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(84px, 105px) minmax(88px, 112px) minmax(89px, 116px); gap: 10px; align-items: center; padding: 10px 14px; }
.inspection-grid-priced { grid-template-columns: minmax(0, 1fr) minmax(122px, 155px) minmax(84px, 105px) minmax(88px, 112px) minmax(89px, 116px); }
.inspection-price-control { width: 100%; min-width: 0; }
.inspection-price-control input { text-align: right; font-variant-numeric: tabular-nums; }
.inspection-legend { border-radius: 7px 7px 0 0; background: var(--ground); color: var(--muted); font-size: .875rem; font-weight: 650; }
.inspection-legend span:not(:first-child) { text-align: right; }
.inspection-lines { list-style: none; margin: 0; padding: 0; }
.inspection-line { border-top: 1px solid var(--line); }
.inspection-line .line-main a { flex: none; }
.inspection-cell { display: grid; min-width: 0; justify-items: end; }
.inspection-cell-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.inspection-count, .count-difference, .inspection-input { font-variant-numeric: tabular-nums; }
.inspection-count, .count-difference { font-size: .875rem; }
.count-difference { color: var(--muted); font-weight: 680; text-align: right; }
.tone-match { color: var(--success); }
.tone-missing { color: var(--error); }
.tone-excess { color: var(--accent-hover); }
.inspection-input { width: 100%; min-width: 0; min-height: 43px; padding: 7px 9px; border: 1px solid var(--input-border); border-radius: var(--field-radius); background: var(--paper); color: var(--ink); text-align: right; }
.inspection-input:hover { border-color: var(--accent); }
.inspection-input[aria-invalid="true"] { border-color: var(--error); }
.inspection-footer { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; padding: 12px 14px; border-top: 1px solid var(--line); border-radius: 0 0 7px 7px; background: var(--ground); font-size: .875rem; }
.inspection-progress { color: var(--muted); }
.inspection-footer .button { margin-left: auto; }
.inspection-batch-builder { margin-bottom: 20px; }
.inspection-batch-builder .panel-title { margin: 0; }
.inspection-batch-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 245px), 1fr)); gap: 12px; }
.inspection-batch-orders { max-height: 27rem; overflow: auto; border: 1px solid var(--line); border-radius: var(--field-radius); scrollbar-color: var(--control) transparent; }
.inspection-batch-order + .inspection-batch-order { border-top: 1px solid var(--line); }
.inspection-batch-order-heading { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin: 0; padding: 8px 12px; background: var(--ground); font-size: .875rem; }
.inspection-batch-order-heading small { color: var(--muted); font-weight: 500; }
.inspection-batch-option { display: grid; grid-template-columns: minmax(0, 1fr) max-content minmax(115px, 145px); align-items: center; gap: 12px; padding: 9px 12px; border-top: 1px solid var(--line); }
.inspection-batch-option:hover, .inspection-batch-option:has(input:checked) { background: var(--tint); }
.inspection-batch-choice { display: flex; align-items: center; gap: 10px; margin: 0; min-width: 0; font-weight: 400; cursor: pointer; }
.inspection-batch-choice input { flex: none; width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.inspection-batch-received { display: grid; gap: 4px; margin: 0; color: var(--muted); font-size: .8125rem; }
.inspection-batch-received input:disabled { background: var(--ground); cursor: default; }
.inspection-batch-option .line-main { overflow-wrap: anywhere; }
.inspection-batch-option :is(.line-name, .line-meta) { display: block; }
.inspection-batch-quantity { display: grid; justify-items: end; font-variant-numeric: tabular-nums; }
.inspection-batch-quantity small { color: var(--muted); }
.inspection-batch-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-end; }
.inspection-batch-actions .inspection-progress:not(:empty) { margin-inline-end: auto; }
.inspection-footer > .inspection-batch-actions { margin-inline-start: auto; }
@media (max-width: 640px) {
  .inspection-batch-builder .inspection-progress:not(:empty) { flex-basis: 100%; }
  .inspection-line-batch .inspection-cell-label { min-height: 2.5em; }
  .inspection-batch-option { grid-template-columns: minmax(0, 1fr) max-content; }
  .inspection-batch-received { grid-column: 1 / -1; margin-inline-start: 28px; max-width: 160px; }
  .inspection-batch-received:has(input:disabled) { display: none; }
}
.receipt-export { padding: 14px; border-top: 1px solid var(--line); }
.receipt-export h3 { margin: 0; font-size: 1rem; }
.export-help { margin: 3px 0 12px; color: var(--muted); font-size: .875rem; }
.export-controls { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.export-controls .field { flex: 1 1 120px; max-width: 170px; min-width: 0; }
.export-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }

.toast { position: fixed; z-index: 5; right: 24px; bottom: 24px; display: flex; align-items: center; gap: 10px; max-width: calc(100% - 32px); padding: 8px 9px 8px 14px; border: 1px solid #c0ddce; border-radius: 10px; background: #eff9f2; color: #254e3d; font-size: .875rem; font-weight: 650; }
.toast > span:first-child { color: var(--success); }

@media (max-width: 1080px) {
  :root { --sidebar: 194px; }
  main { padding-inline: 24px; }
  .topbar { padding-inline: 24px; }
  .intake-layout { gap: 16px; }
  .form-section, .form-actions { padding-inline: 18px; }
}
@media (max-width: 920px) {
  :root { --sidebar: 176px; }
  .intake-layout { grid-template-columns: 1fr; }
  .receipt-column { position: static; }
  .line-list { max-height: none; }
  html:has(#intake-page:not([hidden]) .receipt-mobile-bar:not([hidden])) {
    scroll-padding-bottom: calc(72px + env(safe-area-inset-bottom));
  }
  #intake-page:has(.receipt-mobile-bar:not([hidden])) { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  .receipt-mobile-bar {
    position: fixed;
    inset: auto 0 0 var(--sidebar);
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px calc(9px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: var(--paper);
  }
  #receipt-mobile-count { flex: 1; font-size: .875rem; font-weight: 700; font-variant-numeric: tabular-nums; }
  .receipt-mobile-bar .button { min-height: 44px; padding-inline: 10px; white-space: nowrap; }
  body:has(#intake-page:not([hidden]) .receipt-mobile-bar:not([hidden])) .toast { bottom: calc(76px + env(safe-area-inset-bottom)); }
}
@media (max-width: 640px) {
  .shell { display: block; }
  .sidebar { position: static; height: auto; overflow: visible; padding: 10px 16px; }
  .brand { padding-inline: 0; }
  .sidebar-footer { display: none; }
  .navigation-toggle { display: flex; align-items: center; gap: 6px; min-height: 44px; padding: 6px 10px; border: 1px solid var(--shell-muted); border-radius: var(--field-radius); background: transparent; color: #fbf8ff; font-size: .875rem; }
  .navigation-toggle svg { width: 16px; height: 16px; }
  .navigation-toggle[aria-expanded="true"] svg { rotate: 180deg; }
  .navigation { margin-top: 12px; padding-bottom: 4px; }
  .sidebar-heading:has(.navigation-toggle[aria-expanded="false"]) + .navigation { display: none; }
  .nav-group { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; }
  .nav-label { grid-column: 1 / -1; margin: 0 0 0 8px; }
  .nav-link { margin: 0; min-height: 44px; padding-inline: 8px; gap: 7px; font-size: .875rem; }
  .nav-link svg { width: 17px; height: 17px; }
  .topbar { min-height: 48px; padding-inline: 16px; }
  .breadcrumb { gap: 5px; font-size: .8125rem; }
  .breadcrumb > span { display: none; }
  .receipt-mobile-bar { left: 0; }
  .line-tools .icon-button { width: 44px; height: 44px; }
  main { padding: 23px 14px 36px; }
  h1 { font-size: 1.875rem; }
  .page-heading { margin-bottom: 18px; }
  .page-heading p { font-size: .9375rem; }
  .form-section { padding: 17px 15px; }
  .form-actions { padding: 13px 15px; }
  .field-grid { gap: 13px 10px; }
  .combo input, .text-control input { font-size: 1rem; }
  .combo input { padding-left: 9px; padding-right: 29px; }
  .combo button { width: 25px; }
  .combo[data-swatch] input { padding-left: 28px; }
  .combo-swatch { left: 9px; }
  .history-heading { align-items: start; flex-direction: column; }
  .history, .inspection { padding-inline: 13px; }
  .receipt-record summary { grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; }
  .record-meta { font-size: .8125rem; }
  .inspection-legend { display: none; }
  .inspection-line { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; padding: 10px; }
  .inspection-line .line-main { grid-column: 1 / -1; }
  .inspection-cell { justify-items: start; gap: 3px; }
  .inspection-cell-label { position: static; width: auto; height: auto; clip-path: none; white-space: normal; color: var(--muted); font-size: .8125rem; }
  .inspection-count, .count-difference { align-self: start; padding-top: 9px; text-align: left; }
  .inspection-input { text-align: left; }
  .inspection-footer { padding-inline: 10px; }
  .receipt-export { padding-inline: 10px; }
  .export-actions { margin-left: 0; }
  .toast { right: 16px; bottom: 16px; }
}
@media (max-width: 365px) {
  .photo-drop-copy { display: none; }
  .field-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: no-preference) {
  .receipt-line.is-new { animation: line-arrival 220ms ease-out; }
  @keyframes line-arrival { from { background-color: var(--tint); } to { background-color: transparent; } }
}

@media (min-width: 1160px) {
  .field-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .field-grid > div { grid-column: span 3; }
  .field-grid > .line-entry-field { grid-column: span 2; }
}

@media (max-width: 920px) {
  .inspection-legend.inspection-grid-priced { display: none; }
  .inspection-grid-priced { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; }
  .inspection-grid-priced .line-main, .inspection-price-cell { grid-column: 1 / -1; }
  .inspection-grid-priced .inspection-cell { justify-items: start; gap: 3px; }
  .inspection-grid-priced .inspection-cell-label { position: static; width: auto; height: auto; clip-path: none; white-space: normal; color: var(--muted); font-size: .8125rem; }
  .inspection-price-control { max-width: 190px; }
  .inspection-price-control input { text-align: left; }
}
.account-controls { display: flex; align-items: center; gap: 12px; font-size: .8125rem; white-space: nowrap; }
.account-controls [aria-current="page"] { font-weight: 650; }
#auth-page { max-width: 590px; }
#auth-page h1 { font-size: 1.75rem; }
#auth-message { margin: 10px 0; color: var(--muted); }
.password-form { display: grid; gap: 12px; max-width: 360px; margin-top: 18px; }
.password-form .button { justify-self: start; }
.member-controls { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 12px; }
.member-controls .field:first-child { flex: 1 1 220px; }
.member-select {
  appearance: none;
  width: 100%;
  min-height: 43px;
  padding-block: 7px;
  padding-inline: 12px 38px;
  border: 1px solid var(--input-border);
  border-radius: var(--field-radius);
  background: var(--paper) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath d='m4 6 4 4 4-4' fill='none' stroke='%23645b72' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 12px center;
  color: var(--ink);
  font: inherit;
}
.item-classification { font-size: .9375rem; }
.item-classification:invalid { color: var(--muted); }
.item-classification option { color: var(--ink); }
.item-classification[aria-invalid="true"] { border-color: var(--error); }
@media (max-width: 640px) {
  .item-classification { font-size: 1rem; }
}
@media (forced-colors: active) {
  .member-select { appearance: auto; padding-inline-end: 12px; background-image: none; }
}
.member-list { padding: 0; margin: 16px 0 0; list-style: none; }
.member-list li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px; padding: 9px 0; border-top: 1px solid var(--line); font-size: .875rem; overflow-wrap: anywhere; }
.member-list li > span { min-width: 0; }
.member-list small { display: block; color: var(--muted); }
.member-actions, .profile-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.profile-panel { max-width: 760px; }
.profile-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.profile-actions { margin-top: 16px; }
.member-profile-form { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 16px; }
#profile-email, #member-profile-email { overflow-wrap: anywhere; }
@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; padding-block: 8px; }
  .profile-fields { grid-template-columns: 1fr; }
}
.legacy-panel { margin-top: 16px; }
.supplier-search { margin-top: 12px; max-width: 360px; }
.invitation-result { margin-top: 12px; max-width: 640px; }
.invitation-result textarea {
  width: 100%;
  resize: vertical;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
}
.invitation-result .button { margin-top: 6px; }
.supplier-actions { display: flex; flex-wrap: wrap; gap: 6px; }

.operations-panel, .operations-stack, .operations-price-preview { display: grid; gap: 12px; min-width: 0; }
.operations-stack h2, .operations-detail h2 { margin: 0; font-size: 1.125rem; }
.operations-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(270px, .53fr); gap: 18px; align-items: start; }
.operations-inline, .operations-actions { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; }
.operations-inline > .field { flex: 1 1 190px; min-width: 0; }
.operations-inline > label.field { margin-bottom: 0; }
form.operations-inline { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
.operations-label { font-size: .875rem; font-weight: 650; }
.operations-actions .field:has(input[type="checkbox"]), .operations-confirm .field:has(input[type="checkbox"]) { display: flex; align-items: center; gap: 6px; }
.operations-actions .text-control:has(input[type="checkbox"]), .operations-confirm .text-control:has(input[type="checkbox"]) {
  border: none; min-height: 0; background: none;
}
.operations-actions input[type="checkbox"], .operations-confirm input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); }
.operations-table-wrap { overflow-x: auto; }
.operations-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: .875rem; }
.operations-table td, .operations-table th { border-bottom: 1px solid var(--line); padding: 10px; text-align: right; white-space: nowrap; }
.operations-table th { color: var(--muted); font-weight: 650; }
.operations-table td:first-child, .operations-table th:first-child { padding-left: 0; text-align: left; }
.operations-table input[type="number"] { width: 5.4rem; padding: 8px; font: inherit; border: 1px solid var(--input-border); border-radius: var(--field-radius); }
.operations-product { display: grid; justify-items: start; gap: 3px; min-width: 10rem; white-space: normal; overflow-wrap: anywhere; text-align: left; }
.operations-product small { color: var(--muted); font-size: .75rem; }
.operations-product small.field-error { color: var(--error); }
.operations-empty { padding-block: 6px; color: var(--muted); }
.operations-detail { margin-top: 18px; }
.operations-error { margin: 0 0 14px; }
.operations-results { display: grid; gap: 8px; }
.operations-results:empty, .operations-stack p:empty { display: none; }
.operations-results .button { display: flex; justify-content: space-between; gap: 12px; }
.sale-customer-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--field-radius);
  background: var(--ground);
}
.sale-customer-avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--tint);
  color: var(--accent-hover);
  font-weight: 700;
}
.sale-customer-identity {
  display: grid;
  flex: 1 1 8rem;
  min-width: 0;
  gap: 2px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.sale-customer-phone { color: var(--muted); font-size: .875rem; font-variant-numeric: tabular-nums; }
.sale-customer-card > .button { margin-inline-start: auto; background: var(--paper); }
.sale-customer-card > .button:hover { background: var(--tint); }
.sale-customer .export-help { margin: 0; }
.sale-customer .operations-results .button { flex-wrap: wrap; text-align: start; }
.sale-customer .operations-results .operations-product { min-width: 0; }
.sale-products .export-help { margin: 0; }
.sale-products .operations-results .button { flex-wrap: wrap; text-align: start; }
.sale-products :is(.operations-results, .sale-product-header) .operations-product {
  flex: 1 1 10rem;
  min-width: 0;
}
.sale-products-empty {
  padding: 14px;
  border: 1px dashed var(--input-border);
  border-radius: var(--field-radius);
  color: var(--muted);
}
.sale-product-list { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.sale-product-card {
  container-type: inline-size;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--field-radius);
  background: var(--ground);
}
.sale-product-header { display: flex; align-items: center; gap: 12px; }
.sale-product-header .button { background: var(--paper); }
.sale-product-header .button:enabled:hover { background: var(--tint); }
.sale-product-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
@container (min-width: 32.25rem) {
  .sale-product-controls { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.sale-product-controls > * { min-width: 0; margin: 0; }
.sale-product-controls .text-control { min-height: 44px; }
.sale-product-controls .field-error { display: block; overflow-wrap: anywhere; }
.sale-product-amount { display: grid; align-content: start; gap: 8px; }
.sale-product-price, .sale-product-amount strong { font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.sale-product-amount .operations-label { color: var(--muted); }
.sale-product-unpriced { color: var(--error); }
.operations-totals { display: grid; gap: 6px; margin: 0; padding: 9px 0; font-variant-numeric: tabular-nums; }
.operations-totals > div { display: flex; justify-content: space-between; gap: 8px; }
.operations-totals dd { margin: 0; }
.operations-totals > div:last-child { border-top: 1px solid var(--line); padding-top: 8px; color: var(--accent); font-weight: 750; }
.operations-payment, .operations-price-row { display: grid; justify-items: start; gap: 8px; padding: 12px 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.operations-payment .field, .operations-price-row select { width: 100%; }
.operations-confirm { padding: 12px; background: var(--tint); border-radius: var(--field-radius); }
.operations-price-preview { margin-top: 14px; }
.operations-price-preview h4 { margin: 0; }
.operations-price-preview > .button { justify-self: start; }
@media (max-width: 1050px) { .operations-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 520px) {
  .sale-customer form.operations-inline { grid-template-columns: minmax(0, 1fr); }
  .sale-customer form.operations-inline > .button { justify-self: start; }
  #sale-ui .operations-table td, #sale-ui .operations-table th { padding-inline: 5px; }
  #sale-ui .operations-table td:first-child, #sale-ui .operations-table th:first-child { padding-left: 0; }
  #sale-ui .operations-product { min-width: 6rem; }
  #sale-ui .operations-table input[type="number"] { width: 3.5rem; }
  #sale-ui .operations-table .button { padding-inline: 6px; }
}
.operations-panel > * { min-width: 0; }
.operations-table-wrap { max-width: 100%; }
.sale-invoice { display: none; }
.label-print-dialog { width: min(440px, calc(100% - 32px)); padding: 20px; color: var(--ink); }
.label-print-dialog::backdrop { background: color-mix(in srgb, var(--shell) 50%, transparent); }
.label-print-dialog .operations-actions { justify-content: flex-end; }
.inventory-panel { container-type: inline-size; }
.inventory-toolbar { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px; }
.inventory-toolbar > .field { flex: 1 1 17rem; min-width: 0; max-width: 30rem; }
#inventory-selection:empty { display: none; }
.inventory-label-selection { align-items: center; }
.inventory-panel .export-help { margin: 0; }
.inventory-label-table .operations-table { border-collapse: separate; border-spacing: 0; }
.inventory-label-table th { background: var(--tint); }
.inventory-label-table th:first-child { border-start-start-radius: var(--field-radius); }
.inventory-label-table th:last-child { border-start-end-radius: var(--field-radius); }
.inventory-label-table :is(td, th):first-child { padding-inline: 10px; }
.inventory-label-table :is(td, th):nth-child(2) { text-align: left; }
.inventory-label-table :is(td, th):last-child { text-align: right; }
.inventory-label-table .inventory-product { gap: 2px; min-width: 8rem; }
.inventory-product strong { font-size: .9375rem; }
.inventory-print-label { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; margin: 0; cursor: pointer; }
.inventory-label-table input[type="checkbox"] { width: 18px; height: 18px; margin: 0; vertical-align: middle; accent-color: var(--accent); }
.inventory-available { color: var(--accent-hover); }
.inventory-unpriced { color: var(--muted); }
.inventory-row-actions { display: flex; flex-wrap: wrap; justify-content: end; gap: 8px; }
.inventory-row-actions .button { padding-inline: 9px; }
.inventory-mobile-label { display: none; }
@container (max-width: 57rem) {
  .inventory-label-table { overflow: visible; }
  .inventory-label-table .operations-table,
  .inventory-label-table tbody { display: block; }
  .inventory-label-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .inventory-label-table tbody tr {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 8px 12px;
    margin-bottom: 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--field-radius);
    background: var(--ground);
  }
  .inventory-label-table tbody td {
    grid-column: span 2;
    padding: 0;
    border: 0;
    text-align: left;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .inventory-label-table tbody td:nth-child(1) { grid-column: 1 / -1; padding: 0; order: 1; }
  .inventory-label-table tbody td:nth-child(2) { grid-column: 1 / -1; }
  .inventory-label-table tbody td:nth-child(5) { color: var(--accent-hover); font-weight: 700; }
  .inventory-label-table tbody td:nth-child(8) { grid-column: 1 / -1; order: 2; }
  .inventory-label-table .inventory-product { min-width: 0; }
  .inventory-mobile-label { display: block; color: var(--muted); font-size: .8125rem; font-weight: 500; }
  .inventory-print-label { gap: 8px; }
  .inventory-row-actions { justify-content: start; }
}
.label-print-quantities { max-height: 36vh; overflow: auto; }
.label-print-quantities .operations-table { table-layout: fixed; }
.label-print-quantities .operations-product { min-width: 0; }
.label-print-quantities .operations-table :is(td, th):last-child { width: 5.25rem; padding-right: 4px; }
.label-print-quantities .operations-table input[type="number"] { width: 4.5rem; }
.label-print-quantities .operations-table th { position: sticky; top: 0; background: var(--paper); }

@media print {
  @page sale-invoice-a5 { size: A5 portrait; margin: 9mm; }
  @page sale-invoice-roll { size: auto; margin: 0; }

  body:has(> .sale-invoice) { background: #fff; color: #000; }
  body:has(> .sale-invoice) > :not(.sale-invoice) { display: none !important; }
  .sale-invoice {
    display: block;
    font: 10pt/1.35 Arial, sans-serif;
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
  }
  .sale-invoice-a5 { page: sale-invoice-a5; }
  .sale-invoice-roll { page: sale-invoice-roll; width: 70mm; max-width: 100%; margin-inline: auto; padding-block: 3mm; }
  .sale-invoice-heading { padding-bottom: 2mm; border-bottom: 1px solid; break-inside: avoid; }
  .sale-invoice-heading h1 { font-size: 16pt; letter-spacing: normal; margin-bottom: 1mm; }
  .sale-invoice-roll .sale-invoice-heading { text-align: center; }
  .sale-invoice-roll .sale-invoice-heading h1 { font-size: 13pt; }
  .sale-invoice-buyer { margin-block: 2mm; break-after: avoid; }
  .sale-invoice .operations-table { font-size: inherit; }
  .sale-invoice .operations-table thead { display: table-header-group; }
  .sale-invoice .operations-table tr { break-inside: avoid; }
  .sale-invoice .operations-table :is(th, td) {
    padding: 1.4mm 1mm;
    border-bottom: 1px solid #bbb;
    vertical-align: top;
    color: inherit;
  }
  .sale-invoice .operations-table :is(th, td):first-child { white-space: normal; width: 100%; }
  .sale-invoice .operations-table :is(th, td):last-child { padding-right: 0; }
  .sale-invoice-product small { display: block; font-size: 9pt; }
  .sale-invoice-items { list-style: none; margin: 0; padding: 0; border-top: 1px solid; }
  .sale-invoice-items li { padding-block: 1.5mm; border-bottom: 1px dashed; break-inside: avoid; }
  .sale-invoice-pair { display: flex; justify-content: space-between; gap: 2mm; }
  .sale-invoice-pair > :last-child { flex: none; white-space: nowrap; }
  .sale-invoice-totals { margin: 2mm 0 0; break-inside: avoid; }
  .sale-invoice-a5 .sale-invoice-totals { width: 72mm; margin-left: auto; }
  .sale-invoice-totals .sale-invoice-pair { margin-block: .6mm; }
  .sale-invoice-totals dd { margin: 0; }
  .sale-invoice-totals .sale-invoice-total { border-block: 1px solid; padding-block: 1mm; margin-block: 1mm; font-weight: 700; }
  .sale-invoice-payment dt { padding-left: 2mm; }
  .sale-invoice-policy {
    margin-top: 2mm;
    padding-top: 2mm;
    border-top: 1px dashed;
    break-inside: avoid;
  }
  .sale-invoice-policy p { margin: .8mm 0 0; }
}

.debt-tabs { padding-top: 0; }
form.debt-filters { display: flex; }
.debt-filters .field { flex: 0 1 11rem; }
.debt-search .field:first-child { flex: 0 1 24rem; }
.debt-search .field:has(input[type="checkbox"]) { display: inline-flex; flex: 0 0 auto; flex-direction: row-reverse; align-items: center; gap: 8px; min-height: 43px; }
.debt-search .text-control:has(input[type="checkbox"]) { display: grid; place-items: center; padding: 0; min-height: 0; border: 0; background: transparent; }
.debt-search input[type="checkbox"] { appearance: auto; width: 18px; height: 18px; margin: 0; padding: 0; accent-color: var(--accent); }
.debt-detail-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.debt-detail-heading { min-width: 0; overflow-wrap: anywhere; }
.debt-totals { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); margin: 0; border-block: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.debt-totals > div { padding: 10px 12px; }
.debt-totals > div:last-child { background: var(--tint); color: var(--accent-hover); }
.debt-totals dt { font-size: .8125rem; }
.debt-totals dd { margin: 2px 0 0; font-weight: 700; overflow-wrap: anywhere; }
.debt-editor { background: var(--ground); border: 1px solid var(--line); border-radius: var(--field-radius); padding: 14px; }
.debt-editor h3 { margin: 0; }
.debt-editor-slot:empty { display: none; }
.debt-form-fields { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,11rem),1fr)); gap: 10px; }
.debt-form-fields > .field { min-width: 0; }
#debt-content > .button, .debt-results .operations-stack .button { justify-self: start; }
.debt-history-table .operations-table :is(td, th):nth-child(2) { text-align: left; }
#debt-content .operations-product { min-width: 8rem; max-width: 29rem; }
#debt-content .operations-product a { color: var(--accent-hover); text-underline-offset: 3px; }
@media (max-width: 640px) {
  .debt-filters > .field { flex: 1 1 calc(50% - 5px); }
  .debt-totals { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .debt-table .operations-table, .debt-table .operations-table tbody { display: block; }
  .debt-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .debt-table .operations-table tr { display: grid; gap: 8px 12px; padding-block: 12px; border-bottom: 1px solid var(--line); }
  .debt-table .operations-table td { padding: 0; border: 0; white-space: normal; overflow-wrap: anywhere; }
  .debt-directory-table .operations-table tr { grid-template-columns: minmax(0,1fr) minmax(0,auto); align-items: center; }
  .debt-directory-table .operations-table td:nth-child(3) { text-align: left; }
  .debt-directory-table .operations-table td:nth-child(3)::before,
  .debt-history-table .operations-table td:nth-child(n+3):nth-child(-n+5)::before {
    display: block; content: attr(data-label); color: var(--muted); font-size: .8125rem;
  }
  .debt-history-table .operations-table tr { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .debt-history-table .operations-table td:nth-child(-n+2),
  .debt-history-table .operations-table td:nth-child(6) { grid-column: 1 / -1; }
  .debt-history-table .operations-table td:first-child { font-size: .8125rem; color: var(--muted); }
  .debt-history-table .operations-table td:nth-child(n+3):nth-child(-n+5) { text-align: left; }
  .debt-history-table .operations-table td:nth-child(5) { color: var(--accent-hover); font-weight: 700; }
}

.debt-side-summaries { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.debt-side-summary h3, .return-document h3, .debt-editor h4 { margin: 0; }
.debt-side-summary .debt-totals > div { padding-inline: 8px; }
.return-line { display: grid; grid-template-columns: minmax(0,1fr) minmax(8rem, .32fr); align-items: center; gap: 12px; padding-block: 10px; border-bottom: 1px solid var(--line); }
.return-line .operations-product { min-width: 0; }
.return-document { padding-block: 12px; border-top: 1px solid var(--line); }
.return-items-table .operations-table td:first-child { white-space: normal; overflow-wrap: anywhere; }
.return-value { align-self: end; }
#return-content > .button, #return-content .operations-stack > .button { justify-self: start; }
@media (max-width: 760px) {
  .debt-side-summaries { grid-template-columns: minmax(0,1fr); }
}
@media (max-width: 640px) {
  .debt-directory-table .operations-table tr { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .debt-directory-table .operations-table td:first-child { grid-column: 1 / -1; }
  .debt-directory-table .operations-table td:nth-child(n+2):nth-child(-n+4) { text-align: left; }
  .debt-directory-table .operations-table td:nth-child(n+2):nth-child(-n+4)::before {
    display: block; content: attr(data-label); color: var(--muted); font-size: .8125rem;
  }
  .return-items-table .operations-table tr { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .return-items-table .operations-table td:first-child { grid-column: 1 / -1; }
  .return-items-table .operations-table td:nth-child(n+2) { text-align: left; }
  .return-items-table .operations-table td:nth-child(n+2)::before {
    display: block; content: attr(data-label); color: var(--muted); font-size: .8125rem;
  }
}

.report-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px 12px;
}
.report-filters > .field { flex: 0 1 11rem; min-width: 0; }
.report-filters > .field:first-child { flex-basis: 13rem; }
.report-filters select { width: 100%; min-height: 43px; }
#report-status:empty { display: none; }
.report-results { margin-top: 18px; }
.report-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 10rem), 1fr));
  gap: 1px;
  margin: 0;
  padding: 1px;
  border-radius: var(--field-radius);
  background: var(--line);
  overflow: hidden;
}
.report-summary > div { padding: 12px 14px; background: var(--tint); }
.report-summary dt { color: var(--muted); font-size: .8125rem; }
.report-summary dd {
  margin: 2px 0 0;
  font-size: 1.125rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.report-table-wrap { scrollbar-color: var(--control) var(--ground); }
.report-table-wrap .report-text { text-align: left; }
.report-table-wrap td.report-text { max-width: 22rem; white-space: normal; overflow-wrap: anywhere; }
.report-table-wrap td.report-text:nth-child(-n+2) { min-width: 6.5rem; }
.report-pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: end; gap: 8px; }

@media (max-width: 640px) {
  .report-filters > .field:first-child { flex-basis: 100%; }
  .report-filters > .field { flex: 1 1 calc(50% - 6px); }
  .report-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-summary > div { padding: 9px 10px; }
  .report-pager { justify-content: start; }
}

.attendance-layout {
  display: grid;
  grid-template-columns: minmax(230px, .36fr) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.attendance-layout h2 { margin: 0 0 4px; font-size: 1.125rem; }
.attendance-muted { margin: 0; color: var(--muted); font-size: .875rem; }
.attendance-layout p:empty { display: none; }
.attendance-layout > section > button { justify-self: start; }
.attendance-punches {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 2px 0;
  border-block: 1px solid var(--line);
}
.attendance-punches > div { padding: 12px 8px; }
.attendance-punches > div + div { border-inline-start: 1px solid var(--line); padding-inline-start: 12px; }
.attendance-punches dt { color: var(--muted); font-size: .8125rem; }
.attendance-punches dd { margin: 3px 0 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.attendance-punches a { display: block; font-size: .8125rem; font-weight: 550; }
.attendance-filters > .field { flex: 1 1 9rem; }
.attendance-filters select { width: 100%; min-width: 0; }
.attendance-table td small { display: block; color: var(--muted); }
.attendance-table a { white-space: nowrap; }
.attendance-table td .button { min-height: 36px; padding: 6px 10px; }
.attendance-adjustment {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--ground);
}
.attendance-adjustment h3 { margin: 0; font-size: 1rem; }
.attendance-adjustment .operations-inline > .field { flex-basis: 8rem; }
.attendance-adjustment .text-control, .attendance-adjustment .member-select { background-color: var(--paper); }
@media (max-width: 1040px) {
  .attendance-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .attendance-table td, .attendance-table th { padding-inline: 6px; }
}

.attendance-salary {
  border-block: 1px solid var(--line);
  padding-block: 4px;
}
.attendance-salary summary {
  padding-block: 8px;
  cursor: pointer;
  font-size: .875rem;
  font-weight: 650;
}
.attendance-salary form { display: grid; gap: 10px; padding-bottom: 8px; }
.attendance-salary-fields { justify-content: start; }
.attendance-salary-fields > .field { flex: 0 1 14rem; }
@media (max-width: 440px) {
  .attendance-filters > .field { flex-basis: 100%; }
  .attendance-salary-fields > .field { flex-basis: 10rem; }
}

#loyalty-import { padding-bottom: 16px; border-bottom: 1px solid var(--line); }
#loyalty-import input[type="file"] { max-width: 100%; font: inherit; }
#loyalty-detail > a { justify-self: start; }
#loyalty-detail h3 { margin: 8px 0 0; font-size: 1rem; }
#loyalty-list .operations-table { min-width: 0; }
#loyalty-list :is(th, td):first-child { white-space: normal; overflow-wrap: anywhere; }
#loyalty-list th:last-child { white-space: normal; }
.loyalty-identity { display: grid; gap: 2px; }
.loyalty-identity a { width: fit-content; font-weight: 650; }
#loyalty-list td:nth-child(n + 2), #loyalty-list th:nth-child(n + 2),
#loyalty-detail td:nth-child(3), #loyalty-detail th:nth-child(3) {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
