*{box-sizing:border-box;touch-action:manipulation}html,body{margin:0;height:100%;font-family:-apple-system,system-ui,sans-serif;background:#f4f1ea;color:#222;-webkit-user-select:none;user-select:none}
#app{height:100%;display:flex;flex-direction:column}
header{display:flex;justify-content:space-between;align-items:center;padding:10px 18px;background:#2b2b2b;color:#fff;font-size:20px}
header .brand{display:flex;align-items:center;gap:8px;min-width:0}header .brand-logo{width:36px;height:36px;object-fit:contain;flex:none}
header .env{background:#c0392b;padding:2px 10px;border-radius:8px;font-size:15px}header .env.ok{background:#2e7d32}
.main{flex:1;display:flex;min-height:0}.left{flex:1;overflow:auto;padding:16px}
.pad{width:300px;background:#e4dfd3;padding:12px;display:grid;grid-template-columns:repeat(3,1fr);gap:10px;align-content:start}
.pad button{height:92px;font-size:38px;border:0;border-radius:14px;background:#fff;box-shadow:0 2px 0 #aaa}.pad button:active{background:#ddd}
.pad .wide{grid-column:span 2}.pad .clr{background:#f2c6c0}.pad .disp{grid-column:span 3;height:96px;background:#fff;border-radius:14px;font-size:44px;text-align:right;padding:20px 14px;overflow:hidden}
.big{display:block;width:100%;min-height:110px;margin:0 0 14px;font-size:34px;border:0;border-radius:18px;background:#fff;box-shadow:0 3px 0 #bbb;text-align:left;padding:18px 24px}
.big small{display:block;font-size:20px;color:#666}.big.green{background:#c8e6c9}.big.amb{background:#ffe0b2}.big.frz{background:#bbdefb}
.big.red{background:#ffcdd2}.big.primary{background:#2e7d32;color:#fff;text-align:center}
.row{display:flex;align-items:center;gap:10px;background:#fff;border-radius:14px;padding:12px 16px;margin-bottom:10px;font-size:26px;border:4px solid transparent}
.row.sel{border-color:#1976d2}.row .drop{width:90px;font-weight:700;font-size:34px}.row .nm{flex:1}.row .need{width:150px;text-align:right}
.row .val{width:150px;text-align:right;font-size:34px;font-weight:700;background:#f4f1ea;border-radius:10px;padding:8px}
.tag{font-size:16px;padding:2px 8px;border-radius:8px;background:#eee;margin-left:6px}.tag.warn{background:#ffcc80}
.err{background:#ffcdd2;padding:12px;border-radius:10px;margin:10px 0;font-size:20px}.info{background:#fff8e1;padding:12px;border-radius:10px;margin:10px 0;font-size:20px}
.toolbar{display:flex;gap:10px;margin-bottom:12px}.toolbar button{font-size:26px;padding:14px 22px;border:0;border-radius:12px;background:#fff}
input.f{font-size:30px;padding:16px;width:100%;margin:8px 0;border:2px solid #999;border-radius:10px;-webkit-user-select:text;user-select:text}
h2{margin:6px 0 14px;font-size:30px}

/* iPad LANDSCAPE (1024x768): work area left, keypad ALWAYS on the right, no page scroll; only the left pane scrolls */
html,body{overflow:hidden;overscroll-behavior:none}
.main{flex-direction:row}.left{min-width:0}.pad{flex:0 0 300px;overflow:auto}
@media (orientation:landscape) and (max-height:820px){header{padding:6px 14px;font-size:17px}.pad{width:288px;flex-basis:288px;padding:8px;gap:8px}
.pad button{height:76px;font-size:34px}.pad .disp{height:72px;font-size:38px;padding:14px}.left{padding:10px 12px}
.big{min-height:84px;font-size:28px;margin-bottom:10px;padding:12px 20px}.row{font-size:22px;padding:8px 12px}.row .drop{width:64px;font-size:28px}.row .need{width:130px}.row .val{width:120px;font-size:28px}h2{font-size:26px;margin:2px 0 8px}}
@media (orientation:portrait){body::before{content:"Rotate the iPad to LANDSCAPE";position:fixed;inset:0;z-index:9;background:#2b2b2b;color:#fff;font-size:34px;display:flex;align-items:center;justify-content:center}}
.row .val.sel{outline:4px solid #1976d2}.row .val small{font-size:13px;color:#666}

.loading{display:flex;flex-direction:column;align-items:center;justify-content:center;height:100%;font-size:28px;color:#666;gap:16px}.spin{width:48px;height:48px;border:6px solid #ddd;border-top-color:#2e7d32;border-radius:50%;animation:sp 1s linear infinite}@keyframes sp{to{transform:rotate(360deg)}}

#ov{position:fixed;inset:0;pointer-events:auto;touch-action:none;z-index:20;background:rgba(0,0,0,.45);display:flex;flex-direction:column;align-items:center;justify-content:center;gap:18px;color:#fff;font-size:34px;font-weight:600}#ov[hidden]{display:none}#ov .spin{width:84px;height:84px;border-width:10px;border-color:rgba(255,255,255,.35);border-top-color:#fff}

.row .val::after{content:'\200b'}.row .val{min-height:1.4em;box-sizing:content-box}

.row.picked{background:#c8e6c9}

.modal{position:fixed;inset:0;background:rgba(0,0,0,.45);display:flex;align-items:center;justify-content:center;z-index:50}.modal .card{background:#fff;padding:20px;border-radius:12px;min-width:360px;max-width:80%}.modal .disp{font-size:40px;text-align:right;border:1px solid #999;padding:8px;margin:8px 0}.units{display:flex;flex-wrap:wrap;gap:8px;margin:8px 0}.unit{font-size:20px;padding:10px 14px}.unit.sel{background:#0a7;color:#fff}.loose{font-size:18px;margin-left:8px}
.modal{pointer-events:none;background:none;justify-content:flex-start;align-items:flex-start;padding:90px 0 0 40px}.modal .card{pointer-events:auto;box-shadow:0 4px 24px rgba(0,0,0,.4)}
