/* Batch orders, uniform lists and progress bars. Uses the workspace tokens from styles.css. */

/* Progress bar, shared by tables, the order dialog and batch cards */
.progress{display:flex;align-items:center;gap:8px;margin-top:8px;min-width:96px}
.progress-track{flex:1;height:6px;border-radius:9999px;background:#e3eaea;overflow:hidden}
.progress-fill{display:block;width:100%;height:100%;background:var(--accent);transform-origin:left center;transition:transform .25s cubic-bezier(.22,1,.36,1)}
.progress-value{font-size:12px;font-weight:700;color:var(--ink);min-width:34px;text-align:right;font-variant-numeric:tabular-nums}
td .progress{max-width:150px}
@media(prefers-reduced-motion:reduce){.progress-fill{transition:none}}

/* Order dialog */
.order-progress{display:grid;grid-template-columns:1fr minmax(160px,40%);align-items:end;gap:16px;margin-top:22px}
.order-progress small{display:block;color:var(--muted);margin-bottom:7px}
.order-progress strong{font-size:15px}

/* Batch cards on the production board */
.batch-job{padding:0;overflow:hidden}
.batch-job-open{display:block;width:100%;padding:14px;border:0;background:none;text-align:left;color:inherit}
.batch-job-open:hover{background:#f8fbfa}
.batch-job-open:focus-visible{outline:2px solid var(--accent);outline-offset:-3px;border-radius:10px}
.batch-job-open h3{font-size:13px;line-height:1.45;margin:7px 0 4px}
.batch-job-open .job-meta{font-size:12px}

/* Batches and uniforms dialog */
.batch-summary{display:flex;justify-content:space-between;align-items:flex-start;gap:16px}
.batch-summary h2{margin-bottom:4px}
.batch-summary p{font-size:14px}
.batch-actions-row{display:flex;justify-content:flex-end;margin-bottom:14px}
.batch-toolbar{display:flex;align-items:center;flex-wrap:wrap;gap:10px;margin-bottom:12px}
.batch-toolbar-title{margin-right:auto;font-size:14px;color:var(--muted)}
.batch-toolbar-title strong{color:var(--ink)}
.batch-toolbar-note{font-size:13px}
.batch-select-all{display:flex;align-items:center;gap:8px;font-size:14px;font-weight:600;cursor:pointer}
.batch-select-all input,.batch-pick{width:18px;height:18px;margin:0;accent-color:var(--accent);cursor:pointer}
.batch-move-to{flex:none;min-width:190px}
.batch-move-to select{min-height:34px;padding:6px 32px 6px 10px}
.batch-table{border:1px solid var(--line);border-radius:10px;max-height:min(52vh,520px);overflow:auto}
.batch-table th{position:sticky;top:0;background:#fff;z-index:1}
.batch-table td{vertical-align:middle}
.batch-table td small{display:block;color:var(--muted)}
.uniform-id{font-size:13px;letter-spacing:.2px;font-variant-numeric:tabular-nums;white-space:nowrap}
.measure-ok{color:#247b5e;font-weight:600;font-size:13px}
.measure-missing{color:var(--amber);font-weight:600;font-size:13px}
.batch-row-actions{display:flex;gap:6px;justify-content:flex-end;flex-wrap:wrap}
.uniform-measures{margin-top:20px}

/* New batch order */
.batch-id-preview strong{white-space:nowrap}

/* Settings */
.batch-settings .form-grid{margin-bottom:16px}
.batch-token-help{margin-bottom:16px}
.batch-client-table td{vertical-align:middle;padding-top:8px;padding-bottom:8px}
.batch-client-table .field input{min-height:38px;padding:8px 10px}
#batch-settings-error{color:var(--red);font-size:14px;margin:12px 0 0}
#batch-settings-error:empty{display:none}
.batch-settings-actions{margin-top:16px;justify-content:flex-end}

@media(max-width:760px){
 .batch-summary{flex-direction:column}
 .batch-toolbar-title{flex-basis:100%}
 .batch-move-to{flex:1}
 .batch-row-actions{justify-content:flex-start}
 .order-progress{grid-template-columns:1fr}
}

/* Batch summary */
.batch-facts{display:grid;grid-template-columns:repeat(auto-fit,minmax(110px,1fr));gap:14px 24px;margin:16px 0 20px;padding:14px 16px;border:1px solid var(--line);border-radius:10px}
.batch-stat{min-width:0}
.batch-stat dt{font-size:12px;color:var(--muted)}
.batch-stat dd{margin:2px 0 0;font-size:20px;font-weight:700;line-height:1.3;font-variant-numeric:tabular-nums;color:var(--ink)}
.batch-stat.is-warning dd{color:var(--amber)}
.batch-stat.is-urgent dd{color:var(--red)}
.batch-stat-bar{display:block;height:4px;margin-top:6px;border-radius:999px;background:#e3e9e9;overflow:hidden}
.batch-stat-bar i{display:block;height:100%;background:var(--accent);transform-origin:left}
.batch-filter{display:flex;align-items:center;gap:8px;font-size:14px;cursor:pointer}
.batch-filter input{width:18px;height:18px;margin:0;accent-color:var(--accent)}

/* Filters, actions and station groups on the batches page */
.batch-filter,.batch-station{flex:none;min-width:180px}
.batch-filter select,.batch-station select{min-height:34px;padding:6px 32px 6px 10px}
.batch-actions{padding:10px 12px;border:1px solid var(--line);border-radius:10px;background:#f8fbfa}
.batch-actions .btn .icon{width:15px;height:15px}
.batch-selected{font-size:13px;color:var(--muted)}
.batch-actions-end{margin-left:auto;display:flex;flex-wrap:wrap;gap:8px}
.batch-table .station-row th{position:sticky;top:37px;z-index:1;background:#eef5f3;text-align:left;font-size:13px;font-weight:700;color:var(--ink);padding:8px 12px}
.batch-table .station-row span{margin-left:8px;font-weight:500;color:var(--muted)}
.batch-table tr.is-urgent td{background:#fdf5f4}
.batch-sizes{font-size:13px;line-height:1.5;min-width:180px}

/* Size totals for cutting */
.cutting-list{margin:0 0 12px;border:1px solid var(--line);border-radius:10px;padding:10px 14px;background:#fff}
.cutting-list summary{cursor:pointer;font-size:14px;font-weight:600;color:var(--accent)}
.cutting-list summary:focus-visible{outline:2px solid var(--accent);outline-offset:3px;border-radius:4px}
.cutting-list ul{list-style:none;margin:10px 0 2px;padding:0;display:grid;gap:8px}
.cutting-list li{display:grid;grid-template-columns:minmax(0,14em) 1fr auto;gap:10px;align-items:baseline;font-size:13px}
.cutting-list li small{color:var(--muted);font-variant-numeric:tabular-nums}
.cutting-sizes{display:flex;flex-wrap:wrap;gap:6px}
.cutting-chip{padding:2px 8px;border-radius:6px;background:#eef5f3;font-variant-numeric:tabular-nums}
.cutting-chip.is-missing{background:#fff3df;color:#7a5413}
.work-card .cutting-list{margin-top:14px}
.work-uniforms li.is-urgent{border-color:#e7c2bd;background:#fffafa}

/* One uniform */
.uniform-section{border:1px solid var(--line);border-radius:10px;padding:14px 16px 16px;margin:0 0 14px;min-width:0}
.uniform-section legend,.uniform-section>summary{font-size:14px;font-weight:650;padding:0 6px}
details.uniform-section>summary{cursor:pointer;padding:2px 0;color:var(--ink)}
details.uniform-section[open]>summary{margin-bottom:12px}
.uniform-urgent{align-self:end;min-height:44px}
.uniform-sizes{display:grid;grid-template-columns:repeat(auto-fill,minmax(210px,1fr));gap:12px;margin-top:14px}
.uniform-size{display:flex;flex-wrap:wrap;gap:8px;align-items:flex-end;padding:10px;border:1px solid var(--line);border-radius:10px}
.uniform-size .field{flex:1;min-width:90px}
.uniform-size-tag{display:none;flex-basis:100%;font-size:12px;font-weight:600;color:var(--accent)}
.uniform-size.is-needed{border-color:#9cc9bd;background:#f4faf8}
.uniform-size.is-needed .uniform-size-tag{display:block}

/* Import */
.import-source{display:grid;grid-template-columns:minmax(0,1.4fr) auto minmax(0,1fr);gap:14px;align-items:start;margin-top:16px}
.import-or{align-self:center;color:var(--muted);font-size:13px}
.import-sheet{margin-top:14px;max-width:360px}
.import-error{color:var(--red);font-size:14px;margin:12px 0 0}
.import-error:empty{display:none}
.import-map{border:1px solid var(--line);border-radius:10px;padding:14px 16px;margin:18px 0 0;min-width:0}
.import-map legend{font-size:14px;font-weight:650;padding:0 6px}
.import-map td{vertical-align:middle}
.import-map select{min-height:36px;padding:6px 32px 6px 10px}
.import-preview{margin-top:18px}
.import-preview h3{font-size:16px;margin-bottom:4px}
.import-preview>p{font-size:14px;margin-bottom:10px}
.import-skipped{margin-top:12px;font-size:14px}
.import-skipped summary{cursor:pointer;color:var(--accent);font-weight:600}
.import-skipped ul{margin:8px 0 0;padding-left:20px;display:grid;gap:4px}

/* Settings tables */
.batch-settings-sub{font-size:15px;margin:22px 0 10px}
.batch-type-check{text-align:center}
.batch-type-check input{width:18px;height:18px;accent-color:var(--accent)}
.batch-type-table .field input,.batch-garment-table .field input{min-height:38px;padding:8px 10px}

@media(max-width:760px){
 .import-source{grid-template-columns:1fr}
 .import-or{justify-self:start}
 .batch-actions-end{margin-left:0}
 .cutting-list li{grid-template-columns:1fr auto}
 .cutting-list li .cutting-sizes{grid-column:1/-1;grid-row:2}
 .batch-table .station-row th{position:static}
}

/* Keep the button group inside a table cell so responsive wrappers retain its gap. */
.batch-table .batch-action-cell{vertical-align:middle;padding:12px 16px}
.batch-table .batch-row-actions{display:flex;align-items:center;justify-content:flex-end;flex-wrap:nowrap;gap:8px}
.batch-table .batch-row-actions>.btn{display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;width:auto;min-width:64px;height:38px;min-height:38px;margin:0;padding:8px 12px;font-size:13px;line-height:20px;border-radius:8px;white-space:nowrap}
@media(max-width:760px){.batch-table .batch-action-cell{padding:12px 0}.batch-table .batch-row-actions{justify-content:flex-start;flex-wrap:wrap;gap:8px}.batch-table .batch-row-actions>.btn{flex:1 1 auto;min-height:44px;height:auto}}

/* Filters describe the list; bulk actions appear only for selected uniforms. */
.batch-page-actions{display:flex;align-items:center;flex-wrap:wrap;gap:8px;margin-left:auto}
.batch-page-actions>.btn{min-height:40px;padding:9px 12px;white-space:nowrap}
.batch-filter-bar{display:flex;align-items:flex-end;flex-wrap:wrap;gap:16px;padding:16px;background:#f5f8f7;border:1px solid var(--line);border-radius:10px;margin-bottom:16px}
.batch-filter-bar>.field{flex:0 1 220px;min-width:150px;margin:0;gap:6px}
.batch-filter-bar select,.batch-move-group select{min-height:40px;padding:9px 32px 9px 12px;background-color:white}
.batch-filter-bar>.field>span,.batch-move-group .field>span{font-size:12px;font-weight:600;color:#536e67}
.batch-result-count{font-size:12px;color:var(--muted);margin-left:auto;padding-bottom:12px}
.batch-list-controls{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:10px;padding:8px 2px 14px}
.batch-select-all{font-size:13px;min-height:32px}
.batch-selection-bar{display:flex;align-items:flex-end;flex-wrap:wrap;gap:16px;padding:16px;margin-bottom:14px;border:1px solid #bbd9ce;background:#edf7f2;border-radius:10px}
.batch-selection-summary{display:flex;align-items:center;gap:12px;min-height:40px;margin-right:auto;font-size:13px}
.batch-selection-summary .text-btn{font-size:12px;padding:8px 0;text-decoration:none}
.batch-move-group{display:flex;align-items:flex-end;gap:8px}.batch-move-group .field{min-width:180px;gap:6px;margin:0}
.batch-selection-bar .btn{min-height:40px;padding:9px 12px;white-space:nowrap}
.batch-toolbar-note{padding:8px 0 16px;line-height:1.6;color:var(--muted)}
.batch-table tr:has(.batch-pick:checked)>td{background:#edf7f2}
.batch-table .batch-action-cell{min-width:180px}
@media(max-width:1000px){.batch-page-actions{width:100%;margin-left:0}.batch-selection-summary{flex-basis:100%}.batch-result-count{flex-basis:100%;padding:0;margin:0}}
@media(max-width:760px){.batch-filter-bar{gap:12px;padding:12px}.batch-filter-bar>.field{flex:1 1 150px}.batch-page-actions>.btn{flex:1;min-height:44px}.batch-selection-bar{padding:12px;gap:12px}.batch-move-group{width:100%;flex-wrap:wrap}.batch-move-group .field{flex:1;min-width:160px}.batch-selection-bar .btn,.batch-filter-bar select,.batch-move-group select{min-height:44px}.batch-selection-bar>.btn{width:100%}.batch-table .batch-action-cell{min-width:0}}
/* Keep names, measurements and actions visible together on desktop. */
@media(min-width:761px){
 .batch-table table{table-layout:fixed;min-width:880px;white-space:normal}
 .batch-table th,.batch-table td{padding-left:12px;padding-right:12px;overflow-wrap:anywhere}
 .batch-table thead th:first-child{width:42px}.batch-table thead th:nth-child(2){width:148px}
 .batch-table table{min-width:960px}
 .batch-table thead th:nth-child(4){width:100px}.batch-table thead th:nth-child(5){width:160px}
 .batch-table thead th:nth-child(6){width:150px}.batch-table thead th:last-child{width:200px}
 .batch-table .batch-row-actions>.btn{min-width:54px;padding:8px 10px;font-size:12px}
 .batch-table .batch-row-actions>.btn:last-child:not(:first-child){flex:0 1 auto;min-width:0;height:auto;min-height:38px;white-space:normal;line-height:18px}
}
@media(min-width:761px){.batch-table .batch-row-actions{align-items:stretch}.batch-table .batch-row-actions>.btn{height:auto}}
/* Long step names such as "Ironing / Quality check" wrap inside the status cell instead of running under the actions. */
.batch-table td .badge{white-space:normal;max-width:100%;line-height:1.35;text-align:left}
.batch-table .batch-action-cell{overflow:visible}
