/* Operational document workspace, using the same tokens as receipts/shipments. */
.spr-ui {min-width:0}
.spr-ui h3 {font-size:17px;font-weight:600;margin:0}
.spr-ui label {display:block;font-size:13px;color:var(--text2);line-height:1.5}
.spr-ui label input,.spr-ui label select,.spr-ui label textarea {margin-top:6px}
.spr-form {padding:22px}
.spr-form fieldset {border:0;padding:0;margin:0;min-width:0}
.spr-form-head,.spr-section,.spr-history-toolbar,.spr-save-bar,.spr-history-footer,.spr-total {display:flex;align-items:center;justify-content:space-between;gap:16px}
.spr-form-head {margin-bottom:22px;align-items:flex-start}
.spr-form-head>div {display:flex;gap:12px;align-items:center;flex-wrap:wrap}
.spr-form-head>[role=status] {font-size:12px;color:var(--text3)}
.spr-header-fields {display:grid;grid-template-columns:1fr 1.5fr 1.2fr 1.4fr;gap:16px}
.spr-store-note {min-height:0;font-size:12px;color:var(--text3);line-height:1.5;margin:10px 0 20px}
.spr-product-search {margin:20px 0 24px;position:relative}
.spr-product-search>label {font-size:15px;font-weight:600;color:var(--text)}
.spr-product-search>input {margin:8px 0}
.spr-product-search .prm-search-drop {z-index:50;left:0;right:0;top:100%;overflow:auto}
.spr-section {margin:20px 0 12px}
.spr-section small,.spr-total>span,.spr-history-footer {color:var(--text3);font-size:13px}
.spr-positions {min-width:820px;table-layout:fixed}
.spr-positions td {vertical-align:top;padding:12px 10px}
.spr-positions td:first-child>.prm-doc-link {text-align:left;white-space:normal}
.spr-positions td small,.spr-dialog small,.spr-history-table small {display:block;color:var(--text3);font-size:12px;line-height:1.5;margin-top:5px;overflow-wrap:anywhere}
.spr-positions textarea {resize:vertical;line-height:1.5;font-family:var(--mono)}
.spr-amount {font-variant-numeric:tabular-nums;text-align:right;overflow-wrap:anywhere}
.spr-row-actions {display:flex;flex-direction:column;gap:7px;align-items:stretch}
.spr-row-actions>small {text-align:center}
.spr-row-actions>div {display:flex;gap:5px;justify-content:center}
.spr-row-actions>div>button {padding:5px;min-width:30px}
.spr-row-actions>[data-action=remove] {color:var(--red);padding:7px}
.spr-row-actions button:disabled {cursor:default}
.spr-line-errors {font-size:12px;line-height:1.45;color:var(--red);margin-top:8px}
.spr-total {margin:20px 0;padding-top:16px;border-top:1px solid var(--border)}
.spr-total strong {font-size:20px}
.spr-extra {margin-top:18px;color:var(--text2);font-size:13px}
.spr-extra summary {cursor:pointer;padding:10px 0;min-height:40px}
.spr-extra .spr-header-fields {max-width:600px;grid-template-columns:1fr 1fr;padding:12px 0}
.spr-extra p {color:var(--text3)}
.spr-save-bar {border-top:1px solid var(--border);margin-top:22px;padding-top:18px;flex-wrap:wrap}
.spr-save-bar>span {font-size:13px;color:var(--text3)}
.spr-note {border:1px solid var(--border2);padding:12px 14px;border-radius:8px;line-height:1.6;margin:14px 0;overflow-wrap:anywhere}
.spr-note.error {color:var(--red);border-color:var(--red)}
.spr-note.warning {color:var(--amber)}
.spr-note.success {color:var(--teal)}
.spr-note button {margin-left:8px}
.spr-draft {display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px;background:var(--bg3);border-radius:8px;margin-bottom:18px}
.spr-badge {display:inline-flex;align-items:center;border:1px solid var(--border2);border-radius:6px;font-size:12px;color:var(--text3);padding:4px 7px;line-height:1.3}
.spr-badge.posted {color:var(--teal);border-color:var(--teal-dim,var(--border2))}
.spr-history-toolbar {align-items:flex-end;flex-wrap:wrap;margin-bottom:18px}
.spr-history-toolbar>.spr-search-label {flex:1 1 320px}
.spr-history-toolbar>label {min-width:160px}
.spr-filter {border:1px solid var(--border2);background:var(--bg2);border-radius:10px;padding:16px;margin-bottom:18px}
.spr-filter-grid {display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px}
.spr-dates {display:flex;flex-wrap:wrap;gap:12px;align-items:flex-end;margin-top:16px}
.spr-dates>.date-filter-controls {flex-basis:100%}
.spr-history-table {width:100%;table-layout:fixed}
.spr-history-table th:nth-child(1) {width:16%}.spr-history-table th:nth-child(2) {width:17%}.spr-history-table th:nth-child(3) {width:34%}.spr-history-table th:nth-child(4) {width:22%}.spr-history-table th:nth-child(5) {width:11%}
.spr-history-table [data-document] {cursor:pointer;outline-offset:-2px}
.spr-history-table [data-document]:hover {background:var(--bg3)}
.spr-history-table [data-document]:focus-visible {outline:2px solid var(--blue)}
.spr-history-table td {vertical-align:top;overflow-wrap:anywhere;padding:14px 12px}
.spr-history-table .spr-badge {margin-top:8px}
.spr-history-footer {margin-top:18px}
.spr-comment {white-space:pre-wrap;display:-webkit-box!important;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}
.spr-dialog {width:min(1120px,96vw);max-width:96vw;max-height:92vh;background:var(--bg2);color:var(--text);padding:0;border:1px solid var(--border2);border-radius:12px}
.spr-dialog::backdrop {background:rgba(0,0,0,.55)}
.spr-dialog>header {display:flex;justify-content:space-between;align-items:flex-start;gap:12px;padding:20px 22px;border-bottom:1px solid var(--border2);position:sticky;top:0;background:var(--bg2);z-index:1}
.spr-dialog h2 {font-size:22px;margin:0}.spr-dialog header p {font-size:13px;color:var(--text3);margin:6px 0 0}
.spr-dialog-body {padding:20px 22px}
.spr-dialog dl {display:grid;grid-template-columns:150px 1fr;gap:10px 18px;margin:22px 0;font-size:14px}.spr-dialog dt {color:var(--text3)}.spr-dialog dd {margin:0;white-space:pre-wrap;overflow-wrap:anywhere}
.spr-dialog table {min-width:650px}
#spr-audit:not(:empty) {margin-top:22px;padding-top:18px;border-top:1px solid var(--border2)}
@media(max-width:1100px){.spr-header-fields {grid-template-columns:1fr 1fr}.spr-history-table {min-width:800px}}
@media(max-width:600px){.spr-form {padding:14px}.spr-header-fields,.spr-filter-grid {grid-template-columns:1fr}.spr-form-head {flex-wrap:wrap}.spr-section {align-items:flex-start;flex-direction:column;gap:5px}.spr-save-bar>.prm-actions {width:100%}.spr-save-bar>.prm-actions>button {flex:1}.spr-history-toolbar {gap:10px}.spr-history-toolbar>.spr-search-label {flex-basis:100%}.spr-history-toolbar>label {flex:1}.spr-dialog>header,.spr-dialog-body {padding:14px}.spr-dialog dl {grid-template-columns:1fr;gap:4px}.spr-dialog dd {margin-bottom:10px}.spr-total strong {font-size:18px}}

@media(max-width:600px){.spr-positions:has(.prm-empty){min-width:0}.spr-positions:has(.prm-empty) thead{display:none}}

.spr-source{padding:16px;border:1px solid var(--border2);border-left:3px solid var(--doc-accent,var(--blue));border-radius:10px;margin:18px 0;background:var(--bg2)}
.spr-source-title,.spr-items-head{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}.spr-source h4,.spr-items-head h4{margin:0;font-size:16px}.spr-source p{margin:7px 0;color:var(--text2);font-size:13px}.spr-source-search{display:flex;gap:10px;align-items:end;margin-top:12px}.spr-source-search label{flex:1;min-width:0}.spr-source-results{max-height:300px;overflow:auto;margin-top:8px}.spr-source-option{width:100%;display:flex;flex-direction:column;gap:6px;text-align:left;padding:12px;color:var(--text);background:var(--bg2);border:1px solid var(--border);border-radius:7px;cursor:pointer;font:inherit}.spr-source-option:hover,.spr-source-option:focus-visible{background:var(--bg3);outline:2px solid var(--doc-accent,var(--blue));outline-offset:-2px}.spr-source-option span{font-size:12px;color:var(--text2)}.spr-source-option strong{overflow-wrap:anywhere}.spr-product-search{position:relative;margin:12px 0}.spr-product-drop{position:absolute;top:100%;left:0;right:0;z-index:40;max-height:340px;overflow:auto;border:1px solid var(--border2);border-radius:9px;background:var(--bg2);box-shadow:0 12px 32px #0003}.spr-ui fieldset:disabled{opacity:.8}.spr-dialog{box-sizing:border-box;max-width:calc(100vw - 24px)}.spr-dialog [hidden]{display:none!important}.spr-dialog .spr-comment{white-space:pre-wrap;overflow-wrap:anywhere}.spr-ui :is(input,select,textarea):focus-visible{outline:2px solid var(--blue);outline-offset:2px}.spr-ui small{white-space:normal}.spr-ui .spr-lines{min-width:820px}.spr-ui .spr-lines td:first-child{min-width:230px}.spr-ui .spr-lines input{min-width:70px}.spr-ui .spr-lines td:nth-child(4){min-width:105px}
@media(max-width:600px){.spr-source-search{align-items:stretch;flex-direction:column}.spr-source{padding:12px}.spr-items-head>.prm-btn{width:100%}}
