:root{color-scheme:light;--red:#c90930;--red-dark:#960823;--night:#171921;--yellow:#ffd400;--bg:#f3f4f8;--ink:#202735;--muted:#566477;--line:#e2e6ee;--white:#fff;--green:#117358;--blue:#225cb3;--amber:#94530e;--shadow:0 5px 17px #232e4010}
*{box-sizing:border-box}
body{margin:0;font:15px/1.5 Inter,system-ui,sans-serif;background:var(--bg);color:var(--ink)}
[hidden]{display:none!important}
button,input,select,textarea{font:inherit;min-width:0}
button{cursor:pointer;min-height:39px;padding:.48rem .85rem;border:1px solid var(--line);border-radius:8px;background:var(--white);color:var(--ink);font-weight:700}
button:hover{background:#f6f7fb}button:disabled{opacity:.55;cursor:default}
:focus-visible{outline:3px solid #4b82d3;outline-offset:2px}
.primary{background:var(--red);border-color:var(--red);color:white}.primary:hover{background:var(--red-dark)}
.quiet{background:transparent}.secondary{color:var(--red-dark)}
input,select,textarea{display:block;width:100%;min-height:42px;border:1px solid #cbd2de;border-radius:8px;background:white;color:var(--ink);padding:.53rem .64rem}
input::placeholder{color:#667486}select:disabled{background:#f2f4f7}.fields,.filters,.columns,.kpis{min-width:0;display:grid;gap:14px}
label{font-size:.82rem;font-weight:730;display:grid;gap:.34rem;min-width:0}
p,h1,h2,h3,dl,dd{margin:0}h1{font-size:clamp(1.65rem,3.1vw,2.45rem);line-height:1.1;letter-spacing:-.04em}h2{font-size:1.1rem;line-height:1.3}h3{font-size:.91rem}
.muted{color:var(--muted)}.small{font-size:.81rem}.badge{display:inline-block;background:#edf1f7;color:#3f5067;font-size:.76rem;font-weight:750;padding:4px 9px;border-radius:99px;white-space:nowrap}
.shell{display:grid;min-height:100dvh;grid-template-columns:226px minmax(0,1fr)}
.rail{position:sticky;top:0;height:100dvh;background:linear-gradient(165deg,#171921 15%,#1d2029 67%,#351321 100%);color:white;display:flex;flex-direction:column;padding:22px 14px}
.brand{display:flex;align-items:center;gap:10px;padding:5px 5px 19px;border-bottom:1px solid #ffffff27}.brand img{object-fit:contain}.brand strong,.brand span{display:block;letter-spacing:.07em}.brand strong{font-size:1rem}.brand span{font-size:.63rem;letter-spacing:.13em;color:var(--yellow)}
.nav{display:grid;gap:5px;margin-top:18px}.nav button{text-align:left;border-color:transparent;background:none;color:#e8ebf2;white-space:nowrap}.nav button span{display:inline-block;margin-right:8px;width:18px;color:#b7c0ce}.nav button:hover{background:#ffffff14}.nav button[aria-current=page]{background:#bb0d30;color:white}.nav button[aria-current=page] span{color:white}.rail-note{margin:auto 5px 0;color:#d4d9e1;font-size:.73rem}
.topbar{background:white;border-bottom:1px solid var(--line);min-height:61px;display:flex;justify-content:space-between;gap:8px;align-items:center;padding:10px 26px;font-size:.86rem;color:#424d61}.topbar b{color:#9b1230;margin:0 5px}.top-actions{display:flex;align-items:center;gap:8px}
main{max-width:1450px;padding:24px 26px 50px;margin:auto}
.heading{display:flex;align-items:center;justify-content:space-between;gap:12px;border-bottom:4px solid var(--red);background:linear-gradient(115deg,#232733,#333b4d 65%,#3b2430);color:white;border-radius:14px;padding:23px 24px;margin-bottom:14px}.heading p{color:#e0e6ef;margin-top:.45rem}
.card{background:white;border:1px solid var(--line);border-radius:12px;box-shadow:var(--shadow);padding:16px;min-width:0}
.filters{grid-template-columns:minmax(140px,1fr) minmax(140px,.85fr) minmax(150px,1fr) minmax(190px,1.45fr);padding:12px 15px;margin-bottom:14px}.filters p{grid-column:1/-1}.filters p:empty{display:none}
.kpis{grid-template-columns:repeat(4,minmax(0,1fr));margin-bottom:14px}.kpi{border-top:3px solid var(--blue);padding:12px 15px}.kpi[data-tone=green]{border-top-color:var(--green)}.kpi[data-tone=amber]{border-top-color:#cf8426}.kpi[data-tone=red]{border-top-color:var(--red)}.kpi span,.kpi strong{display:block}.kpi strong{font-size:clamp(1.25rem,2.2vw,1.83rem);margin-top:4px;line-height:1.2;overflow-wrap:anywhere;font-variant-numeric:tabular-nums}.kpi span{color:var(--muted);font-weight:650;font-size:.83rem}
.columns{grid-template-columns:minmax(0,1.2fr) minmax(0,1fr);align-items:start}.section-head{display:flex;justify-content:space-between;align-items:center;gap:8px;margin-bottom:12px}.subheading{margin-top:17px}.fields{grid-template-columns:repeat(2,minmax(0,1fr));margin-top:8px}.closing-fields{grid-template-columns:repeat(3,minmax(0,1fr))}.actions{margin-top:13px}.hint,.notice,.demo-banner,.status{padding:9px 12px;border-radius:8px;margin-top:10px}.hint{background:#edf4fd;color:#244a7a}.notice,.demo-banner{background:#fff4da;color:#71450f;border:1px solid #efdab6}.demo-banner{display:flex;flex-wrap:wrap;gap:8px;margin:0 0 12px}.status{background:#edf5ff;color:#193f6c;margin:0 0 12px}.status[data-error=true]{background:#fff1f3;color:#92142d}
.bar-line{padding:9px 0}.bar-label{display:flex;justify-content:space-between;gap:8px;font-size:.86rem;font-weight:660}.bar-line progress{display:block;width:100%;height:.62rem;margin-top:6px;accent-color:var(--blue)}.bar-line[data-tone=green] progress{accent-color:var(--green)}.bar-line[data-tone=amber] progress{accent-color:#d18d30}.bar-line[data-tone=red] progress{accent-color:var(--red)}
.summary div{display:flex;justify-content:space-between;gap:10px;padding:8px 0;border-top:1px solid var(--line);font-size:.88rem}.summary dt{color:var(--muted)}.summary dd{font-weight:750;text-align:right;max-width:58%;overflow-wrap:anywhere}.summary+p{margin-top:10px}
.ingredient{display:grid;grid-template-columns:minmax(100px,1.7fr) minmax(65px,.75fr) minmax(58px,.65fr) auto;align-items:end;gap:6px;margin:8px 0}.ingredient button{height:42px;min-width:38px;padding:0}.batch{padding:11px 0;border-top:1px solid var(--line)}.batch summary{font-weight:700;cursor:pointer}.batch summary small{display:block;color:var(--muted);font-weight:500;padding-left:17px}.batch ul,.login-features{padding-left:18px}.batch ul{margin:8px 0}.batch .cost{border-top:1px dashed var(--line);margin-top:12px;padding-top:10px}.empty{background:#f5f7fc;padding:12px;border-radius:9px;color:var(--muted)}
.login-layout{display:grid;grid-template-columns:minmax(0,1.25fr) minmax(280px,1fr);align-items:stretch;gap:16px;max-width:990px;margin:34px auto}.login-hero{border-radius:14px;background:radial-gradient(ellipse at 0 100%,#4f222e,transparent 75%),linear-gradient(145deg,#202737,#292633);color:white;padding:30px;min-height:320px;border-bottom:4px solid var(--red)}.hero-label{display:inline-block;color:#ffe079;font-weight:750;font-size:.85rem;margin-bottom:14px}.login-hero p{margin-top:10px;color:#e0e7f2}.login-features{margin:22px 0 0;color:#e9edf4}.login-features li{margin-top:7px}.login-card{padding:24px}.login-card form{display:grid;gap:11px;margin:16px 0 10px}.login-card .secondary{width:100%;margin-bottom:5px}
@media(max-width:1060px){.shell{grid-template-columns:190px minmax(0,1fr)}main{padding:18px}.filters{grid-template-columns:repeat(2,minmax(0,1fr))}.closing-fields{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:760px){.shell{display:block}.rail{position:relative;height:auto;padding:10px 12px}.brand{padding:0;border:0}.brand img{width:39px;height:39px}.nav{grid-template-columns:repeat(3,minmax(0,1fr));gap:3px;margin-top:8px}.nav button{text-align:center;font-size:.86rem;padding:6px 4px}.nav button span{margin-right:2px;width:auto}.rail-note{display:none}.topbar{min-height:48px;padding:6px 12px}.top-actions .badge{display:none}main{padding:13px}.heading{padding:15px}.heading p{font-size:.84rem}.filters,.card{padding:12px}.columns,.login-layout{grid-template-columns:1fr}.kpis{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.login-layout{margin:4px 0}.login-hero{min-height:0;padding:18px}.login-features{margin-top:12px}}
@media(max-width:390px){.heading{align-items:flex-start;flex-direction:column}.ingredient{grid-template-columns:1fr 1fr auto}.ingredient label:first-child{grid-column:1/-1}}

.nav button .nav-count { display: inline-grid; place-items: center; min-width: 1.55rem; padding: .1rem .3rem; margin-left: auto; font-size: .72rem; color: #171921; border-radius: 1rem; background: #ffd400; }
.review-toolbar { display: flex; align-items: end; gap: .8rem; margin-bottom: 1rem; }
.review-toolbar label { width: min(100%, 18rem); }
.review-grid { margin-bottom: 1rem; }
.review-grid h2 { margin-bottom: .8rem; }
.store-losses {
  --loss-border: #eadfe3;
  container-type: inline-size;
  margin-top: 18px;
  overflow: hidden;
  border: 1px solid var(--loss-border);
  border-radius: 16px;
  background: var(--white);
  box-shadow: var(--shadow);
}
.losses-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px 20px;
  flex-wrap: wrap;
  padding: 18px 22px;
  border-bottom: 3px solid var(--red);
  background: linear-gradient(110deg, #222531 20%, #392637 100%);
  color: var(--white);
}
.losses-header h2 {
  font-size: clamp(1.25rem, 2.2vw, 1.55rem);
  letter-spacing: -.025em;
}
.losses-header p { margin-top: 3px; font-size: .82rem; color: #e3dce5; }
.losses-tools { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.losses-tools button { min-height: 34px; background: #fff; color: var(--ink, #242731); font-size: .78rem; }
#losses-checked-at { margin: 0 0 10px; }
.losses-header .losses-period {
  margin: 0;
  padding: 5px 10px;
  border: 1px solid #ffffff38;
  border-radius: 6px;
  font-variant-numeric: tabular-nums;
}
.losses-body { padding: 18px 22px 22px; }
.losses-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}
.losses-metrics > div {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 5px;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f7f8fb;
}
.losses-metrics > div:first-child {
  border-color: #f1cdd5;
  background: #fff2f5;
}
.losses-metrics dt { color: var(--muted); font-size: .8rem; font-weight: 680; }
.losses-metrics dd strong {
  display: block;
  font-size: clamp(1.12rem, 2.5vw, 1.65rem);
  line-height: 1.2;
  letter-spacing: -.025em;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.losses-metrics > div:first-child strong { color: var(--red-dark); }
.losses-metrics small { display: block; margin-top: 4px; color: var(--muted); font-size: .74rem; }
.losses-grid { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 6fr); gap: 14px; align-items: start; }
.losses-day, .losses-history {
  min-width: 0;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.losses-section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.losses-section-heading h3 { font-size: .98rem; letter-spacing: -.012em; }
.losses-section-heading time { flex-shrink: 0; color: var(--muted); font-size: .76rem; font-variant-numeric: tabular-nums; }
.losses-empty { padding: 10px 12px; border-radius: 7px; background: #f5f7fa; color: var(--muted); font-size: .82rem; }
.losses-day-summary > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 0;
  border-top: 1px solid var(--line);
  font-size: .83rem;
}
.losses-day-summary dt { min-width: 0; color: var(--muted); overflow-wrap: anywhere; }
.losses-day-summary dd { max-width: 56%; text-align: right; font-weight: 700; overflow-wrap: anywhere; }
.losses-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-variant-numeric: tabular-nums; }
.losses-table th, .losses-table td { padding: 6px 7px; text-align: left; overflow-wrap: anywhere; }
.losses-table thead th { background: #f2f4f8; color: var(--muted); font-size: .73rem; font-weight: 700; }
.losses-table thead th:first-child { width: 51%; border-radius: 5px 0 0 5px; }
.losses-table thead th:last-child { width: 28%; border-radius: 0 5px 5px 0; }
.losses-table tbody tr + tr { border-top: 1px solid var(--line); }
.losses-table tbody th, .losses-table td { font-size: .82rem; }
.losses-table tbody th { font-weight: 650; }
.losses-table tbody strong { display: block; font-weight: inherit; }
.losses-table tbody small { display: block; margin-top: 2px; color: var(--muted); font-size: .71rem; font-weight: 550; }
.losses-table th:not(:first-child), .losses-table td { text-align: right; }
.losses-table tbody td:last-child { font-weight: 750; }
.losses-disclosure > summary, .losses-history-toggle {
  margin-top: 6px;
  min-height: 36px;
  padding: 7px 9px;
  border: 0;
  border-radius: 7px;
  background: #faf0f3;
  color: var(--red-dark);
  font-size: .81rem;
  font-weight: 720;
  cursor: pointer;
}
.losses-disclosure > summary { width: fit-content; }
.losses-history-toggle[aria-expanded="true"] { background: #f2f4f8; color: var(--ink); }
.losses-disclosure[open] > summary { margin-bottom: 7px; }

@container (max-width: 700px) {
  .losses-grid { grid-template-columns: 1fr; gap: 10px; }
}
@container (max-width: 480px) {
  .losses-header { padding: 14px; }
  .losses-body { padding: 11px; }
  .losses-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; margin-bottom: 10px; }
  .losses-metrics > div { padding: 9px; }
  .losses-metrics > div:first-child { grid-column: 1 / -1; }
  .losses-metrics > div:first-child strong { font-size: 1.55rem; }
  .losses-metrics dt { font-size: .75rem; }
  .losses-day, .losses-history { padding: 9px; }
  .losses-table th, .losses-table td { padding: 5px 4px; }
}
.review-grid form label { margin-bottom: .5rem; }
.material-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.queue-row { display: grid; width: 100%; text-align: left; margin: .4rem 0; gap: .2rem; border-color: #dce0e7; }
.queue-row[aria-pressed="true"] { border-color: #c90930; background: #fff4f5; }
.recipe-item { padding: .75rem 0; border-bottom: 1px solid #e7e9ef; }
.recipe-item p { margin: .15rem 0 .45rem; }
.recipe-item .fields { align-items: end; }
.recipe-status { margin: .35rem 0 0; color: #92510b; }
.ingredient-costs { margin: .85rem 0; border-top: 1px solid #e7e9ef; }
.ingredient-costs > summary { cursor: pointer; padding: .75rem 0; color: #242731; font-weight: 650; }
@media (max-width: 550px) {
  .material-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .review-toolbar { align-items: center; }
  .review-toolbar button { flex-shrink: 0; }
}
.review-grid output.hint { display: block; }
.nav button[aria-current=page] .nav-count { color: #171921; }
@media (max-width: 760px) {
  .nav:has(#review-nav:not([hidden])) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

#install-dialog { width: min(32rem, calc(100% - 2rem)); border: 0; padding: 1.4rem; border-radius: 1rem; box-shadow: 0 18px 55px #17192155; }
#install-dialog::backdrop { background: #171921a8; }
#install-dialog p { line-height: 1.55; }
#install-dialog p strong { display: block; }
#install-app { white-space: nowrap; }
