/* Shared, data-neutral layout repairs. No calculation or persistence changes. */
#main-content,.content,.content>*,.modal-body,.offer-body,.field{min-width:0;}
.finance-chart-grid{grid-template-columns:minmax(0,1.45fr) minmax(0,.75fr);}
.finance-panel,.finance-panel-head,.finance-customer-empty{min-width:0;overflow-wrap:anywhere;}
.finance-month-wrap{max-width:100%;overflow-x:auto;}
@media(max-width:1100px){.finance-chart-grid{grid-template-columns:minmax(0,1fr);}}
.topbar{flex-wrap:wrap;gap:12px;}
.topbar>div:first-child{min-width:0;flex:1 1 280px;}
/* The existing tablet header switches to column; a pixel flex-basis would
   otherwise become a 280px minimum height and cover the controls below. */
@media(max-width:820px){.topbar>div:first-child{flex:0 1 auto;}}
.topbar .sub,.topbar h1,.modal-head h3{overflow-wrap:anywhere;white-space:normal;}
.topbar>.btn{flex-shrink:0;}
.modal-head{min-width:0;gap:12px;}.modal-head>div{min-width:0;}
.modal-close{flex-shrink:0;}
.modal-foot{flex-wrap:wrap;gap:12px;max-height:42dvh;overflow:auto;}
.modal-foot>div{min-width:0;flex-wrap:wrap;}
.btn,.icon-btn{white-space:normal;overflow-wrap:anywhere;line-height:1.4;}
.table-wrap,.table-scroll,.calc-table-wrap{min-width:0;max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch;overscroll-behavior-inline:contain;scrollbar-width:auto;scrollbar-color:var(--brass,#bd8d3d) var(--graphite,#1c222b);}
.table-wrap::-webkit-scrollbar,.table-scroll::-webkit-scrollbar,.calc-table-wrap::-webkit-scrollbar{height:13px;}
.table-wrap::-webkit-scrollbar-thumb,.table-scroll::-webkit-scrollbar-thumb,.calc-table-wrap::-webkit-scrollbar-thumb{background:var(--brass,#bd8d3d);border:3px solid var(--graphite,#1c222b);border-radius:8px;}
.sw-list-table>thead>tr>th,.sw-list-table>tbody>tr>td{vertical-align:top;overflow-wrap:anywhere;white-space:normal;}
.sw-list-table>tbody>tr>.actions-col{white-space:normal;min-width:0;width:190px;text-align:left;}
.sw-list-table>tbody>tr>.actions-col>.icon-btn,.sw-list-table>tbody>tr>.actions-col>.btn{display:block;max-width:100%;min-height:40px;text-align:left;margin:3px 0;}
.order-overview-order .order-drawing-preview-button{display:block;margin-top:10px;padding:9px 12px;border:1px solid var(--brass,#bd8d3d);border-radius:4px;color:var(--brass-bright,#efbb69);min-height:44px;text-align:left;max-width:100%;}
.sw-order-overview-table{min-width:0!important;}
.sw-order-overview-table .order-overview-order{min-width:180px;max-width:300px;}
.sw-list-table .status-pill{white-space:normal;max-width:100%;}
.sw-list-table .customer-address,.sw-list-table .import-file-name{max-width:100%;overflow:visible;text-overflow:clip;white-space:normal;overflow-wrap:anywhere;}
.sw-scroll-tools{display:none!important;}
.sw-scroll-tools[hidden]{display:none!important;}
.sw-scroll-tools>span{flex:1 1 150px;}
.sw-scroll-tools button{background:var(--panel,#282f39);color:var(--paper,#eee);border:1px solid var(--line,#57606b);border-radius:4px;min-width:44px;min-height:40px;cursor:pointer;}
.sw-scroll-tools button:disabled{opacity:.4;cursor:default;}
.sw-scroll-tools button:focus-visible,.sw-scroll-region:focus-visible{outline:2px solid var(--brass-bright,#efbb69);outline-offset:2px;}
.sw-scroll-top{width:100%;height:16px;overflow-x:scroll;overflow-y:hidden;overscroll-behavior-inline:contain;scrollbar-width:auto;scrollbar-color:var(--brass,#bd8d3d) var(--graphite,#1c222b);}
.sw-scroll-top>div{height:1px;}
/* iPad-Kartenansicht auch auf Windows: alle Listen bleiben ohne horizontales Verschieben lesbar. */
@media(min-width:0px){
 .table-wrap:has(>table.mobile-card-table),.table-scroll:has(>table.mobile-card-table){overflow:visible;border:0;}
 table.mobile-card-table,table.mobile-card-table>tbody{display:block;width:100%!important;min-width:0!important;max-width:100%;}
 table.mobile-card-table>thead{display:none;}
 table.mobile-card-table>tbody{display:grid;gap:12px;}
 table.mobile-card-table>tbody>tr{display:block;border:1px solid var(--line);border-left:3px solid var(--brass);padding:8px 14px;background:var(--panel);min-width:0;}
 table.mobile-card-table>tbody>tr>td{display:block;width:auto;min-width:0;padding:10px 0;text-align:left;white-space:normal;overflow-wrap:anywhere;border-bottom:1px solid var(--line);}
 table.mobile-card-table>tbody>tr>td::before{content:attr(data-mobile-label);display:block;margin-bottom:6px;font:12px/1.4 var(--mono);color:var(--muted);text-transform:uppercase;}
 table.mobile-card-table>tbody>tr>td[data-mobile-label=""]::before{display:none;}
 table.mobile-card-table>tbody>tr>td:last-child{border-bottom:0;}
 table.mobile-card-table>tbody>tr>.actions-col{display:flex;flex-wrap:wrap;gap:6px;width:auto;}
 table.mobile-card-table>tbody>tr>.actions-col::before{flex-basis:100%;}
 table.mobile-card-table>tbody>tr>.actions-col>.icon-btn{min-height:44px;border:1px solid var(--line);padding:8px 10px;}
 table.mobile-card-table>tbody>tr>td>*{min-width:0;max-width:100%;}
 .customer-view-field{min-width:0;max-width:100%;}
 .field input,.field select,.field textarea{max-width:100%;}
}
/* Auftragskarten behalten Zeichnung, Status und Aktionen auch auf großen Windows-Monitoren im Sichtfeld. */
@media(min-width:0px){
 .sw-order-overview-table,.sw-order-overview-table>tbody{display:block;width:100%!important;min-width:0!important;max-width:100%;}
 .sw-order-overview-table>thead{display:none;}
 .sw-order-overview-table>tbody{display:grid;gap:14px;}
 .sw-order-overview-table>tbody>.order-overview-row{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:0 20px;padding:14px 18px;background:var(--panel);border:1px solid var(--line);border-left:3px solid var(--brass);}
 .sw-order-overview-table>tbody>tr>td{display:block;min-width:0;width:auto;padding:12px 0;text-align:left;overflow-wrap:anywhere;white-space:normal;border-bottom:1px solid var(--line);}
 .sw-order-overview-table>tbody>tr>td::before{content:attr(data-mobile-label);display:block;margin-bottom:6px;font:12px/1.4 var(--mono);text-transform:uppercase;color:var(--muted);}
 .sw-order-overview-table>tbody>tr>td[data-mobile-label=""]::before{display:none;}
 .sw-order-overview-table .order-overview-order{max-width:none;min-width:0;}
 .sw-order-overview-table>tbody>tr>td:nth-child(2){grid-column:1/-1;grid-row:1;}
 .sw-order-overview-table>tbody>tr>td.actions-col{grid-column:1/-1;display:flex;flex-wrap:wrap;gap:6px;min-width:0;width:auto;border-bottom:0;}
 .sw-order-overview-table td.actions-col::before{flex-basis:100%;}
 .sw-order-overview-table .actions-col>.icon-btn{padding:8px 12px;border:1px solid var(--line);min-height:44px;}
 .sw-order-overview-table>tbody>tr:has(>td[colspan]){display:block;min-width:0;}
 .sw-order-overview-table>tbody>tr>td[colspan]{width:100%;min-width:0;}
}
@media(max-width:767px){.sw-order-overview-table>tbody>.order-overview-row{grid-template-columns:minmax(0,1fr);padding:10px 14px;}.sw-order-overview-table>tbody>tr>td:nth-child(2){grid-column:1;}.sw-order-overview-table .actions-col>.icon-btn{width:100%;}.sw-order-overview-table .order-overview-signal{min-width:0;}}

/* v324: HTML colspan is not a CSS-grid span. Detail and empty-state rows
   occupy the whole list, on phones as well as desktop/iPad cards. */
table.mobile-card-table>tbody>tr.sw-spanning-row{display:block;grid-column:1/-1;min-width:0;max-width:100%;}
table.mobile-card-table>tbody>tr.sw-spanning-row>td{display:block;grid-column:1/-1;width:100%;min-width:0;text-align:left;}
table.mobile-card-table>tbody>tr.sw-spanning-row>td::before{display:none;}
table.mobile-card-table>tbody>tr.order-production-detail-row{padding:0;}
table.mobile-card-table>tbody>tr.order-production-detail-row>td{padding:0;}
.order-production-detail,.order-production-position-list,.order-production-position-title{min-width:0;max-width:100%;overflow-wrap:anywhere;}
.order-production-detail-head{flex-wrap:wrap;}
.order-production-detail-head>div{flex:1 1 300px;min-width:0;}
.order-production-detail-head>.status-pill{flex:0 1 auto;}
.order-production-position{grid-template-columns:minmax(0,1fr) minmax(120px,auto);align-items:start;}
.order-production-position> *{min-width:0;max-width:100%;}
.order-production-position-title{grid-column:1;grid-row:1;}
.order-production-position>button[data-production-position]{grid-column:2;grid-row:1;justify-self:end;}
.order-production-position>.order-operation-groups,.order-production-position>.order-operation-chain{grid-column:1/-1;grid-row:2;}
.order-production-position>.order-runtime-audit{grid-column:1/-1;grid-row:3;line-height:1.6;padding-top:12px;border-top:1px solid var(--line);}
.order-runtime-audit>strong{display:block;margin-bottom:6px;}
.order-production-position .order-operation-chain{flex-wrap:wrap;overflow:visible;min-width:0;}
.order-production-position .order-operation-card{flex:1 1 220px;min-width:min(100%,220px);max-width:100%;overflow-wrap:anywhere;}
.order-production-position .order-operation-card button{max-width:100%;}
.order-operation-group-head{flex-wrap:wrap;}
.order-operation-group-head>strong,.order-operation-group-head>span{min-width:0;overflow-wrap:anywhere;}
.order-runtime-part{flex-wrap:wrap;min-width:0;}
.order-runtime-part>span{min-width:0;}
.personnel-panel-head{flex-wrap:wrap;}
.personnel-panel-head>div{min-width:0;}
.personnel-calendar-controls{max-width:100%;}
@media(max-width:1280px){.personnel-layout{grid-template-columns:minmax(0,1fr);}}
@media(max-width:767px){
 .order-production-detail{padding:12px;}
 .order-production-detail-head>div{flex:0 1 auto;}
 .order-production-position{grid-template-columns:minmax(0,1fr);padding:10px;}
 .order-production-position>button[data-production-position]{grid-column:1;grid-row:4;justify-self:stretch;width:100%;}
 .order-operation-group-head>span{text-align:left;}
 .order-runtime-part>span{text-align:left;}
}
