.order-grid,.order-settings-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}.order-grid label,.order-detail-form .card>label{display:grid;gap:5px}.order-detail-form .card>label{margin-top:16px}.order-detail-form textarea{width:100%;min-height:92px;resize:vertical}.order-chip{display:inline-block;padding:4px 9px;border-radius:20px;background:#e9f0ff;color:#254b86;font-weight:600;white-space:nowrap}.order-settings-grid .card{margin:0}.order-settings-grid .dashboard-manage-row{gap:12px}.order-settings-grid .quote-setting-actions{display:flex;gap:6px;align-items:center}.order-settings-grid .quote-setting-actions form{margin:0}@media(max-width:700px){.order-grid,.order-settings-grid{grid-template-columns:1fr}}
table[data-smart-list=orders] tbody td:first-child a{color:var(--text);font-weight:700;text-decoration:none}
.order-settings-grid{grid-template-columns:repeat(3,minmax(0,1fr))}.order-settings-grid>.card{min-width:0}@media(max-width:1250px){.order-settings-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}@media(max-width:700px){.order-settings-grid{grid-template-columns:1fr}}
.order-list-card .smart-bar.date-period-toolbar{align-items:flex-end;gap:6px}.order-list-card .smart-bar.date-period-toolbar>.list-period-form{gap:6px}.order-list-card .smart-bar.date-period-toolbar .list-period-form select{width:118px}.order-list-card .smart-bar.date-period-toolbar>input{min-width:165px;flex-basis:190px}

/* Detail layout follows the approved quote workspace. */
.order-editor-frame{width:100%;max-width:1540px;margin:0 auto;min-width:0}
.order-recordline{display:flex;align-items:center;flex-wrap:wrap;gap:12px;padding:12px 16px;background:#fff;border:1px solid var(--border);border-radius:10px;margin-bottom:16px;font-size:12px}
.order-recordline .order-chip{margin-left:auto}
.order-workspace{display:grid;grid-template-columns:minmax(0,1fr) 365px;gap:16px;align-items:start}
.order-editor-pane,.order-details-pane,.order-detail-form{display:grid;gap:14px;min-width:0}
.order-workspace .card{margin:0;min-width:0}
.order-details-pane label{display:grid;gap:5px;font-size:12px;margin:0}
.order-details-pane .card>label{margin-top:14px}
.order-workspace input,.order-workspace select,.order-workspace textarea{width:100%;min-width:0;box-sizing:border-box}
.order-details-pane .order-grid{gap:12px}
.order-editor-pane .table-scroll{max-width:100%}
@media(max-width:1230px){.order-workspace{grid-template-columns:minmax(0,1fr) 320px}}
@media(max-width:1100px){.order-workspace{grid-template-columns:1fr}.order-details-pane{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:720px){.order-details-pane{grid-template-columns:1fr}.order-workspace .order-grid{grid-template-columns:1fr}}
#order-materials table{min-width:750px}#order-materials td{vertical-align:top}#order-materials td:first-child{min-width:145px}#order-materials form{display:grid;gap:7px;margin:0}#order-materials label{display:grid;gap:4px;font-size:11px;margin:0}#order-materials input{max-width:100px}#order-materials select{max-width:210px}.order-material-actions{display:flex;gap:5px;flex-wrap:wrap}.material-badge{display:block;font-size:11px;border-radius:5px;padding:5px 7px;background:#eef0f3}.material-badge.complete{background:#e8f7ed;color:#237341}.material-badge.partial{background:#fff1d6;color:#90600a}.material-badge.available{background:#eaf2ff;color:#235eba}.material-badge.short{background:#ffebeb;color:#a02f38}
#order-materials .order-add-line{display:flex;align-items:end;gap:8px;margin:0 0 16px;flex-wrap:wrap}#order-materials .order-add-line label:first-of-type{flex:1;min-width:220px}#order-materials .order-add-line input[type=search]{max-width:none}#order-materials td:first-child{min-width:0;width:30px}#order-materials td:nth-child(2){min-width:160px}#order-materials td:last-child>form:last-child{margin-top:6px}#order-materials .order-line-grip{cursor:grab;user-select:none}#order-materials .order-line-dragging{opacity:.45;background:#eaf2ff}#order-materials input[type=number]{max-width:75px}
#order-materials form[hidden]{display:none}#order-materials td:last-child>form:last-child{width:32px}#order-materials .order-line-grip:active{cursor:grabbing}
/* Compact order lines; quantity width is visual, not a maximum value. */
#order-materials td{vertical-align:middle;padding:8px 6px}#order-materials input[type=number]{width:44px;max-width:44px;padding:6px 4px;appearance:textfield;-moz-appearance:textfield}#order-materials input[type=number]::-webkit-inner-spin-button,#order-materials input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}#order-materials .order-line-actions{display:flex;align-items:center;gap:5px}#order-materials .order-line-actions>form:first-child{display:flex;align-items:center;gap:5px}#order-materials .order-material-actions{flex-wrap:nowrap}#order-materials .material-badge{display:inline-block;padding:4px 6px;white-space:nowrap}#order-materials .order-line-actions .btn{white-space:nowrap;padding:6px 8px}#order-materials .order-quantity-status{display:block;font-size:11px;color:var(--muted);margin-bottom:6px}#order-materials .order-quantity-status:empty{display:none}
/* Align numeric order columns and their controls to the right. */
#order-materials th:nth-child(n+3),#order-materials td:nth-child(n+3){text-align:right}
#order-materials th:nth-child(n+3){padding-right:6px}
#order-materials [data-quantity-autosave]{justify-items:end}
#order-materials tbody input[type=number]{text-align:right}
#order-materials .order-line-actions{justify-content:flex-end}
/* Keep numeric columns together beside the actions; description takes remaining space. */
#order-materials table{width:100%;table-layout:auto}
#order-materials th:nth-child(2),#order-materials td:nth-child(2){width:100%}
#order-materials th:nth-child(n+3),#order-materials td:nth-child(n+3){width:1%;white-space:nowrap;padding-left:12px}
/* New order article uses the same single-line entry structure as quotes. */
#order-materials .order-add-quote-style{display:block;margin-bottom:16px}
#order-materials .order-new-line{min-width:740px;table-layout:auto}
#order-materials .order-new-line th,#order-materials .order-new-line td{width:auto;min-width:0;padding:6px;text-align:left;white-space:nowrap}
#order-materials .order-new-line th:nth-child(2),#order-materials .order-new-line td:nth-child(2){width:100%;min-width:170px}
#order-materials .order-new-line input{max-width:none;width:100%;min-width:0}
#order-materials .order-new-line input[type=search]{width:105px}
#order-materials .order-new-line input[name=quantity]{width:44px}
#order-materials .order-new-line input[name=price]{width:70px}
#order-materials .order-new-line input[name=discount]{width:52px}
#order-materials .order-new-line select{width:65px;padding:6px}
#order-materials .order-new-line td:nth-child(n+3),#order-materials .order-new-line th:nth-child(n+3){text-align:right}
#order-save-status{font-size:12px;font-weight:400;color:var(--text);max-width:360px}
.order-cancel-menu{position:relative}.order-cancel-menu>summary{list-style:none;cursor:pointer}.order-cancel-menu>summary::-webkit-details-marker{display:none}.order-cancel-menu>form{position:absolute;right:0;top:calc(100% + 8px);z-index:30;width:min(360px,80vw);padding:16px;background:white;border:1px solid var(--border);border-radius:10px;box-shadow:0 8px 24px #0002;display:grid;gap:12px}.order-cancel-menu textarea{width:100%;box-sizing:border-box}.order-cancel-menu label{display:grid;gap:6px}.order-cancel-menu label:has(input[type=checkbox]){display:flex;align-items:flex-start}
.order-editor-frame>.section-head .quote-actionbar{align-items:center}
.order-editor-frame>.section-head .quote-actionbar>.btn,.order-editor-frame>.section-head .order-cancel-menu>summary.btn{box-sizing:border-box;display:inline-flex;align-items:center;justify-content:center;height:37px;min-height:37px;padding:9px 12px;font-size:13px;line-height:17px}
/* Cancel dropdown must not inherit the generic details top margin. */
.order-editor-frame>.section-head .quote-actionbar>.order-cancel-menu{margin:0;padding:0;align-self:center}
.order-relation-fields{grid-column:1/-1;display:grid;gap:12px}.order-relation-fields .order-customer-ready select{display:none}.order-relation-fields .order-customer-ready .ticket-customer-suggestions:not([hidden]){display:grid}.order-relation-fields .order-contact-create>div{grid-template-columns:minmax(0,1fr)}.order-relation-fields .order-contact-create{margin:0}.order-relation-fields .ticket-customer-field>input{width:100%;box-sizing:border-box}
