:root{--bg:#eef1f4;--card:#fbfcfd;--ink:#1d2327;--mute:#8a949b;--slate:#4f6f7d;--slate2:#45626f;--pill:#e3eaec;--pillInk:#2f4954;--seg:#e1e5e9;--line:#e8ecef;--warn:#b5523b}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{height:100%;margin:0;overflow:hidden;overscroll-behavior:none}
body{font:16px/1.3 -apple-system,BlinkMacSystemFont,"SF Pro Text",system-ui,sans-serif;background:var(--bg);color:var(--ink)}
button,input,select{font:inherit;color:inherit}button{cursor:pointer;border:0;background:none;padding:0}
svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round;flex:none}
.screen{position:fixed;inset:0;display:flex;flex-direction:column;padding:env(safe-area-inset-top) calc(env(safe-area-inset-right) + 22px) 0 calc(env(safe-area-inset-left) + 22px)}
.screen[hidden]{display:none}
.fixed{flex:none}
.scroll{flex:1;overflow-y:auto;-webkit-overflow-scrolling:touch;margin:0 -22px;padding:4px 22px calc(env(safe-area-inset-bottom) + 24px)}
.topbar{display:flex;justify-content:space-between;align-items:center;min-height:56px;padding-top:6px}
.topbar .gear{margin-left:auto}
.gear{width:48px;height:48px;border-radius:50%;background:var(--card);box-shadow:0 1px 3px rgba(30,50,60,.12),0 0 0 1px rgba(30,50,60,.04);display:grid;place-items:center;color:var(--slate)}
.gear svg{width:26px;height:26px}
.back{display:flex;align-items:center;gap:2px;color:var(--slate);font-weight:600;font-size:17px;margin-left:-6px;padding:8px 0}
h1{font-size:34px;font-weight:800;letter-spacing:-.5px;margin:6px 0 4px}
h2{font-size:22px;margin:0 0 4px}
.serif,.name{font-family:"New York","Iowan Old Style",Georgia,"Times New Roman",serif;font-weight:500}
.stats{font:12px/1.4 ui-monospace,"SF Mono",Menlo,monospace;text-transform:uppercase;letter-spacing:1.6px;color:var(--mute);margin:0 0 18px}
.eyebrow{font-size:12px;text-transform:uppercase;letter-spacing:1.5px;color:var(--mute);font-weight:500;margin:0 0 10px}
.primary{display:flex;align-items:center;justify-content:center;gap:10px;background:var(--slate);color:#fff;border-radius:16px;height:60px;font-size:20px;font-weight:600;width:100%;box-shadow:0 1px 2px rgba(30,50,60,.15)}
.primary:active{background:var(--slate2)}.primary svg{width:24px;height:24px}.primary .caret{width:18px;height:18px;opacity:.8;margin-left:-4px}
.duo{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin-bottom:16px}
.menuwrap{position:relative}
.menu{position:absolute;left:0;top:66px;z-index:5;background:var(--card);border-radius:16px;box-shadow:0 8px 30px rgba(30,50,60,.18);padding:8px;min-width:100%;display:grid;gap:6px}
.menu[hidden]{display:none}
.card{background:var(--card);border-radius:18px;padding:16px;margin-bottom:14px;box-shadow:0 0 0 1px rgba(30,50,60,.03)}
.pill{display:flex;align-items:center;gap:10px;background:var(--pill);color:var(--pillInk);border-radius:14px;height:50px;padding:0 14px;font-size:16px;font-weight:500;width:100%}
.pill:active{background:#d6e0e3}.pill:disabled{opacity:.38}.pill.wide{margin-bottom:10px}
.menu button{display:flex;align-items:center;gap:10px;background:var(--pill);color:var(--pillInk);border-radius:12px;height:48px;padding:0 14px;font-weight:500;white-space:nowrap}
.trio{display:grid;grid-template-columns:1fr 1fr 1.4fr;gap:8px}.trio .pill{justify-content:center;padding:0 8px;gap:6px}
.seg{display:flex;background:var(--seg);border-radius:12px;padding:3px;margin-bottom:16px}
.seg button{flex:1;height:34px;border-radius:9px;font-size:15px;font-weight:500;color:#3b444a}
.seg button.on{background:#fff;box-shadow:0 1px 3px rgba(0,0,0,.12);font-weight:600;color:var(--ink)}
.sechead{display:flex;justify-content:space-between;align-items:baseline;margin:6px 0 10px}.sechead .eyebrow{margin:0}.sechead span{color:var(--mute);font-size:14px}
.rows{background:var(--card);border-radius:18px;padding:6px 16px;margin-bottom:16px}
.r{display:flex;align-items:center;gap:14px;padding:11px 0;border-bottom:1px solid var(--line)}.r:last-child{border:0}
.ic{width:42px;height:42px;border-radius:50%;background:var(--pill);color:var(--slate);display:grid;place-items:center;flex:none}
.ic svg{width:21px;height:21px}
.r .t{flex:1;min-width:0}.name{font-size:19px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.sub{font-style:italic;color:var(--mute);font-size:15px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.r .when{color:var(--mute);font-size:16px;text-align:right;white-space:nowrap}.r .when.due{color:var(--warn)}
.chev{color:#b8bfc4;width:16px;height:16px}
.empty{color:var(--mute);text-align:center;padding:28px 0;font-style:italic;font-family:Georgia,serif}
.hint{color:var(--mute);font-size:14px;margin:8px 0 0}
.camwrap{position:relative;background:#1d2327;border-radius:20px;overflow:hidden;aspect-ratio:4/3;width:100%;flex:none}
#cam{width:100%;height:100%;object-fit:cover;display:block}
.frame{position:absolute;left:10%;top:30%;width:80%;height:40%;border:2.5px solid rgba(255,255,255,.85);border-radius:14px;box-shadow:0 0 0 999px rgba(0,0,0,.28);transition:border-color .15s,box-shadow .15s}
.frame.hit{border-color:#5fd08a;box-shadow:0 0 0 999px rgba(0,0,0,.28),0 0 0 4px rgba(95,208,138,.55)}
.camhint{position:absolute;inset:auto 0 12px;z-index:1;text-align:center;color:#cfd8dc;font-size:14px}
.manual{display:flex;gap:10px;margin:14px 0}
.manual input,.field input,.field select,.row input{flex:1;height:50px;border:1px solid var(--line);background:var(--card);border-radius:14px;padding:0 14px;font-size:17px;min-width:0}
.manual .pill{width:auto;padding:0 22px;justify-content:center}
.ghost{height:50px;width:100%;border-radius:14px;color:var(--slate);font-weight:600;font-size:17px;background:var(--card)}
.prodhead{display:flex;gap:14px;align-items:center;margin:4px 0 16px}
.prodhead img,.prodhead .ic{width:64px;height:64px;border-radius:16px;object-fit:cover;background:#fff}
.prodhead .name{font-size:24px;white-space:normal}
.counts{display:flex;gap:8px;margin-top:6px}.counts span{font:12px ui-monospace,Menlo,monospace;letter-spacing:1px;text-transform:uppercase;color:var(--mute)}
.field{display:block;margin-bottom:12px}.field>span{display:block;font-size:13px;color:var(--mute);margin-bottom:6px}.field input,.field select{width:100%}
.row{display:flex;align-items:center;gap:10px;flex-wrap:wrap}.row input{flex:none;width:70px;text-align:center}
.two{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.toast{position:fixed;left:50%;top:50%;transform:translate(-50%,-50%);background:rgba(29,35,39,.88);color:#fff;padding:16px 26px;border-radius:16px;font-size:18px;font-weight:500;z-index:20;max-width:80vw;text-align:center;backdrop-filter:blur(8px);-webkit-backdrop-filter:blur(8px)}
.toast[hidden]{display:none}
.sheet{position:fixed;inset:0;background:rgba(238,241,244,.92);display:grid;place-items:center;padding:24px;z-index:15}.sheet[hidden]{display:none}.sheet .card{width:100%;max-width:380px;padding:22px}.sheet h2{margin-bottom:18px}

.r[data-id]{cursor:pointer}.r[data-id]:active{opacity:.6}
.detail{padding:0}.detail .scroll{margin:0;padding:0 0 calc(env(safe-area-inset-bottom) + 28px)}
.roundback{position:absolute;top:calc(env(safe-area-inset-top) + 10px);left:calc(env(safe-area-inset-left) + 20px);width:48px;height:48px;border-radius:50%;background:rgba(251,252,253,.96);box-shadow:0 1px 4px rgba(30,50,60,.18);display:grid;place-items:center;color:var(--ink);z-index:3}
.roundback svg{width:26px;height:26px;stroke-width:2}
.hero{position:relative;margin-top:calc(env(safe-area-inset-top) + 68px);height:300px;background:#fff;overflow:hidden}
.hero img{width:100%;height:100%;object-fit:cover;object-position:center 35%}
.hero::after{content:"";position:absolute;inset:auto 0 0 0;height:55%;background:linear-gradient(to top,rgba(0,0,0,.62),rgba(0,0,0,.25) 55%,transparent)}
.hero.noimg{background:linear-gradient(160deg,#6d8b98,#4f6f7d)}.hero.noimg::after{display:none}
.heroic{position:absolute;inset:0;display:grid;place-items:center;color:rgba(255,255,255,.5)}.heroic svg{width:90px;height:90px;stroke-width:1.2}
.herotxt{position:absolute;left:22px;right:22px;bottom:16px;z-index:1;color:#fff;text-shadow:0 1px 8px rgba(0,0,0,.35)}
.herotxt .name{font-size:30px;white-space:normal;line-height:1.1}.herotxt .sub{color:rgba(255,255,255,.88);font-family:Georgia,serif;font-size:16px;margin-top:4px}
.dpad{padding:6px 22px 0}
.eyebrow.sect{font-size:15px;letter-spacing:.3px;text-transform:none;font-weight:600;color:var(--mute);margin:18px 2px 8px}
.detail .card{margin-bottom:0;font-size:17px;line-height:1.45;padding:16px 18px;border-radius:20px}
.card.prose{font-size:16px;line-height:1.55}.muted{color:var(--mute)}
.card.stock{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.stk{display:flex;flex-direction:column;gap:2px}.stk b{font-size:12px;text-transform:uppercase;letter-spacing:1.4px;color:var(--mute);font-weight:500}.stk .big{font-size:28px;font-weight:700}.stk .muted{font-size:14px}
.ns{display:flex;gap:4px;align-items:center}.ns.none{color:var(--mute);font-style:italic}
.ns .g{width:40px;height:40px;display:grid;place-items:center;color:#fff;font-weight:800;font-size:18px;border-radius:8px;opacity:.35}
.ns .g.on{opacity:1;width:52px;height:52px;font-size:26px;border-radius:12px;box-shadow:0 0 0 3px #fff,0 2px 6px rgba(0,0,0,.25)}
.gA{background:#038141}.gB{background:#85bb2f}.gC{background:#fecb02;color:#333!important}.gD{background:#ee8100}.gE{background:#e63e11}
.credit{text-align:center;margin-top:18px}.credit a{color:var(--slate)}

.dmy{display:grid;grid-template-columns:1fr 1.25fr 1.25fr;gap:10px;margin-bottom:6px}
.dmy label>span{display:block;font-size:12px;text-transform:uppercase;letter-spacing:1.4px;color:var(--mute);margin:0 0 6px 2px}
.dmy select{width:100%;height:54px;border:0;border-radius:14px;background:var(--pill);color:var(--pillInk);font-size:19px;font-weight:600;text-align:center;text-align-last:center;-webkit-appearance:none;appearance:none;padding:0 8px}
.datepreview{margin:4px 2px 14px;font-variant-numeric:tabular-nums}

#viewList .r{-webkit-user-select:none;user-select:none;-webkit-touch-callout:none;transition:transform .15s,background .15s;border-radius:12px}
#viewList .r.pressing{transform:scale(.97);background:var(--pill)}
.danger{display:block;width:100%;height:50px;margin-top:22px;border-radius:14px;background:#fbe9e7;color:#b3261e;font-weight:600;font-size:16px}
.danger:active{background:#f5d3cf}
#editBody .field input{width:100%}#editBody .seg{margin-top:4px}
.row.tg{margin-top:12px;color:var(--mute);font-size:15px}

.titlerow{display:flex;align-items:center;justify-content:space-between;gap:12px}.titlerow h1{margin-bottom:0}
.savepill{display:inline-flex;align-items:center;gap:6px;height:40px;padding:0 18px;border-radius:20px;background:var(--pill);color:var(--pillInk);font-size:16px;font-weight:600;flex:none}
.savepill svg{width:18px;height:18px}.savepill:active{background:#d6e0e3}
.r .l2{display:flex;align-items:baseline;gap:10px;margin-top:2px}.r .l2 .sub{flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.r .l2 .when{flex:none;margin-left:auto}
.r .l2 .sub:empty+.when{margin-left:0}

.stp{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-top:12px}
.stp .lbl{font-size:16px;color:var(--ink,inherit)}
.stp .ctl{display:flex;align-items:center;background:var(--pill);border-radius:24px;padding:3px}
.stp .sb{width:48px;height:44px;border-radius:22px;font-size:26px;line-height:1;color:var(--pillInk);font-weight:500;touch-action:manipulation}
.stp .sb:active{background:#d6e0e3}.stp .sb:disabled{opacity:.3}
.stp output{min-width:40px;text-align:center;font-size:19px;font-weight:600;color:var(--pillInk)}
.tgh{margin:14px 0 0}

.titlerow{align-items:flex-start}.pillstack{display:grid;gap:8px;flex:none}.pillstack .savepill{justify-content:center;min-width:132px}
.savepill.disc{background:#fbe9e7;color:#b3261e}.savepill.disc:active{background:#f5d3cf}.savepill:disabled{opacity:.5}
.stickybar{position:sticky;bottom:0;bottom:calc(-24px - env(safe-area-inset-bottom));margin:18px -22px 0;padding:14px 22px calc(14px + env(safe-area-inset-bottom));background:linear-gradient(to bottom,rgba(238,241,244,0),var(--bg) 18%);display:grid;gap:8px}
.stickybar .ghost{margin:0}

.leftcard{display:flex;align-items:center;gap:18px}.leftbig{flex:none;width:64px;height:64px;border-radius:50%;background:var(--pill);color:var(--slate);display:grid;place-items:center}
.leftctl{flex:1;min-width:0}.lefttxt{font-size:16px;color:var(--mute);margin-bottom:10px}.lefttxt b{color:var(--ink);font-size:19px}
#eLeft{-webkit-appearance:none;appearance:none;width:100%;height:10px;border-radius:5px;background:linear-gradient(to right,var(--slate) var(--p,100%),var(--pill) var(--p,100%));outline:none}
#eLeft::-webkit-slider-thumb{-webkit-appearance:none;width:30px;height:30px;border-radius:50%;background:#fff;box-shadow:0 2px 8px rgba(30,50,60,.25);border:0}
#eLeft::-moz-range-thumb{width:30px;height:30px;border-radius:50%;background:#fff;box-shadow:0 2px 8px rgba(30,50,60,.25);border:0}
.ic .bottle{display:block}
.ic svg.bottle{width:21px;height:28px}.leftbig svg.bottle{width:36px;height:48px}
.pill:disabled,.trio .pill:disabled{opacity:1;background:transparent;color:#c9d0d4;box-shadow:inset 0 0 0 1.5px #e6eaed;pointer-events:none;cursor:default}.pill:disabled svg{opacity:.6}

#home .scroll{flex:1;min-height:0;overflow-y:auto}
.dock{flex:none;padding:12px 0 calc(12px + env(safe-area-inset-bottom))}
#listSeg button{font-size:14px}
.sortbtn{display:flex;align-items:center;gap:4px;font-size:13px;font-weight:600;color:var(--slate);background:var(--seg);border-radius:999px;padding:5px 10px}.sortbtn svg{width:12px;height:12px}
#home .sechead{align-items:center}
.pillstack [hidden]{display:none}
.r .qty{flex:none;width:28px;margin:0 -8px 0 -2px;font-size:16px;font-weight:600;color:var(--slate);font-variant-numeric:tabular-nums}
.ohead{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:10px}.ohead .eyebrow{margin:0;min-width:0}
.qctl{flex:none;display:flex;align-items:center;background:var(--pill);border-radius:20px;padding:2px}.qctl .sb{width:36px;height:32px;border-radius:16px;font-size:21px;line-height:1;color:var(--pillInk);touch-action:manipulation}.qctl .sb:active{background:#d6e0e3}.qctl .sb:disabled{opacity:.3}.qctl output{min-width:24px;text-align:center;font-size:16px;font-weight:600;color:var(--pillInk);font-variant-numeric:tabular-nums}
.stackpos{opacity:.7;font-weight:400}
.savepill.add{background:#e3efe6;color:#2e6b45}.savepill.add:active{background:#cfe3d5}
.pillstack{gap:6px}.pillstack .savepill{height:38px}
.acnt{display:flex;align-items:center;justify-content:space-between;gap:12px;margin:12px 0}.acnt .lbl{font-size:16px}.acnt .ctl{display:flex;align-items:center;background:var(--pill);border-radius:24px;padding:3px}.acnt output{min-width:40px;text-align:center;font-size:19px;font-weight:600;color:var(--pillInk)}.acnt .ab{width:48px;height:44px;border-radius:22px;font-size:26px;line-height:1;color:var(--pillInk);font-weight:500;touch-action:manipulation}.acnt .ab:disabled{opacity:.3}
.sheetbtns{display:grid;gap:10px;margin-top:18px}#addSheet .seg{margin-bottom:6px}
.actgrid{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;margin:14px 0 4px}.actgrid [hidden]{display:none}
.actgrid .savepill{justify-content:center;padding:0 8px;height:40px;min-width:0;font-size:15px;gap:5px}.actgrid .savepill svg{width:16px;height:16px}
.actgrid{grid-template-columns:repeat(2,1fr);gap:10px}.actgrid .savepill{height:52px;font-size:17px;border-radius:16px;gap:8px}.actgrid .savepill svg{width:20px;height:20px}
.namefield{margin-bottom:0}
.stk .big small{font-size:16px;font-weight:500;color:var(--mute)}
.stk .stp{flex-direction:column;align-items:stretch;gap:4px;margin-top:10px}.stk .stp .lbl{font-size:12px;text-transform:uppercase;letter-spacing:1.4px;color:var(--mute)}.stk .stp .ctl{justify-content:space-between}.stk .stp .sb{width:44px;height:40px}
.tgthint{margin:6px 4px 0}.linkbtn{width:100%;margin-top:14px}
/* v40: compact Edit page so it fits a phone screen without scrolling */
#edit{padding-left:calc(env(safe-area-inset-left) + 16px);padding-right:calc(env(safe-area-inset-right) + 16px)}
#edit .scroll{margin:0 -16px;padding:0 16px calc(env(safe-area-inset-bottom) + 8px)}
#edit .topbar{min-height:44px;padding-top:2px}#edit h1{font-size:30px;margin:0 0 2px}
#edit .actgrid{gap:8px;margin:8px 0 2px}#edit .actgrid .savepill{height:46px}
#edit .stats{margin:6px 2px 4px}#edit .eyebrow.sect{margin:10px 2px 6px}
#edit .card{padding:10px 12px;margin-bottom:0;border-radius:16px}#edit .field input{height:46px}
#edit .leftbig{width:48px;height:48px}#edit .leftcard{gap:14px}
#edit .dmy{gap:8px;margin-bottom:0}#edit .dmy label>span{margin-bottom:4px}#edit .dmy select{height:46px}#edit .datepreview{margin:4px 2px 0}
#edit .stickybar{margin:8px -16px 0;padding:8px 16px calc(8px + env(safe-area-inset-bottom));gap:6px;bottom:calc(-8px - env(safe-area-inset-bottom))}#edit .stickybar .primary{height:52px}#edit .stickybar .ghost{height:44px}
#edit .topbar{min-height:40px}#edit h1{font-size:28px}#edit .actgrid .savepill{height:44px}#edit .eyebrow.sect{margin:8px 2px 4px}#edit .stats{margin:4px 2px 0}
#edit .leftbig{width:44px;height:44px}#edit .stickybar{padding-top:6px;gap:6px}
#edit .leftcard{padding-top:6px;padding-bottom:6px}#edit .lefttxt{margin-bottom:2px}#edit .scroll{padding-bottom:env(safe-area-inset-bottom)}#edit .stickybar{bottom:calc(0px - env(safe-area-inset-bottom))}
#edit .leftbig{width:46px;height:46px}
#edit .leftbig svg.bottle{width:26px;height:34px}
.pname{font-size:21px;font-weight:700;line-height:1.2;margin:6px 2px 0;color:var(--ink,#1f2a30)}
.namecard{padding:10px 12px}.namecard input{width:100%;height:48px;border:1px solid var(--line);background:var(--card);border-radius:14px;padding:0 14px;font-size:17px}
/* v42: relax Edit page spacing (still no scroll at 390x664) */
#edit .topbar{min-height:44px}#edit h1{font-size:30px;margin:0 0 4px}
#edit .actgrid{gap:10px;margin:10px 0 4px}#edit .actgrid .savepill{height:48px}
#edit .stats{margin:8px 2px 0}#edit .pname{margin:8px 2px 2px}#edit .eyebrow.sect{margin:12px 2px 6px}
#edit .card{padding:12px 14px}#edit .leftcard{padding-top:10px;padding-bottom:10px}
#edit .leftbig{width:54px;height:54px}#edit .leftbig svg.bottle{width:28px;height:37px}
#edit .stickybar{margin-top:10px;padding-top:10px;gap:8px}
.cathead{font-size:12px;text-transform:uppercase;letter-spacing:1.2px;color:var(--mute);font-weight:600;margin:14px 4px 6px}.cathead:first-of-type{margin-top:4px}
#login .scroll{padding-top:12vh}.loginh{font-size:40px;margin:0 2px 6px}.loginbox{display:grid;gap:12px;padding:18px 16px}.loginlab{font-size:14px;color:var(--mute)}#loginPass{font-size:18px;padding:12px 14px;border-radius:12px;border:1px solid #d5dbe0;background:#fff;width:100%;box-sizing:border-box}#loginBtn{justify-content:center;height:48px}.loginerr{color:#b3261e;margin:0;min-height:1.2em;font-size:14px}.loginnote{color:var(--mute);font-size:14px;margin:4px 4px}
#loginPass{font-size:28px;letter-spacing:10px;text-align:center}
/* Back-to-top (Woven): appears once a list has scrolled more than its own height */
.totop{position:sticky;top:0;height:0;z-index:5;display:flex;justify-content:center;pointer-events:none}
.totop button{pointer-events:auto;margin-top:10px;width:44px;height:44px;border-radius:50%;border:1px solid var(--line);background:rgba(251,252,253,.94);color:var(--ink);box-shadow:0 2px 10px rgba(29,35,39,.12);display:grid;place-items:center;padding:0;opacity:0;transform:translateY(-6px) scale(.9);transition:opacity .2s,transform .2s;-webkit-tap-highlight-color:transparent;-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px)}
.totop.on button{opacity:1;transform:none}.totop:not(.on) button{pointer-events:none}
