/* Shared final V4 surfaces; engine state is unaffected by these layout rules. */
@media(min-width:521px){
 .application-shell::after{content:'';position:fixed;inset:0 0 0 var(--rail);background:rgba(0,0,0,.23);z-index:44;pointer-events:none;opacity:0;transition:opacity 120ms ease}
 .application-shell.collapsed.hover-open::after{opacity:1;pointer-events:auto}
 .application-shell.collapsed.hover-open>.navigation-rail{z-index:47}
 .application-shell.collapsed.hover-open>.context-navigation{z-index:48}
 .order-card-v4 .card-order-heading h1{font-size:28px;line-height:34px;white-space:nowrap}
 .order-card-v4 .order-meta{font-size:12px;line-height:17px;margin-left:48px;gap:8px}
 .order-card-v4 .card-order-header{min-width:0;gap:8px}
 .order-card-v4 .card-order-heading{gap:10px}
 .order-card-v4 .card-order-heading>.card-icon{width:25px;min-width:25px;border:0;background:transparent;padding:3px}
 .order-card-v4 .status-selector{font-size:13px}
 .order-card-v4 .workspace-products .actions>[data-action=v4-density]{width:32px;font-size:13px;padding:5px}
 .order-card-v4 .workspace-products .actions>[data-action=v4-items-menu]{display:inline-flex}
 .order-card-v4 .line-comment.comment-indicator{height:32px;width:32px;position:relative;align-items:center;justify-content:center;border:1px solid var(--border);border-radius:6px;padding:5px}
 .order-card-v4 .comment-indicator.no-comment{color:var(--muted);background:transparent}
 .order-card-v4 .comment-indicator.has-comment{color:var(--primary);background:color-mix(in srgb,var(--primary) 15%,var(--surface));border-color:color-mix(in srgb,var(--primary) 45%,var(--border))}
 .comment-indicator>svg{width:18px;height:18px}.comment-indicator>b{position:absolute;right:-5px;top:-6px;background:var(--primary);color:white;font-size:9px;line-height:16px;min-width:16px;padding:0 3px;border-radius:9px;text-align:center}
 .order-card-v4 .order-product-columns>span:nth-child(4){font-size:0}
 .order-card-v4 .detail-tabs>[data-action=workspace-more]{display:inline-flex;align-items:center;gap:3px;min-width:50px}
 .order-card-v4 .detail-tabs>[data-action=workspace-more] svg{height:12px;width:12px}
 .order-card-v4 .process-actions>[data-action=order-menu],.order-card-v4 .process-actions>[data-action=documents]{font-size:0;flex:0 0 36px;padding:5px}
 .order-card-v4 .process-actions>[data-action=documents] svg:last-child{width:11px}
}
.order-card-v4 .order-readiness li>button{display:flex;align-items:center;gap:7px;width:100%;border:0;min-height:24px;padding:1px 0;color:inherit;text-align:left;font:inherit;background:transparent;box-shadow:none}
.order-card-v4 .order-readiness li>button>i{border:1px solid #8da9b9;border-radius:50%;display:flex;align-items:center;justify-content:center;width:22px;height:22px;flex-shrink:0;color:#8da9b9}
.order-card-v4 .order-readiness li.passed>button>i{background:#00cfa7;color:#001e18;border-color:#00cfa7}
.order-card-v4 .order-readiness li>button>i svg{width:15px;height:15px}
.order-card-v4 .order-readiness li>button>small{margin-left:auto;color:#ffc053;font-size:11px;max-width:45%;text-align:right}
.order-card-v4 .order-readiness li.passed>button>small{color:#00edbd}
.order-card-v4 .order-readiness li>button>svg{width:12px;height:12px;flex-shrink:0;color:#45ccb6}
.order-card-v4 .order-readiness li>button:hover{background:#ffffff09}
.order-overview-panel{display:flex;flex-direction:column;gap:10px;min-width:0}
.context-work-panel{border:1px solid var(--border);border-radius:7px;overflow:hidden;background:linear-gradient(135deg,var(--surface),var(--canvas));min-width:0}
.context-work-panel>header{display:flex;align-items:center;justify-content:space-between;gap:6px;padding:9px 10px;border-bottom:1px solid var(--border-subtle)}
.context-work-panel h3{font-size:13px;margin:0}.context-work-panel .text-button{font-size:11px;min-height:24px}
.attention-row{display:flex;width:100%;align-items:flex-start;gap:8px;text-align:left;padding:9px 10px;background:transparent;border:0;border-radius:0;box-shadow:none;border-bottom:1px solid var(--border-subtle);font-size:12px}
.attention-row:last-child{border-bottom:0}.attention-row>span{min-width:0;flex:1}.attention-row strong{font-size:12px;line-height:17px;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;font-weight:500}.attention-row small{display:block;color:var(--secondary);font-size:11px;line-height:15px;margin-top:3px}.attention-row>svg{width:13px;height:13px;flex-shrink:0;margin-top:3px}.attention-row:hover{background:var(--raised)}
.attention-dot{width:11px;height:11px;flex:0 0 11px;border-radius:50%;background:var(--warning);margin-top:3px}.attention-dot.purple{background:var(--purple)}.attention-dot.red{background:var(--danger)}.task-box{border:1px solid var(--border);border-radius:3px;width:14px;height:14px;flex:0 0 14px;margin-top:2px}.overview-empty{font-size:12px;color:var(--secondary);padding:10px;margin:0}.full-note{white-space:pre-wrap;overflow-wrap:anywhere;line-height:1.5}.attention-target{outline:2px solid var(--warning);outline-offset:-2px;transition:outline-color .2s}
.smart-popover{width:270px;max-height:calc(100dvh - 16px);overflow:auto;padding:10px 12px}
.smart-popover .panel-heading h2{font-size:13px}.smart-popover .panel-heading{margin-bottom:5px}
.smart-popover .smart-menu-row{width:100%;min-height:36px;display:flex;align-items:center;justify-content:flex-start;gap:9px;padding:7px 8px;border:0;border-radius:5px;box-shadow:none;background:transparent;text-align:left;font-size:12px;margin:0}
.smart-popover .smart-menu-row>svg{width:17px;height:17px;flex-shrink:0}.smart-popover .smart-menu-row>svg:last-child:not(:first-child){margin-left:auto}.smart-popover .smart-menu-row:hover,.smart-popover .smart-menu-row:focus-visible,.smart-popover .smart-menu-row.selected{background:var(--raised)}.smart-popover .smart-menu-row.destructive{color:var(--danger)}.smart-popover button[hidden]{display:none}.smart-popover h3{font-size:10px;color:var(--muted);text-transform:uppercase;letter-spacing:.5px;padding:8px 7px 4px;margin:5px 0 0;border-top:1px solid var(--border)}
.smart-popover .warehouse-choice{gap:2px;align-items:flex-start;flex-direction:column}.smart-popover input{width:100%;margin:5px 0;font-size:13px}.edit-popover{max-width:min(380px,calc(100vw - 16px));max-height:calc(100dvh - 16px);overflow:auto}
.product-picker-modal{width:min(930px,calc(100vw - 32px));max-width:calc(100vw - 24px);height:min(700px,85dvh);max-height:85dvh;display:flex;flex-direction:column;background:linear-gradient(130deg,var(--surface),var(--canvas));box-shadow:0 18px 70px #0008,0 0 18px #008bff0b;padding:15px;border:1px solid var(--border)}
.product-picker-modal>.panel-heading{flex-shrink:0;min-height:32px;margin-bottom:10px}.product-picker-modal>.panel-heading h2{font-size:18px}.product-picker-modal>.modal-body{min-height:0;overflow:hidden;flex:1;padding:0}
.order-product-picker{height:100%;min-height:0;display:flex;flex-direction:column;gap:9px;color:var(--text)}
.picker-search{display:flex;align-items:center;gap:9px;flex-shrink:0}.picker-search>svg{position:absolute;margin-left:12px;height:17px;width:17px;color:var(--secondary)}.picker-search input{width:100%;min-width:0;height:38px;padding:7px 10px 7px 36px;background:var(--canvas);color:var(--text);font-size:13px}.picker-search button{height:38px;width:38px;flex-shrink:0;padding:8px}
.picker-tabs{display:flex;gap:4px;flex-shrink:0;border-bottom:1px solid var(--border);padding-bottom:4px}.picker-tabs button{min-height:32px;padding:6px 10px;background:transparent;border:0;font-size:12px}.picker-tabs button.active{background:color-mix(in srgb,var(--primary) 22%,var(--surface));color:var(--primary);box-shadow:inset 0 -2px var(--primary);border-radius:5px 5px 0 0}
.picker-filters{display:flex;gap:7px;flex-shrink:0}.picker-filters select{font-size:12px;min-height:32px;min-width:0;max-width:25%;flex:1}.picker-hint:empty,.picker-error:empty{display:none}.picker-hint{font-size:11px;color:var(--secondary);margin:0}.picker-error{font-size:12px;color:var(--danger);margin:0;flex-shrink:0}
.picker-results{min-height:0;overflow:auto;flex:1;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;align-content:start;padding:1px 3px 1px 1px;overscroll-behavior:contain}
.picker-product{display:grid;grid-template-columns:56px minmax(0,1fr) 96px;grid-template-rows:auto 30px;gap:5px 9px;align-items:center;position:relative;padding:10px;border-radius:7px;background:linear-gradient(125deg,var(--raised),var(--surface));border:1px solid var(--border-subtle);min-width:0}
.picker-product.selected{border-color:var(--primary);background:color-mix(in srgb,var(--primary) 12%,var(--surface))}
.picker-product>img{width:56px;height:56px;object-fit:cover;border-radius:5px;grid-column:1;grid-row:1 / 3;background:#ecf1f5}
.picker-product-main{min-width:0;grid-column:2;grid-row:1}.picker-product-main>strong{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;font-size:13px;line-height:16px}.picker-product-main small{display:block;font-size:10px;color:var(--secondary);line-height:14px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.picker-stock{font-size:10px;display:block;line-height:14px}.picker-price{grid-column:3;grid-row:1;align-self:center;text-align:right;font-size:13px;white-space:normal;overflow-wrap:anywhere;line-height:17px}
.picker-quantity{grid-column:2;grid-row:2;display:flex;align-items:center}.picker-quantity button{width:28px;min-height:30px;padding:2px;font-size:17px}.picker-quantity input{width:34px;height:30px;border-radius:0;padding:1px;text-align:center;background:var(--canvas);font-size:12px;appearance:textfield}.picker-quantity input::-webkit-inner-spin-button{appearance:none}
.picker-product>.picker-select{grid-column:3;grid-row:2;justify-self:end;height:30px;min-height:30px;width:34px;padding:5px}.picker-select.selected{background:var(--success);color:var(--canvas);border-color:var(--success)}
.picker-product>.picker-favorite{position:absolute;right:7px;top:4px;width:20px;height:20px;min-height:20px;padding:2px;border:0;background:none;color:var(--muted)}.picker-favorite svg{height:13px;width:13px}.picker-favorite.active{color:var(--warning)}.picker-price{padding-top:8px}
.picker-footer{display:flex;justify-content:space-between;gap:10px;align-items:center;flex-shrink:0;border-top:1px solid var(--border);padding-top:10px;min-height:48px;font-size:12px}.picker-footer>div:first-child{display:flex;align-items:center;gap:13px;min-width:0}.picker-footer strong{font-size:16px;font-variant-numeric:tabular-nums}.picker-footer-actions{display:flex;gap:8px}.picker-footer button{min-height:36px;font-size:12px}.picker-empty{grid-column:1 / -1;padding:30px 12px;text-align:center;font-size:13px;color:var(--secondary)}
@media(max-width:1100px) and (min-width:521px){.order-card-v4 .card-order-heading h1{font-size:23px}.order-card-v4 .card-order-heading{gap:6px}.order-card-v4 .order-meta{font-size:11px;margin-left:42px}.order-card-v4 .card-order-header .actions .button{min-width:27px;width:27px;font-size:0}.order-card-v4 .status-selector{font-size:11px;max-width:145px}.order-card-v4 .card-order-heading>.card-icon{display:none}}
@media(max-width:600px){.product-picker-modal{padding:11px;width:calc(100vw - 16px);max-width:calc(100vw - 16px);height:85dvh}.product-picker-modal>.panel-heading h2{font-size:16px}.picker-results{grid-template-columns:1fr}.picker-tabs{gap:0}.picker-tabs button{padding:6px;font-size:11px}.picker-filters{flex-wrap:wrap;gap:5px}.picker-filters select{flex:1 1 40%;max-width:50%}.picker-footer{align-items:stretch;gap:6px;flex-direction:column}.picker-footer>div:first-child{justify-content:space-between}.picker-footer-actions{justify-content:flex-end}.picker-product{grid-template-columns:52px minmax(0,1fr) 80px;gap:5px 7px;padding:8px}.picker-product>img{width:52px;height:52px}.picker-search input{font-size:16px}.picker-favorite{opacity:1}}
@media(prefers-reduced-motion:reduce){.application-shell::after{transition:none}}
.product-picker-modal .picker-search input{padding-left:36px}
.order-card-v4 .v4-bottom-dock .process-actions>[data-action=order-menu],.order-card-v4 .v4-bottom-dock .process-actions>[data-action=documents]{font-size:0;flex:0 0 36px;padding:5px}
.order-card-v4 .v4-bottom-dock .process-actions>[data-action=documents] svg:last-child{width:10px}
[data-order-save]{font-size:9px;color:var(--success);font-weight:400;margin-left:5px}[data-order-save].save-failed{color:var(--danger)}
/* Pinned navigation + a small laptop: warehouse stays in the line menu rather than overflowing the row. */
@container order-workspace (max-width:800px){.order-card-v4 .line-warehouse,.order-card-v4 .order-product-columns>span:nth-child(3){display:none}.order-card-v4 .order-product-row,.order-card-v4 .order-product-columns{grid-template-columns:18px minmax(100px,1fr) 58px 66px 44px minmax(62px,.65fr) 26px;column-gap:3px}}
@container order-workspace (min-width:1251px){.order-card-v4 .order-product-row,.order-card-v4 .order-product-columns{grid-template-columns:22px minmax(170px,1.85fr) minmax(115px,1.3fr) 36px minmax(78px,.8fr) 96px 60px minmax(85px,.9fr) 32px}}
@container order-workspace (max-width:1250px){.order-card-v4 .line-comment.comment-indicator{width:26px;height:30px;padding:4px}}
/* Narrow tablets with an explicitly pinned sidebar use a readable vertical workspace. Desktop stays bounded. */
@media(min-width:521px) and (max-width:900px){
 .page-content:has(>.order-card-v4){overflow:auto}
 .order-card-v4:not(.workspace-inline){height:auto;max-height:none;grid-template-columns:minmax(0,1fr);overflow:visible}
 .order-card-v4:not(.workspace-inline) .v4-main{height:680px;grid-template-rows:54px 174px minmax(150px,1fr) 54px;gap:8px}
 .order-card-v4:not(.workspace-inline) .v4-right{height:500px;grid-template-rows:244px minmax(0,1fr)}
 .order-card-v4:not(.workspace-inline) .v4-bottom-dock{position:sticky;bottom:0;z-index:4;background:var(--canvas)}
}

.picker-stock.stock-green{color:var(--success)}.picker-stock.stock-amber{color:var(--warning)}.picker-stock.stock-red{color:var(--danger)}.picker-empty>p{margin-bottom:10px}

/* Shared action groups reuse the existing smart-popover surface. */
.overlay-dismiss.menu-dismiss{background:transparent}
.smart-popover .smart-menu-group+ .smart-menu-group{border-top:1px solid var(--border);margin-top:6px;padding-top:2px}
.smart-popover .smart-menu-group>h3{border:0;font-size:11px;line-height:1.4;margin:0;padding:7px 8px 4px}
.smart-popover .smart-menu-row{font-size:13px;line-height:1.4;white-space:normal;text-decoration:none;color:var(--text)}
.smart-popover .smart-menu-row>span{min-width:0;text-align:left}
.smart-popover .smart-menu-row.destructive,.smart-popover .danger-group>h3{color:var(--danger)}
.smart-popover .saved-view-list>div{display:flex;align-items:center;gap:4px}
.smart-popover .saved-view-list>div>[data-action=ux-view-menu]{width:32px;flex:0 0 32px;padding:6px}
.smart-popover .saved-view-list>div>[data-action=ux-view-apply]{min-width:0;flex:1}
.smart-popover .saved-view-list strong{white-space:normal}
