.factor-key{display:grid;justify-items:center;gap:.5rem;margin:1rem auto}.factor-key svg{width:min(100%,15rem);height:auto}.factor-key code{overflow-wrap:anywhere;max-width:100%;user-select:all}
/* Layout system. Rules that keep every screen consistent at any window size:
   1. Every size is in rem. The root size grows gently with the window, and the
      "big text" option only changes the root, so everything scales together.
   2. Screens are made from a few blocks: .split, .cols, .cards, .form, .bar,
      .tablewrap, .row. No screen has sizes of its own (no style="width:...").
   3. Blocks react to the room they have (container queries), not to the window.
   4. Tables that do not fit turn into cards (see fitTables in app.js).
   5. layout_test.go checks all of this in a real browser. Run it after changes. */

@font-face { font-family: UI; src: url(/font/ui); font-weight: 200 1000; }
:root {
  --bg: #f5f7fa; --card: #fff; --ink: #10243d; --muted: #586a80; --faint: #73839a; --line: #e3e8ef; --line2: #d0d8e3;
  --sea: #0f4c8a; --sea2: #0a3769; --soft: #e9f1fb; --sun: #f0a020; --coral: #f26a6a;
  --good: #1b7f45; --goodbg: #def7e6; --bad: #b42323; --badbg: #fde6e6; --warn: #8a4b0b; --warnbg: #fdf1cf;
  --shadow: 0 1px 2px rgba(34, 48, 60, .04), 0 1px 3px rgba(34, 48, 60, .05); --shadow2: 0 .75rem 2rem rgba(34, 48, 60, .13);
  --side: #fff; --side-line: var(--line); --side-ink: #2a3d55; --side-ic: #7186a0; --side-grp: #73839a; --side-hover: #f1f4f7; --side-on: var(--soft); --side-on-ink: var(--sea2); --side-box: #f4f6f8;
  /* spacing and shape scale */
  --s1: .25rem; --s2: .5rem; --s3: .75rem; --s4: 1rem; --s5: 1.25rem; --s6: 1.5rem; --r1: .5rem; --r2: .625rem; --r3: .875rem;
  --ctl: 2.75rem; /* height of every control in a form */
}
html { font-size: clamp(15px, 12.4px + .21vw, 18px); }
html:has(body.big) { font-size: clamp(17px, 14px + .24vw, 20.5px); }
body.t-dark { --side: #0b2545; --side-line: transparent; --side-ink: #dbe6f3; --side-ic: #9db6d6; --side-grp: #9db3d0; --side-hover: rgba(255, 255, 255, .08); --side-on: #1a5fa8; --side-on-ink: #fff; --side-box: rgba(255, 255, 255, .07); }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body { font: 500 1rem/1.55 UI, "Segoe UI", sans-serif; color: var(--ink); background: var(--bg); display: flex; flex-direction: column; -webkit-font-smoothing: antialiased; }
h1, h2, h3 { margin: 0; font-weight: 700; line-height: 1.35; overflow-wrap: break-word; }
h1 { font-size: 1.4rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1.03rem; margin-bottom: var(--s2); }
p { margin: 0 0 var(--s2); }
a { color: var(--sea); }
b, strong { font-weight: 700; }
.ic { width: 1.3em; height: 1.3em; flex: none; vertical-align: -.25em; stroke-width: 1.9; }
kbd { font: 600 .72rem/1 Consolas, monospace; background: rgba(15, 31, 42, .08); border: 1px solid rgba(15, 31, 42, .12); border-bottom-width: 2px; border-radius: .3rem; padding: .2rem .4rem; direction: ltr; display: inline-block; flex: none; }
.btn.primary kbd { background: rgba(255, 255, 255, .18); border-color: rgba(255, 255, 255, .25); }
.muted { color: var(--muted); font-size: .9rem; font-weight: 500; }
.num, .numr { text-align: left; white-space: nowrap; font-variant-numeric: tabular-nums; } .num { direction: ltr; }
.nw { white-space: nowrap; direction: ltr; display: inline-block; } .wide { width: 100%; } .center-text { text-align: center; } .anywhere { overflow-wrap: anywhere; } .gap-top { margin-top: var(--s4); }
::-webkit-scrollbar { width: .6rem; height: .6rem; } ::-webkit-scrollbar-thumb { background: #c5cfd8; border-radius: 1rem; border: 2px solid transparent; background-clip: content-box; } ::-webkit-scrollbar-thumb:hover { background-color: #9fadb9; }

/* ---------- shell ---------- */
.shell { flex: 1; display: flex; min-height: 0; }
.side { width: 14.5rem; flex: none; background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; border-left: 1px solid var(--side-line); min-height: 0; }
.brand { display: flex; gap: var(--s3); align-items: center; padding: var(--s4) var(--s4) var(--s2); flex: none; }
.brand > div { min-width: 0; } .brand b { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; font-size: 1rem; line-height: 1.35; } .brand small { color: var(--side-grp); font-size: .82rem; }
.logo { width: 2.5rem; height: 2.5rem; border-radius: .75rem; background: var(--sea); display: grid; place-items: center; color: #fff; flex: none; } .logo .ic { width: 1.45rem; height: 1.45rem; }
.links { flex: 1; min-height: 0; overflow: hidden auto; padding: 0 var(--s3) var(--s2); scrollbar-width: thin; }
.grp { color: var(--side-grp); font-size: .82rem; font-weight: 600; padding: .55rem var(--s2) .15rem; }
.side .links a { display: flex; align-items: center; gap: var(--s3); padding: .36rem var(--s3); margin-bottom: 1px; color: var(--side-ink); text-decoration: none; font-weight: 600; font-size: .95rem; border-radius: var(--r2); position: relative; }
.side .links a .ic { width: 1.3rem; height: 1.3rem; color: var(--side-ic); }
.side .links a:hover { background: var(--side-hover); }
.side .links a.on { background: var(--side-on); color: var(--side-on-ink); font-weight: 700; } .side .links a.on .ic { color: var(--side-on-ink); }
.badge:not(:empty) { background: var(--coral); color: #fff; border-radius: 2rem; padding: 0 .5rem; margin-right: auto; font-size: .82rem; font-weight: 700; line-height: 1.6; }
.who { margin: 0 var(--s3) var(--s3); padding: var(--s2); border-radius: var(--r3); background: var(--side-box); display: flex; align-items: center; gap: var(--s2); flex: none; }
.who > div { min-width: 0; flex: 1; } .who form { margin: 0; flex: none; }
.avatar { width: 2.1rem; height: 2.1rem; border-radius: 50%; background: var(--sea); color: #fff; display: grid; place-items: center; font-weight: 700; flex: none; }
.who b { display: block; font-size: .9rem; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .who small { color: var(--side-grp); font-size: .82rem; }
.iconbtn { border: 0; background: transparent; color: var(--side-ic); border-radius: var(--r1); padding: .4rem; cursor: pointer; display: grid; min-width: 2rem; min-height: 2rem; place-items: center; } .iconbtn:hover { background: var(--side-hover); color: var(--bad); }
.work { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; justify-content: space-between; align-items: center; gap: var(--s2) var(--s4); padding: .65rem var(--s6); flex-wrap: wrap; background: var(--card); border-bottom: 1px solid var(--line); flex: none; }
.top h1 { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#status { display: flex; gap: .4rem; flex-wrap: wrap; }
.pill { font-size: .84rem; font-weight: 600; background: #eef2f5; color: #475866; border-radius: 2rem; padding: .15rem .7rem; display: inline-flex; gap: .4rem; align-items: center; white-space: nowrap; }
.pill.good { background: var(--goodbg); color: var(--good); } .pill.off { background: var(--warnbg); color: var(--warn); } .pill.bad { background: var(--badbg); color: var(--bad); }
main#main { flex: 1; min-height: 0; overflow: hidden auto; padding: var(--s5) var(--s6) var(--s6); container: main / inline-size; }
main.center { flex: 1; min-height: 0; display: grid; place-items: safe center; padding: var(--s4); overflow: hidden auto; background: linear-gradient(160deg, #0b2545, #0f4c8a); }

/* Narrow windows: the menu becomes a rail, icon above its name. */
@media (max-width: 68em) {
  .side { width: 6.2rem; } .brand { justify-content: center; padding: var(--s2); } .brand > div, .grp { display: none; }
  .links { padding: 0 var(--s1) var(--s1); scrollbar-width: none; }
  .side .links a { flex-direction: column; gap: 0; padding: .35rem var(--s1); font-size: .8rem; text-align: center; line-height: 1.25; }
  .badge:not(:empty) { position: absolute; top: .1rem; left: .7rem; margin: 0; padding: 0 .35rem; }
  .who { flex-direction: column; padding: var(--s1); margin: 0 var(--s1) var(--s1); } .who > div, .avatar { display: none; }
  main#main { padding: var(--s4); } .top { padding: .5rem var(--s4); }
}
/* Short windows: give the height to the content. */
@media (max-height: 40em) {
  .top { padding-block: .35rem; } h1 { font-size: 1.2rem; } main#main { padding-block: var(--s3); } .brand { padding-block: var(--s2); } .grp { padding-top: .25rem; }
}

/* ---------- blocks ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r3); padding: var(--s5); margin-bottom: var(--s4); box-shadow: var(--shadow); min-width: 0; }
.card > h2:first-child, .card > h3:first-child { margin-bottom: var(--s3); } .card > :last-child, .card form > :last-child { margin-bottom: 0; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 12.5rem), 1fr)); gap: var(--s4); margin-bottom: var(--s4); }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 24rem), 1fr)); gap: var(--s4); align-items: start; } .cols > * { min-width: 0; }
/* Main part with a side part; the side part drops below when there is no room. */
.split { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s4); align-items: start; } .split > * { min-width: 0; }
@container main (min-width: 60rem) { .split { grid-template-columns: minmax(0, 1fr) 21rem; } .split.lead { grid-template-columns: 26rem minmax(0, 1fr); } }
.narrowcard { max-width: 42rem; }
.driver-avatar { width: 2.65rem; height: 2.65rem; object-fit: cover; border-radius: 50%; display: inline-grid; place-items: center; background: var(--soft); color: var(--sea); flex: none; }
.meal-part { display: grid; grid-template-columns: minmax(0, 2fr) minmax(5rem, 1fr) auto; align-items: end; gap: var(--s2); margin-bottom: var(--s3); }
#meal-weights label { margin-block: var(--s3); }
.expense-page fieldset { margin-inline: 0; min-width: 0; padding: 0; border: 0; }
.expense-page legend { padding: 0; font-size: .95rem; font-weight: 700; }
.expense-field-head, .expense-worker { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--s2); }
.expense-field-head + select { margin-top: var(--s2); }
.expense-total { display: flex; align-items: baseline; gap: var(--s2); padding: .25rem .75rem; border-radius: var(--r2); background: var(--soft); color: var(--sea2); }
.expense-total span { font-size: .85rem; }
.expense-total strong { font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.expense-history .period { margin: var(--s4) 0; padding: var(--s3) 0; width: 100%; border: solid var(--line); border-width: 1px 0; border-radius: 0; box-shadow: none; }
.expense-history small, .expense-worker small { display: block; }
.expense-worker { border-top: 1px solid var(--line); padding-top: var(--s3); margin-top: var(--s3); overflow-wrap: anywhere; }
@container main (max-width: 59.99rem) {
  .expense-entry { display: contents; }
  .expense-workers { order: 1; }
  .expense-page .card { margin: 0; }
}
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--r3); padding: var(--s3) var(--s4); box-shadow: var(--shadow); position: relative; min-width: 0; container: stat / inline-size; }
.stat > span { color: var(--muted); font-size: .9rem; display: block; padding-left: 2.6rem; } .stat > b { font-size: clamp(1rem, 11cqi, 1.45rem); font-weight: 700; display: block; white-space: nowrap; }
.stat .sic { position: absolute; left: var(--s3); top: var(--s3); width: 2.1rem; height: 2.1rem; border-radius: var(--r2); display: grid; place-items: center; background: var(--soft); color: var(--sea); } .stat .sic .ic { width: 1.1rem; height: 1.1rem; }
.stat .sic.w { background: var(--warnbg); color: var(--warn); } .stat .sic.b { background: var(--badbg); color: var(--bad); }
.stat.hero { background: var(--sea); color: #fff; border: 0; } .stat.hero > span { color: #d5e5f7; } .stat.hero > b { font-size: clamp(1.1rem, 12.5cqi, 2rem); } .stat.hero .sic { background: rgba(255, 255, 255, .16); color: #fff; }
.stat.hero.loss { background: var(--bad); } .stat.hero.loss > span { color: #ffe1dd; }
.bar { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; margin-bottom: var(--s4); } .bar > b { min-width: 0; overflow-wrap: break-word; }
.bar > label { display: flex; gap: .4rem; align-items: center; font-weight: 500; color: var(--muted); font-size: .9rem; white-space: nowrap; }
.bar > input, .bar > select { flex: 0 1 17rem; width: auto; min-width: 9rem; }
.period { background: var(--card); border: 1px solid var(--line); border-radius: .75rem; padding: .4rem; box-shadow: var(--shadow); width: fit-content; max-width: 100%; }
.period .btn.small:not(.primary) { border-color: transparent; background: transparent; box-shadow: none; } .period .btn.small:not(.primary):hover { background: #eef2f5; }
.grow { flex: 1; }
.row { display: flex; gap: var(--s2); flex-wrap: wrap; margin-top: var(--s3); } .row > * { flex: 1 1 auto; margin: 0; } .row form .btn { width: 100%; }
.blank { text-align: center; padding: 2.75rem var(--s5); color: var(--muted); } .blank .ic { width: 2.75rem; height: 2.75rem; color: #b4c2cd; stroke-width: 1.5; } .blank b { display: block; color: var(--ink); font-size: 1.08rem; margin: var(--s2) 0 .1rem; }
.alert { border-radius: var(--r2); padding: .6rem var(--s3); margin-bottom: var(--s3); background: var(--soft); font-size: .92rem; overflow-wrap: break-word; } .alert.bad { background: var(--badbg); color: var(--bad); } .alert.warn { background: var(--warnbg); color: var(--warn); }
.alert.short span, .alert.short small { display: block; } .alert.short small { margin-top: var(--s1); color: var(--ink); }
small.autoout { display: block; }
.tag { font-size: .85rem; font-weight: 600; border-radius: 2rem; padding: .05rem .65rem; background: #eef2f5; color: #475866; display: inline-block; white-space: nowrap; }
.tag.good { background: var(--goodbg); color: var(--good); } .tag.bad { background: var(--badbg); color: var(--bad); } .tag.warn { background: var(--warnbg); color: var(--warn); }
.pos-v { color: var(--good); } .neg-v { color: var(--bad); }
details summary { cursor: pointer; font-weight: 600; padding: var(--s2) 0; color: var(--sea); font-size: .95rem; }

/* ---------- controls ---------- */
.btn { font: 700 .97rem/1.35 UI, sans-serif; border: 1px solid var(--line2); background: #fff; color: var(--ink); border-radius: var(--r2); min-height: 2.5rem; padding: .3rem var(--s4); cursor: pointer; text-decoration: none; display: inline-flex; gap: var(--s2); align-items: center; justify-content: center; white-space: nowrap; transition: background .12s, border-color .12s; }
.btn:hover { border-color: #9fb0bd; background: #f8fafb; }
.btn.primary { background: var(--sea); border-color: var(--sea); color: #fff; } .btn.primary:hover { background: var(--sea2); border-color: var(--sea2); }
.btn.danger { color: var(--bad); border-color: #f1c4c0; } .btn.danger:hover { background: var(--badbg); }
.btn.big { font-size: 1.03rem; min-height: 3rem; border-radius: .75rem; }
.btn.small { font-size: .9rem; min-height: 2.1rem; padding: .1rem var(--s3); border-radius: var(--r1); }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid rgba(245, 158, 11, .75); outline-offset: 1px; }
input, select, textarea { font: 500 1rem/1.4 UI, sans-serif; width: 100%; min-width: 0; height: var(--ctl); border: 1px solid var(--line2); border-radius: var(--r2); padding: 0 var(--s3); background: #fff; color: var(--ink); text-overflow: ellipsis; }
input:hover, select:hover { border-color: #9fb0bd; } input:focus, select:focus { border-color: var(--sea); box-shadow: 0 0 0 3px rgba(15, 76, 138, .14); outline: 0; }
input::placeholder { color: var(--faint); font-weight: 400; }
input[type=checkbox], input[type=radio] { width: 1.15rem; height: 1.15rem; accent-color: var(--sea); flex: none; box-shadow: none; }
input.filter { margin-bottom: .4rem; background: #f6f8fa; }
label { display: block; font-weight: 700; font-size: .95rem; min-width: 0; } label > input, label > select { margin-top: .3rem; }
label.check { display: flex; gap: var(--s2); align-items: center; font-weight: 500; min-height: 2rem; } label.check > input { margin: 0; }
.stack > * { margin: 0 0 var(--s4); } .stack > :last-child { margin-bottom: 0; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr)); gap: var(--s3); align-items: end; }
.pick { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .3rem; }
.pick label { flex: 1 1 auto; position: relative; }
.pick input, .svc input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.pick span { display: flex; flex-direction: column; justify-content: center; text-align: center; border: 1.5px solid var(--line2); border-radius: var(--r2); min-height: 2.6rem; padding: .25rem var(--s3); background: #fff; font-weight: 500; overflow-wrap: break-word; }
.pick input:hover + span { border-color: #9fb0bd; }
.pick input:checked + span { border-color: var(--sea); background: var(--soft); color: var(--sea2); font-weight: 700; box-shadow: inset 0 0 0 1px var(--sea); }
.pick input:focus-visible + span, .svc input:focus-visible + span { outline: 3px solid rgba(245, 158, 11, .75); }
/* Date field: shows day/month/year whatever the language of the browser engine. */
.date { position: relative; display: inline-flex; align-items: center; gap: .4rem; height: 2.1rem; padding: 0 var(--s3); border: 1px solid var(--line2); border-radius: var(--r1); background: #fff; color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; direction: ltr; cursor: pointer; white-space: nowrap; }
.date:hover { border-color: #9fb0bd; } .date:focus-within { border-color: var(--sea); box-shadow: 0 0 0 3px rgba(15, 76, 138, .14); } .date input { position: absolute; inset: 0; opacity: 0; height: 100%; margin: 0; padding: 0; border: 0; cursor: pointer; }

/* ---------- tables ---------- */
.tablewrap { border: 1px solid var(--line); border-radius: var(--r3); margin-bottom: var(--s4); background: #fff; box-shadow: var(--shadow); overflow: clip; min-width: 0; }
table { width: 100%; border-collapse: collapse; background: #fff; }
th { background: #f7f9fb; font-weight: 700; font-size: .87rem; color: var(--muted); text-align: right; padding: .6rem .8rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { border-top: 1px solid #edf1f5; padding: .55rem .8rem; text-align: right; font-size: .97rem; } th.num, td.num, th.numr, td.numr { text-align: left; overflow-wrap: normal; }
/* Columns made of words keep a readable width; below it the table turns into cards. */
td.grow-col { min-width: 9rem; }
tbody tr:first-child td { border-top: 0; } tbody tr:hover td { background: #fafcfd; }
tr.off td { color: var(--faint); } tr.sumrow td { font-weight: 700; background: #f7f9fb; } tr.changed td { background: #fffbeb !important; }
td form { margin: 0; display: inline; } td input:not([type=checkbox]) { height: 2.3rem; min-width: 5.5rem; } td.acts { white-space: nowrap; } td.acts > * { vertical-align: middle; }
.inrow { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; } .inrow input { flex: none; width: 6.5rem; min-width: 0; } .inrow .btn { flex: none; white-space: nowrap; } .inrow select { flex: none; width: auto; height: 2.3rem; min-width: 0; } .closetbl small.inshop { display: block; color: var(--muted); font-weight: 600; }
.priceinput { font-weight: 700; text-align: center; max-width: 11rem; }
.price-tools { display: grid; grid-template-columns: minmax(9rem, 16rem) minmax(12rem, 22rem) auto; align-items: end; }
.price-tools > label { display: grid; gap: var(--s1); min-width: 0; font-weight: 600; }
.price-tools > label > :is(input, select) { margin: 0; }
.price-tools > .btn, .settings-picker > .btn { min-height: var(--ctl); justify-self: start; }
@container main (max-width: 37rem) {
  .price-tools { grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr)); }
  .price-tools > .btn { justify-self: stretch; }
  #price-table.stacked tr { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #price-table.stacked td:nth-child(2) { grid-column: 1 / -1; grid-row: 1; }
  #price-table.stacked .priceinput { width: 100%; min-width: 0; }
}
.price-switch { position: relative; display: inline-flex; align-items: center; min-height: 2.75rem; cursor: pointer; }
.price-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.price-track { position: relative; display: inline-flex; align-items: center; justify-content: space-between; width: 4.2rem; height: 1.9rem; padding: 0 .44rem; background: #a93637; color: white; border-radius: 2rem; font: 700 .9rem/1 sans-serif; transition: background-color .18s; }
.price-track::after { content: ''; position: absolute; left: .19rem; width: 1.52rem; height: 1.52rem; border-radius: 50%; background: white; box-shadow: 0 1px 3px #0004; transition: transform .18s; }
.price-on, .price-switch input:checked + .price-track .price-off { visibility: hidden; }
.price-switch input:checked + .price-track .price-on { visibility: visible; }
.price-switch input:checked + .price-track { background: #167344; }
.price-switch input:checked + .price-track::after { transform: translateX(2.3rem); }
.price-switch input:focus-visible + .price-track { outline: 3px solid var(--blue, #1767a8); outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) { .price-track, .price-track::after { transition: none; } }
.empty { color: var(--muted); text-align: center; padding: 2.2rem var(--s5) !important; }
.kv td:last-child { text-align: left; font-variant-numeric: tabular-nums; direction: ltr; white-space: nowrap; overflow-wrap: normal; } .kv td:first-child { overflow-wrap: break-word; }
.stacked thead { display: none; } .stacked, .stacked tbody { display: block; }
.stacked tr { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 8.5rem), 1fr)); gap: var(--s2) var(--s4); padding: var(--s3) var(--s4); border-top: 1px solid var(--line); } .stacked tr:first-child { border-top: 0; } .stacked tr:hover td { background: none; }
.stacked td { border: 0; padding: 0; min-width: 0; display: block; text-align: right !important; } .stacked td:empty { display: none; }
.stacked td[data-label]::before { content: attr(data-label); display: block; color: var(--muted); font-size: .82rem; font-weight: 600; direction: rtl; }
.stacked td.acts { grid-column: 1 / -1; display: flex; gap: var(--s2); flex-wrap: wrap; } .stacked td.acts::before { display: none; } .stacked td[colspan] { grid-column: 1 / -2; } .stacked td.empty { grid-column: 1 / -1; text-align: center !important; } .stacked tr.sumrow { background: #f7f9fb; }

/* ---------- dialogs and messages ---------- */
dialog { border: 0; border-radius: 1.1rem; padding: var(--s6); width: min(33rem, calc(100vw - 1.5rem)); max-width: none; max-height: calc(100vh - 1.5rem); overflow: hidden auto; scroll-padding-bottom: 5.5rem; box-shadow: 0 1.5rem 4.5rem rgba(7, 22, 43, .35); color: var(--ink); }
dialog::backdrop { background: rgba(7, 22, 43, .5); }
dialog h2 { margin-bottom: var(--s3); }
/* The last row of buttons stays in view even when the dialog is taller than the window. */
dialog > form:last-child > .row:last-child { position: sticky; bottom: calc(-1 * var(--s6)); background: #fff; margin: 0 calc(-1 * var(--s6)) calc(-1 * var(--s6)); padding: var(--s3) var(--s6) var(--s4); border-top: 1px solid var(--line); z-index: 1; }
.ask { font-size: 1.1rem; font-weight: 600; white-space: pre-line; }
#toast { position: fixed; inset: auto auto 1.2rem 1.2rem; margin: 0; border: 0; padding: 0; background: none; overflow: visible; gap: var(--s2); max-width: min(29rem, calc(100vw - 2.4rem)); }
#toast:popover-open { display: grid; }
.toast { background: #10243d; color: #fff; padding: var(--s3) var(--s4); border-radius: .75rem; font-size: .95rem; box-shadow: var(--shadow2); cursor: pointer; overflow-wrap: break-word; border-right: 4px solid #22c55e; animation: slide .18s ease-out; }
.toast.bad { background: #4a1010; border-right-color: #ef4444; }
@keyframes slide { from { transform: translateY(.5rem); opacity: 0; } }
.savebar { position: sticky; bottom: 0; margin-top: var(--s3); padding: var(--s2) var(--s4); background: var(--warnbg); border: 1px solid #f3d38a; border-radius: var(--r3); display: flex; flex-wrap: wrap; gap: var(--s2); justify-content: space-between; align-items: center; box-shadow: var(--shadow2); }

/* ---------- settings ---------- */
.operation-switch { min-width: 8rem; gap: .6rem; justify-content: center; }
.operation-track { display: inline-flex; align-items: center; direction: ltr; width: 2.8rem; height: 1.55rem; padding: .2rem; border-radius: 1rem; background: #ad3d42; }
.operation-track::after { content: ''; width: 1.15rem; height: 1.15rem; border-radius: 50%; background: white; }
.operation-switch[aria-checked=true] .operation-track { background: #167344; }
.operation-switch[aria-checked=true] .operation-track::after { transform: translateX(1.25rem); }
.settings { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s4); align-items: start; }
.settings-picker { display: none; }
@container main (max-width: 37rem) {
  .settings > .tabs { display: none; }
  .settings-picker { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: var(--s1) var(--s2); }
  .settings-picker label { grid-column: 1 / -1; }
}
.tabs { display: flex; flex-wrap: wrap; gap: .4rem; }
.tabs a { display: flex; gap: var(--s2); align-items: center; padding: .4rem var(--s3); min-height: 2.5rem; border-radius: var(--r2); text-decoration: none; color: var(--ink); font-weight: 600; background: var(--card); border: 1px solid var(--line); white-space: nowrap; } .tabs a .ic { color: var(--side-ic); width: 1.2rem; height: 1.2rem; }
.tabs a:hover { border-color: #9fb0bd; } .tabs a.on { background: var(--sea); border-color: var(--sea); color: #fff; } .tabs a.on .ic { color: #fff; }
.panel { max-width: 46rem; }
@container main (min-width: 58rem) { .settings { grid-template-columns: 14rem minmax(0, 1fr); } .tabs { flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: var(--r3); padding: var(--s2); box-shadow: var(--shadow); } .tabs a { border-color: transparent; background: none; } }
.lines3 { display: grid; gap: var(--s2) var(--s3); grid-template-columns: minmax(0, 1fr) minmax(5.5rem, 8rem) minmax(8rem, 11rem); align-items: center; } .lines3 > * { margin: 0; }
.userrow { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; padding: var(--s2) 0; border-bottom: 1px solid #edf1f5; } .userrow b { min-width: 0; overflow-wrap: break-word; }
.perms { display: grid; gap: var(--s2); grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr)); } label.check.perm { align-items: flex-start; padding: var(--s3); border: 1px solid var(--line2); border-radius: var(--r2); cursor: pointer; } label.check.perm > input { margin-top: var(--s1); } .perm span { display: flex; flex-direction: column; min-width: 0; } .perm small { color: var(--muted); font-size: .875rem; } label.check.perm:has(:checked) { border-color: var(--sea); background: var(--soft); }

/* ---------- chart ---------- */
.chart { display: flex; gap: var(--s2); height: 14rem; direction: ltr; padding-top: .4rem; }
.yaxis { display: flex; flex-direction: column; justify-content: space-between; padding-bottom: 1.6rem; color: var(--muted); font-size: .8rem; font-variant-numeric: tabular-nums; text-align: right; }
.plot { flex: 1; min-width: 0; display: flex; gap: 2px; border-bottom: 1px solid #c2ccd5; margin-bottom: 1.6rem; background: linear-gradient(#e9eef2, #e9eef2) 0 0 / 100% 1px no-repeat, linear-gradient(#e9eef2, #e9eef2) 0 50% / 100% 1px no-repeat; position: relative; }
.col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; position: relative; min-width: 0; outline: 0; cursor: default; }
.col i { display: block; width: min(1.5rem, 70%); background: var(--sea); border-radius: 4px 4px 0 0; }
.col:hover i, .col:focus i { background: var(--sea2); } .col:hover, .col:focus { background: rgba(15, 76, 138, .06); }
.col > span { position: absolute; top: 100%; margin-top: .25rem; font-size: .8rem; color: var(--muted); white-space: nowrap; }
.tip { display: none; position: absolute; top: 0; left: 50%; transform: translateX(-50%); z-index: 5; background: #10243d; color: #fff; border-radius: var(--r2); padding: var(--s2) var(--s3); font-size: .85rem; white-space: nowrap; direction: rtl; text-align: right; box-shadow: var(--shadow2); pointer-events: none; }
.tip b { display: block; font-size: 1rem; } .col:hover .tip, .col:focus .tip { display: block; } .col:nth-child(-n+3) .tip { left: 0; transform: none; } .col:nth-last-child(-n+3) .tip { left: auto; right: 0; transform: none; }

/* ---------- point of sale ---------- */
.pos { display: grid; grid-template-columns: minmax(0, 1fr) clamp(17.5rem, 34cqi, 25rem); gap: var(--s4); height: 100%; min-height: 0; }
.goods { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.searchwrap { position: relative; flex: none; } .searchwrap .ic { position: absolute; right: 1rem; top: 50%; transform: translateY(-50%); width: 1.35rem; height: 1.35rem; color: var(--faint); pointer-events: none; }
.search { font-size: 1.12rem; height: 3.2rem; padding: 0 3rem 0 1rem; border-radius: var(--r3); box-shadow: var(--shadow); }
.cats { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: var(--s2); flex: none; } .cats .chip { font-size: .95rem; min-height: 2.3rem; padding: .1rem var(--s4); font-weight: 700; color: var(--ink); }
.tiles { flex: 1; min-height: 0; overflow: hidden auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 9.6rem), 1fr)); gap: var(--s2); margin-top: var(--s2); align-content: start; grid-auto-rows: max-content; padding: 3px; }
.tile { font: inherit; text-align: right; background: #fff; border: 1.5px solid var(--line); border-right: 4px solid var(--sea); border-radius: var(--r3); padding: var(--s2) var(--s3); cursor: pointer; position: relative; display: flex; flex-direction: column; min-height: 6.4rem; min-width: 0; color: var(--ink); box-shadow: var(--shadow); transition: box-shadow .12s, border-color .12s; }
.tile em { position: absolute; left: var(--s2); top: var(--s2); font: 700 .82rem/1.5 UI; background: #eef2f5; color: var(--muted); border-radius: .4rem; padding: 0 .4rem; }
.tile b { font-size: 1.07rem; line-height: 1.35; padding-left: 2.2rem; overflow-wrap: break-word; } .tile small { color: var(--muted); font-size: .87rem; line-height: 1.4; } .tile strong { margin-top: auto; padding-top: .2rem; color: var(--sea2); font-size: 1.12rem; white-space: nowrap; }
.tile img { width: 100%; height: 5.2rem; object-fit: cover; border-radius: .55rem; margin-bottom: .35rem; background: #eef2f5; } .tile.pic { padding: .4rem .4rem var(--s2); } .tile.pic > :not(img, em) { padding-inline: .35rem; } .tile.pic b { padding-left: 0; } .tile.pic em { left: .65rem; top: .65rem; background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .25); } .tile.extra { border-right-color: var(--coral); }
.tile:hover { box-shadow: 0 .4rem 1rem rgba(15, 31, 42, .1); border-color: #9fb0bd; border-right-color: var(--sea); } .tile.extra:hover { border-right-color: var(--coral); }
.tile.hit { border-color: var(--sea); background: var(--soft); box-shadow: 0 0 0 3px rgba(15, 76, 138, .16); }
.keys { color: var(--muted); font-size: .87rem; margin: var(--s2) 0 0; display: flex; gap: .2rem var(--s4); flex-wrap: wrap; flex: none; } .keys span { white-space: nowrap; }
.cart { background: #fff; border: 1px solid var(--line); border-radius: 1rem; padding: var(--s3) var(--s4); display: flex; flex-direction: column; min-height: 0; min-width: 0; overflow: hidden auto; box-shadow: var(--shadow); container: cart / inline-size; }
.cart > * { flex: none; }
.held { display: flex; gap: .3rem; flex-wrap: wrap; margin-bottom: var(--s2); max-height: 4.8rem; overflow: hidden auto; }
.emptycart { margin: auto; text-align: center; color: var(--muted); } .emptycart .ic { width: 3.5rem; height: 3.5rem; color: #c2ced8; stroke-width: 1.4; }
.lines { flex: 1 1 5rem !important; min-height: 4.5rem; overflow: hidden auto; margin: 0 -.25rem; padding: 0 .25rem; }
.line { border-bottom: 1px solid #edf1f5; padding: var(--s2) .1rem; } .line.short { background: #fffbeb; border-radius: var(--r1); padding: var(--s2); }
.lh, .ld, .ls { display: flex; justify-content: space-between; align-items: center; gap: var(--s2); } .lh b { min-width: 0; overflow-wrap: break-word; line-height: 1.35; }
.ld { flex-wrap: wrap; } .ld strong { font-variant-numeric: tabular-nums; white-space: nowrap; margin-right: auto; }
.ls { color: var(--muted); font-size: .88rem; }
.x { border: 0; background: none; color: var(--faint); cursor: pointer; border-radius: .4rem; display: grid; place-items: center; width: 2rem; height: 2rem; flex: none; padding: 0; } .x:hover { background: var(--badbg); color: var(--bad); }
.qtyedit { border: 1px dashed #a9b8c4; background: #f8fafb; border-radius: var(--r1); font: inherit; font-size: .92rem; cursor: pointer; min-height: 2rem; padding: 0 var(--s2); color: var(--ink); } .qtyedit:hover { border-color: var(--sea); }
.lsvc { display: flex; gap: .3rem; flex-wrap: wrap; margin-top: .35rem; }
.chip { font: 600 .87rem/1.3 UI; border: 1px solid var(--line2); background: #fff; border-radius: 2rem; min-height: 1.95rem; padding: 0 .65rem; cursor: pointer; color: var(--muted); white-space: nowrap; } .chip:hover { border-color: var(--sea); } .chip.on { background: var(--sea) !important; color: #fff !important; border-color: var(--sea); }
.warnline { color: var(--warn); font-size: .87rem; margin-top: .2rem; }
.sum { border-top: 1px dashed var(--line2); margin-top: var(--s2); padding-top: var(--s2); } .sum div { display: flex; justify-content: space-between; gap: var(--s2); color: var(--muted); flex-wrap: wrap; } .sum .total { font-size: clamp(1.2rem, 7.5cqi, 1.75rem); font-weight: 700; color: var(--ink); align-items: baseline; } .sum .total span { white-space: nowrap; } .sum .total span:first-child { font-size: 1rem; color: var(--muted); }
.cart .row { margin-top: var(--s2); } .cart .row > * { flex: 1 1 0; min-width: max-content; } .cart .row .btn { width: 100%; padding-inline: var(--s2); }
.donebox { margin: auto; text-align: center; width: 100%; } .donebox .ok { width: 3.6rem; height: 3.6rem; border-radius: 50%; background: var(--goodbg); color: var(--good); display: grid; place-items: center; margin: 0 auto var(--s2); } .donebox .ok .ic { width: 2rem; height: 2rem; } .donebox h2 { color: var(--good); font-size: 1.35rem; } .donebox .total { font-size: clamp(1.5rem, 11cqi, 2.4rem); font-weight: 700; }
.change { font-size: 1.1rem; font-weight: 600; color: var(--good); min-height: 1.7rem; margin: .3rem 0; } .change.bad { color: var(--bad); }
.switchrow { display: flex; flex-wrap: wrap; gap: var(--s3); align-items: center; justify-content: space-between; padding: var(--s3) 0; border-top: 1px solid var(--line); } .switchrow > div { flex: 1 1 18rem; min-width: 0; } .switchrow p { margin: .3rem 0 0; }
.payhead { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 0 var(--s3); margin-bottom: var(--s3); color: var(--muted); } .payhead b { font-size: clamp(1.4rem, 7vw, 2.1rem); color: var(--ink); white-space: nowrap; }
label.big input { font-size: 1.6rem; font-weight: 700; text-align: center; height: 3.4rem; }
.svcs { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr)); gap: var(--s2); margin-top: var(--s3); }
.svc { position: relative; } .svc span { display: block; border: 1.5px solid var(--line2); border-radius: .75rem; padding: .4rem var(--s3); font-weight: 600; } .svc small { display: block; color: var(--muted); font-weight: 400; font-size: .85rem; }
.svc input:checked + span { border-color: var(--sea); background: var(--soft); box-shadow: inset 0 0 0 1px var(--sea); }
@media (max-height: 40em) { .keys { display: none; } .search { height: 2.7rem; } .btn.big { min-height: 2.6rem; } .cart { padding-block: var(--s2); } .tile { min-height: 5.4rem; } label.big input { height: 2.8rem; font-size: 1.35rem; } dialog { padding: var(--s4) var(--s5); } dialog > form:last-child > .row:last-child { bottom: calc(-1 * var(--s4)); margin: 0 calc(-1 * var(--s5)) calc(-1 * var(--s4)); padding: var(--s2) var(--s5); } }

/* ---------- login ---------- */
.login { width: min(27rem, 100%); padding: 1.6rem; border-radius: 1.25rem; box-shadow: var(--shadow2); border: 0; margin: 0; } .login h1 { text-align: center; margin: var(--s2) 0 var(--s1); font-size: 1.3rem; } .login .logo { margin: 0 auto; width: 3.2rem; height: 3.2rem; border-radius: 1rem; } .login .logo .ic { width: 1.8rem; height: 1.8rem; }
.pinpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s2); direction: ltr; } .pinpad button { font: 600 1.35rem/1 UI; height: 3rem; border-radius: .75rem; border: 1px solid var(--line2); background: #fff; cursor: pointer; color: var(--ink); } .pinpad button:hover { background: #f3f6f8; } .pinpad button:active { background: var(--soft); }
#pin { text-align: center; font-size: 1.6rem; letter-spacing: .6rem; direction: ltr; }
@media (max-height: 46em) { .login { padding: var(--s4) var(--s5); } .login .logo { display: none; } .pinpad button { height: 2.5rem; } .login .stack > * { margin-bottom: var(--s2); } }

/* ---------- other pieces ---------- */
.buy-form { display: grid; gap: var(--s4); }
.buy-form .card { margin: 0; }
.buy-form h2 { margin: 0; font-size: 1.12rem; }
.buy-form fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.buy-form legend { padding: 0; font-size: .95rem; font-weight: 700; }
.buy-origin, .buy-settlement, .buy-pay-fields { display: grid; gap: var(--s4); }
.buy-label, .buy-heading, .buy-actions { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); }
.buy-label { margin-bottom: .3rem; }
.buy-link { background: var(--soft); border: 0; border-radius: var(--r1); min-height: 2.1rem; padding: .2rem .65rem; color: var(--sea); font: inherit; font-size: .88rem; font-weight: 700; cursor: pointer; }
.buy-heading { flex-wrap: wrap; margin-bottom: var(--s3); }
.buy-heading .btn { color: var(--sea); }
#plines { display: grid; gap: var(--s2); margin-bottom: var(--s3); }
.pl { padding: var(--s3); border: 1px solid var(--line); background: var(--bg); border-radius: var(--r2); }
.buy-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s2) var(--s3); align-items: end; }
.buy-product { grid-column: 1 / -1; }
.buy-product-input { display: flex; gap: .35rem; margin-top: .3rem; }
.buy-product-input .filter { margin: 0; width: 40%; }
.buy-product-input select { flex: 1; }
.buy-fixed-unit { display: flex; align-items: center; height: var(--ctl); margin-top: .3rem; color: var(--muted); font-weight: 500; }
.buy-fields .delpl { justify-self: end; height: var(--ctl); padding: 0 .65rem; color: var(--muted); }
.buy-fields .delpl:hover { color: var(--bad); }
.pl [data-pack-hint]:not(:empty), .buy-allocation { display: block; margin-top: var(--s2); }
.pl [data-pack-hint] { color: var(--sea); font-weight: 600; }
.pl [data-pack-hint]:empty { display: none; }
.buy-allocation { border-top: 1px solid var(--line); padding-top: var(--s2); }
.buy-allocation label { display: inline-flex; gap: var(--s2); align-items: center; flex-wrap: wrap; }
.buy-allocation input { width: 6rem; margin: 0; }
.buy-allocation small { margin-inline-start: .6rem; }
.buy-payment { display: grid; gap: var(--s3); align-content: start; }
.buy-payment > h2:first-child, .buy-summary > h2:first-child { margin-bottom: 0; }
.buy-payment details { border-top: 1px solid var(--line); }
.buy-payment [data-credit-choice] { padding: .7rem; border: 1px solid var(--line); border-radius: .6rem; }
.buy-payment [data-credit-field] { margin-top: .6rem; }
.buy-summary [data-credit-closing] dd { color: var(--good); }
.buy-summary dl { margin: var(--s3) 0; }
.buy-summary dl > div { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s2); padding: .25rem 0; }
.buy-summary dt { color: var(--muted); }
.buy-summary dd { margin: 0; font-variant-numeric: tabular-nums; font-weight: 700; }
.buy-summary .buy-due { border-top: 1px solid var(--line); margin-top: .35rem; padding-top: .55rem; }
.buy-due dt, .buy-due dd { color: var(--sea2); font-weight: 700; }
.buy-actions .primary { flex: 1; }
@container main (min-width: 38rem) {
  .buy-origin, .buy-settlement { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); align-items: start; }
  .buy-fields { grid-template-columns: repeat(4,minmax(0,1fr)) auto; }
}
@container main (min-width: 58rem) {
  .buy-fields { grid-template-columns: minmax(0,2.4fr) repeat(4,minmax(0,1fr)) auto; }
  .buy-product { grid-column: auto; }
  .buy-pay-fields:has([data-partial]:not([hidden])) { grid-template-columns: minmax(0,1fr) minmax(0,2fr); align-items: end; }
}
.receipt { max-width: 20rem; width: 100%; border: 1px solid var(--line); border-radius: var(--r1); background: #fff; box-shadow: var(--shadow); justify-self: center; }
.paperdlg { max-width: 26rem; } .paperdlg .receipt { display: block; max-height: 60vh; object-fit: contain; margin: var(--s3) auto; }
.ordercard { display: flex; gap: var(--s1) var(--s3); align-items: center; background: #fff; border: 1px solid var(--line); border-right: 5px solid var(--sea); border-radius: var(--r3); padding: var(--s3) var(--s4); margin-bottom: var(--s2); text-decoration: none; color: inherit; flex-wrap: wrap; box-shadow: var(--shadow); } .ordercard:hover { box-shadow: 0 .4rem 1rem rgba(15, 31, 42, .1); }
.ordercard.new { border-right-color: var(--sun); background: #fffbeb; }
.otimer { display: inline-flex; align-items: center; gap: var(--s1); background: var(--soft); color: var(--sea2); border-radius: 2rem; padding: 0 var(--s3); font-weight: 700; white-space: nowrap; min-height: 2rem; } .otimer .ic { width: 1.1rem; height: 1.1rem; } .otimer .clock { font-variant-numeric: tabular-nums; direction: ltr; } .otimer.slow { background: var(--warnbg); color: var(--warn); } .otimer.late { background: var(--badbg); color: var(--bad); }
.phone { font-size: 1.3rem; font-weight: 700; direction: ltr; display: inline-block; white-space: nowrap; } .phone.s { font-size: 1.08rem; }
/* ---------- pictures ---------- */
.thumb { width: 3rem; height: 3rem; padding: 0; border: 1.5px dashed var(--line); border-radius: .6rem; background: #f7f9fb; color: var(--muted); cursor: pointer; display: grid; place-items: center; overflow: hidden; } .thumb:hover { border-color: var(--sea); color: var(--sea); } .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; } .thumb:has(img) { border-style: solid; } .withthumb { display: flex; gap: var(--s2); align-items: center; } .withthumb .thumb { flex: none; width: 2.6rem; height: 2.6rem; } .photobox { display: grid; grid-template: minmax(0, 1fr) / minmax(0, 1fr); place-items: center; height: 14rem; border: 1.5px dashed var(--line); border-radius: var(--r3); background: #f7f9fb; overflow: hidden; } .photobox img { width: 100%; height: 100%; min-height: 0; object-fit: contain; } .photobox p { margin: 0; }
@media (max-height: 40em) { .tile img { height: 3.4rem; } .photobox { height: 8rem; } }
/* ---------- order steps ---------- */
.ostep { list-style: none; display: flex; gap: var(--s1); margin: 0 0 var(--s3); padding: 0; } .ostep li { flex: 1 1 0; min-width: 0; text-align: center; font-size: .9rem; color: var(--muted); font-weight: 600; line-height: 1.35; } .ostep i { display: block; height: .45rem; border-radius: 1rem; background: #dfe6ee; margin-bottom: .35rem; } .ostep .done { color: var(--sea2); } .ostep .done i { background: var(--sea); } .ostep .now { font-weight: 800; } .ostep .now i { background: var(--coral); }
.task { border: 1px solid var(--line); border-radius: var(--r3); padding: var(--s3) var(--s4); margin-top: var(--s3); } .task > h3 { margin: 0 0 var(--s2); display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; } .task > h3 i { font: 700 .9rem/1.6rem UI; width: 1.6rem; height: 1.6rem; border-radius: 50%; background: #eef2f5; color: var(--muted); text-align: center; flex: none; } .task > h3 i:empty { display: none; } .task.ok { border-color: #b9e2c8; background: #f6fcf8; } .task.ok > h3 i { background: var(--good); color: transparent; position: relative; } .task.ok > h3 i::after { content: '✓'; color: #fff; position: absolute; inset: 0; } .task .row { margin-top: var(--s2); } .task p { margin: var(--s2) 0 0; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
/* ---------- clear reports ---------- */
.period .btn.small.on:not(.primary) { background: var(--soft); color: var(--sea2); border-color: var(--sea); }
a.stat { text-decoration: none; color: inherit; } a.stat:hover { border-color: var(--sea); } .stat > small { display: block; color: var(--muted); font-size: .85rem; line-height: 1.45; margin-top: .15rem; }
.notes .note { display: flex; gap: var(--s3); align-items: center; padding: .55rem 0; border-top: 1px solid var(--line); text-decoration: none; color: inherit; } .notes h2 + .note { border-top: 0; } .notes .note i { width: .7rem; height: .7rem; border-radius: 50%; background: var(--sea); flex: none; } .notes .note.warn i { background: var(--sun); } .notes .note.bad i { background: var(--bad); } .notes .note span { flex: 1; min-width: 0; } .notes .note b { color: var(--sea2); white-space: nowrap; border: 1px solid var(--line2); border-radius: var(--r2); padding: .15rem .7rem; background: #fff; font-size: .92rem; } .notes .note:hover b { border-color: var(--sea); }
.equation { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s3); align-items: center; margin: var(--s2) 0 var(--s3); } .equation span { border: 1px solid var(--line); border-radius: var(--r2); padding: .4rem .9rem; background: #f9fbfd; } .equation small { display: block; color: var(--muted); font-size: .85rem; } .equation b { font-size: 1.25rem; white-space: nowrap; } .equation em { font: 700 1.3rem/1 UI; color: var(--muted); } .equation .res { background: var(--sea); border-color: var(--sea); color: #fff; } .equation .res small { color: #d5e5f7; } .equation .res b { font-size: 1.5rem; } .equation .res.loss { background: var(--bad); border-color: var(--bad); }
/* ---------- what remains ---------- */
.tile .left { font-size: .84rem; font-weight: 700; color: var(--good); line-height: 1.4; overflow-wrap: break-word; } .tile .left.warn { color: var(--warn); } .tile .left.bad { color: var(--bad); } .tile .left.none { color: var(--muted); font-weight: 500; }
.qtyleft { margin: 0 0 var(--s2); font-weight: 700; color: var(--good); } .qtyleft:empty { display: none; } .qtyleft.warn { color: var(--warn); } .qtyleft.bad { color: var(--bad); }
.leftline { font-size: .86rem; color: var(--muted); }
.have { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); align-items: center; background: var(--soft); border-radius: var(--r2); padding: .5rem var(--s3); } .have b { color: var(--sea2); }
.addqty { border: 1px solid var(--line); border-radius: var(--r3); padding: var(--s3); } .addqty .pick { margin-top: var(--s2); } .addqty p { margin: var(--s2) 0 0; }
/* ---------- supplier and customer page ---------- */
.party { display: flex; flex-wrap: wrap; gap: var(--s3) var(--s4); align-items: center; } .party .avatar { width: 3.4rem; height: 3.4rem; border-radius: 50%; background: var(--sea); color: #fff; font-size: 1.45rem; font-weight: 800; display: grid; place-items: center; flex: none; } .party .who { display: block; flex: 1 1 14rem; min-width: 0; } .party .who h2 { margin: 0; overflow-wrap: break-word; } .party .who p { margin: .15rem 0 0; overflow-wrap: break-word; } .party .acts2 { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; }
/* A stat measures itself, so in a flexible row it needs a width of its own. */
.bar > .stat { flex: 0 1 15rem; }
/* ---------- the shop's page on the website ---------- */
.panel:has(.store-profile) { max-width: 60rem; min-width: 0; }
.store-profile, .profile-section, .payment-method { display: grid; gap: var(--s4); }
.store-profile .profile-section { margin: 0; }
.profile-section header { padding-bottom: var(--s3); border-bottom: 1px solid var(--line); }
.profile-section header p { margin: var(--s1) 0 0; }
.profile-section :is(label, h3) { margin: 0; }
.profile-section label > small { font-size: .85rem; font-weight: 400; color: var(--muted); }
.profile-section textarea { display: block; height: auto; min-height: 4.6rem; margin-top: .3rem; padding: var(--s2) var(--s3); resize: vertical; }
.profile-section textarea:focus-visible, .profile-image:focus-visible { outline: 2px solid var(--sea); outline-offset: 2px; }
.profile-media, .profile-hours, .profile-methods { display: grid; gap: var(--s3); grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); }
.profile-methods { grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr)); }
.profile-image { display: flex; align-items: center; gap: var(--s3); min-width: 0; padding: var(--s2) var(--s3); text-align: start; font: inherit; color: var(--ink); background: #fff; border: 1px solid var(--line2); border-radius: var(--r2); cursor: pointer; }
.profile-image:hover { border-color: var(--sea); background: #f7faff; }
.profile-image b, .profile-image small { display: block; }
.profile-image small { color: var(--sea); }
.profile-thumb { display: grid; grid-template: minmax(0, 1fr) / minmax(0, 1fr); place-items: center; flex: none; width: 3rem; height: 3rem; overflow: hidden; border-radius: var(--r1); background: var(--soft); color: var(--sea); }
.profile-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.profile-thumb.landscape { width: 4rem; }
.payment-method { align-content: start; gap: var(--s3); padding: var(--s4); border: 1px solid var(--line); background: #f8fafc; border-radius: var(--r2); min-width: 0; }
.payment-method h3 { display: flex; align-items: center; gap: var(--s2); }
.payment-method h3 .ic { color: var(--sea); }
.payment-method .payment-url { min-height: var(--ctl); overflow-wrap: anywhere; field-sizing: content; }
.payment-code .profile-thumb { width: 3.5rem; height: 3.5rem; }
.payment-code img { object-fit: contain; background: #fff; }
.store-profile > footer { display: flex; justify-content: end; }
@container main (max-width: 37rem) {
  .store-profile > footer .btn { width: 100%; white-space: normal; }
}
fieldset { border: 1px solid var(--line); border-radius: var(--r3); padding: var(--s3) var(--s4); margin: 0; min-width: 0; } legend { font-weight: 700; padding: 0 var(--s2); }
.msgitem { border-bottom: 1px solid var(--line); padding: var(--s3) 0; } .msgitem:last-child { border-bottom: 0; } .msgitem p { white-space: pre-line; }
a.pill { text-decoration: none; } .pill.warn { background: var(--warnbg); color: var(--warn); }
.lockcard { max-width: 34rem; margin: 3rem auto; text-align: center; padding: var(--s6); } .lockcard h1 { margin: var(--s3) 0; } .lockcard .row { justify-content: center; } .lockic { display: inline-grid; place-items: center; width: 4.5rem; height: 4.5rem; border-radius: 50%; background: var(--badbg); color: var(--bad); } .lockic .ic { width: 2.2rem; height: 2.2rem; }
/* Website order queue and searchable history */
.order-queue, .orders-archive { margin-block: var(--s4); min-width: 0; }
.queue-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s4); }
.queue-filters { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1); }
.queue-filters button { display: inline-flex; align-items: center; gap: .45rem; min-height: 2.6rem; padding: .35rem .75rem; background: var(--card); border: 1px solid var(--line2); border-radius: var(--r2); color: var(--ink); font: inherit; font-weight: 650; cursor: pointer; }
.queue-filters b { color: var(--muted); font-variant-numeric: tabular-nums; }
.queue-filters [aria-pressed=true] { background: var(--sea); border-color: var(--sea); color: #fff; }
.queue-filters [aria-pressed=true] b { color: inherit; }
.archive-search, .archive-tools { display: flex; align-items: center; gap: var(--s3); }
.queue-search { position: relative; flex: 1 1 14rem; max-width: 23rem; }
.queue-table td { padding-block: .55rem; vertical-align: middle; }
.queue-table td small { display: block; color: var(--muted); font-size: .82rem; }
.queue-table tbody tr:focus-within, .queue-table tbody tr:hover { background: #f6f9fd; }
.queue-status { display: inline-block; padding: .15rem .65rem; border-radius: 1rem; font-size: .88rem; font-weight: 700; background: var(--soft); color: var(--sea2); }
.queue-status.status-new { background: var(--warnbg); color: var(--warn); }
.queue-status.status-ready, .queue-status.status-out { background: var(--goodbg); color: var(--good); }
.queue-money, [data-deadline] { font-variant-numeric: tabular-nums; }
.queue-money { font-weight: 700; white-space: nowrap; }
.queue-table .queue-action { color: var(--sea); font-weight: 700; }
.queue-table .deadline-late { color: var(--bad); }
.queue-empty { padding: var(--s5); text-align: center; color: var(--muted); background: var(--card); border: 1px solid var(--line); border-radius: var(--r3); }
.orders-archive { background: var(--card); padding: var(--s5); border: 1px solid var(--line); border-radius: var(--r3); box-shadow: var(--shadow); }
.archive-tools { flex-wrap: wrap; margin-bottom: var(--s4); }
.archive-tools label { display: flex; align-items: center; gap: var(--s2); }
.archive-tools .archive-search { position: relative; flex: 1 1 17rem; max-width: 30rem; }
.archive-search input { width: 100%; padding-inline-start: 2.5rem; }
.archive-search .ic { position: absolute; inset-inline-start: var(--s3); pointer-events: none; color: var(--muted); }
.archive-table { margin-bottom: 0; box-shadow: none; }
.archive-table td small { display: block; color: var(--muted); }
.tracking-link { font-weight: 700; }
.archive-empty { margin: 0; padding-block: var(--s4); color: var(--muted); border-top: 1px solid var(--line); }
@container (max-width: 45rem) {
  .queue-search { max-width: none; }
  .orders-archive { padding: var(--s3); }
}
.report-tabs { display: flex; flex-wrap: wrap; gap: var(--s2); border-bottom: 1px solid var(--line2); margin-bottom: var(--s4); }
.report-tabs a { color: var(--muted); font-weight: 700; text-decoration: none; padding: var(--s2) var(--s4); border-bottom: .18rem solid transparent; }
.report-tabs a[aria-current] { color: var(--sea); border-color: var(--sea); }
.report-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s3); }
.report-head h2, .report-head .bar { margin: 0; }
.report-head small, .report-sub { color: var(--muted); }
.report-sub { display: block; }
.report-kpis { grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr)); }
.stat.report-net { color: white; background: var(--sea2); }
.stat.report-net span, .stat.report-net b { color: white; }
.report-columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); gap: var(--s4); align-items: start; }
.report-ledger { display: grid; grid-template-columns: 1fr auto; margin: 0; }
.report-ledger :is(dt, dd) { margin: 0; border-bottom: 1px solid var(--line); padding-block: var(--s2); }
.report-ledger dd { direction: ltr; font-variant-numeric: tabular-nums; text-align: left; }
.report-search { align-items: end; }
.fixedfee { display: flex; align-items: center; gap: var(--s2); min-height: var(--ctl); white-space: nowrap; }
.stock-balance-edit { display: inline-flex; align-items: center; gap: .4rem; min-height: 2.1rem; padding: .15rem .4rem; border: 1px solid transparent; border-radius: var(--r1); color: inherit; background: transparent; font: inherit; cursor: pointer; }
.stock-balance-edit .ic { width: .9rem; height: .9rem; color: var(--sea); }
.stock-balance-edit:hover, .stock-balance-edit:focus-visible { background: var(--soft); border-color: var(--line2); }
.merchant-heading, .merchant-order-tools, .merchant-login header { display: flex; align-items: center; gap: var(--s3); min-width: 0; }
.merchant-nav-open.btn, .merchant-nav-close.btn { display: none; }
.merchant-order-tools { flex-wrap: wrap; margin-bottom: var(--s3); }
.merchant-order-tools .btn { color: var(--sea); }
.merchant-login header { border-bottom: 1px solid var(--line); padding-bottom: var(--s4); margin-bottom: var(--s5); }
.merchant-login header .logo { display: grid; margin: 0; flex: none; }
.merchant-login header h1 { text-align: start; margin: 0; }
.merchant-login details { border-top: 1px solid var(--line); padding-top: var(--s2); }
@media (max-width: 44em), (max-width: 58em) and (max-height: 28em) and (pointer: coarse) {
  .shell:has(#merchant-nav[popover]) .merchant-nav-open { display: inline-flex; }
  #merchant-nav[popover]:not(:popover-open) { display: none; }
  #merchant-nav:popover-open { position: fixed; inset: 0 0 0 auto; margin: 0; padding: var(--s3); width: min(20rem, 87vw); height: 100%; max-height: 100%; border: 0; box-shadow: var(--shadow2); }
  #merchant-nav::backdrop { background: rgb(10 28 49 / 42%); }
  #merchant-nav:popover-open .merchant-nav-close { display: inline-flex; align-self: flex-end; }
  #merchant-nav:popover-open .brand, #merchant-nav:popover-open .who { flex-direction: row; justify-content: start; }
  #merchant-nav:popover-open :is(.grp, .brand > div, .who > div) { display: block; }
  #merchant-nav:popover-open .links a { flex-direction: row; text-align: start; min-height: var(--ctl); gap: var(--s3); padding-inline: var(--s3); font-size: 1rem; }
  #merchant-nav:popover-open .badge:not(:empty) { position: static; margin-inline-start: auto; }
}

.pos-sections, .pos-category, .btn.sync-toggle { display: none; }
@media screen and (max-width: 44em), (max-width: 58em) and (max-height: 28em) and (pointer: coarse) {
  body { height: 100dvh; }
  .shell { padding-inline: env(safe-area-inset-right) env(safe-area-inset-left); }
  .top { gap: .35rem; padding: max(.45rem, env(safe-area-inset-top)) .8rem .45rem; }
  .merchant-heading { gap: .6rem; max-width: 100%; }
  .btn.sync-toggle { display: inline-flex; min-height: 44px; padding-inline: .55rem; margin-inline-start: auto; }
  #status { width: 100%; }
  .sync-toggle[aria-expanded=false] ~ #status .sync-detail { display: none; }
  #main { scroll-padding-block: .8rem 2rem; }
  main#main { padding: .8rem .75rem max(1rem, env(safe-area-inset-bottom)); }
  .card, .settings .card { padding: .9rem; }
  #merchant-nav:popover-open { height: 100dvh; padding-bottom: max(.75rem, env(safe-area-inset-bottom)); padding-top: max(.75rem, env(safe-area-inset-top)); }
  #merchant-nav .links { overscroll-behavior: contain; }
  :is(input:not([type=checkbox],[type=radio]), select, textarea) { font-size: max(16px, 1em); max-width: 100%; }
  .btn, .btn.small, .chip, .iconbtn, .stock-balance-edit, .qtyedit, .line .x, .tabs a { min-height: 44px; }
  .iconbtn, .line .x { min-width: 44px; }
  dialog { max-height: calc(100dvh - 1rem); overscroll-behavior: contain; }
  .pos { display: flex; flex-direction: column; gap: .65rem; }
  .pos-sections { display: flex; gap: .35rem; flex: none; padding: .25rem; background: var(--soft); border-radius: var(--r2); }
  .pos-sections button { flex: 1; background: transparent; border-color: transparent; }
  .pos-sections button[aria-pressed=true] { background: white; border-color: var(--line2); color: var(--sea); box-shadow: var(--shadow); }
  .pos-sections [data-cart-count] { padding-inline: .5rem; border-radius: 1rem; background: var(--soft); }
  .pos .goods, .pos .cart { flex: 1; }
  .pos .cats { display: none; }
  .pos-category { display: flex; align-items: center; gap: .75rem; margin: .4rem 0 0; }
  .pos-category select { flex: 1; margin: 0; }
  .pos:not(.show-cart) .cart, .pos.show-cart .goods, .pos .keys, .pos button kbd { display: none; }
  .pos .tiles { grid-template-columns: repeat(auto-fill, minmax(min(100%, 8rem), 1fr)); }
  .pos .cart, .pos .lines { overscroll-behavior: contain; }
  .meal-part, .lines3 { grid-template-columns: minmax(0, 1fr) auto; }
  .meal-part > :first-child, .lines3 > :first-child { grid-column: 1 / -1; }
  .stacked td.acts { white-space: normal; }
  .stacked td.acts .btn { padding-inline: .5rem; }
  .stacked td.item-actions { display: grid; grid-template-columns: minmax(0, 1.5fr) repeat(2, minmax(0, 1fr)); gap: .3rem; }
  .stacked td.item-actions .btn { padding-inline: .25rem; gap: .2rem; }
  .settings .bar > label { display: grid; width: 100%; gap: .25rem; white-space: normal; }
  .settings .bar > label :is(input, select) { width: 100%; min-width: 0; }
  .notes .note { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .4rem .65rem; }
  .notes .note b { grid-column: 2; justify-self: start; }
}

.inventory { container-type: inline-size; display: flex; flex-wrap: wrap; align-items: center; gap: .8rem; }
.inv-head, .inv-list, .inv-filters { background: var(--card); border: 1px solid var(--line); border-radius: var(--r3); }
.inv-head { width: 100%; display: flex; align-items: center; flex-wrap: wrap; gap: .6rem 1.25rem; padding: .8rem 1rem; }
.inv-search-group { flex: 1 1 16rem; max-width: 32rem; }
.inv-search-group label { font-weight: 700; }
.inv-search { position: relative; }
.inv-search span { position: absolute; inset-inline-start: .8rem; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.inv-search input { width: 100%; padding-inline-start: 2.6rem; }
.inv-total { margin-inline-start: auto; color: var(--muted); }
.inv-total b { color: var(--ink); display: block; }
.inv-ops { margin-inline-start: auto; }
.inv-total + .inv-ops { margin-inline-start: 0; }
.inv-ops summary, .inv-period summary { width: fit-content; max-width: 100%; cursor: pointer; color: var(--sea); border: 1px solid var(--line2); border-radius: var(--r2); padding: .45rem .8rem; font-weight: 650; background: var(--card); }
.inv-ops[open] { flex-basis: 100%; }
.inv-ops .row { margin-top: .5rem; flex-wrap: wrap; }
.inv-heading, .inv-pager { display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem .85rem; }
.inv-heading h2 { margin: 0; }
.inv-period { margin-inline-start: auto; }
.inv-period[open] { flex-basis: 100%; }
.inv-period b { font-variant-numeric: tabular-nums; margin-inline-start: .4rem; }
.inv-period .period { margin: .5rem 0 0; }
.inv-list { width: 100%; overflow: clip; }
.inv-columns, .inv-row-main { display: grid; grid-template-columns: minmax(0,1.8fr) repeat(2,minmax(0,1fr)) minmax(13.5rem,1.2fr); align-items: center; gap: .6rem; padding: .6rem 1rem; }
.inv-columns { background: var(--soft); color: var(--sea2); font-size: .9rem; font-weight: 700; }
.inv-row { border-top: 1px solid var(--line); }
.inv-row-main strong { display: block; overflow-wrap: anywhere; }
.inv-row-main small { color: var(--muted); }
.inv-balance { font-variant-numeric: tabular-nums; }
.inv-balance > small { display: none; }
.inv-balance .inv-short { color: var(--bad); background: var(--badbg); border-radius: .4rem; padding: 0 .35rem; }
.inv-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .35rem; }
.inv-actions .inv-toggle { background: transparent; color: var(--sea); border-color: transparent; }
.inv-toggle:hover, .inv-toggle[aria-expanded=true] { text-decoration: underline; }
.inv-summary { background: var(--bg); padding: .65rem 1rem; }
.inv-summary dl { display: flex; flex-wrap: wrap; gap: .6rem 1.75rem; margin: 0; }
.inv-summary dt { color: var(--muted); font-size: .85rem; }
.inv-summary dd { margin: 0; font-weight: 700; }
.inv-pager { margin-block: 1rem .65rem; }
.inv-filters { padding: 1rem; margin-bottom: .8rem; }
.inv-filters .period { margin: .65rem 0 0; }
.inv-kind { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.inv-kind select { width: auto; max-width: 100%; }
@container (max-width: 42rem) {
  .inv-search-group { flex-basis: 100%; max-width: none; }
  .inv-total { margin-inline-start: 0; }
  .inv-total + .inv-ops { margin-inline-start: auto; }
  .inv-columns { display: none; }
  .inv-row:first-of-type { border-top: 0; }
  .inv-row-main { grid-template-columns: repeat(2,minmax(0,1fr)); padding: .8rem; }
  .inv-row-main > :first-child, .inv-actions { grid-column: 1 / -1; }
  .inv-balance > small { display: block; }
  .inv-period { margin-inline-start: 0; }
}

.supplier-balance { display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: .35rem; padding: .25rem .6rem; border-radius: .5rem; font-weight: 650; background: var(--bg); color: var(--muted); }
.buy-origin [data-supplier-balance] { margin-block-start: .45rem; }
.supplier-balance.owes, .supplier-stat.owes, .buy-summary .buy-due.owes { background: var(--badbg); color: var(--bad); }
.supplier-balance.credit, .supplier-stat.credit, .buy-summary .buy-due.credit { background: var(--goodbg); color: var(--good); }
.supplier-stat:is(.owes,.credit) > :is(span,b), .buy-summary .buy-due:is(.owes,.credit) > * { color: inherit; }
.buy-summary .buy-due { padding: .55rem .65rem; border-radius: .55rem; }
#buy-supplier option.owes { color: var(--bad); }
#buy-supplier option.credit { color: var(--good); }
.order-address { overflow-wrap: anywhere; }
.customer-order-note { background: var(--soft); border-inline-start: 3px solid var(--sea); border-radius: .6rem; padding: .65rem .9rem; margin-block: .7rem; }
.customer-order-note > h3 { margin: 0 0 .2rem; font-size: 1rem; color: var(--sea2); }
.customer-order-note > p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.order-detail { display: grid; gap: var(--s4); grid-template-columns: minmax(0, 1fr); align-items: start; }
.order-detail > .card { margin: 0; }
@container main (min-width: 50rem) {
  .order-detail { grid-template-columns: minmax(0, 1fr) minmax(19rem, 34%); grid-template-rows: auto 1fr; }
  .order-invoice { grid-column: 2; grid-row: 1 / span 2; }
}
.order-invoice-lines { margin: 0; padding: 0; list-style: none; }
.order-invoice-lines li, .order-invoice-delivery { padding-block: var(--s3); border-top: 1px solid var(--line); }
.order-invoice-row { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s3); overflow-wrap: anywhere; }
.order-invoice-row > b { flex: none; font-variant-numeric: tabular-nums; }
.order-invoice-product { display: flex; align-items: center; gap: var(--s2); min-width: 0; }
.order-invoice-product img { flex: none; width: 2.5rem; height: 2.5rem; object-fit: cover; border-radius: var(--r1); }
.order-invoice-meta { display: flex; flex-wrap: wrap; gap: 0 var(--s3); color: var(--muted); font-size: .85rem; margin-top: var(--s1); }
.order-invoice-total { padding: var(--s3); border-radius: var(--r2); color: var(--sea2); background: var(--soft); }
.order-invoice-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 8rem), 1fr)); gap: var(--s2); margin-top: var(--s3); }
