/* Shared operational UI; print templates retain their established layout. */
:root {
  --ink: #26313b;
  --muted: #5e6974;
  --tertiary: #73808a;
  --line: #dfe5e8;
  --line-light: #edf0f2;
  --canvas: #ffffff;
  --surface: #ffffff;
  --sidebar: #f7f9f9;
  --hover: #f4f7f7;
  --brand: #087f78;
  --brand-hover: #06675f;
  --brand-soft: #e9f7f4;
  --warning: #93600d;
  --warning-soft: #fff5e4;
  --danger: #ba3434;
  --danger-soft: #fff0ef;
  --success: #26744b;
  --success-soft: #edf7f0;
}


@media screen {
  body .nav-list .nav-section-title {
    margin:12px 0 4px; padding:6px 10px; border-radius:4px;
    background:#e9edef; color:var(--muted); font-size:12px; font-weight:600;
  }
  body .nav-list .nav-section-title:first-child { margin-top:0; }
  body .nav-list .nav-item { position:relative; padding-left:24px; }
  body .nav-list .nav-item.active::before {
    content:""; position:absolute; left:9px; top:50%; transform:translateY(-50%);
    width:3px; height:16px; border-radius:2px; background:var(--brand);
  }
  body .button.primary, body .button.filter-query, body .prod-machine.active {
    background: var(--brand); border-color: var(--brand); color: #fff;
  }
  body .button.primary:hover, body .button.filter-query:hover { background: var(--brand-hover); border-color: var(--brand-hover); color: #fff; }
  body .topbar-primary { background:var(--brand); color:#fff; border-color:var(--brand); }
  body .topbar-primary:hover { background:var(--brand-hover); }
  body .user-avatar { background:var(--brand-soft); color:var(--brand); }
  body .link-button { color: var(--brand); }
  body .link-button:hover { color: var(--brand-hover); }
  body .action-attention, body .link-button[data-action="price"], body .sales-order-table .link-button[data-action="price"] {
    display: inline-flex; justify-content: center; align-items: center;
    margin: 0; padding: 5px 9px; border: 1px solid transparent; border-radius: 5px;
    background: var(--brand-soft); color: var(--brand); font-weight: 500; line-height: 20px; white-space: nowrap;
  }
  body .action-attention:hover, body .link-button[data-action="price"]:hover, body .sales-order-table .link-button[data-action="price"]:hover { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-hover); }
  body [data-action="price"], body .sales-order-table .link-button[data-action="price"] {
    background:var(--warning-soft); color:var(--warning); border:1px solid #f0cf97;
  }
  body [data-action="price"]:is(:hover,:focus-visible), body .sales-order-table .link-button[data-action="price"]:is(:hover,:focus-visible) {
    background:#ffebc7; color:#784a08; border-color:#dba34a;
  }
  body .link-button:is([data-action^="delete"], [data-action^="remove"], [data-real-remove], [data-return-remove], [data-receipt-remove], [data-remove-line], [data-remove-draft-line]) { color: var(--muted); }
  body .link-button:is([data-action^="delete"], [data-action^="remove"], [data-real-remove], [data-return-remove], [data-receipt-remove], [data-remove-line], [data-remove-draft-line]):is(:hover,:focus-visible) { color: var(--danger); }
  body .button.danger { color: var(--danger); background: var(--danger-soft); border-color: #efc6c3; }
  body :is(input,select,textarea) { accent-color: var(--brand); }
  body :is(button,input,select,textarea,a):focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
  body table:not(.a4-sheet table):not(.reconciliation-sheet table) :is(th,td) {
    text-align: center !important; vertical-align: middle !important;
  }
  body table:not(.a4-sheet table):not(.reconciliation-sheet table) :is(th,td) :is(button,input,select,.line-amount,.number,.sales-line-value,.prod-sub,.product-name-button) { text-align: center; }
  body td :is(.actions,.prod-actions,.ui-row-actions) { display: flex; justify-content: center; align-items: center; gap: 12px; flex-wrap: wrap; }
  body .ui-row-actions { min-width: 172px; gap:10px; }
  body .sales-order-table { table-layout:fixed; min-width:1280px; }
  body .sales-order-table th:nth-child(1) { width:14%; }
  body .sales-order-table th:nth-child(2) { width:17%; }
  body .sales-order-table th:nth-child(3) { width:9%; }
  body .sales-order-table th:nth-child(4) { width:19%; min-width:0; }
  body .sales-order-table th:nth-child(5) { width:9%; }
  body .sales-order-table th:nth-child(6) { width:9%; }
  body .sales-order-table th:nth-child(7) { width:7%; }
  body .sales-order-table th:nth-child(8) { width:16%; }
  body .sales-order-table td { padding:12px 10px; overflow-wrap:anywhere; }
  body .sales-order-table td:first-child { white-space:normal; }
  body .sales-order-table td:first-child button { max-width:100%; white-space:normal; overflow-wrap:anywhere; }
  body .sales-order-table td:nth-child(3),body .prod-table td:nth-child(2) { white-space:nowrap; }
  body .sales-order-table td:nth-child(5)>.sales-line-value,
  body .sales-order-table td:nth-child(6)>.sales-line-value { display:flex; align-items:center; justify-content:center; padding:0; min-height:42px; }
  body .sales-order-table td:nth-child(6)>.sales-line-value:only-child { min-height:0; }
  body .sales-order-table td:nth-child(6)>.sales-line-value+.sales-line-value { margin-top:10px; }
  body .badge { justify-content:center; vertical-align:middle; }
  body .prod-dialog { color:var(--ink); }
  body :is(.prod-sub,.prod-empty,.planner-empty,.planner-time-unknown) { color:var(--tertiary); }
  body :is(.prod-form-section,.prod-common-filters,.prod-stat,.prod-stage,.planner-editor,.prod-dialog) { border-color:var(--line); }
  body :is(.prod-note,.prod-selected,.prod-calculation-panel) { background:var(--brand-soft); color:var(--ink); }
  body .prod-stage { background:var(--hover); }
  body :is(.planner-badge.active,.planner-time-bar.active) { color:var(--brand); background:var(--brand-soft); }
  body :is(.planner-badge.done,.planner-time-bar.done) { color:var(--success); background:var(--success-soft); }
  body :is(.planner-badge.paused,.planner-time-bar.paused,.prod-badge.warn) { color:var(--warning); background:var(--warning-soft); }
  body :is(.planner-badge.late,.planner-time-bar.late) { color:var(--danger); background:var(--danger-soft); }
  body .planner-selected .planner-time-label { background:var(--brand-soft); }
  body .planner-time-label, body .planner-machine-label, body .planner-time-head>* { text-align:center; }
  body .planner-due { align-self:center; justify-self:center; }
}

.modal:has(.purchase-receipt-form){width:min(1220px,calc(100vw - 48px))}
.purchase-receipt-form .notice{margin-top:14px}
.purchase-receipt-form [data-raw-column][hidden]{display:none!important}
.purchase-receipt-editor{width:100%;table-layout:fixed;min-width:800px}
.purchase-receipt-editor th:first-child{width:25%}
.purchase-receipt-editor th:nth-child(2){width:6%}
.purchase-receipt-editor th:last-child{width:6%}
.purchase-receipt-editor :is(th,td){padding:10px 8px;text-align:center;vertical-align:middle}
.purchase-receipt-editor :is(input,select){width:100%;min-width:0;min-height:36px;padding:7px 8px;border:1px solid var(--line);border-radius:6px;background:var(--surface);color:var(--ink);font:inherit;text-align:center}
.purchase-receipt-editor input[readonly]{background:var(--hover);color:var(--muted)}
.purchase-receipt-table{width:100%;table-layout:fixed;min-width:1000px}
.purchase-receipt-table :is(th,td){padding:12px 8px;text-align:center;vertical-align:middle;overflow-wrap:anywhere}
.purchase-receipt-table th:nth-child(1){width:9%}
.purchase-receipt-table th:nth-child(2){width:15%}
.purchase-receipt-table th:nth-child(3){width:12%}
.purchase-receipt-table th:nth-child(4){width:9%}
.purchase-receipt-table th:nth-child(5){width:17%}
.purchase-receipt-table th:nth-child(6){width:5%}
.purchase-receipt-table th:nth-child(7){width:9%}
.purchase-receipt-table th:nth-child(8){width:10%}
.purchase-receipt-table th:nth-child(9){width:6%}
.purchase-receipt-table th:nth-child(10){width:8%}
.purchase-receipt-table :is(th,td):is(:nth-child(1),:nth-child(4),:nth-child(6),:nth-child(7),:nth-child(8),:nth-child(9)){white-space:nowrap;overflow-wrap:normal}
.purchase-receipt-table .field-hint{white-space:normal;text-align:center}
.purchase-receipt-print :is(th,td){text-align:center;vertical-align:middle}

/* Desktop working density is screen-only; paper and label geometry are independent. */
@media screen and (min-width:1001px){
 body .content{padding:20px 24px 30px}
 body .topbar{padding-left:24px;padding-right:24px}
 body .page-head{gap:12px;margin-bottom:14px}
 body .page-head h2{font-size:23px}
 body .page-head p{margin-top:4px;line-height:1.5}
 body .panel-head{padding:10px 14px;gap:10px}
 body .panel-body{padding:12px 14px}
 body .panel+.panel{margin-top:12px}
 body .metric-grid{gap:10px;margin-bottom:14px}
 body .metric{padding:13px 14px}
 body .metric strong{margin-top:5px}
 body .metric-grid:has(>.workbench-card){grid-template-columns:repeat(5,minmax(0,1fr))}
 body .split{gap:12px;align-items:start}
 body .notice:not(.a4-sheet .notice){padding:9px 12px;line-height:1.5}
 body .content>.notice{margin-bottom:12px}
 body .content>.panel>.table-wrap>table:not(.work-order-product-table):not(.planner-pending-table):not(.rm-table):not(.pl-table):not(.delivery-line-table):not(.order-progress-table) :is(th,td){padding:8px 10px}
 body .content>.panel>.table-wrap>table td.empty{padding:24px}
 body .content .ui-row-actions{gap:6px;min-width:132px}
 body .document-pagination{gap:8px;padding:10px 12px}
 body .document-tabs{margin-top:12px;gap:6px}
 body .form-grid,body .filter-grid{gap:10px 12px}
 body .field{gap:4px;min-width:0}
 body .field>input,body .field>select{min-height:34px;padding:6px 9px;font-size:13px}
 body .modal-head,body .modal-foot{padding:10px 16px}
 body .modal-body{padding:12px 16px}
 body .modal-foot{gap:8px}
 body .modal .form-actions{margin-top:12px}
 body .modal .summary-list{gap:8px 16px}
 body .modal .summary-row{gap:10px;min-width:0;overflow-wrap:anywhere}
 body .modal .summary-row>strong{min-width:0}
 body .modal .form-grid:has(#customer-name,#supplier-name,#db-customer-name,#db-supplier-name,#edit-customer-name,#edit-supplier-name){grid-template-columns:repeat(2,minmax(0,1fr))}
 body .role-permission-group{padding:10px 14px}
 body .role-permission-group h4{margin-bottom:6px}
 body .role-permission-options{gap:3px 12px}
 body .role-permission-options .rejection-option{min-height:32px;line-height:1.4}
 body .production-role-section{padding:12px 14px}
 body .production-role-options{gap:4px 12px}
 body .prod-toolbar{margin:10px 0}
 body .prod-stats{margin:10px 0;gap:10px}
 body .prod-stat{padding:10px 12px}
 body .prod-stat strong{margin-top:4px}
 body .content:has([data-guide-search])>article .panel-head>div{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
 body .content:has([data-guide-search])>article .panel-head h3{margin-top:0!important}
 body .modal .summary-list[data-order-review]{grid-template-columns:repeat(2,minmax(0,1fr))}
}
