:root{
font:16px/1.4 system-ui,-apple-system,"Segoe UI",sans-serif;
color:#18181b;
background:#f6f6f7;
--border:#e4e4e7;
--muted:#52525b;
--blue:#7c3aed;
--green:#7c3aed}
*{
box-sizing:border-box}
body{
margin:0}
button,input,select{
font:inherit;
color:inherit;
border:1px solid #d4d4d8;
border-radius:9px;
min-height:56px;
padding:10px 14px;
max-width:100%;
background:white}
button{
cursor:pointer;
font-weight:650;
touch-action:manipulation}
button:disabled{
opacity:.48;
cursor:not-allowed}
button.primary{
background:var(--blue);
color:white;
border-color:var(--blue)}
button.danger{
color:#b3261e;
border-color:#e4e4e7}
button[aria-pressed=true]{
background:#f1ecfe;
border-color:var(--blue);
color:var(--blue)}
:focus-visible{
outline:3px solid #7c3aed;
outline-offset:3px}
a{
color:var(--blue)}
h1,h2,h3,p{
margin:0 0 10px}
h2{
font-size:1.12rem}
h3{
font-size:1rem}
label{
display:flex;
flex-direction:column;
gap:6px}
label.check{
flex-direction:row;
align-items:center;
gap:10px;
min-height:56px}
input[type=checkbox]{
width:26px;
height:26px;
min-height:26px;
padding:0;
flex:none;
accent-color:var(--blue)}
[hidden]{
display:none!important}
.muted{
color:var(--muted);
font-size:.86rem}
.sr-only{
position:absolute;
width:1px;
height:1px;
overflow:hidden;
clip:rect(0,0,0,0);
white-space:nowrap}
.topbar{
min-height:88px;
background:white;
border-bottom:1px solid var(--border);
display:flex;
align-items:center;
gap:14px;
padding:12px 20px}
.brand{
font-size:1.2rem;
white-space:nowrap}
.brand span{
display:block;
font-size:.7rem;
font-weight:500;
color:var(--muted)}
.station-label{
flex:0 0 150px;
min-width:150px;
max-width:170px}
.station-label select{width:100%;min-width:0}
.identity{
display:flex;
flex-direction:column;
min-width:0;
flex:1}
.identity strong{
overflow-wrap:anywhere;
font-size:1.04rem}
.badge{
display:inline-block;
padding:6px 10px;
border-radius:7px;
background:#f6f6f7;
font-size:.8rem;
font-weight:650;
overflow-wrap:anywhere}
.badge.good{
color:#18181b;
background:#f6f6f7;
border:1px solid #e4e4e7}
.badge.warning{
color:#6b4b00;
background:#fffbea;
border:1px solid #ffd60a}
main{
max-width:1920px;
margin:auto;
padding:0 20px 12px}
.notice{
border:1px solid #e4e4e7;
background:#f6f6f7;
border-radius:8px;
padding:10px 14px;
margin:10px 0;
font-size:.9rem;
overflow-wrap:anywhere}
.notice.error{
background:#ffffff;
border-color:#e4e4e7;
border-left:4px solid #b3261e;
color:#b3261e}
.notice.warning{
background:#fffbea;
border-left:4px solid #ffd60a;
color:#6b4b00}
.worknav{
display:flex;
align-items:center;
gap:10px;
min-height:80px}
.worknav #actor{
margin-left:auto}
.worknav a{
padding:16px 6px}
.workgrid{
display:grid;
grid-template-columns:minmax(320px,.85fr) minmax(0,1.5fr);
gap:16px;
align-items:start}
.surface{
background:white;
border:1px solid var(--border);
border-radius:14px;
min-width:0;
overflow:hidden}
.panel-heading{
display:flex;
gap:10px;
justify-content:space-between;
align-items:center;
padding:12px 16px;
border-bottom:1px solid var(--border)}
.panel-heading h2{
margin:0}
.panel-heading button{
min-height:56px}
.video-panel{
padding-bottom:12px}
.video-panel #video-content{
padding:0 14px}
.preview{
background:#142333;
border-radius:9px;
margin:14px 0;
min-height:230px;
display:grid;
place-items:center;
color:#c9d5e0}
.preview figure{
width:100%;
margin:0}
.preview figcaption{
background:#2a2a2f;
color:var(--muted);
padding:6px 8px}
figure{
margin:12px 0}
img{
display:block;
width:100%;
max-height:430px;
object-fit:contain;
border-radius:7px;
background:#152538}
figcaption{
font-size:.78rem;
overflow-wrap:anywhere}
.progress-strip{
padding:12px 16px 4px;
display:flex;
align-items:center;
gap:16px}
.progress-strip strong{
white-space:nowrap;
font-size:.9rem}
progress{
width:100%;
height:10px;
accent-color:var(--green)}
.line-filters{
display:flex;
gap:8px;
align-items:center;
flex-wrap:wrap;
padding:8px 14px 0}
.line-filters select{
font-size:.85rem;
max-width:190px;
padding:8px}
.line-filters button{
font-size:.8rem}
.line-filters .check{
font-size:.8rem}
.selection-note{
padding:0 16px;
margin:4px 0 8px;
font-size:.73rem}
.line-list{
max-height:calc(100dvh - 395px);
min-height:170px;
overflow-y:auto;
overscroll-behavior:contain}
.line-row{
display:grid;
grid-template-columns:28px minmax(0,1fr) 64px 66px 70px 64px;
gap:8px;
align-items:center;
padding:10px 14px;
border-top:1px solid var(--border);
min-height:100px}
.line-row.ready{
background:#fffbea;
box-shadow:inset 3px 0 0 #ffd60a}
.line-row.accepted{
background:#f6f6f7;
box-shadow:inset 3px 0 0 #d4d4d8}
.line-name{
font-weight:650;
font-size:.94rem;
overflow-wrap:anywhere}
.line-editor{
display:block;
text-align:left;
width:100%;
border-color:transparent;
background:transparent;
padding:4px 0;
min-height:56px;
color:#7c3aed;
line-height:1.25}
.line-editor:disabled{
opacity:1;
color:inherit}
.line-editor:not(:disabled){
text-decoration:underline;
text-decoration-color:#ddd3fb;
text-underline-offset:4px}
.line-editor .editor-action{display:block;font-size:.75rem;font-weight:500;color:var(--muted);margin-top:4px;text-decoration:none}
.line-meta{
font-size:.76rem;
color:var(--muted);
margin:3px 0;
overflow-wrap:anywhere}
.line-state{
font-size:.79rem;
font-weight:600;
color:#52525b}
.ready .line-state{
color:var(--green)}
.accepted .line-state{
color:#52525b}
.quantity{
text-align:center;
font-size:1.12rem;
font-variant-numeric:tabular-nums}
.quantity small{
display:block;
font-size:.68rem;
font-weight:400;
color:var(--muted)}
.row-accept{
width:56px;
height:56px;
padding:0;
font-size:1.4rem;
color:var(--green);
background:#f1ecfe;
border-color:#ddd3fb}
.row-actions{
grid-column:2/-1;
display:flex;
align-items:center;
gap:10px;
flex-wrap:wrap}
.row-actions button{
min-height:56px;
padding:8px 12px;
font-size:.8rem}
.row-actions .line-meta{
flex:1;
min-width:100px}
.workfooter{
display:flex;
align-items:center;
gap:10px;
padding:14px 0 0;
min-height:84px}
.workfooter #complete{
margin-left:auto}
.workfooter #footer-hint{
flex:1}
.controls,.tabs{
display:flex;
gap:10px;
flex-wrap:wrap;
align-items:center}
.login-card{
max-width:620px;
margin:40px auto;
background:white;
border:1px solid var(--border);
border-radius:14px;
padding:28px}
.login-card form,form#settings-form{
display:grid;
gap:16px}
dialog{
border:1px solid #e4e4e7;
border-radius:16px;
width:min(640px,calc(100% - 32px));
max-height:90dvh;
padding:22px;
color:inherit;
box-shadow:0 20px 100px rgb(9 9 11 / 34%)}
dialog::backdrop{
background:rgb(9 9 11 / 62%)}
dialog.drawer{
width:min(780px,calc(100% - 24px));
height:100dvh;
max-height:100dvh;
margin:0 0 0 auto;
border-radius:16px 0 0 16px}
dialog.wide-dialog{
width:min(960px,calc(100% - 32px))}
.dialog-heading{
display:flex;
align-items:center;
justify-content:space-between;
gap:20px;
margin-bottom:16px;
position:sticky;
top:-22px;
background:white;
padding:10px 0;
z-index:1}
.dialog-heading h2{
margin:0}
.tabs{
margin:12px 0}
.catalog-list{
display:grid;
gap:12px;
margin-top:16px}
.catalog-card,.history-entry{
padding:16px;
border:1px solid var(--border);
border-radius:10px;
min-width:0}
.catalog-card h3{
overflow-wrap:anywhere}
.catalog-card .controls{
margin-top:12px}
.catalog-card.test{
border-color:#ffd60a;
background:#fffbea}
.catalog-card .badge{
margin-bottom:8px}
.stepper{
display:flex;
gap:12px;
margin:8px 0 18px}
.stepper input{
min-width:0;
width:160px;
text-align:center;
font-size:1.6rem}
.stepper button{
width:64px;
font-size:1.5rem}
#manual-fields>label,#reverse-fields>label{
margin:14px 0}
#manual-context{
overflow-wrap:anywhere}
#manual-preview img{
max-height:240px}
.history-entry{
margin:12px 0}
.history-entry details{
margin:8px 0}
.history-entry summary{
cursor:pointer;
min-height:56px;
padding:14px 0}
.history-entry img{
max-height:320px}
.history-entry dl{
display:grid;
grid-template-columns:minmax(100px,.5fr) minmax(0,1fr);
gap:6px;
font-size:.88rem}
.history-entry dd{
margin:0;
overflow-wrap:anywhere}
.right-video .video-panel{
grid-column:2;
grid-row:1}
.right-video .lines-panel{
grid-column:1;
grid-row:1}
.workgrid.right-video{
grid-template-columns:minmax(0,1.5fr) minmax(320px,.85fr)}
body.large-text{
font-size:19px}
body.large-text .line-list{
max-height:calc(100dvh - 430px)}
.empty-state{
padding:28px 20px;
color:var(--muted)}
@media(min-width:1600px){
.workgrid{
grid-template-columns:minmax(420px,1fr) minmax(0,1.4fr)}
.workgrid.right-video{
grid-template-columns:minmax(0,1.4fr) minmax(420px,1fr)}
.line-row{
min-height:112px}
.preview{
min-height:360px}
}
@media(max-width:1100px){
main{
padding:0 12px 12px}
.topbar{
padding:10px 12px;
gap:8px}
.brand span{
display:none}
.station-label{
max-width:135px}
.topbar .badge{
display:none}
.workgrid,.workgrid.right-video{
grid-template-columns:1fr;
gap:10px}
.right-video .video-panel,.right-video .lines-panel{
grid-column:auto;
grid-row:auto}
.video-panel{
order:0}
.lines-panel{
order:1}
.video-panel .panel-heading{
padding:4px 14px}
.preview{
min-height:150px}
.preview img{
max-height:220px}
.line-list{
max-height:calc(100dvh - 448px)}
.worknav{
min-height:74px;
gap:8px}
.worknav #actor{
max-width:140px}
.worknav #source-badge{
max-width:200px}
.workfooter{
flex-wrap:wrap}
.workfooter #footer-hint{
display:none}
}
@media(max-width:720px){
.topbar{
flex-wrap:wrap}
.brand{
display:none}
.identity{
flex-basis:calc(100% - 160px)}
.topbar #refresh{
flex:1}
.worknav{
flex-wrap:wrap;
padding:10px 0}
.worknav #actor{
margin:0}
.worknav #source-badge{
max-width:none}
.line-filters select{
max-width:160px}
.line-row{
grid-template-columns:26px minmax(0,1fr) 42px 50px 50px 56px;
gap:4px;
padding:10px 8px}
.line-name{
font-size:.84rem}
.quantity{
font-size:.98rem}
.quantity small{
font-size:.6rem}
.line-list,body.large-text .line-list{
max-height:none}
.workfooter{
position:static;
bottom:auto;
background:#f6f6f7;
padding:10px 0;
z-index:2}
.workfooter button{
flex:1}
.workfooter #complete{
flex-basis:100%}
.progress-strip{
flex-wrap:wrap;
gap:6px}
.panel-heading{
padding:10px}
.line-filters{
padding:8px}
.line-filters button{
flex:1}
dialog{
padding:16px}
.dialog-heading{
top:-16px}
body.large-text .line-row{
grid-template-columns:26px minmax(0,1fr) 44px 56px}
.large-text .quantity.camera{
grid-column:2;
text-align:left}
.large-text .row-accept{
grid-column:4;
grid-row:1}
.large-text .quantity.proposed{
grid-column:3;
grid-row:2}
.large-text .row-actions{
grid-column:2/-1}
}
.workgrid>.surface{
height:calc(100dvh - 270px)}
.lines-panel{
display:flex;
flex-direction:column}
.line-list,body.large-text .line-list{
flex:1;
min-height:0;
max-height:none}
.video-panel{
overflow-y:auto}
.video-toolbar{
display:flex;
align-items:center;
justify-content:space-between;
gap:12px;
margin:0 0 16px;
padding:12px 16px;
min-height:72px}
.video-toolbar h2{
margin:0;
font-size:1.1rem}
.video-toolbar button{
min-height:56px;
min-width:132px}
.video-panel.collapsed{
display:none}
.workgrid:has(> .video-panel.collapsed),
.workgrid.right-video:has(> .video-panel.collapsed){
grid-template-columns:minmax(0,1fr);
grid-template-rows:auto minmax(0,1fr)}
.workgrid:has(> .video-panel.collapsed)>*{
grid-column:1}
@media(max-width:720px){
.video-toolbar{
display:flex;
align-items:center;
justify-content:space-between;
gap:12px;
margin:0 0 16px;
padding:12px 16px;
min-height:72px}
.video-toolbar h2{
margin:0;
font-size:1.1rem}
.video-toolbar button{
min-height:56px;
min-width:132px}
.video-panel.collapsed{
display:none}
.workgrid:has(> .video-panel.collapsed),
.workgrid.right-video:has(> .video-panel.collapsed){
grid-template-rows:auto auto}
}
.workgrid>.video-panel.collapsed,
body.large-text .workgrid>.video-panel.collapsed{
height:auto !important;
max-height:none !important;
overflow:visible;
align-self:start;
padding-bottom:0}
.video-panel.collapsed .panel-heading{
border-bottom:0}
.video-panel.collapsed #video-content{
display:none}
.video-panel img{
max-height:300px}
.video-panel .muted{
font-size:.78rem}
body.large-text .workgrid>.surface{
height:calc(100dvh - 300px)}
@media(max-width:1100px){
.workgrid,.workgrid.right-video{
height:calc(100dvh - 270px);
grid-template-rows:auto minmax(0,1fr)}
.workgrid>.surface,body.large-text .workgrid>.surface{
height:auto}
.video-panel{
max-height:220px}
.lines-panel{
min-height:0}
.line-filters{
gap:6px}
.line-filters select{
max-width:180px}
.workfooter{
min-height:80px}
}
@media(max-width:720px){
.workgrid,.workgrid.right-video{
height:auto;
grid-template-rows:auto auto}
.workgrid>.surface,body.large-text .workgrid>.surface{
height:auto}
.line-list,body.large-text .line-list{
flex:auto;
max-height:none;
min-height:150px}
.video-panel{
max-height:320px}
}
.quantity{min-width:0;overflow-wrap:anywhere;}
@media(max-width:720px){
.topbar{display:grid;grid-template-columns:auto minmax(150px,1fr) auto;gap:8px;}
.topbar .brand{display:block;grid-column:1;grid-row:1;}
.topbar .brand span{display:none;}
.topbar .station-label{grid-column:2;grid-row:1;min-width:150px;max-width:none;width:100%;}
.topbar #settings-open{grid-column:3;grid-row:1;}
.topbar .identity{grid-column:1/-1;grid-row:2;flex-basis:auto;min-width:0;}
.topbar #refresh{grid-column:1/-1;grid-row:3;width:100%;}
.topbar:has(#station-picker[hidden]) .identity{grid-column:2/-1;grid-row:1;}
.line-row,body.large-text .line-row{grid-template-columns:26px minmax(0,1fr) minmax(0,1fr) 56px;align-items:start;gap:6px;}
.line-row>input{grid-column:1;grid-row:1;margin-top:10px;}
.line-row>div:not(.quantity){grid-column:2/4;grid-row:1;}
.line-row .row-accept{grid-column:4;grid-row:1;align-self:center;}
.line-row .quantity.required{grid-column:2;grid-row:2;}
.line-row .quantity.camera,.large-text .line-row .quantity.camera{grid-column:3;grid-row:2;}
.line-row .quantity.proposed,.large-text .line-row .quantity.proposed{grid-column:4;grid-row:2;}
}
/* Keep all primary actions inside the viewport, including when a notice is visible. */
@media(min-width:721px){
html,body{height:100%;}
body{height:100dvh;overflow:hidden;display:flex;flex-direction:column;}
.topbar{flex:0 0 auto;}
main{width:100%;flex:1 1 0;min-height:0;display:flex;flex-direction:column;}
#message{flex:0 0 auto;}
#workspace{flex:1;min-height:0;display:flex;flex-direction:column;}
.worknav{flex:0 0 auto;}
.workgrid,.workgrid.right-video{flex:1;min-height:0;height:auto;}
.workgrid>.surface,body.large-text .workgrid>.surface{height:100%;min-height:0;}
.workfooter{flex:0 0 auto;}
}
@media(min-width:721px) and (max-width:1100px){
.workgrid>.surface,body.large-text .workgrid>.surface{height:auto;min-height:0;}
.workgrid>.lines-panel,body.large-text .workgrid>.lines-panel{height:100%;align-self:stretch;}
.video-panel{max-height:156px;}
}
@media(prefers-reduced-motion:no-preference){
button{
transition:background-color .12s,border-color .12s}
}

/* --- Batch work, fixation and anomaly hints ------------------------------- */
/* The batch header is bounded chrome: 1-3 compact rows of numbered kit tiles
   instead of a verbose per-kit card list. It must leave the current 15-line
   stage on screen together with all 50 kits of a batch. */
.batch-header{
 display:grid;
 grid-template-columns:minmax(0,1fr);
 gap:5px;
 align-items:center;
 flex:none;
 margin:0 0 8px;
 padding:8px 12px;
 background:white;
 border:1px solid var(--border);
 border-left:4px solid var(--blue);
 border-radius:12px}
.batch-heading{
 display:flex;
 align-items:center;
 gap:10px;
 flex-wrap:wrap}
.batch-identity{
 flex:1 1 240px;
 min-width:0}
.batch-identity h2{
 margin:0;
 font-size:1.02rem;
 overflow-wrap:anywhere}
.batch-identity p{
 margin:1px 0 0;
 font-size:.72rem}
.batch-actions{
 flex:0 0 auto;
 gap:8px}
.batch-actions button{
 min-height:44px;
 padding:6px 12px;
 font-size:.85rem}
.batch-kits{
 display:flex;
 flex-wrap:wrap;
 gap:3px;
 min-width:0;
 margin:0;
 padding:0;
 list-style:none}
.batch-kit-tile{
 display:inline-flex;
 align-items:center;
 justify-content:center;
 min-width:26px;
 height:24px;
 padding:0 4px;
 border:1px solid var(--border);
 border-radius:6px;
 background:#f4f4f5;
 color:#52525b;
 font-size:.74rem;
 font-weight:650;
 font-variant-numeric:tabular-nums;
 line-height:1}
.batch-kit-tile.in_progress{
 background:#f1ecfe;
 border-color:#ddd3fb;
 color:#5b21b6}
.batch-kit-tile.ready_to_finish{
 background:#fffbea;
 border-color:#ffd60a;
 color:#6b4b00}
.batch-kit-tile.completed{
 background:#ecfdf3;
 border-color:#bbf7d0;
 color:#166534}
.batch-kit-tile.active{
 border-color:var(--blue)}
.batch-kit-tile.current{
 outline:2px solid var(--blue);
 outline-offset:1px;
 font-weight:700}
.batch-summary{
 display:flex;
 flex-wrap:wrap;
 gap:2px 14px;
 font-size:.76rem;
 line-height:1.3;
 color:var(--muted);
 text-align:left;
 white-space:nowrap}
.batch-create{
 margin-top:12px;
 padding:12px;
 border:1px dashed #d4d4d8;
 border-radius:10px;
 background:#f6f6f7}
.batch-count-label{
 display:flex;
 justify-content:space-between;
 align-items:baseline;
 gap:12px;
 flex-wrap:wrap;
 margin:0 0 6px;
 font-weight:650;
 font-size:.9rem}
.batch-count-hint{
 font-weight:500;
 font-size:.8rem;
 color:var(--muted)}
.stepper.batch-stepper{
 display:flex;
 align-items:center;
 gap:8px;
 margin:0 0 10px}
.batch-stepper input{
 width:90px;
 min-width:0;
 text-align:center;
 font-size:1.25rem;
 min-height:52px}
.batch-stepper button{
 width:52px;
 min-height:52px;
 padding:0;
 font-size:1.3rem}
.batch-create-button{
 width:100%;
 min-height:52px}
.fixation-bar{
 display:flex;
 align-items:center;
 gap:12px;
 flex-wrap:wrap;
 padding:8px 14px;
 border-top:1px solid var(--border);
 border-bottom:1px solid var(--border);
 background:#f1ecfe}
.fixation-bar button{
 min-height:48px;
 min-width:132px}
.fixation-hint{
 flex:1 1 200px;
 margin:0;
 font-size:.76rem;
 color:#52525b}
.row-fixation{
 display:flex;
 flex-direction:column;
 align-items:center;
 justify-content:center;
 gap:2px;
 min-width:0;
 font-size:.62rem;
 line-height:1.1;
 color:var(--muted);
 text-align:center}
.row-fixation input{
 width:26px;
 height:26px;
 min-height:26px}
.anomaly-stack{
 display:flex;
 flex-direction:column;
 gap:8px;
 padding:10px 14px;
 border-bottom:1px solid var(--border);
 background:#fffbea}
.anomaly-card{
 padding:10px 12px;
 border:1px solid #ffd60a;
 border-radius:10px;
 background:#ffd60a}
.anomaly-heading{
 display:flex;
 align-items:center;
 justify-content:space-between;
 gap:12px}
.anomaly-heading strong{
 color:#18181b;
 font-size:.9rem;
 overflow-wrap:anywhere}
.anomaly-close{
 min-height:40px;
 padding:4px 12px;
 font-size:.8rem;
 font-weight:650;
 flex:none}
.anomaly-card p{
 margin:6px 0 0;
 font-size:.82rem;
 overflow-wrap:anywhere}
.anomaly-meta{
 font-size:.72rem}
.batch-card .batch-kit-line{
 font-size:.78rem;
 overflow-wrap:anywhere}
.batch-card.paused{
 border-color:#ffd60a;
 background:#fffbea}
.batch-card.completed{
 border-color:#ffd60a;
 background:#f6f6f7}
@media(min-width:721px){
.line-row.batch-row{
 grid-template-columns:28px minmax(0,1fr) 64px 66px 70px 78px}
}
@media(max-width:1100px){
.batch-summary{
 white-space:normal}
.batch-header{
 padding:8px 10px;
 gap:5px}
}
@media(max-width:720px){
.batch-heading{
 align-items:flex-start;
 gap:6px}
.batch-actions{
 width:100%}
.batch-actions button{
 flex:1}
.batch-summary{
 flex-direction:column;
 white-space:normal}
.batch-kit-tile{
 min-width:30px;
 height:30px;
 font-size:.78rem}
.batch-stepper input{
 width:70px;
 flex:1}
.fixation-bar{
 align-items:stretch}
.fixation-bar button{
 width:100%}
.line-row .row-fixation{
 grid-column:4;
 grid-row:1;
 align-self:center}
}
/* Short screens: the batch header, the fixation bar and the anomaly hint need
   vertical room. The page scrolls instead of clipping the line list. */
@media(min-width:721px) and (max-height:760px){
html,body{
 height:auto}
body{
 min-height:100dvh;
 overflow:auto;
 display:block}
main{
 display:block;
 min-height:0}
#workspace{
 display:block}
.workgrid,.workgrid.right-video{
 display:grid;
 flex:none;
 height:auto;
 min-height:0}
.workgrid>.surface,body.large-text .workgrid>.surface{
 height:auto;
 min-height:0}
.workgrid>.lines-panel,body.large-text .workgrid>.lines-panel{
 height:auto;
 min-height:480px}
.video-panel{
 max-height:330px}
.line-list,body.large-text .line-list{
 flex:none;
 min-height:240px;
 max-height:440px}
.workfooter{
 position:static;
 flex:0 0 auto}
}
.anomaly-stack{
 max-height:212px;
 overflow-y:auto;
 overscroll-behavior:contain}
.anomaly-card{
 padding:8px 10px}
.anomaly-card p{
 margin:4px 0 0}

.manual-delta{margin:8px 0 0;font-weight:600}
.manual-delta.manual{color:#6b4b00}
.manual-reason-hint{margin:6px 0 0;color:#6b4b00;font-size:.85rem}
.editor-recovery{margin-top:12px}
.editor-recovery:not([open]) > :not(summary){display:none}
.editor-recovery summary{cursor:pointer;color:#52525b;font-weight:600}
.editor-recovery .controls{margin-top:8px}

.fixed-check{display:grid;place-items:center;width:28px;height:28px;border-radius:8px;background:#f1ecfe;color:#7c3aed;font-weight:700}
.evidence-link{display:inline-block;margin-top:6px;font-size:.85rem}

.required-mark{color:#7c3aed;font-weight:700}

.fixation-error{margin:8px 0 0;padding:10px 12px;border-radius:8px;background:#ffffff;border-left:3px solid #b3261e;color:#b3261e;font-weight:600}

/* Stage-first operator screen: no per-line checkboxes, no manual fixation bar. */
.stage-progress{display:grid;gap:8px;padding:10px 12px;border-radius:12px;background:#f7f5ff;border:1px solid #e5def8;margin:8px 0 10px}
.stage-heading{display:flex;align-items:baseline;justify-content:space-between;gap:12px}
.stage-heading strong{font-size:1.02rem}
.stage-count{font-size:.82rem}
.stage-steps{display:flex;flex-wrap:wrap;gap:6px}
.stage-chip{display:inline-flex;align-items:center;padding:4px 9px;border-radius:999px;background:#fff;border:1px solid #e4e4e7;color:#52525b;font-size:.78rem;white-space:nowrap}
.stage-chip.done{background:#ecfdf3;border-color:#bbf7d0;color:#166534}
.stage-chip.current{background:#7c3aed;border-color:#7c3aed;color:#fff;font-weight:650}
.stage-auto{margin:0;font-size:.86rem;color:#52525b;min-height:1.2em}
.stage-complete-hint{margin:8px 0 0;padding:9px 11px;border-radius:9px;background:#ecfdf3;color:#166534;font-weight:600;font-size:.88rem}
.line-row.stage-row{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:10px;min-height:58px;padding:10px 12px;cursor:pointer;border-width:1px}
.line-row.stage-row:hover,.line-row.stage-row:focus-visible{border-color:#7c3aed;outline:none}
.line-row.stage-row.complete{background:#f0fdf4;border-color:#bbf7d0}
.line-row.stage-row.mismatch{background:#fff1f2;border-color:#fecdd3}
.line-row.stage-row.unknown{background:#fff}
.line-row.stage-row.accepted{background:#f4f4f5;border-color:#e4e4e7;cursor:default}
.stage-line-info{display:grid;gap:4px;min-width:0}
.stage-line-name{font-size:1.02rem;font-weight:700;overflow-wrap:anywhere}
.stage-line-status{font-size:.86rem;font-weight:650}
.stage-line-status.complete{color:#15803d}
.stage-line-status.mismatch{color:#b91c1c}
.stage-line-status.accepted{color:#52525b}
.stage-line-status.unknown{color:#71717a}
.stage-line-manual{font-size:.8rem;color:#52525b;overflow-wrap:anywhere}
.stage-line-side{display:flex;align-items:center;gap:8px;flex-wrap:wrap;justify-content:flex-end}
.stage-line-qty{display:flex;gap:6px;flex-wrap:wrap;justify-content:flex-end}
.stage-accept{min-height:44px;padding:4px 10px;font-size:.84rem;font-weight:650;background:#ecfdf3;color:#166534;border-color:#bbf7d0}
.stage-auto.hold-failed{color:#b91c1c;font-weight:650}
.stage-line-qty .quantity{min-width:64px;padding:4px 6px;border-radius:8px;background:#f4f4f5}
.stage-line-qty .quantity.manual{background:#fef9c3}
.batch-kit-tile{pointer-events:none}
@media (max-width: 1100px){
  .line-row.stage-row{grid-template-columns:minmax(0,1fr);min-height:52px;padding:9px 10px}
  .stage-line-side{justify-content:flex-start}
  .stage-line-qty{justify-content:flex-start}
  .stage-line-qty .quantity{min-width:56px}
}
@media (min-height: 900px){
  .line-list{max-height:none}
}

/* Target production panel: 21.5" 1920x1080. Keep the current stage visible
   without scrolling even when the stage has around 15 full lines. */
@media (min-width: 1200px) and (min-height: 760px){
  main{padding:0 16px 8px}
  .worknav{min-height:64px}
  .worknav button{min-height:48px;padding:8px 12px}
  .batch-header{padding:8px 12px;gap:4px}
  .batch-heading{min-height:0;gap:8px}
  .batch-summary{font-size:.76rem}
  .video-toolbar{min-height:52px;margin:0 0 8px;padding:8px 12px}
  .video-toolbar h2{font-size:1rem}
  .video-toolbar button{min-height:44px;min-width:112px;padding:6px 10px}
  .workgrid{gap:10px}
  .panel-heading{padding:8px 12px}
  #lines-title{font-size:1rem}
  .stage-progress{padding:6px 9px;gap:4px;margin:5px 0 6px;border-radius:10px}
  .stage-heading strong{font-size:.96rem}
  .stage-count,.stage-auto{font-size:.78rem;min-height:1em}
  .stage-chip{padding:1px 6px;font-size:.7rem;line-height:1.35}
  .line-row.stage-row{min-height:44px;padding:4px 9px;gap:8px}
  .stage-line-info{gap:1px}
  .stage-line-name{font-size:.98rem;line-height:1.2}
  .stage-line-status{font-size:.8rem;line-height:1.2}
  .stage-line-manual{font-size:.72rem;line-height:1.2}
  .stage-line-qty{gap:4px}
  .stage-line-qty .quantity{min-width:54px;padding:2px 4px;font-size:.8rem;line-height:1.15}
  .stage-line-qty .quantity small{font-size:.6rem}
  .workfooter{min-height:56px;padding:6px 0}
  .workfooter button{min-height:44px;padding:6px 10px}
  .workfooter #footer-hint{font-size:.78rem}
}

/* Wide 21.5" panels: stages with many lines use two readable columns so the
   whole stage stays on screen without scrolling. */
@media (min-width: 1200px) and (min-height: 760px){
  .line-list.two-columns{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px 10px;align-content:start;overflow:visible}
  .line-list.two-columns .line-row.stage-row{min-height:44px;padding:3px 8px;gap:6px}
  .line-list.two-columns .stage-line-name{font-size:.92rem}
  .line-list.two-columns .stage-line-status{font-size:.76rem}
  .line-list.two-columns .stage-line-qty .quantity{min-width:48px;padding:1px 3px;font-size:.76rem}
  .line-list.two-columns .stage-line-qty .quantity small{font-size:.56rem}
  .line-list.two-columns .stage-line-manual{font-size:.68rem}
}

/* 21.5" displays running at 125% Windows scaling: 1536x864 CSS pixels.
   Tighten only the chrome so all positions of a 16-line stage remain visible. */
@media (min-width: 1200px) and (max-width: 1599px) and (min-height: 760px){
  .topbar{min-height:64px;padding:8px 12px}
  .brand{font-size:1.05rem}
  .worknav{min-height:50px;gap:8px}
  .worknav button{min-height:42px;padding:5px 10px}
  .batch-header{padding:6px 10px;gap:3px}
  .batch-heading h2{font-size:.98rem}
  #batch-meta{font-size:.7rem}
  .batch-summary{font-size:.72rem}
  .video-toolbar{min-height:44px;margin:0 0 4px;padding:4px 10px}
  .video-toolbar h2{font-size:.95rem}
  .video-toolbar button{min-height:38px;min-width:100px;padding:4px 8px}
  .panel-heading{padding:6px 10px}
  #lines-title{font-size:.95rem}
  .stage-progress{padding:5px 8px;gap:3px;margin:4px 0 5px}
  .stage-heading strong{font-size:.92rem}
  .stage-count,.stage-auto{font-size:.72rem}
  .stage-chip{padding:1px 5px;font-size:.66rem}
  .line-row.stage-row{min-height:40px;padding:3px 8px;gap:6px}
  .line-list.two-columns{gap:4px 8px}
  .line-list.two-columns .line-row.stage-row{min-height:40px}
  .stage-line-name{font-size:.9rem;line-height:1.15}
  .stage-line-status{font-size:.72rem;line-height:1.15}
  .stage-line-qty .quantity{min-width:48px;padding:1px 3px;font-size:.72rem}
  .stage-line-qty .quantity small{font-size:.56rem}
  .workfooter{min-height:48px;padding:4px 0}
  .workfooter button{min-height:38px;padding:4px 8px}
  .workfooter #footer-hint{font-size:.72rem}
}

/* 1280x800 fallback: less height than the 21.5" target but the same 15-line
   stage and 50 kits must stay on one screen. Tighten only chrome here. */
@media (min-width: 1200px) and (max-height: 840px){
  .topbar{min-height:56px;padding:6px 12px}
  .topbar button{min-height:40px;padding:4px 10px}
  .worknav{min-height:44px}
  .worknav button{min-height:36px;padding:4px 10px}
  .worknav a{padding:10px 6px}
  .batch-header{padding:5px 9px;gap:2px}
  #batch-meta{display:none}
  .batch-heading h2{font-size:.92rem}
  .batch-actions button{min-height:34px;padding:3px 10px;font-size:.8rem}
  .stage-progress{display:flex;align-items:center;flex-wrap:wrap;gap:2px 10px;padding:3px 8px;margin:3px 0 4px}
  .stage-heading{flex:1 1 auto;gap:8px}
  .stage-heading strong{font-size:.88rem}
  .stage-steps{flex:0 0 auto}
  .stage-auto{flex:1 1 100%;font-size:.7rem;min-height:0}
  .panel-heading{padding:4px 8px}
  .video-toolbar{min-height:38px;padding:4px 8px;margin:0 0 4px}
  .video-toolbar button{min-height:30px;min-width:96px;padding:3px 8px}
  .workfooter{min-height:40px;padding:2px 0}
  .workfooter button{min-height:34px;padding:3px 8px}
}

/* --- Native continuous replay preview ---------------------------------------
   One persistent <video> lives inside the existing preview rectangle, so the
   video panel keeps the old geometry. The annotated snapshot stays one explicit
   click away and is never layered over the live recording. */
.preview{position:relative}
.preview video{
 display:block;
 width:100%;
 max-height:430px;
 object-fit:contain;
 border-radius:7px;
 background:#152538}
.video-panel .preview video{max-height:300px}
@media(max-width:1100px){
 .preview video{max-height:220px}
}
.preview-modes{
 position:absolute;
 top:8px;
 right:8px;
 display:flex;
 gap:6px;
 z-index:2}
.preview-modes button{
 min-height:44px;
 min-width:44px;
 padding:6px 12px;
 font-size:.8rem;
 font-weight:650;
 line-height:1.1;
 border-radius:9px;
 background:rgba(24,24,27,.86);
 color:#f4f4f5;
 border:1px solid rgba(244,244,245,.4);
 cursor:pointer}
.preview-modes button[aria-pressed="true"]{
 background:#7c3aed;
 border-color:#7c3aed;
 color:#fff}
.preview-modes button:disabled{
 opacity:.55;
 cursor:not-allowed}
.preview-video-error{
 position:absolute;
 left:8px;
 right:8px;
 bottom:60px;
 z-index:3;
 margin:0;
 font-size:.82rem}
.preview-video-retry{
 position:absolute;
 left:8px;
 bottom:8px;
 z-index:4;
 min-height:44px}
