:root{--orange:#e87730;--ink:#252621;--muted:#77786f;--border:#dedfd7;--paper:#f5f5ef}*{box-sizing:border-box}body{margin:0;background:var(--paper);color:var(--ink);font-family:Arial,sans-serif;font-size:14px}header{height:82px;background:#fff;border-bottom:1px solid var(--border);display:flex;align-items:center;justify-content:space-between;padding:0 5%}.brand{display:flex;align-items:center;gap:14px;font-weight:800;font-size:22px;letter-spacing:2px;text-decoration:none;color:inherit}.mark{display:grid;place-items:center;background:var(--orange);color:#fff;width:34px;height:38px;font-size:25px;transform:skewY(-8deg)}.divider{color:#ccc;font-weight:400;margin:0 5px}.product{font-size:15px;letter-spacing:0;font-weight:400}.pill{border:1px solid #dadfcf;background:#f5f8ed;padding:8px 12px;border-radius:30px;font-size:12px}.pill:before{content:'●';color:#6a8c50;margin-right:8px}main{max-width:1320px;margin:auto;padding:42px 40px 0}.heading{display:flex;align-items:center;justify-content:space-between}.eyebrow{font-size:11px;letter-spacing:2px;color:#73766c}h1{font-size:49px;letter-spacing:-2px;line-height:1.08;margin:22px 0 18px;font-weight:600}h1 span{color:#888a80}.intro{line-height:1.7;color:#6c6f64}.stats{border-left:1px solid #d5d8cd;padding:8px 60px 8px 35px;display:flex;flex-direction:column;gap:9px}.stats strong{font-size:60px;font-weight:400;line-height:1}.stats span{color:#777}.stats b{font-size:12px;color:#7b812f;background:#e9eccf;padding:7px 12px;border-radius:4px;font-weight:400;width:fit-content}nav{display:flex;gap:28px;margin:26px 0 25px;border-bottom:1px solid var(--border)}button,.button{border:1px solid #d6d9cd;border-radius:6px;background:#fff;color:var(--ink);padding:12px 16px;font:inherit;cursor:pointer;display:inline-flex;justify-content:center;align-items:center;gap:6px;text-decoration:none;min-height:43px}button:hover,.button:hover{background:#f0f0e9}button:disabled{opacity:.5;cursor:wait}nav button{border:0;background:none;border-radius:0;padding:15px 2px;color:#7d8074}nav button.active{border-bottom:3px solid var(--orange);color:#252621;font-weight:600}h2{font-size:18px;letter-spacing:-.3px;margin:0}h3{font-size:17px}.tab{display:none}.tab.active{display:block}.scanGrid{display:grid;grid-template-columns:1.3fr 1fr;gap:24px}.card{background:#fff;border:1px solid var(--border);border-radius:10px;padding:25px}.cardTitle{display:flex;align-items:center;justify-content:space-between;margin-bottom:20px}.tag{font-size:10px;letter-spacing:1px;border:1px solid #dbe0d4;padding:6px 8px;border-radius:4px}.step{font-size:13px;color:#989c8d}#stage{background:#262c29;min-height:310px;position:relative;border-radius:6px;overflow:hidden;display:flex;align-items:center;justify-content:center;color:#d8dfd8}#placeholder{text-align:center;padding:35px}.frameIcon{font-size:55px;color:#d9b367}#placeholder p{font-size:13px;color:#a0aaa0;line-height:1.7}#stage video,#stage canvas{width:100%;max-height:450px;object-fit:contain;display:block}#stage [hidden]{display:none}#photo.selecting{touch-action:none;cursor:crosshair}#selection{position:absolute;border:2px solid #ffcb58;background:#ffce5022;pointer-events:none}.cameraActions,.cropActions{display:flex;gap:8px;flex-wrap:wrap;margin-top:16px}.primary{background:var(--orange);color:white;border-color:var(--orange);font-weight:600}.primary:hover{background:#cb6222}.small{font-size:12px;line-height:1.6;color:#828579}#ocrStatus{font-size:12px;color:#626b59;padding-top:12px;border-top:1px solid #eee;line-height:1.6}.notice{background:#f8f3df;border-left:3px solid #dfc764;color:#7a6c3b;font-size:12px;line-height:1.6;padding:12px 14px;margin-bottom:20px}label{display:block;font-size:12px;color:#666b60;font-weight:500}input,select{display:block;width:100%;border:1px solid #d6d9ce;background:#fff;border-radius:5px;color:#292f24;font:inherit;font-size:16px;padding:12px;margin:8px 0 16px;min-height:44px}input:focus,select:focus{outline:2px solid #f0b389;outline-offset:1px}#reading{font-size:31px;letter-spacing:2px;margin-bottom:4px}#serial{font-size:20px;letter-spacing:1px;margin-bottom:4px}.match{font-size:12px;margin:8px 0 20px;color:#71805e}.check{display:flex;align-items:center;gap:9px;line-height:1.5;margin:17px 0}.check input{width:18px;min-height:18px;margin:0;accent-color:var(--orange)}.full{width:100%}details{margin-top:18px;font-size:12px;color:#787e70}pre{white-space:pre-wrap;overflow-wrap:anywhere}#saveStatus{font-size:13px;line-height:1.5}.offline{border:1px solid #d9dccf;border-radius:9px;margin:24px 0;display:flex;justify-content:space-between;align-items:center;gap:20px;padding:20px 24px}.offline strong{font-size:14px}.offline p{color:#7a8071;font-size:12px;line-height:1.6;margin-bottom:0;max-width:760px}.offline button{flex-shrink:0}.sectionHeading{display:flex;align-items:center;justify-content:space-between;gap:15px;margin:25px 0}.sectionHeading p{color:var(--muted);line-height:1.6}.addGrid{display:grid;grid-template-columns:1.3fr 1fr 1fr .7fr auto;gap:12px;align-items:center}.addGrid button{margin-top:8px}.toolbar{display:flex;align-items:center;gap:15px;border-top:1px solid #eee;padding-top:20px;margin-top:15px}.toolbar input{max-width:420px;margin:0;flex:1}.tableWrap{overflow:auto}table{width:100%;border-collapse:collapse;white-space:nowrap;text-align:left}th{font-size:10px;letter-spacing:1px;color:#8a8e82;font-weight:500;padding:20px 12px;border-bottom:1px solid var(--border)}td{padding:20px 12px;border-bottom:1px solid #eee;font-size:13px}td:first-child{font-weight:600;font-variant-numeric:tabular-nums}td:nth-child(4){font-size:17px}.empty{padding:50px 20px;text-align:center;color:#878d7b}.empty span{font-size:35px}.empty p{font-size:13px}.historyItem{display:flex;gap:20px;align-items:center;background:#fff;border:1px solid var(--border);padding:20px;border-radius:8px;margin-bottom:10px}.historyItem img{width:100px;height:80px;object-fit:contain;background:#eee;cursor:pointer}.historyItem strong{font-size:24px}.historyItem p{color:#797f71;font-size:12px}footer{display:flex;justify-content:space-between;padding:30px 0;font-size:10px;color:#8b9081;letter-spacing:1px}button:focus-visible,.button:focus-visible{outline:3px solid #f4b55a}[hidden]{display:none!important}@media(max-width:760px){header{height:66px;padding:0 18px}.brand{font-size:17px;gap:8px}.product{font-size:12px}.divider{margin:0}.pill{font-size:10px;padding:6px}main{padding:28px 16px 0}h1{font-size:37px}.eyebrow{font-size:9px}.intro{font-size:12px}.stats{padding:5px 0 5px 20px}.stats strong{font-size:40px}.stats span{font-size:10px}.stats b{font-size:10px}.scanGrid{grid-template-columns:1fr;gap:16px}.card{padding:18px}#stage{min-height:270px}nav{gap:24px;margin:22px 0}nav button{font-size:13px}.offline{align-items:stretch;flex-direction:column;padding:18px}.sectionHeading{flex-direction:column;align-items:flex-start}.addGrid{grid-template-columns:1fr 1fr}.addGrid button{grid-column:span 2;margin:0}.toolbar{gap:8px}.toolbar input{min-width:0;font-size:13px}footer{font-size:8px;gap:20px}.cameraActions button,.cameraActions .button{flex:1;padding:12px 9px}.cropActions button{font-size:11px;padding:8px}.heading{gap:12px}.stats{min-width:95px}.historyItem{gap:12px}}
#stage canvas{width:auto;height:auto;max-width:100%;max-height:450px;object-fit:fill}

/* Application shell: one selected workspace beside a persistent navigation rail. */
header{height:72px;padding:0 28px;position:sticky;top:0;z-index:20}
.appLayout{display:grid;grid-template-columns:220px minmax(0,1fr);min-height:calc(100vh - 72px)}
.sidebar{background:#fff;border-right:1px solid var(--border);padding:24px 16px;position:sticky;top:72px;height:calc(100vh - 72px);overflow-y:auto;display:flex;flex-direction:column;gap:28px}
.sidebar nav{display:flex;flex-direction:column;gap:6px;margin:0;border:0}
.sidebar nav button{justify-content:flex-start;border:0;border-radius:7px;padding:14px 16px;font-size:14px;color:#64685c;text-align:left}
.sidebar nav button.active{border:0;background:#fff0e5;color:#a94a13;box-shadow:inset 3px 0 var(--orange);font-weight:600}
.sidebar .stats{border:0;border-top:1px solid var(--border);margin-top:auto;padding:24px 12px 4px;gap:8px;min-width:0}
.sidebar .stats strong{font-size:32px}.sidebar .stats span{font-size:12px}
main#content{width:100%;max-width:1480px;margin:0 auto;padding:28px 32px 0;min-width:0}
.tab{min-width:0}.scanGrid{grid-template-columns:minmax(0,1.2fr) minmax(0,1fr);align-items:start}.card{min-width:0}.sectionHeading{margin:0 0 24px}.sectionHeading p{margin-bottom:0}
#offline .offline{margin-top:0;background:#fff}.menuToggle{display:none}.addGrid{grid-template-columns:repeat(4,minmax(0,1fr))}.addGrid button{grid-column:1/-1;justify-self:start;margin:0 0 12px}footer{gap:16px;flex-wrap:wrap}
@media(max-width:1100px){main#content{padding:24px 20px 0}.appLayout{grid-template-columns:190px minmax(0,1fr)}.scanGrid{grid-template-columns:1fr}.addGrid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:760px){header{height:66px;padding:0 16px}.appLayout{display:block;min-height:calc(100vh - 120px)}.menuToggle{display:flex;margin:12px 16px;min-height:40px}.sidebar{display:none;position:fixed;top:66px;left:0;bottom:0;height:auto;width:240px;z-index:30;box-shadow:12px 0 36px #0002}.sidebar.open{display:flex}.sidebar nav button{font-size:15px}main#content{padding:12px 16px 0}.cardTitle{gap:10px;flex-wrap:wrap}.sectionHeading{margin:0 0 18px}.toolbar{flex-wrap:wrap}.toolbar input{min-width:140px}.historyItem{min-width:0}.historyItem p{overflow-wrap:anywhere}.brand{letter-spacing:1px}footer{line-height:1.6}}

#ocrStatus:empty,#offlineStatus:empty,#engineInfo:empty,#saveStatus:empty,#meterStatus:empty{display:none}#offline .offline{justify-content:space-between}.sectionHeading:empty{display:none}

/* Palette shared with Retrofit Reports. */
:root{--orange:#f5a623;--ink:#1c1c1c;--muted:#606060;--border:#dcdcdc;--paper:#f3f3f3;--surface:#fff;--field:#fff;--input-border:#808080;--selected:#fff0d2;--selected-ink:#714300;--button-ink:#1c1c1c;--warning-bg:#fff2d5;--warning-ink:#76550d;color-scheme:light}
:root[data-theme="dark"]{--orange:#ffb638;--ink:#f4f4f4;--muted:#bcbcbc;--border:#3c3c3c;--paper:#121212;--surface:#1e1e1e;--field:#303030;--input-border:#8b8b8b;--selected:#3a2b13;--selected-ink:#ffcf7a;--button-ink:#211600;--warning-bg:#342b1b;--warning-ink:#e7c47a;color-scheme:dark}
body{font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif}header,.sidebar,.card,.historyItem,#offline .offline{background:var(--surface);color:var(--ink);border-color:var(--border)}button,.button,input,select{background:var(--field);color:var(--ink);border-color:var(--input-border)}input::placeholder{color:var(--muted)}button:hover,.button:hover{background:var(--selected)}.primary,.mark{background:var(--orange);color:var(--button-ink);border-color:var(--orange)}.primary:hover{background:var(--orange);filter:brightness(.9)}.sidebar nav button,.small,label,.match,.sectionHeading p,.historyItem p,.empty,details,#ocrStatus,.sidebar .stats span,th{color:var(--muted)}.sidebar nav button.active,.stats b,.pill{background:var(--selected);color:var(--selected-ink);border-color:var(--border)}.tag,.toolbar,td,th,#ocrStatus,.sidebar .stats{border-color:var(--border)}.notice{background:var(--warning-bg);color:var(--warning-ink);border-color:var(--orange)}.topActions{display:flex;align-items:center;gap:8px}.topActions select{width:auto;margin:0;min-height:34px;padding:5px 8px;font-size:13px}.topActions button{min-height:34px;padding:5px 10px}.topActions .pill{font-size:11px}#typeFilter{max-width:190px;margin:0;font-size:13px}.result{padding:18px;max-width:460px;width:100%}.result .cardTitle{margin-bottom:12px}.result h2{font-size:16px}.result input:not([type=checkbox]),.result select{font-size:14px;min-height:34px;padding:6px 9px;margin:5px 0 10px}.result #reading{font-size:22px;letter-spacing:1px}.result #serial{font-size:16px;letter-spacing:.5px}.result .check{margin:12px 0;font-size:11px}.result .match{margin:4px 0 10px}.result button{min-height:34px;padding:7px 10px;font-size:13px}.result details{margin-top:12px}.result p:empty{display:none}.toolbar{flex-wrap:wrap}.toolbar select{width:auto}.sidebar .stats b{background:var(--selected)}
@media(max-width:760px){header{padding:0 12px}.topActions .pill{display:none}.brand{gap:6px;font-size:15px}.brand .product{font-size:10px}.topActions{gap:5px}.topActions select{max-width:96px}.result{max-width:none}.addGrid{grid-template-columns:1fr 1fr}}

.accountCard{max-width:460px}.accountCard form{display:grid;gap:8px}.accountCard h2{margin-bottom:16px}.accountBanner,.syncControls{display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin-bottom:16px;padding:10px 14px;border:1px solid var(--border);border-radius:8px;background:var(--selected);color:var(--selected-ink)}.syncControls{background:var(--surface);color:var(--muted);font-size:12px}.syncControls button{font-size:12px;min-height:30px;padding:5px 9px}.accountBanner button{margin-left:auto}.accountCard button{margin:6px 0}#userForm .check input{width:18px}#auditRows{max-height:320px;overflow:auto}#userRows button{min-height:30px;padding:5px 8px;font-size:12px}@media(max-width:760px){.topActions #accountButton{max-width:80px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.brand .product{display:none}.topActions select{max-width:80px}.accountBanner button{margin:0}}

/* Hide workspaces until the account database is ready. */
body.auth-locked .sidebar,body.auth-locked #menuToggle,body.auth-locked #accountButton,body.auth-locked #connection,body.auth-locked #syncControls,body.auth-locked #impersonation{display:none!important}
body.auth-locked .appLayout{display:block}
body.auth-locked main{margin:0;width:100%;min-width:0}
body.auth-locked .tab{display:none!important}
body.auth-locked #account{display:block!important;max-width:440px;margin:32px auto}
body.auth-locked #account .sectionHeading{display:none}
body.auth-locked .accountCard{max-width:none}
@media(max-width:760px){
 .menuToggle{position:sticky;top:66px;z-index:25;margin:0;width:100%;border-radius:0;background:var(--surface)}
 .addGrid{grid-template-columns:1fr}
 .addGrid button{grid-column:1;width:100%}
 .result input:not([type=checkbox]),.result select{font-size:16px}
 #registerMeter,#cancelOCR{width:100%;margin:8px 0}
}

@media(max-width:760px){
 .scanGrid,.card,.result,main#content{min-width:0}
 .topActions{min-width:0}
 #stage{min-height:180px}
 #stage canvas,#stage video{max-height:280px}
 .sidebar{top:106px}
}
@media(max-width:360px){header{padding:0 8px;gap:6px}.brand{font-size:12px;letter-spacing:0}.mark{width:26px;height:30px;font-size:20px}.topActions select{max-width:72px}.topActions button{padding:5px 6px}.topActions #accountButton{max-width:65px}}

#photoAttachment{margin:12px 0;font-size:12px}#attachedPhoto{display:block;max-width:100%;width:120px;height:90px;object-fit:contain;border:1px solid var(--border);border-radius:5px}
