:root{
  --bg:#f3f5f4; --card:#fff; --ink:#14201f; --muted:#64716f; --line:#dde3e1;
  --pri:#0f3d3e; --pri-ink:#fff; --acc:#1fa37f; --acc-soft:#e3f6ef;
  --err:#c2362b; --err-soft:#fdecea; --r:14px;
  --safe-b:env(safe-area-inset-bottom,0px);
}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{margin:0;background:var(--bg);color:var(--ink);font:16px/1.4 system-ui,-apple-system,"Segoe UI",Roboto,sans-serif}
.hidden{display:none!important}
h1{margin:.2em 0 0;font-size:1.6rem}
h2{margin:0;font-size:1.05rem}
h3{font-size:.95rem;margin:1em 0 .4em}
.mt{margin-top:1.1rem}
.muted{color:var(--muted)} .small{font-size:.82rem}
.err{color:var(--err);min-height:1.2em}
code,.mono{font-family:ui-monospace,Menlo,Consolas,monospace;font-size:.9rem}

label{display:block;font-size:.8rem;color:var(--muted);margin:.55rem 0 0;font-weight:500}
input,select,textarea{
  display:block;width:100%;margin-top:.25rem;padding:.7rem .75rem;font:inherit;font-size:16px;color:var(--ink);
  background:#fff;border:1px solid var(--line);border-radius:10px;outline:none;
}
input:focus,select:focus,textarea:focus{border-color:var(--acc);box-shadow:0 0 0 3px var(--acc-soft)}
textarea{resize:vertical}
details{margin-top:.6rem}
summary{cursor:pointer;color:var(--pri);font-size:.9rem;padding:.3rem 0}

.row{display:flex;gap:.6rem;align-items:flex-end}
.grow{flex:1;min-width:0}

.btn{appearance:none;border:0;border-radius:11px;padding:.75rem 1rem;font-family:inherit;font-weight:650;font-size:1rem;line-height:1.15;cursor:pointer;min-height:48px}
.btn.primary{background:var(--pri);color:var(--pri-ink)}
.btn.ghost{background:#fff;color:var(--pri);border:1px solid var(--line)}
.btn.danger{background:var(--err-soft);color:var(--err)}
.btn.block{display:block;width:100%;margin-top:.6rem}
.btn:active{transform:scale(.98)}
.btn:disabled{opacity:.5}

.screen{min-height:100dvh}
.login-box{max-width:360px;margin:0 auto;padding:12vh 1.4rem 2rem;text-align:center}
.login-box label{text-align:left}
.login-box .btn{margin-top:1.2rem}

.top{position:sticky;top:0;z-index:5;display:flex;justify-content:space-between;align-items:center;
  padding:.7rem 1rem;background:var(--pri);color:#fff}
.badge{font-size:.7rem;background:#f6c344;color:#3a2a00;padding:.15rem .45rem;border-radius:6px;margin-left:.4rem;font-weight:700;vertical-align:middle}
.badge:empty{display:none}
.dev{display:flex;align-items:center;gap:.45rem;border:1px solid rgba(255,255,255,.3);background:transparent;color:#fff;
  padding:.4rem .7rem;border-radius:20px;font-family:inherit;font-weight:600;font-size:.85rem}
.dev .dot{width:9px;height:9px;border-radius:50%;background:#e2685c}
.dev.on .dot{background:#7fe0c4;box-shadow:0 0 0 3px rgba(127,224,196,.25)}

.view{padding:.8rem .8rem calc(80px + var(--safe-b));max-width:640px;margin:0 auto}
#v-new{padding-bottom:calc(150px + var(--safe-b))}
.card{background:var(--card);border-radius:var(--r);padding:1rem;margin-bottom:.8rem;box-shadow:0 1px 2px rgba(0,0,0,.04)}
.card-h{display:flex;justify-content:space-between;align-items:center;gap:.5rem;margin-bottom:.2rem;flex-wrap:wrap}
select.mini{width:auto;padding:.35rem .5rem;margin:0;font-size:.85rem}

.seg{display:flex;background:var(--bg);border-radius:10px;padding:3px}
.seg button{border:0;background:transparent;padding:.45rem .7rem;border-radius:8px;font-family:inherit;font-weight:600;font-size:.85rem;color:var(--muted)}
.seg button.on{background:#fff;color:var(--pri);box-shadow:0 1px 2px rgba(0,0,0,.1)}
body.pf .pj-only, body.pj .pf-only{display:none}

.line{border:1px solid var(--line);border-radius:12px;padding:.6rem .7rem .7rem;margin-top:.7rem;position:relative}
.line .del{position:absolute;top:.35rem;right:.35rem;border:0;background:transparent;color:var(--muted);font-size:1.3rem;width:36px;height:36px}
.line .grid{display:grid;grid-template-columns:.8fr .95fr 1.2fr 1.05fr;gap:.45rem}
.line .grid label{margin-top:.35rem}
.line .lt{text-align:right;font-weight:700;margin-top:.4rem}
.line input,.line select{padding:.6rem .45rem}
.line select{padding-right:.2rem}

.total-bar{position:fixed;left:0;right:0;bottom:calc(62px + var(--safe-b));z-index:4;display:flex;justify-content:space-between;align-items:center;
  gap:1rem;padding:.7rem 1rem;background:#fff;border-top:1px solid var(--line);box-shadow:0 -4px 14px rgba(0,0,0,.05)}
.tot{font-size:1.35rem;font-weight:800}
.total-bar .btn{min-width:150px}

.tabs{position:fixed;left:0;right:0;bottom:0;z-index:6;display:flex;background:#fff;border-top:1px solid var(--line);padding-bottom:var(--safe-b)}
.tabs button{flex:1;border:0;background:none;padding:.45rem 0 .5rem;color:var(--muted);font-family:inherit;font-weight:600;font-size:.74rem;display:flex;flex-direction:column;align-items:center;gap:2px;height:62px;justify-content:center}
.tabs svg{width:24px;height:24px}
.tabs button.on{color:var(--pri)}

.inv{background:#fff;border-radius:12px;padding:.8rem .9rem;margin-bottom:.5rem;display:flex;justify-content:space-between;gap:.6rem;align-items:center}
.inv .n{font-weight:700}
.inv .s{font-size:.8rem;color:var(--muted)}
.inv .v{text-align:right;font-weight:700;white-space:nowrap}
.tag{display:inline-block;font-size:.68rem;padding:.1rem .4rem;border-radius:5px;background:var(--acc-soft);color:#0d6b52;margin-left:.3rem;font-weight:700}
.tag.x{background:var(--err-soft);color:var(--err)}

.sheet{position:fixed;inset:0;z-index:20;background:rgba(10,20,20,.45);display:flex;align-items:flex-end;justify-content:center}
.sheet-box{background:#fff;width:100%;max-width:560px;border-radius:18px 18px 0 0;padding:1rem 1rem calc(1rem + var(--safe-b));animation:up .2s ease-out}
@keyframes up{from{transform:translateY(40px);opacity:.4}}
.sheet-h{display:flex;justify-content:space-between;align-items:flex-start}
.sh-title{font-size:1.15rem;font-weight:800}
.x{border:0;background:var(--bg);width:38px;height:38px;border-radius:50%;font-size:1.4rem;line-height:1}
.sheet.hist .new-only,.sheet:not(.hist) .hist-only{display:none}

.toast{position:fixed;left:50%;bottom:calc(150px + var(--safe-b));transform:translateX(-50%);z-index:30;max-width:92vw;
  background:#14201f;color:#fff;padding:.7rem 1rem;border-radius:10px;font-size:.9rem;box-shadow:0 6px 20px rgba(0,0,0,.2)}
.toast.bad{background:var(--err)}
.busy{position:fixed;inset:0;z-index:40;background:rgba(255,255,255,.75);display:flex;flex-direction:column;align-items:center;justify-content:center;gap:.8rem;font-weight:600}
.spin{width:38px;height:38px;border:4px solid var(--line);border-top-color:var(--pri);border-radius:50%;animation:sp 1s linear infinite}
@keyframes sp{to{transform:rotate(360deg)}}

.log{background:#0f1716;color:#b8e8d9;font-size:.72rem;padding:.6rem;border-radius:8px;max-height:240px;overflow:auto;white-space:pre-wrap;word-break:break-all;margin-top:.6rem}
.taxrow{display:flex;align-items:center;gap:.6rem;margin-top:.4rem}
.taxrow span{width:60px;font-weight:600}
.taxrow input{margin:0}
.spacer{height:1px}
.sheet-actions .row .btn{font-size:.92rem;padding:.75rem .5rem}
.toast{white-space:pre-line}

/* ---- produse predefinite (butelii) ---- */
.tile{border:1.5px solid var(--line);border-radius:14px;padding:.75rem .8rem;margin-top:.7rem;transition:border-color .15s,background .15s}
.tile.on{border-color:var(--acc);background:#f6fcfa}
.t-name{font-weight:650;line-height:1.35}
.t-kg{display:inline-block;width:4.2em;margin:0 .2em;padding:.3rem .4rem;text-align:center;font-weight:700}
.t-row{display:flex;align-items:flex-end;gap:.7rem;margin-top:.4rem}
.t-price{flex:1;margin:0}
.t-price input{padding:.6rem .6rem}
.stepper{display:flex;align-items:center;border:1px solid var(--line);border-radius:12px;overflow:hidden;background:#fff}
.stepper button{width:48px;height:48px;border:0;background:var(--bg);font-size:1.5rem;font-weight:700;color:var(--pri)}
.stepper button:active{background:var(--acc-soft)}
.stepper input{width:52px;margin:0;border:0;border-radius:0;text-align:center;font-size:1.2rem;font-weight:800;padding:.4rem 0}
.tile.on .stepper input{color:var(--acc)}
.t-sub{margin-top:.35rem}
.mini-btn{min-height:34px;padding:.35rem .7rem;font-size:.82rem}

.chips{display:flex;flex-wrap:wrap;gap:.4rem;margin-top:.45rem}
.chip{border:1px solid var(--line);background:#fff;border-radius:20px;padding:.35rem .8rem;font-family:inherit;font-weight:700;font-size:.9rem;color:var(--pri)}
.chip:active{background:var(--acc-soft)}
.t-kg{width:4.6em;text-transform:uppercase}
.tile{position:relative}
.t-del{top:.2rem;right:.2rem}
.t-more{display:block;margin-top:.5rem;border:0;background:none;color:var(--acc);font-family:inherit;font-weight:700;font-size:.9rem;padding:.3rem 0}
#pmode button{padding:.35rem .55rem;font-size:.78rem}
.tile .t-del{position:absolute;top:.3rem;right:.3rem;border:0;background:transparent;color:var(--muted);font-size:1.4rem;width:38px;height:38px;line-height:1}
.tile .t-name{padding-right:30px}

.emit-box{display:flex;flex-direction:column;align-items:stretch;gap:.35rem}
.ch-toggle{display:flex;align-items:center;justify-content:center;gap:.45rem;margin:0;padding:.3rem .6rem;border:1px solid var(--line);border-radius:10px;
  color:var(--ink);font-size:.88rem;font-weight:650;cursor:pointer;user-select:none}
.ch-toggle input{width:20px;height:20px;margin:0;accent-color:var(--acc)}
.ch-toggle.on{border-color:var(--acc);background:var(--acc-soft);color:#0d6b52}
#v-new{padding-bottom:calc(180px + var(--safe-b))}

/* două butoane de emitere */
.total-bar{flex-wrap:wrap;gap:.5rem 1rem}
.total-bar > div:first-child{display:flex;align-items:baseline;justify-content:space-between;width:100%}
.emit-box{flex-direction:row;width:100%;gap:.6rem}
.emit-box .btn{flex:1;min-width:0;min-height:52px;font-size:1rem;letter-spacing:.02em;padding:.7rem .4rem}
#emit-ch{background:var(--acc);color:#fff}
.btn.dark{background:var(--pri);color:#fff}
#v-new{padding-bottom:calc(200px + var(--safe-b))}
.toast{bottom:calc(200px + var(--safe-b))}

/* ecran de instalare */
.install{position:fixed;inset:0;z-index:50;background:linear-gradient(160deg,#0f3d3e 0%,#14504f 100%);color:#fff;display:flex;align-items:center;justify-content:center;padding:1.2rem;overflow:auto}
.install-box{max-width:380px;width:100%;text-align:center}
.install-ico{border-radius:22px;box-shadow:0 10px 30px rgba(0,0,0,.3);margin-bottom:.6rem}
.install h1{font-size:1.6rem;margin:.3rem 0 .4rem}
.install p{color:rgba(255,255,255,.85);line-height:1.5}
.install .btn.primary{background:#7fe0c4;color:#0f3d3e;font-size:1.1rem;min-height:56px;margin-top:1.2rem}
.install .btn.ghost{background:transparent;color:#fff;border-color:rgba(255,255,255,.35);margin-top:.8rem}
.inst-manual{text-align:left;background:rgba(255,255,255,.08);border-radius:14px;padding:.6rem 1rem;margin-top:1rem}
.inst-manual ol{padding-left:1.2rem;margin:.3rem 0;line-height:1.7}
.inst-manual .muted{color:rgba(255,255,255,.7)}
.kbd{display:inline-block;background:#fff;color:#0f3d3e;border-radius:6px;padding:0 .4rem;font-weight:800}
.inst-done{background:rgba(127,224,196,.18);border-radius:12px;padding:.8rem;margin-top:1rem;color:#fff!important}
.t-kgu.hidden{display:none}
.t-kg{width:5.8em}
