/* Settings and WorkTool share one continuous, responsive work surface. */
body #appView .settings-workspace{width:100%;max-width:1600px;margin:0;color:#20252d;min-width:0;padding-bottom:36px}
body #appView .settings-tabs{display:flex;gap:28px;align-items:center;overflow-x:auto;margin:0 0 20px;border-bottom:1px solid #e5e9ef;scrollbar-width:thin}
body #appView .settings-tabs [role=tab]{flex-shrink:0;min-height:44px;padding:12px 0;border:0;border-radius:0;background:transparent;color:#667085;font-size:14px;box-shadow:none}
body #appView .settings-tabs [aria-selected=true]{color:#245fd7;font-weight:600;box-shadow:inset 0 -2px #245fd7}
body #appView .settings-workspace > [hidden]{display:none!important}
body #appView .settings-workspace .panel{border-radius:6px;box-shadow:none;margin-bottom:16px;border:1px solid #e8ecf1}
body #appView .settings-workspace .panel-head{min-height:60px;padding:16px 20px;gap:16px;align-items:center}
body #appView .settings-workspace .panel-title{font-size:14px;font-weight:600;line-height:1.5}
body #appView .settings-workspace .panel-body{padding:20px}
body #appView .settings-workspace .settings-core-grid{gap:16px;align-items:stretch}
body #appView .settings-workspace .settings-core-grid .panel{height:100%;margin:0}
body #appView .settings-workspace .settings-field{gap:8px;font-size:12px;color:#475467}
body #appView .settings-workspace .settings-field :is(input,select){min-height:38px;font-size:13px;border-radius:5px}
body #appView .settings-workspace .scan-key-grid{grid-template-columns:repeat(3,minmax(0,1fr));gap:20px;padding:20px}
body #appView .settings-workspace .scan-key-setting{grid-template-columns:24px minmax(0,1fr);gap:8px 12px;padding-bottom:16px;border-bottom:1px solid #edf0f4}
body #appView .settings-workspace .scan-key-number{grid-row:1/4;font-size:18px;color:#98a2b3;font-weight:500;line-height:22px}
body #appView .settings-workspace .scan-key-setting strong{font-size:14px;font-weight:600;line-height:22px}
body #appView .settings-workspace .scan-key-setting>span:not(.scan-key-number){font-size:12px;line-height:18px;color:#667085}
body #appView .settings-workspace .scan-key-setting input.hotkey-input{grid-column:2;min-height:38px;font-size:13px;text-align:left;padding-left:12px}
body #appView .settings-workspace .scan-key-test{gap:12px;padding:16px 20px;background:#f8fafc}
body #appView .settings-workspace .settings-scope-label{padding:12px 20px}
body #appView .settings-workspace .settings-secondary{margin-top:16px}
.wt-workspace{width:100%;min-width:0;color:#20252d;font-size:13px;line-height:1.5;--wt-muted:#667085;--wt-line:#e9edf2;--wt-blue:#245fd7}
.wt-tabs{display:flex;gap:22px;align-items:center;overflow-x:auto;margin:0 0 20px;padding:0 2px;scrollbar-width:thin}
.wt-tabs button{flex:0 0 auto;min-height:40px;white-space:nowrap;padding:9px 0;border:0;border-bottom:2px solid transparent;border-radius:0;background:none;color:#667085;font-size:13px;font-weight:500;box-shadow:none}
.wt-tabs button.is-active{color:var(--wt-blue);border-bottom-color:var(--wt-blue);font-weight:600}
.wt-tabs button:hover{color:var(--wt-blue);background:none}
.wt-workspace :is(button,a,input,select,textarea):focus-visible,.settings-tabs button:focus-visible{outline:2px solid #245fd7;outline-offset:3px}
.wt-workspace :is(button,input,select,textarea){font:inherit}
.wt-workspace button:not([role=tab]):not(.wt-case-row){min-height:36px;padding:7px 12px;border-radius:5px;line-height:20px}
.wt-workspace button:disabled{cursor:not-allowed;opacity:.55}
.wt-workspace [role=tabpanel]{min-width:0}
.wt-surface{background:#fff;padding:20px;margin:0 0 16px;border:1px solid var(--wt-line);border-radius:6px;box-shadow:none;min-width:0}
.wt-section-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:16px;min-height:28px}
.wt-section-head h2{margin:0;font-size:14px;line-height:22px;font-weight:600;color:#20252d}
.wt-section-head>div{display:flex;gap:8px;flex-wrap:wrap}
.wt-section-head>span{font-size:12px;color:var(--wt-muted)}
.wt-metrics{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:0;margin:0 0 16px;background:#fff;border:1px solid var(--wt-line);border-radius:6px;padding:16px 0}
.wt-metrics>div{min-width:0;padding:0 20px;border-right:1px solid var(--wt-line)}
.wt-metrics>div:last-child{border:0}
.wt-metrics span{display:block;color:var(--wt-muted);font-size:12px;line-height:20px}
.wt-metrics strong{display:block;color:#20252d;font-size:24px;font-weight:600;line-height:32px;margin-top:4px;font-variant-numeric:tabular-nums}
.wt-business-metrics{grid-template-columns:repeat(5,minmax(0,1fr))}
.wt-flow{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:24px}
.wt-flow article{display:grid;align-content:start;gap:12px;padding-right:24px;border-right:1px solid var(--wt-line);min-width:0}
.wt-flow article:last-child{padding-right:0;border:0}
.wt-flow h3{font-size:14px;margin:0;font-weight:600}
.wt-flow p,.wt-muted{color:var(--wt-muted);font-size:12px;line-height:1.7;margin:0 0 12px}
.wt-flow button{justify-self:start}
.wt-info-lines{display:flex;flex-wrap:wrap;gap:14px 28px;font-size:12px;color:var(--wt-muted);margin:0 0 16px;overflow-wrap:anywhere}
.wt-info-lines strong{color:#344054;font-weight:500;margin-left:10px}
.wt-cap-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:0 24px}
.wt-cap-grid button{display:flex;justify-content:space-between;align-items:center;text-align:left;background:transparent;border:0;border-bottom:1px solid var(--wt-line);border-radius:0!important;padding:14px 0!important;gap:12px;box-shadow:none}
.wt-cap-grid button:hover{background:#f8fafc}
.wt-cap-grid strong{font-size:13px;font-weight:500;min-width:0;overflow-wrap:anywhere}
.wt-cap-grid span{font-size:12px;color:var(--wt-muted);flex-shrink:0}
.wt-form{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px 24px;max-width:1000px;align-items:start}
.wt-form label{display:flex;flex-direction:column;gap:8px;font-size:12px;color:#475467;min-width:0}
.wt-form input,.wt-form select,.wt-form textarea{box-sizing:border-box;width:100%;min-height:38px;padding:8px 10px;background:#fff;border:1px solid #dce2e9;border-radius:5px;font-size:13px;line-height:20px;color:#20252d;min-width:0}
.wt-form textarea{resize:vertical;min-height:90px;line-height:1.7}
.wt-form .wt-check{min-height:38px;flex-direction:row;align-items:center;gap:8px}
.wt-check input{width:16px;min-height:16px;height:16px;flex:0 0 16px;accent-color:var(--wt-blue)}
.wt-form>button{justify-self:start}
.wt-wide{grid-column:1/-1}
.wt-actions{display:flex;align-items:center;flex-wrap:wrap;gap:8px}
.wt-actions a{font-size:12px;color:#245fd7;text-decoration:none}
.wt-result{grid-column:1/-1;max-height:360px;overflow:auto;font-size:12px;line-height:1.6;white-space:pre-wrap;overflow-wrap:anywhere;background:#f7f9fc;padding:16px;border-radius:5px}
.wt-empty{display:flex;flex-direction:column;align-items:center;gap:16px;padding:36px 16px;text-align:center;font-size:13px;line-height:1.6;color:var(--wt-muted)}
.wt-row{display:flex;align-items:center;gap:16px;padding:14px 0;border-bottom:1px solid var(--wt-line);min-width:0}
.wt-row>span:first-child{flex:1;min-width:0;overflow-wrap:anywhere}
.wt-row strong{font-size:13px;font-weight:500}
.wt-row small,.wt-table-wrap td small{display:block;color:var(--wt-muted);font-size:12px;line-height:18px;margin-top:4px;overflow-wrap:anywhere}
.wt-row button{flex-shrink:0}
.wt-row:last-child{border-bottom:0}
.wt-table-wrap{overflow-x:auto;max-width:100%;scrollbar-width:thin}
.wt-table-wrap table{width:100%;min-width:720px;border-collapse:collapse;border-spacing:0;font-size:13px}
.wt-table-wrap th{text-align:left;color:#667085;background:#f8fafc;font-weight:500;padding:10px 12px;font-size:12px;white-space:nowrap}
.wt-table-wrap td{padding:14px 12px;border-bottom:1px solid var(--wt-line);background:#fff;vertical-align:top}
.wt-table-wrap td:nth-child(1){width:180px}
.wt-table-wrap td:nth-child(2){max-width:350px;overflow-wrap:anywhere}
.wt-table-wrap td:nth-child(4){max-width:300px;overflow-wrap:anywhere}
.wt-table-wrap pre{max-width:450px;white-space:pre-wrap}
.wt-state{display:inline-flex;align-items:center;gap:6px;font-size:12px;line-height:20px;color:#667085;background:none!important;white-space:nowrap}
.wt-state:before{content:'';width:5px;height:5px;border-radius:50%;background:currentColor;flex-shrink:0}
.wt-state--succeeded,.wt-state--reply_succeeded,.wt-state--working{color:#278367}
.wt-state--failed,.wt-state--reply_failed{color:#b42318}
.wt-state--uncertain,.wt-state--handoff,.wt-state--partial,.wt-state--open{color:#9a6700}
.wt-state--waiting{color:#245fd7}
.wt-state--resolved,.wt-state--history{color:#667085}
.wt-engine{display:flex;gap:16px;flex-wrap:wrap;align-items:center;padding:0 0 20px}
.wt-engine strong{font-size:14px;font-weight:600}
.wt-engine span{font-size:12px;color:var(--wt-muted)}
.wt-message{padding:16px 0;border-bottom:1px solid var(--wt-line)}
.wt-message header{display:flex;gap:12px;align-items:center;flex-wrap:wrap;font-size:12px;color:var(--wt-muted)}
.wt-message header strong{font-size:14px;color:#344054;font-weight:600;overflow-wrap:anywhere}
.wt-message header time{margin-left:auto;font-variant-numeric:tabular-nums}
.wt-message p{white-space:pre-wrap;overflow-wrap:anywhere;font-size:13px;line-height:1.7;margin:10px 0}
.wt-draft{background:#f7f9fc;border-left:2px solid #d8e2ef;padding:12px 16px;margin:12px 0}
.wt-draft small{color:var(--wt-muted)}
.wt-qr-list{display:flex;flex-wrap:wrap;gap:24px}
.wt-qr-list article{width:180px;overflow-wrap:anywhere}
.wt-qr-list img{display:block;width:150px;height:150px;object-fit:contain;margin:12px 0}
.wt-qr-list h3{font-size:13px;font-weight:600}
.wt-qr-list small{display:block;color:var(--wt-muted);font-size:12px;margin-top:8px}
.wt-notice{font-size:12px;line-height:1.7;padding:12px 16px;background:#faf8f3;color:#805e23}
.wt-basket{padding:20px 0 0;font-size:13px;border-top:1px solid var(--wt-line);margin-top:20px}
.wt-basket ol{line-height:1.8;padding-left:20px}
.wt-basket button{margin-right:8px}
.wt-list+.wt-form{margin-top:24px;padding-top:20px;border-top:1px solid var(--wt-line)}
.wt-business-filter{display:grid;grid-template-columns:minmax(140px,.8fr) minmax(180px,1fr) minmax(220px,1.6fr) auto;gap:12px;align-items:end;margin:0 0 16px}
.wt-business-filter label{display:grid;gap:8px;min-width:0;font-size:12px;color:#475467}
.wt-business-filter input,.wt-business-filter select{box-sizing:border-box;width:100%;height:38px;min-width:0;border:1px solid #dce2e9;border-radius:5px;padding:8px 10px;background:#fff;font-size:13px}
.wt-business-filter button{height:38px}
.wt-case-list{display:grid;gap:0}
.wt-case-row{display:flex;align-items:center;text-align:left;gap:20px;width:100%;padding:16px 0;border:0;border-bottom:1px solid var(--wt-line);border-radius:0;background:#fff;color:inherit;box-shadow:none;line-height:1.5;min-width:0}
.wt-case-row--followup{display:grid;grid-template-columns:minmax(200px,1fr) 80px minmax(100px,160px) 160px}
.wt-case-row--order{display:grid;grid-template-columns:minmax(200px,1fr) auto auto}
.wt-case-row:hover{background:#f8fafc;border-color:var(--wt-line)}
.wt-case-row>span{display:grid;gap:5px;min-width:0}
.wt-case-main{flex:1;min-width:0}
.wt-case-row small{color:var(--wt-muted);font-size:12px;line-height:18px;overflow-wrap:anywhere}
.wt-case-row strong{font-size:13px;line-height:20px;font-weight:500;overflow-wrap:anywhere}
.wt-case-main strong{font-size:14px;font-weight:600}
.wt-case-overdue strong{color:#9a6700;font-variant-numeric:tabular-nums}
.wt-case-urgent{font-size:12px;color:#b42318;font-style:normal}
.wt-case-pager{justify-content:flex-end;margin-top:16px;color:var(--wt-muted);font-size:12px;padding-right:64px}
.wt-case-pager>span{margin-right:auto}
.wt-business-modal{z-index:13000!important}
.wt-case-card{width:min(1020px,calc(100vw - 40px));max-height:calc(100dvh - 40px);border-radius:8px}
.wt-case-card .erp-dialog-body{max-height:calc(100dvh - 144px);overflow:auto;padding:20px 24px}
.wt-case-card .wt-form{max-width:none}
.wt-case-facts{padding:20px 0;border-bottom:1px solid #e9edf2}
.wt-case-facts h3{font-size:14px;font-weight:600;margin:0 0 16px}
.wt-case-products{display:flex;gap:12px;flex-wrap:wrap;margin-top:16px}
.wt-case-products article{display:flex;align-items:center;gap:12px;max-width:100%;min-width:200px;padding:10px;background:#f8fafc;border-radius:5px}
.wt-case-products img{width:60px;height:60px;object-fit:contain;background:#fff;border-radius:4px}
.wt-case-products article div{display:grid;gap:5px;min-width:0;overflow-wrap:anywhere}
.wt-case-products small{color:#667085}
.wt-case-timeline{display:grid;gap:20px;border-left:2px solid #e9edf2;padding-left:16px}
.wt-case-timeline article div{display:flex;justify-content:space-between;gap:12px}
.wt-case-timeline article small{color:#667085}
.wt-case-timeline p,.wt-case-card .wt-draft p{white-space:pre-wrap;overflow-wrap:anywhere;line-height:1.7;margin:8px 0}
.wt-case-card [data-wtb-status]{color:#b42318;white-space:pre-wrap;font-size:13px}
.wt-case-card .wt-row{flex-wrap:wrap}
@media(max-width:1100px){
  .wt-cap-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .wt-case-row--followup{grid-template-columns:minmax(170px,1fr) 70px minmax(90px,120px) 140px;gap:12px}
  .wt-business-filter{grid-template-columns:1fr 1fr;gap:12px}
  .wt-business-filter>button{justify-self:end;min-width:80px}
  body #appView .settings-workspace .scan-key-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media(max-width:760px){
  body #appView .settings-tabs{gap:24px;margin-bottom:16px}
  body #appView .settings-tabs [role=tab]{font-size:13px}
  body #appView .settings-workspace .panel-head{padding:14px 16px;align-items:flex-start;flex-wrap:wrap}
  body #appView .settings-workspace .panel-body{padding:16px}
  body #appView .settings-workspace .scan-key-grid{grid-template-columns:1fr;padding:16px;gap:16px}
  .wt-tabs{gap:20px;margin-bottom:16px}
  .wt-surface{padding:16px;margin-bottom:12px}
  .wt-metrics{grid-template-columns:repeat(2,minmax(0,1fr));padding:0;margin-bottom:12px}
  .wt-metrics>div{padding:12px 16px;border-right:1px solid var(--wt-line);border-bottom:1px solid var(--wt-line)}
  .wt-metrics>div:nth-child(even){border-right:0}
  .wt-metrics>div:last-child{border-bottom:0}
  .wt-business-metrics>div:last-child{grid-column:1/-1}
  .wt-metrics strong{font-size:22px;line-height:28px}
  .wt-flow{grid-template-columns:1fr;gap:16px}
  .wt-flow article{border-right:0;border-bottom:1px solid var(--wt-line);padding:0 0 16px;gap:8px}
  .wt-flow article:last-child{padding-bottom:0}
  .wt-section-head{flex-wrap:wrap;align-items:flex-start;gap:10px;margin-bottom:14px}
  .wt-case-row--followup{grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:10px 16px}
  .wt-case-main{grid-column:1/-1}
  .wt-case-row--followup>span:nth-child(2){grid-column:2;grid-row:2;justify-self:end}
  .wt-case-row--followup>span:nth-child(3){grid-column:1;grid-row:2}
  .wt-case-row--followup>span:nth-child(4){grid-column:1/-1;display:flex;gap:12px;align-items:center}
  .wt-case-row--order{grid-template-columns:1fr auto;gap:12px}
  .wt-case-row--order .wt-case-main{grid-column:1/-1}
  .wt-row{flex-wrap:wrap;gap:10px}
  .wt-row>span:first-child{flex-basis:100%}
  .wt-case-pager{padding-right:0;justify-content:flex-start}
  .wt-case-pager>span{flex-basis:100%}
  .wt-case-card{width:calc(100vw - 24px);max-height:calc(100dvh - 24px)}
  .wt-case-card .erp-dialog-body{padding:16px;max-height:calc(100dvh - 120px)}
  .wt-case-timeline article div{display:grid;gap:4px}
  .wt-case-card .wt-form{grid-template-columns:1fr}
}
@media(max-width:520px){
  .wt-form,.wt-cap-grid,.wt-business-filter{grid-template-columns:1fr}
  .wt-form{gap:16px}
  .wt-business-filter>button{justify-self:stretch}
  .wt-wide{grid-column:1/-1}
  .wt-cap-grid button{min-height:44px!important}
  .wt-workspace button:not([role=tab]):not(.wt-case-row){min-height:40px}
  .wt-message header time{margin-left:0;width:100%}
  .wt-actions{gap:8px}
  .wt-info-lines{display:grid;gap:12px}
  .wt-info-lines span{display:flex;justify-content:space-between;gap:12px}
  .wt-info-lines strong{text-align:right;margin:0}
  body #appView .settings-workspace .scan-key-test{padding:16px;align-items:flex-start}
  body #appView .settings-workspace .scan-key-test label{width:100%;display:grid;gap:8px}
  body #appView .settings-workspace .scan-key-test input{width:100%;box-sizing:border-box}
}
@media(prefers-reduced-motion:reduce){.wt-workspace *{scroll-behavior:auto!important;transition:none!important}}

/* Match the compact workspace header at every viewport width. */
body #appView main.workspace[data-view="settings"]>.topbar{display:flex;flex-direction:row;flex-wrap:nowrap;align-items:center;justify-content:space-between;gap:12px;min-height:44px;margin-bottom:12px;padding:0 0 12px}
body #appView main.workspace[data-view="settings"]>.topbar>:first-child{flex:1;min-width:0;text-align:left}
body #appView main.workspace[data-view="settings"] #pageTitle{font-size:18px;line-height:1.4;text-align:left;margin:0;white-space:nowrap}
body #appView main.workspace[data-view="settings"] #pageDesc:empty{display:none}
body #appView main.workspace[data-view="settings"] :is(#tabletTools,#pageHeaderActions){flex:0 0 auto;width:auto;margin:0}
@media(max-width:520px){
  body #appView main.workspace[data-view="settings"]>.topbar{gap:8px;min-height:40px;margin-bottom:8px;padding-bottom:8px}
  body #appView main.workspace[data-view="settings"] #pageTitle{font-size:16px}
  body #appView main.workspace[data-view="settings"] .tablet-mode-toggle{padding:6px 8px;font-size:12px}
  body #appView main.workspace[data-view="settings"] .page-refresh-button{padding:6px 8px;font-size:12px;min-width:0}
}
.wt-business-modal .erp-dialog-card.wt-case-card{width:min(1020px,calc(100vw - 40px));max-width:none;max-height:calc(100dvh - 40px)}
.wt-business-modal .wt-case-card>.erp-dialog-head{display:flex;flex-direction:row;align-items:flex-start;justify-content:space-between;gap:16px;min-height:72px;padding:16px 24px}
.wt-business-modal .wt-case-card>.erp-dialog-head>div{min-width:0;flex:1}
.wt-business-modal .wt-case-card>.erp-dialog-head h2{margin:0;font-size:16px;line-height:24px;overflow-wrap:anywhere}
.wt-business-modal .wt-case-card>.erp-dialog-head p{font-size:12px;line-height:18px;color:#667085;margin:6px 0 0}
.wt-business-modal .wt-case-card [data-wtb-close]{flex:0 0 auto;min-width:44px;min-height:40px;padding:8px;border:0;background:none;font-size:13px;color:#667085;box-shadow:none}
.wt-business-modal .wt-case-card>.erp-dialog-body{flex:1;min-height:0;max-height:calc(100dvh - 144px);overflow:auto;padding:0 24px 20px;overscroll-behavior:contain}
@media(max-width:760px){
  .wt-business-modal .erp-dialog-card.wt-case-card{width:calc(100vw - 24px);max-height:calc(100dvh - 24px)}
  .wt-business-modal .wt-case-card>.erp-dialog-head{padding:14px 16px;gap:8px;min-height:72px}
  .wt-business-modal .wt-case-card>.erp-dialog-head h2{font-size:14px;line-height:22px}
  .wt-business-modal .wt-case-card>.erp-dialog-body{padding:0 16px 16px;max-height:calc(100dvh - 120px)}
}
