:root{font-family:Segoe UI,Arial,sans-serif;color:#27364a;background:#f6f7f9;font-size:16px;--orange:#cf4c00;--border:#dce1e7;--muted:#617087}*{box-sizing:border-box}body{margin:0}button,input,select,textarea{font:inherit}button,a,input,select,textarea{outline-offset:4px}button{cursor:pointer;border:1px solid var(--border);border-radius:7px;padding:10px 15px;background:#fff;color:#29384d;font-weight:600;min-height:42px}button:hover{background:#f0f3f7}button:disabled{opacity:.55;cursor:wait}.primary{background:var(--orange);border-color:var(--orange);color:#fff}.primary:hover{background:#b74100}.secondary{background:#fff}.quiet{border-color:transparent;background:transparent;color:#58677e;font-size:.875rem}.danger{color:#b32828;border-color:#efb4b4;background:#fff7f7}.danger:hover{background:#ffe9e9}input:not([type=checkbox]),select,textarea{width:100%;padding:10px 12px;border:1px solid #cbd3dd;border-radius:6px;background:#fff;color:#27364a}input[type=checkbox]{accent-color:var(--orange);width:18px;height:18px;cursor:pointer}label{display:flex;flex-direction:column;gap:7px;font-size:.875rem;font-weight:600}small,.muted{color:var(--muted);font-size:.875rem}small{display:block;line-height:1.5}h1,h2,p{margin-top:0}h1{font-size:2rem;font-weight:650;letter-spacing:-.8px;margin-bottom:9px}h2{font-size:1.125rem;margin-bottom:14px}p{line-height:1.55;color:var(--muted)}[hidden]{display:none!important}.workspace{display:grid;grid-template-columns:244px minmax(0,1fr);min-height:100vh}.sidebar{background:#fff;border-right:1px solid var(--border);display:flex;flex-direction:column;padding:32px 20px;position:sticky;top:0;height:100vh}.brand,.login-brand{display:flex;align-items:center;gap:12px;line-height:1.3;font-size:1rem}.brand-mark{background:#f36b16;color:white;display:grid;place-items:center;width:42px;height:44px;border-radius:10px;font-size:1.8rem;font-weight:750}.brand strong,.login-brand strong{font-size:1.15rem}.nav-label{margin:48px 12px 14px;font-size:.75rem;font-weight:700;letter-spacing:1px;color:#7b8595}.sidebar nav{display:flex;flex-direction:column;gap:5px}.sidebar nav button{text-align:left;border:0;font-size:.875rem;padding:13px 10px;line-height:1.5}.sidebar nav button span{display:inline-block;width:26px;color:#8a95a5;font-size:.75rem}.sidebar nav button.active{background:#fff0e6;color:#a83c00}.sidebar nav button.active span{color:var(--orange)}.sidebar-foot{margin-top:auto;padding:24px 10px 0}.version{font-size:.75rem;color:#7c8798}.sidebar-foot p{margin:16px 0 0;font-weight:600;color:#27364a}.sidebar-foot button{padding-left:0}.topbar{min-height:78px;display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid var(--border);background:#fff;padding:16px 36px;gap:20px}.topbar>span{font-size:.75rem;letter-spacing:1.4px;font-weight:600;color:#778397}.top-actions{display:flex;gap:20px;align-items:center}.pill{font-size:.8125rem;padding:6px 11px;border-radius:100px;background:#eef1f5;color:#58677c}.pill.good{background:#e8f5ec;color:#226b3f}.pill.bad{background:#fff0e5;color:#9a4a0e}.page{padding:35px 36px;max-width:1680px;margin:auto}.page-heading{display:flex;align-items:center;justify-content:space-between;gap:20px;margin-bottom:24px}.page-heading p{margin:0;font-size:.9375rem;max-width:750px}.eyebrow{display:block;color:var(--orange);font-weight:700;font-size:.75rem;letter-spacing:1.5px;margin-bottom:12px}.metrics{display:grid;grid-template-columns:repeat(3,1fr);border:1px solid var(--border);border-radius:9px;background:#fff;margin-bottom:25px}.metrics>div{padding:22px 24px;border-right:1px solid var(--border)}.metrics>div:last-child{border:0}.metrics span{display:block;font-size:.875rem;color:var(--muted);margin-bottom:9px}.metrics strong{font-size:2.2rem;font-weight:600}.metrics>div:nth-child(2) strong{color:#298357}.toolbar{display:flex;justify-content:space-between;align-items:center;gap:12px;flex-wrap:wrap;margin:18px 0}.toolbar>div{display:flex;align-items:center;gap:8px;flex-wrap:wrap}.file-button{cursor:pointer;font-size:.875rem;color:#58677e;padding:10px}.file-button input{max-width:200px;font-size:.75rem;margin-top:5px}.table-bar{background:#fff;border:1px solid var(--border);border-bottom:0;border-radius:8px 8px 0 0;padding:16px;display:flex;align-items:end;gap:20px;flex-wrap:wrap}.table-bar label{width:280px}.table-bar>span{padding-bottom:10px;font-size:.875rem}.table-wrap{overflow:auto;background:white;border:1px solid var(--border);border-radius:0 0 8px 8px}table{width:100%;border-collapse:collapse;font-size:.875rem}th{background:#f8f9fb;color:#68768a;text-align:left;font-weight:600;padding:14px 12px;white-space:nowrap;border-bottom:1px solid var(--border)}td{padding:17px 12px;vertical-align:top;border-bottom:1px solid #edf0f4;line-height:1.55;max-width:450px;overflow-wrap:anywhere}td strong{display:block;font-weight:650}td small{font-size:.8125rem;color:#788395}.order-id{color:#27364a;white-space:nowrap}.tag{display:inline-block;border-radius:4px;padding:3px 7px;background:#f1f3f6;white-space:nowrap;font-size:.8125rem;margin-right:4px}.status-ready{color:#24683e;background:#e9f5ed;padding:4px 8px;border-radius:4px;display:inline-block}.status-review{color:#875218}.empty{text-align:center;padding:45px 24px;color:var(--muted)}.empty p{max-width:440px;margin:auto;font-size:.9375rem}.empty h2{color:#3b495f;margin-bottom:10px}.empty-symbol{display:block;font-size:2rem;color:#b9c1ce;margin-bottom:15px}.rule-bar{display:flex;align-items:center;flex-wrap:wrap;gap:14px;border:1px solid var(--border);background:#fff;border-radius:8px;padding:20px;margin-top:16px}.rule-bar>div{margin-right:auto}.rule-bar strong{font-size:.875rem}.rule-bar small{margin-top:5px;max-width:470px}.rule-bar label{width:60px}.rule-bar input{padding:7px!important}.card{background:#fff;border:1px solid var(--border);border-radius:9px;padding:24px}.automation{margin-top:28px}.automation>div{display:flex;align-items:center;gap:16px}.automation p{font-size:.875rem;margin-bottom:14px}.automation form{display:flex;align-items:center;flex-wrap:wrap;gap:18px}.check{display:flex;flex-direction:row;align-items:center;gap:8px;font-weight:400}.automation small{margin-top:15px}.queue{margin-top:30px}.queue-heading{display:flex;gap:18px;align-items:baseline}.queue-heading span{font-size:.875rem;color:var(--muted);overflow-wrap:anywhere}.queue h2{font-size:1rem}.job{display:grid;grid-template-columns:65px 1fr 140px;gap:16px;border-top:1px solid var(--border);padding:12px 2px;font-size:.875rem}.job p{margin:4px 0 0;font-size:.8125rem}.job>span:last-child{text-align:right}.job.done>span:last-child{color:#277349}.job.failed>span:last-child,.job.uncertain>span:last-child{color:#ac3434}.info{padding:16px 20px;border-left:3px solid #ef9e61;background:#fff2e8;color:#81502b;border-radius:4px;font-size:.9375rem;line-height:1.6;margin-bottom:16px}#notice{padding:15px 18px;border-radius:7px;background:#eaf4ef;color:#245d3e;margin-bottom:24px;line-height:1.5}#notice.error{background:#fff0ed;color:#973b2e}.settings-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:22px}.settings-grid .card label{margin:17px 0}.settings-grid .card p{font-size:.9375rem}.wide{grid-column:1/-1}.profile-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:0 24px}.settings-grid textarea{font-family:inherit}#config-json{font-family:Consolas,monospace;font-size:.875rem}.save-row{display:flex;gap:20px;align-items:center;margin:22px 0}.lookup{display:flex;align-items:end;gap:12px;margin:16px 0}.lookup label{max-width:280px}.lookup input{min-width:0}pre{white-space:pre-wrap;overflow-wrap:anywhere;font-family:inherit;font-size:.9375rem;line-height:1.65}footer{padding:22px 36px;border-top:1px solid var(--border);font-size:.75rem;color:#7b8797;display:flex;justify-content:space-between;gap:16px}.login-screen{min-height:100vh;display:flex;align-items:center;justify-content:center;padding:100px 24px;background:#f5f6f8}.login-brand{position:absolute;top:35px;left:40px}.login-card{max-width:440px;width:100%;padding:38px;background:#fff;border:1px solid var(--border);border-radius:12px;box-shadow:0 15px 70px #20304b0a}.login-card label{margin:20px 0}.login-card button{width:100%;display:flex;justify-content:space-between;margin:26px 0 15px}.login-card h1{font-size:2.3rem}#login-error{color:#a32e2e;font-size:.875rem}.thumb{width:42px;height:42px;object-fit:contain;float:left;margin-right:10px}.product{margin-bottom:8px}.product:last-child{margin:0}@media(min-width:1600px){.page{padding-top:44px}}@media(max-width:1100px){.workspace{grid-template-columns:205px minmax(0,1fr)}.sidebar{padding:26px 12px}.page{padding:26px 22px}.topbar{padding:15px 22px}.toolbar>div:last-child{width:100%}.settings-grid{grid-template-columns:1fr}.profile-grid{grid-template-columns:1fr}.metrics>div{padding:20px 15px}.automation form{gap:14px}.top-actions{gap:10px}}@media(max-width:1200px), (hover:none) and (pointer:coarse){.workspace{display:block}.sidebar{position:static;height:auto;padding:18px}.sidebar .brand{margin-bottom:15px}.sidebar nav{flex-direction:row;overflow:auto}.sidebar nav button{white-space:nowrap}.nav-label,.sidebar-foot .version{display:none}.sidebar-foot{margin:0;padding:8px 0 0;display:flex;align-items:center;justify-content:space-between}.sidebar-foot p{margin:0}.topbar{padding:12px 18px;min-height:65px;flex-wrap:wrap}.topbar>span{display:none}.top-actions{width:100%;justify-content:space-between}.page{padding:24px 16px}.page-heading{align-items:start}.page-heading h1{font-size:1.65rem}.page-heading button{font-size:.8125rem;padding:8px}.metrics{grid-template-columns:1fr}.metrics>div{border-right:0;border-bottom:1px solid var(--border);display:flex;align-items:center;justify-content:space-between;padding:14px 18px}.metrics strong{font-size:1.65rem}.metrics span{margin:0}.rule-bar>div{width:100%}.rule-bar button{flex:1}.table-bar label{width:100%}.card{padding:20px}.save-row{flex-direction:column;align-items:start}.job{grid-template-columns:45px 1fr 95px;gap:8px}.queue-heading{display:block}.queue-heading span{display:block;margin-bottom:12px}footer{padding:20px 16px;flex-direction:column}.login-brand{left:24px;top:25px}.login-card{padding:28px}.lookup{flex-wrap:wrap}}

.column-sort{border:0;background:transparent;color:inherit;font:inherit;font-weight:600;text-align:left;padding:8px 0;cursor:pointer;white-space:nowrap}.column-sort:hover{color:var(--accent,#b54b00)}.column-sort:focus-visible{outline:2px solid #b54b00;outline-offset:3px}th[aria-sort="ascending"],th[aria-sort="descending"]{color:#b54b00}.product-weight{font-variant-numeric:tabular-nums;min-width:130px}
@media(max-width:1200px), (hover:none) and (pointer:coarse){
  main,.page,.view,.card,.toolbar>div{min-width:0;max-width:100%}
  .sidebar nav{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));overflow:visible}
  .sidebar nav button{white-space:normal;min-width:0;min-height:44px}
  .page-heading{flex-wrap:wrap;gap:12px}
  .toolbar>div{width:100%}.toolbar button,.file-button{flex:1 1 140px}
  input:not([type=checkbox]),select,textarea{font-size:16px;min-width:0}
  .rule-bar{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));padding:14px;gap:12px}
  .rule-bar>div,.rule-bar>button{grid-column:1/-1;width:100%}
  .rule-bar label{width:auto}.rule-bar input{min-height:44px}
  #orders-view .table-wrap,#sorter-view .table-wrap{border:0;background:transparent;overflow:visible}
  #orders-view table,#sorter-view table{display:block;width:100%}
  #orders-view thead,#sorter-view thead{display:block;margin:12px 0}
  #orders-view thead tr,#sorter-view thead tr{display:block}
  #orders-view th,#sorter-view th{display:none}
  #orders-view th:first-child,#sorter-view th:first-child{display:flex;align-items:center;gap:10px;border:0;background:transparent;padding:8px}
  #orders-view th:first-child::after,#sorter-view th:first-child::after{content:'Zaznacz wszystkie widoczne';white-space:normal}
  #order-rows,#sorter-rows{display:grid;gap:16px}
  #order-rows tr,#sorter-rows tr{display:grid;grid-template-columns:minmax(0,1fr);border:1px solid var(--border);border-radius:10px;background:#fff;overflow:hidden}
  #order-rows td,#sorter-rows td{display:block;max-width:none;min-width:0;padding:10px 14px;font-size:15px}
  #order-rows td:first-child,#sorter-rows td:first-child{background:#f8f9fb;display:flex;align-items:center;gap:10px;min-height:48px}
  #order-rows td:first-child::after,#sorter-rows td:first-child::after{content:'Zaznacz zamówienie';color:var(--muted)}
  #order-rows td::before,#sorter-rows td::before{display:block;font-size:12px;font-weight:600;color:var(--muted);margin-bottom:4px}
  #order-rows td:nth-child(2)::before{content:'Zamówienie / konto'}
  #order-rows td:nth-child(3)::before{content:'Data / status'}
  #order-rows td:nth-child(4)::before{content:'Produkty'}
  #order-rows td:nth-child(5)::before{content:'Waga produktów'}
  #order-rows td:nth-child(6)::before{content:'Gabaryty'}
  #order-rows td:nth-child(7)::before{content:'Folder'}
  #order-rows td:nth-child(8)::before{content:'Wynik'}
  #sorter-rows td:nth-child(2)::before{content:'Zamówienie'}
  #sorter-rows td:nth-child(3)::before{content:'Masa netto'}
  #sorter-rows td:nth-child(4)::before{content:'Gramatury'}
  #sorter-rows td:nth-child(5)::before{content:'Folder docelowy'}
  #sorter-rows td:nth-child(6)::before{content:'Wynik'}
  .product{display:flow-root;overflow-wrap:anywhere;padding:8px 0;border-bottom:1px solid #edf0f4}.product:last-child{border-bottom:0}
  .thumb{width:48px;height:48px}.product-weight{min-width:0}
  .automation>div{display:block}.automation form{display:grid;grid-template-columns:minmax(0,1fr)}
  .check{min-height:44px}.job{grid-template-columns:48px minmax(0,1fr)}.job>span:last-child{grid-column:2;text-align:left}
  .job p,#notice,.info{overflow-wrap:anywhere}.lookup label,.lookup button{width:100%;max-width:none}
}

/* Keep product names separate from thumbnails, including desktop tables. */
.product{display:grid;grid-template-columns:42px minmax(0,1fr);column-gap:10px;align-items:start}
.product .thumb{grid-column:1;grid-row:1 / span 2;float:none;margin:0}
.product>span{grid-column:2;min-width:0;overflow-wrap:break-word;word-break:normal}
.product>small{grid-column:2;overflow-wrap:anywhere}
.product:not(:has(.thumb))>span,.product:not(:has(.thumb))>small{grid-column:1 / -1}
@media(min-width:1201px) and (hover:hover){#orders-view td:nth-child(4){min-width:320px}}
@media(max-width:1200px), (hover:none) and (pointer:coarse){
 .product{grid-template-columns:48px minmax(0,1fr);font-size:16px;line-height:1.5}
 .product .thumb{width:48px;height:48px}
}

/* Keep the quantity in the same text flow as the product name. */
.product>span>strong{display:inline;white-space:nowrap}

.product.missing-weight{background:#fff0f0;border-left:3px solid #b42318;border-radius:4px;padding:8px;color:#a51d16}
.product.missing-weight>small{color:#a51d16}
.product .weight-warning{grid-column:1/-1;font-size:.8125rem}
.product .weight-warning strong{display:inline}
.product .weight-warning a{color:#a51d16;text-decoration:underline;font-weight:600}
