/* Food scanner: isolated tokens keep camera, product and label screens consistent. */
dialog.food-scan{--scan-ink:#063d48;--scan-muted:#57737a;--scan-lime:#b9f578;color:var(--scan-ink);background:#f7faf9;border:0;border-radius:30px;padding:0;width:min(100% - 32px,540px);max-width:540px;max-height:92dvh;box-shadow:0 32px 120px #002e4550;overflow:auto;overscroll-behavior:contain;color-scheme:light}
dialog.food-scan::backdrop{background:#001f2ccb;backdrop-filter:blur(7px)}
.food-scan *{box-sizing:border-box}.food-scan [hidden]{display:none!important}.food-scan button{font-family:inherit;cursor:pointer}.food-scan button:disabled{opacity:.55;cursor:default}.food-scan button:focus-visible,.food-scan input:focus-visible,.food-scan select:focus-visible{outline:3px solid #087f89;outline-offset:3px}.food-scan h2:focus{outline:none}
.food-scan .scan-header{display:flex;align-items:center;justify-content:space-between;gap:16px;position:sticky;top:0;z-index:4;padding:14px 20px;background:#f7faf9f5;border-bottom:1px solid #063d4810;backdrop-filter:blur(12px);color:#063d48;font-size:14px;font-weight:650}
.food-scan .scan-header button{display:grid;place-items:center;width:42px;height:42px;padding:0;border:1px solid #063d4816;border-radius:50%;font-size:23px;line-height:1;background:transparent;color:#063d48;box-shadow:none}
.food-scan .scan-content{padding:20px 24px 0}.food-scan h2{font-size:29px;line-height:1.13;letter-spacing:-1px;margin:8px 0 14px;color:#063d48;font-weight:750}.food-scan h3{font-size:17px;margin:0;color:#063d48}.food-scan p{font-size:14px;line-height:1.55;color:#57737a}.food-scan svg{width:24px;height:24px;flex-shrink:0}.food-scan .scan-kicker{font-size:11px;letter-spacing:1.2px;text-transform:uppercase;font-weight:700;margin:0 0 10px;color:#087f89}
.food-scan .scan-hero{position:relative;isolation:isolate;background:radial-gradient(ellipse at 90% 0,#146b6e,transparent 75%),#063d48;border-radius:24px;padding:22px 24px 24px;color:#fff;margin-bottom:24px;overflow:hidden}.food-scan .scan-hero h2{color:#fff;font-size:31px;margin:12px 0}.food-scan .scan-hero p{color:#c5e1e1;margin-bottom:22px;max-width:280px}.food-scan .scan-hero .scan-kicker{color:#b9f578;font-size:10px;margin:0}.scan-art{height:118px;position:relative;display:grid;place-items:center;margin-bottom:12px}.scan-pack{background:linear-gradient(155deg,#f6fff7,#b9e2d3);border-radius:10px;width:79px;height:100px;transform:rotate(-10deg);display:flex;flex-direction:column;justify-content:space-evenly;align-items:center;box-shadow:12px 14px 30px #001c3045;color:#063d48}.scan-pack span{font-size:14px;letter-spacing:-.6px;font-weight:800}.food-scan .scan-pack svg{width:49px;height:49px}.scan-art:before{content:'';position:absolute;width:156px;height:104px;border:1px solid #b9f57575;border-radius:20px}.scan-art i{position:absolute;width:176px;height:2px;top:58px;background:#b9f578;box-shadow:0 0 20px #b9f57890;animation:scan-sweep 3s ease-in-out infinite}
.food-scan .scan-primary,.food-scan .scan-secondary{display:flex;align-items:center;justify-content:center;gap:10px;width:100%;min-height:54px;padding:14px 17px;border:0;border-radius:16px;background:#b9f578;color:#063d48;font-size:15px;font-weight:750;box-shadow:none;line-height:1.3}.food-scan .scan-primary:hover{background:#c9ff92}.food-scan .scan-secondary{background:#e9f1ef}.food-scan .scan-primary span{margin-left:auto;white-space:nowrap;font-size:13px}
.food-scan form{margin:0}.food-scan label{display:flex;flex-direction:column;gap:8px;margin:0 0 17px;color:#365c64;font-size:13px;font-weight:600}.food-scan label>span{display:inline;font-size:11px;font-weight:400;color:#6f888a;margin-top:-5px}.food-scan input,.food-scan select{background:#fff;border:1px solid #dce6e2;border-radius:13px;padding:13px 14px;min-height:49px;color:#063d48;font-size:16px;font-family:inherit;width:100%;min-width:0;box-shadow:none}.food-scan select{padding-right:24px}.food-scan .scan-code-row{display:flex;gap:8px;margin-top:-8px;margin-bottom:24px}.scan-code-row button{flex:0 0 50px;border:0;border-radius:13px;background:#063d48;color:#b9f578;font-size:24px}.scan-section-title{display:flex;justify-content:space-between;align-items:center;margin:28px 0 9px}.scan-section-title>span{font-size:11px;color:#57737a}.food-scan .scan-recent>button{display:flex;align-items:center;gap:13px;width:100%;text-align:left;background:transparent;border:0;border-bottom:1px solid #dfe9e5;padding:13px 0;color:#063d48;border-radius:0;box-shadow:none}.scan-recent>button>span:nth-child(2){display:flex;flex-direction:column;gap:4px;min-width:0;flex:1}.scan-recent strong{font-size:14px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.scan-recent small{font-size:12px;color:#57737a}.scan-recent b{font-weight:400;font-size:20px}
.food-scan .scan-footnote{font-size:12px;line-height:1.6;color:#667f83;margin:20px 0 24px}.food-scan a{color:#087f89;text-underline-offset:3px}.food-scan .scan-error,.food-scan .scan-notice{background:#fff3de;color:#794f16;padding:14px 16px;border-radius:14px;font-size:13px;margin:15px 0 22px}.scan-loading{display:flex;flex-direction:column;align-items:center;text-align:center;padding:64px 10px 80px;gap:14px}.food-scan .scan-loading>svg{width:60px;height:60px;color:#087f89}.scan-loading h2{margin-bottom:0}.scan-loading p{margin:0 0 20px}.scan-spinner{width:26px;height:26px;border:2px solid #dce6e2;border-top-color:#087f89;border-radius:50%;animation:scan-spin 1s linear infinite}.scan-camera{position:relative;aspect-ratio:1/1.05;background:#063d48;border-radius:22px;overflow:hidden;margin:22px 0}.scan-camera video{width:100%;height:100%;object-fit:cover}.scan-target{position:absolute;inset:30% 8%;border:2px solid #b9f578;border-radius:18px;box-shadow:0 0 0 150px #00192260;pointer-events:none}
.scan-product-heading{display:flex;align-items:center;gap:20px;margin:8px 0 22px}.scan-product-heading>div{min-width:0}.food-scan .scan-product-heading h2{font-size:27px;overflow-wrap:anywhere;margin:5px 0 9px}.scan-product-heading>div>span{font-size:11px;letter-spacing:1px;color:#6f898c}.food-scan .scan-product-heading .scan-kicker{font-size:10px;margin-bottom:6px}.scan-thumb{width:46px;height:55px;border-radius:10px;background:#e8f0eb;display:grid;place-items:center;flex-shrink:0;overflow:hidden;padding:5px}.scan-thumb img{width:100%;height:100%;object-fit:contain}.scan-product-heading .scan-thumb{width:86px;height:102px;border-radius:17px;padding:10px}.scan-baseline{display:flex;justify-content:space-between;gap:8px;align-items:center;padding:13px 0 22px;border-bottom:1px solid #dfe9e5;margin-bottom:24px;font-size:12px;color:#57737a}.food-scan .scan-baseline button{padding:8px 0;background:transparent;border:0;color:#087f89;font-size:12px;min-height:40px;text-decoration:underline;text-underline-offset:4px}.food-scan .scan-amount-label{text-align:center;color:#063d48;margin-bottom:12px;font-size:15px}
.scan-quantity{display:flex;align-items:center;justify-content:center;gap:18px}.food-scan .scan-quantity button{width:46px;height:46px;flex-shrink:0;border:1px solid #dce6e2;border-radius:50%;background:#fff;color:#063d48;font-size:23px;padding:0}.scan-quantity>div{display:flex;flex-direction:column;align-items:center;max-width:170px}.food-scan .scan-quantity input{background:transparent;border:0;border-radius:0;text-align:center;font-size:49px;font-weight:750;letter-spacing:-2px;padding:0;line-height:1.2;min-height:60px;appearance:textfield}.scan-quantity input::-webkit-inner-spin-button{appearance:none}.scan-quantity>div>span{font-size:13px;color:#57737a}.scan-shortcuts{display:flex;justify-content:center;flex-wrap:wrap;gap:8px;margin:20px 0 25px}.food-scan .scan-shortcuts button{padding:9px 13px;min-height:40px;background:#e8f0eb;border:0;color:#365c64;border-radius:20px;font-size:12px}
.scan-totals{background:#063d48;border-radius:23px;padding:22px;color:#fff;margin-bottom:24px}.scan-energy{display:flex;justify-content:space-between;align-items:center;gap:12px;padding-bottom:19px;border-bottom:1px solid #ffffff20}.scan-energy>span{font-size:12px;color:#bad2d3}.scan-energy strong{font-size:35px;letter-spacing:-1px;color:#b9f578}.scan-energy small{font-size:13px;font-weight:500;letter-spacing:0}.scan-macros{display:grid;grid-template-columns:repeat(3,1fr);gap:10px;padding-top:19px}.scan-macros>div{display:flex;flex-direction:column;gap:7px}.scan-macros strong{font-size:19px;font-weight:650;letter-spacing:-.5px}.scan-macros span{font-size:10px;color:#c0d9d9}.food-scan .scan-totals p{font-size:11px;color:#9cbbbf;margin:18px 0 0}.scan-log-fields,.scan-label-grid{display:grid;grid-template-columns:1fr 1fr;gap:0 14px}.scan-label-grid label{align-self:end}.food-scan .scan-unit{display:flex;gap:12px;padding:0;margin:5px 0 22px;border:0}.scan-unit legend{font-size:13px;margin-bottom:10px;color:#365c64}.food-scan .scan-unit label{flex:1;flex-direction:row;align-items:center;gap:10px;padding:13px;background:#fff;border:1px solid #dce6e2;border-radius:13px;margin:0;cursor:pointer}.food-scan .scan-unit label:has(:checked){background:#e5f4e0;border-color:#569961}.food-scan .scan-unit input{width:18px;height:18px;min-height:18px;flex:0 0 18px;accent-color:#087f89;margin:0;padding:0;appearance:auto}
.food-scan .scan-bottom{position:sticky;bottom:0;z-index:3;background:linear-gradient(#f7faf900,#f7faf9 13px);padding:20px 0 max(20px,env(safe-area-inset-bottom));margin-top:0}.diary-scan-entry{display:flex;align-items:center;gap:14px;text-align:left;padding:17px 20px;width:100%;border:0;border-radius:18px;background:#063d48;color:#fff;margin:18px 0 23px;box-shadow:none}.diary-scan-entry>svg{width:30px;height:30px;color:#b9f578;flex-shrink:0}.diary-scan-entry>span{flex:1;display:flex;flex-direction:column;gap:3px}.diary-scan-entry strong{font-size:16px}.diary-scan-entry small{font-size:12px;color:#c0dada}.diary-scan-entry>b{font-size:22px;color:#b9f578}.diary-quick-options{display:flex;justify-content:center;gap:10px;flex-wrap:wrap}
@keyframes scan-sweep{0%,100%{transform:translateY(-25px)}50%{transform:translateY(28px)}}@keyframes scan-spin{to{transform:rotate(360deg)}}
@media(max-width:600px){dialog.food-scan{width:100%;max-width:none;height:100%;height:100dvh;max-height:100%;max-height:100dvh;margin:0;border-radius:0}.food-scan .scan-header{padding-top:max(12px,env(safe-area-inset-top));padding-left:20px;padding-right:20px}.food-scan .scan-content{padding:20px 22px 0}.food-scan .scan-hero{padding:20px}.food-scan .scan-hero h2{font-size:30px}.food-scan .scan-product-heading h2{font-size:25px}}
@media(max-width:350px){.food-scan .scan-content{padding:16px 16px 0}.food-scan .scan-hero h2{font-size:27px}.food-scan .scan-product-heading{gap:12px}.scan-product-heading .scan-thumb{width:65px;height:84px}.food-scan .scan-primary{font-size:13px}.food-scan .scan-primary span{font-size:11px}.scan-log-fields{grid-template-columns:1fr}.scan-energy strong{font-size:30px}}
@media(prefers-reduced-motion:reduce){.scan-art i,.scan-spinner{animation:none}}

/* Existing mobile styles use !important globally; these overrides stay inside this dialog. */
html:has(#food-scan-dialog[open]),body:has(#food-scan-dialog[open]){overflow:hidden!important}
dialog#food-scan-dialog[open]{padding:0!important;border:0!important;overflow-x:hidden;box-shadow:0 32px 120px #002e4550!important}
#food-scan-dialog .scan-quantity input{font-size:49px!important;min-height:60px!important;border-radius:0!important}
#food-scan-dialog .scan-unit input{min-height:18px!important;border-radius:50%!important}
@media(max-width:600px){dialog#food-scan-dialog[open]{inset:0!important;margin:0!important;border-radius:0!important;width:100%!important;height:100dvh!important;max-width:none!important;max-height:100dvh!important}}
