/* The receipt is always in view while the keypad is in use. */
.receiving-app.thumb-mode .receiving-header{min-height:48px;height:auto;padding:2px 12px;gap:8px}
.receiving-app.thumb-mode .receiving-header>div:not(.exchange-tabs){display:flex;align-items:baseline;flex-wrap:wrap;gap:2px 12px}
.receiving-app.thumb-mode .receiving-header>div>small{display:none}
.receiving-app.thumb-mode .receiving-header>div>strong{font-size:17px;line-height:1.15}
.receiving-app.thumb-mode .receiving-header .recovery-status{font-size:12px;font-weight:500;min-height:0;height:auto;line-height:1.2;margin:0;overflow:visible;color:#3e564a}
.receiving-app.thumb-mode .recovery-status[data-kind=error]{color:#9c221d;font-weight:700;height:auto;white-space:normal}
.receiving-app.thumb-mode .modal-body{padding:4px 10px}
#live-calculator{--ledger-height:clamp(168px,calc(100dvh - 529px),390px);gap:6px}
#live-calculator .thumb-batch{display:grid;grid-template-columns:auto minmax(0,1fr) auto;grid-template-areas:"heading undo tools" "rows rows rows";gap:0;align-items:center}
#live-calculator .batch-heading{grid-area:heading;height:auto;min-height:0;padding:0}
#live-calculator .batch-heading button,#live-calculator #calc-tools:not([open]) summary{display:flex;gap:7px;align-items:center;min-height:44px;height:44px;padding:0 4px;border:0;background:transparent;color:#203e30}
#live-calculator .batch-heading button{font-size:17px}
#batch-count{font-variant-numeric:tabular-nums;color:#425c50}
#live-calculator #calc-tools:not([open]){grid-area:tools;border:0;background:transparent;padding:0}
#live-calculator #calc-tools:not([open]) summary{font-size:14px;font-weight:600}
#live-calculator #thumb-undo:not([hidden]){grid-area:undo;position:static;height:auto;justify-self:center}
#live-calculator #thumb-undo .thumb-undo{height:auto;margin:0;border:0;padding:0;background:transparent}
#live-calculator #thumb-undo span{display:none}
#live-calculator #thumb-undo button{height:44px;min-height:44px;padding:0 8px;text-decoration:underline;background:transparent;border:0;color:#165a41}
#live-calculator #thumb-status{position:absolute;width:1px;height:1px;min-height:0;clip-path:inset(50%);overflow:hidden;white-space:nowrap}
#live-calculator #batch-rows{grid-area:rows;border:1px solid #cbd9cf;border-radius:10px}
#live-calculator #batch-rows .batch-scroll{height:var(--ledger-height);min-height:0;max-height:none;overflow:auto;scrollbar-gutter:stable;overscroll-behavior-y:contain}
#live-calculator .batch-table thead{display:table-header-group;background:#ecf2ee}
#live-calculator .batch-table thead th{height:25px;font-size:12px;padding:0 8px}
#live-calculator .batch-table th:first-child{width:36%}
#live-calculator .batch-table th:nth-child(2){width:15%;text-align:right}
#live-calculator .batch-table th:last-child{width:21px}
#live-calculator .batch-row{height:44px;cursor:pointer;touch-action:pan-y}
#live-calculator .batch-row>th,#live-calculator .batch-row>td{padding:0 8px}
#live-calculator .batch-row .batch-more{padding:0;text-align:center;font-size:21px;color:#546d5e}
#live-calculator .batch-row:focus-within,#live-calculator .batch-row:active{background:#edf5ef}
#live-calculator .batch-edit{min-height:44px;font-size:18px;line-height:1.12;padding:3px 0;color:#18241d}
#live-calculator .batch-edit small{font-size:12px;font-weight:600}
#live-calculator .batch-qty,#live-calculator .batch-money{font-size:18px;font-weight:650;color:#111a14}
#live-calculator #batch-rows .batch-total{display:none}
#live-calculator .batch-empty{height:54px;font-size:14px}
#live-calculator #thumb-composer,#live-calculator .thumb-entry{gap:4px}
#live-calculator .thumb-types button,#live-calculator .thumb-grades,#live-calculator .thumb-grades button{height:44px;min-height:44px}
#live-calculator .thumb-grades button{padding:2px}
#live-calculator .thumb-entry-bar{display:grid;grid-template-columns:minmax(0,1fr) minmax(94px,34%);gap:5px;align-items:stretch}
#live-calculator .thumb-quantity{height:48px;min-height:48px;padding:0 4px;gap:3px}
#live-calculator .thumb-quantity>label{font-size:15px;line-height:1.05;min-width:0}
#live-calculator .thumb-quantity input{min-width:30px;width:50px;height:44px;min-height:44px;font-size:28px;flex:1}
#live-calculator .entry-cancel{height:44px;min-height:44px}
#live-calculator .thumb-add{min-height:48px;height:48px;font-size:16px;padding:0 4px}
#live-calculator #thumb-preview{height:20px;min-height:20px;font-size:13px;line-height:1.35;margin:0;color:#3b5244}
#live-calculator .thumb-keypad{gap:3px;grid-template-columns:repeat(3,minmax(0,1fr))}
#live-calculator .thumb-keypad button{min-height:44px;height:44px;font-size:24px;padding:0}
.receiving-app.thumb-mode .modal-foot{padding:4px 10px max(4px,env(safe-area-inset-bottom))}
.receiving-app.thumb-mode .wizard-nav button{height:44px;min-height:44px;padding:4px}
#live-calculator dialog.calc-sheet{box-sizing:border-box;color:#17251c;background:white;width:min(96vw,480px);max-height:80dvh;overflow:auto;border:1px solid #b7c9bf;border-radius:18px;padding:16px;inset:0;margin:auto;box-shadow:0 10px 40px #14271a32}
#live-calculator dialog.calc-sheet:not([open]){display:none}
#live-calculator .calc-sheet::backdrop{background:#11291e70}
#live-calculator .calc-sheet header{display:flex;gap:10px;align-items:center;justify-content:space-between;margin-bottom:10px}
#live-calculator .calc-sheet h2{margin:0;font-size:21px;line-height:1.2;color:#12251b}
#live-calculator .calc-sheet button{min-height:44px}
#live-calculator .calc-sheet .batch-scroll{min-height:0;height:auto;max-height:55dvh;overflow:auto}
#live-calculator .calc-sheet .batch-total{display:flex}
#live-calculator .line-actions{display:flex;flex-wrap:wrap;gap:8px}
#live-calculator .line-actions button{flex:1;color:#164732;background:#e8f3eb}
#live-calculator .line-actions .line-delete{background:#fff1ee;color:#982c21}
#live-calculator .calc-sheet [data-row-summary]{font-size:18px;font-variant-numeric:tabular-nums}
@media(max-width:600px){
 #live-calculator dialog.calc-sheet{width:100%;max-width:100vw;margin:auto 0 0;border-radius:18px 18px 0 0;padding-bottom:max(16px,env(safe-area-inset-bottom))}
}
@media(orientation:landscape) and (min-width:700px){
 #live-calculator{--ledger-height:clamp(168px,calc(100dvh - 225px),560px)}
 #live-calculator #batch-rows .batch-scroll{height:auto;max-height:var(--ledger-height)}
 #live-calculator #batch-rows .batch-total{display:flex}
}

#live-calculator .batch-scroll,#live-calculator .batch-row td,#live-calculator .batch-row th,#live-calculator .batch-edit{touch-action:pan-y}

.receiving-app.thumb-mode:not(.exchange-mode) .modal-foot .wizard-summary{display:grid;grid-template-columns:auto 1fr;grid-template-areas:"label count" "total total";align-content:center;gap:1px 5px;padding:0;margin:0;line-height:1.1}
.receiving-app.thumb-mode:not(.exchange-mode) .wizard-summary>div{display:contents}
.receiving-app.thumb-mode:not(.exchange-mode) .wizard-summary small{grid-area:label;font-size:11px;white-space:nowrap}
.receiving-app.thumb-mode:not(.exchange-mode) #receive-count{grid-area:count;font-size:11px;white-space:nowrap}
.receiving-app.thumb-mode:not(.exchange-mode) #receive-total{grid-area:total;font-size:21px}
@media(max-height:720px) and (orientation:portrait){
 #live-calculator{--ledger-height:clamp(160px,calc(100dvh - 477px),240px)}
 #live-calculator .thumb-keypad{grid-template-columns:repeat(4,minmax(0,1fr));grid-template-areas:"n1 n2 n3 back" "n4 n5 n6 clear" "n7 n8 n9 zero"}
 #live-calculator [data-action=calc-digit][data-id="0"]{grid-area:zero}
 #live-calculator [data-action=calc-digit][data-id="C"]{grid-area:clear}
 #live-calculator [data-action=calc-digit][data-id="⌫"]{grid-area:back}
}

#live-calculator [data-full-rows] .batch-note{display:block;margin:6px 0;font-size:14px;color:#354c3d}

@media(max-height:620px) and (orientation:portrait){
 #live-calculator{--ledger-height:clamp(115px,calc(100dvh - 452px),160px)}
 #live-calculator #thumb-preview{position:absolute;width:1px;height:1px;min-height:0;clip-path:inset(50%);overflow:hidden}
}

/* Promotion uses the same offline calculator and a fixed final unit price. */
#live-calculator .thumb-batch{grid-template-columns:auto minmax(44px,1fr) auto;grid-template-areas:"heading promotion tools" "rows rows rows"}
#live-calculator .calc-promotion{grid-area:promotion;justify-self:center;min-height:44px;padding:4px 12px;border:1px solid #becdbf;border-radius:12px;background:#fff;color:#253b2d;font-size:15px;font-weight:700}
#live-calculator .calc-promotion[aria-pressed=true]{color:#624100;background:#fff1c8;border-color:#aa7e19}
#live-calculator .promotion-entry .thumb-entry-bar{grid-template-columns:minmax(90px,1fr) minmax(90px,1.1fr) minmax(90px,.95fr)}
#live-calculator .promotion-entry .thumb-quantity,#live-calculator .thumb-price{height:64px;min-height:64px;box-sizing:border-box;border:1px solid #b8c7bc;border-radius:12px;position:relative;background:white;display:grid;grid-template-rows:18px 44px;grid-template-columns:1fr;margin:0;padding:0 4px;gap:0;min-width:0}
#live-calculator .promotion-entry .thumb-quantity>label,#live-calculator .thumb-price>span{font-size:12px;line-height:18px;color:#263c2d}
#live-calculator .promotion-entry .thumb-quantity input,#live-calculator .thumb-price input{height:44px;min-height:44px;width:100%;font-size:22px;font-weight:700;padding:0 2px;border:0;border-radius:6px;background:transparent}
#live-calculator .promotion-entry .thumb-quantity input{padding-right:30px}
#live-calculator .promotion-entry .entry-cancel{position:absolute;right:0;bottom:0;width:32px;min-width:32px;padding:0;background:transparent}
#live-calculator .promotion-entry .thumb-add{height:64px}
#live-calculator .promotion-entry .keypad-active{border:2px solid #a47300;background:#fff9e8;padding:0 3px;grid-template-rows:17px 43px}
#live-calculator .promotion-label{color:#765000;font-weight:700}
#live-calculator.has-promotion-entry #batch-rows .batch-scroll{height:calc(var(--ledger-height) - 16px)}
@media(max-height:720px) and (orientation:portrait){#live-calculator [data-action=calc-digit][data-id=","]{grid-area:clear}}

#live-calculator .thumb-batch:has(#thumb-undo:not([hidden])){grid-template-columns:auto minmax(44px,1fr) 44px auto;grid-template-areas:"heading promotion undo tools" "rows rows rows rows"}
#live-calculator #thumb-undo:not([hidden]){grid-area:undo}
#live-calculator #thumb-undo button{width:44px;font-size:0;padding:0}
#live-calculator #thumb-undo button::after{content:"↶";font-size:26px}
#live-calculator .thumb-batch:has(#thumb-undo:not([hidden])) .calc-promotion{padding-left:6px;padding-right:6px}
#live-calculator .promotion-entry .entry-cancel{width:44px;min-width:44px}
#live-calculator .promotion-entry .thumb-quantity input{padding-right:40px}

/* EPAL repair prices stay next to quantity, without moving the type/grade strips. */
#live-calculator .repair-entry .thumb-entry-bar{grid-template-columns:minmax(84px,1fr) minmax(104px,1.2fr) minmax(84px,1fr)}
#live-calculator .repair-entry .thumb-quantity{height:64px;min-height:64px;box-sizing:border-box;display:grid;grid-template-rows:18px 44px;grid-template-columns:1fr;position:relative;padding:0 4px;gap:0;min-width:0}
#live-calculator .repair-entry .thumb-quantity>label{font-size:12px;line-height:18px}
#live-calculator .repair-entry .thumb-quantity input{height:44px;min-height:44px;width:100%;min-width:0;font-size:22px;padding:0 40px 0 2px;border:0}
#live-calculator .repair-entry .entry-cancel{position:absolute;right:0;bottom:0;width:44px;min-width:44px;padding:0;background:transparent}
#live-calculator .repair-entry .thumb-add{height:64px}
#live-calculator .repair-prices{min-width:0;height:64px;display:grid;grid-template-rows:18px 44px;gap:0}
#live-calculator .repair-prices strong{font-size:12px;line-height:18px;color:#18241d}
#live-calculator .repair-prices>div{display:grid;grid-template-columns:1fr 1fr;gap:4px}
#live-calculator .repair-prices button{min-height:44px;height:44px;min-width:44px;padding:0 2px;font-size:16px;font-weight:700;color:#153e2e;background:#fff;border:1px solid #9bb5a8;border-radius:8px}
#live-calculator .repair-prices button[aria-pressed=true]{background:#175e45;color:#fff;border:2px solid #0f4834}
#live-calculator.has-repair-choice #batch-rows .batch-scroll{height:calc(var(--ledger-height) - 16px)}

/* Delete is explicit, touch-sized and always followed by confirmation. */
.receiving-header .receiving-discard{min-height:44px;padding:4px 9px;color:#852d2c;background:#fff7f6;border:1px solid #e2b8b2;border-radius:10px;font-size:14px}
.receiving-header>div{min-width:0}
.arrival-card .draft-discard,.draft-card .draft-discard{min-height:48px;padding:10px 16px;margin:8px 0;color:#852d2c;background:#fff7f6;border:1px solid #e2b8b2;border-radius:12px;font-weight:600}

.modal-foot:has(.discard-confirm) button{min-height:48px}
