/* Marinno — the shop app (components).
 *
 * Brand tokens live in /css/brand.css, linked before this file. Do not
 * redefine them here.
 *
 * Phone is the real case: this runs inside Telegram on a shop assistant's
 * device, often a cheap one in daylight. Big targets, high contrast, short
 * lines, nothing that depends on hover.
 *
 * From 820px up it becomes a proper desktop layout — the order form splits
 * into a product list and a sticky summary — because shop owners do open this
 * on a PC in the back office, and a 560px column stranded in the middle of a
 * monitor reads as broken.
 */

.frame {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  min-height: 100%;
}

/* --- Type ---------------------------------------------------------------- */

.t-lg {
  font-family: var(--disp);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
  text-wrap: balance;
}

.t-muted { color: var(--text-muted); font-size: 14px; margin: 0; }
.t-faint { color: var(--text-faint); font-size: 12.5px; margin: 0; }

.loading { padding: 56px 20px; text-align: center; color: var(--text-muted); }
.loading-sm { padding: 22px 14px; font-size: 13px; }

/* Size only — brand.css decides which of the two files is shown. */
.brandmark { width: auto; height: 30px; max-width: 100%; }
.brandmark-sm { height: 20px; }

.sec-head {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin: 0 0 7px 2px;
}

/* --- Gate screens -------------------------------------------------------- */

.gate { min-height: 100dvh; display: grid; place-items: center; padding: 24px 18px; }

.gate-card {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 13px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 22px;
  box-shadow: var(--shadow);
  animation: site-rise var(--dur-base) var(--ease-out) both;
}
.gate-card .btn-primary { width: 100%; margin-top: 2px; }

/* The join code is read off a note or repeated down a phone line, so it is set
 * big, monospaced and widely tracked — each character has to be unmistakable. */
.codeinput {
  width: 100%;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-align: center;
  text-transform: uppercase;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 15px 12px;
  min-height: 60px;
  transition: border-color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}
.codeinput::placeholder { color: var(--text-faint); letter-spacing: 0.22em; }
.codeinput:focus { outline: none; border-color: var(--accent); background: var(--surface); }

.alert {
  width: 100%;
  color: var(--red);
  background: var(--red-soft);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  font-size: 13.5px;
  font-weight: 500;
  text-align: left;
  animation: site-err var(--dur-base) var(--ease-out) both;
}

/* --- Shell --------------------------------------------------------------- */

.screen { display: flex; flex-direction: column; min-height: 100dvh; }

.head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  padding-top: max(12px, env(safe-area-inset-top));
  border-bottom: 1px solid var(--hair);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 5;
}
.head-brand { line-height: 0; flex: none; }

.head-shop { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.head-shopname {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.head-who { font-size: 11.5px; color: var(--text-muted); }

.iconback {
  flex: none;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.iconback:active { transform: scale(0.94); }

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px;
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
}

/* --- Order rounds -------------------------------------------------------- */

.rounds {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 15px 16px;
  box-shadow: var(--shadow);
}

.rounds-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 8px;
}
.clock { font-variant-numeric: tabular-nums; letter-spacing: 0.05em; }

.rounds-lead { margin: 0 0 13px; font-size: 14px; color: var(--text-muted); line-height: 1.45; }
.lead-strong { color: var(--text); font-weight: 600; }

.roundlist {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--hair);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.round {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 10px;
  background: var(--surface-2);
  padding: 9px 12px;
  min-height: 52px;
}
/* An open round is the actionable one — lift it out of the sunken list. */
.round.open { background: var(--surface); }

.r-label { font-size: 14px; font-weight: 500; color: var(--text-muted); }
.round.open .r-label { color: var(--text); font-weight: 600; }

.r-cut { font-size: 13.5px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text-faint); }
.round.open .r-cut { color: var(--text); }

.r-state { justify-self: end; }

/* "Buyurtma yo'q": a toggle button. On a phone it sits full width BELOW the round's own button (two pills do not fit on one
 * row); on a wider screen it moves NEXT to it, on its left. Pressed: a grey fill and a tick. */
.btn-skip {
  font-family: var(--ui);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border-strong, var(--border));
  border-radius: var(--radius-pill);
  padding: 7px 14px;
  min-height: 34px;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
.btn-skip:active { transform: scale(0.97); }
.btn-skip.on { color: var(--text); background: var(--gray-soft); border-color: transparent; }
.btn-skip:disabled { opacity: 0.5; }
.btn-skip .sk-short { display: none; }
.round > .btn-skip { grid-column: 1 / -1; width: 100%; min-height: 38px; }
.rounds > .btn-skip { width: 100%; margin-top: 8px; min-height: 40px; }
/* From 380px the two fit on one row: the short word ("Yo'q") stands left of "Buyurtma"; from 520px the whole phrase does. */
@media (min-width: 380px) {
  .round.can-skip { grid-template-columns: 1fr auto auto auto; }
  .round.can-skip > .btn-skip { grid-column: auto; width: auto; min-height: 34px; order: 1; }
  .round.can-skip > .r-state { order: 2; }
  .round > .btn-skip .sk-long { display: none; }
  .round > .btn-skip .sk-short { display: inline; }
}
@media (min-width: 520px) {
  .round > .btn-skip .sk-long { display: inline; }
  .round > .btn-skip .sk-short { display: none; }
}

.btn-round {
  font-family: var(--ui);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--on-accent);
  background: var(--accent);
  border: 0;
  border-radius: var(--radius-pill);
  padding: 7px 14px;
  min-height: 34px;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
.btn-round:active { transform: scale(0.96); background: var(--accent-dark); }

.btn-wide { width: 100%; margin-top: 12px; }

.chip {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 600;
  border-radius: var(--radius-pill);
  padding: 3px 9px;
  white-space: nowrap;
}
.chip-ok { color: var(--green); background: var(--green-soft); }
.chip-wait { color: var(--amber); background: var(--amber-soft); }
.chip-done { color: var(--green); background: var(--green-soft); }
.chip-off { color: var(--text-muted); background: var(--gray-soft); }
.chip-bad { color: var(--red); background: var(--red-soft); }
.chip-late { color: var(--amber); background: var(--amber-soft); margin-left: 5px; }

/* Sending late is possible, not encouraged — so it gets the quiet outline
 * treatment rather than the filled brand pill an open round earns. */
.btn-round-late {
  color: var(--amber);
  background: transparent;
  border: 1px solid var(--amber);
}
.btn-round-late:active { background: var(--amber-soft); }

/* --- Order history ------------------------------------------------------- */

.olist {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--hair);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.orow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  text-align: left;
  font-family: var(--ui);
  background: var(--surface);
  border: 0;
  padding: 12px 15px;
  min-height: 56px;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out);
}
.orow:active { background: var(--surface-2); }

.o-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

/* The question after a delivery was signed for, and the driver's screens (js/driver.js). */
.rq { text-align: center; display: flex; flex-direction: column; gap: 10px; align-items: stretch; padding: 24px 20px; }
.rq-tick { width: 54px; height: 54px; margin: 0 auto; border-radius: 99px; background: var(--green); color: #fff; font-size: 28px; line-height: 54px; }
.rq-q { font-size: 20px; font-weight: 600; margin: 6px 0 0; }
.dr-main { padding-top: 14px; }
.dr-round { font-size: 15px; font-weight: 600; margin: 0 0 6px; }
.dr-tabs { display: flex; gap: 6px; margin: 0 0 10px; overflow-x: auto; }
.dr-tab { flex: none; font-family: var(--ui); font-size: 13px; font-weight: 500; color: var(--text-muted); background: var(--surface-2); border: 1px solid transparent; border-radius: var(--radius-pill); padding: 8px 15px; min-height: 36px; cursor: pointer; }
.dr-tab.on { background: var(--text); color: var(--surface); }
.dr-sum { font-size: 13.5px; color: var(--text-muted); line-height: 1.5; margin: 0 0 14px; }
.dr-sum b { color: var(--text); font-weight: 600; }
.dr-muted { color: var(--text-muted); font-size: 13px; }
.dr-rt { padding-left: 2px; }
.dr-stop { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.dr-stop.now { border-color: var(--accent); }
.dr-head { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px; text-align: left; font-family: var(--ui); background: none; border: 0; padding: 10px 12px; min-height: 48px; cursor: pointer; color: inherit; }
.dr-name { display: flex; flex-direction: column; min-width: 0; }
.dr-name b { font-size: 14.5px; font-weight: 600; }
.dr-name small { font-size: 12px; color: var(--text-muted); font-weight: 400; }
.dr-chev { color: var(--text-muted); font-size: 15px; flex: none; }
.dr-body { padding: 2px 12px 12px; border-top: 1px solid var(--hair); }
.dr-contact { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13px; color: var(--text-muted); padding: 8px 0 4px; }
.dr-call { color: var(--accent); font-weight: 600; text-decoration: none; white-space: nowrap; }
.dr-h { font-size: 12px; font-weight: 600; letter-spacing: 0.04em; color: var(--text-muted); margin: 10px 0 2px; text-transform: uppercase; }
.dr-take { color: var(--accent); }
.dr-lines { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0 10px; }
.dr-line { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--hair); font-size: 14px; }
.dr-line:last-child { border-bottom: 0; }
.dr-line span:last-child { font-weight: 600; white-space: nowrap; }
.dr-state { font-size: 13px; padding: 8px 10px; border-radius: var(--radius-sm); margin-top: 10px; background: var(--gray-soft); color: var(--text-muted); }
.dr-state.ok { background: var(--green-soft); color: var(--green); }
.dr-state.wait { background: var(--amber-soft); color: var(--amber); }
.dr-go { margin-top: 12px; }
/* "No return" is a real button (decided 2026-10-20: the underlined link under Yetkazildi was missed) */
.dr-noret { margin-top: 10px; }

/* Where is the car: a vertical line from circle to circle, drawn by each row down to the CENTRE of the next circle, so it
 * is continuous. Green up to the truck, grey after it. */
.orow.orow-route { flex-wrap: wrap; align-items: flex-start; }
.orow.orow-route .o-main { flex: 1; }
.rt-wrap { flex: 1 0 100%; display: block; text-align: left; padding-top: 6px; }
.rt-sum { display: block; font-size: 12.5px; color: var(--text-muted); line-height: 1.45; margin: 0 0 10px; }
.rt-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 16px 14px; margin-bottom: 14px; }
.rt-card .rt-sum { font-size: 13.5px; }
.rt { display: block; padding: 2px 0 2px 2px; }
.rt-row { position: relative; display: block; padding: 0 0 15px 38px; min-height: 24px; }
.rt-row:last-child { padding-bottom: 0; }
.rt-row::before {
  content: '';
  position: absolute;
  left: 13px;
  top: 12px;
  bottom: -12px;
  width: 2px;
  background: var(--border);
}
.rt-row.seg-done::before { background: var(--green); }
.rt-row:last-child::before { display: none; }
.rt-dot {
  position: absolute;
  left: 2px;
  top: 0;
  z-index: 1;
  width: 24px;
  height: 24px;
  border-radius: 99px;
  display: grid;
  place-items: center;
  font-size: 11.5px;
  font-weight: 600;
  background: var(--surface);
  border: 1.5px solid var(--border);
  color: var(--text-muted);
  box-sizing: border-box;
}
.rt-dot.done { background: var(--green); border-color: var(--green); color: #fff; }
.rt-dot.rt-hq { background: var(--text); border-color: var(--text); color: var(--surface); }
.rt-dot.rt-car { background: var(--accent); border-color: var(--accent); color: #fff; width: 28px; height: 28px; left: 0; top: -2px; }
.rt-dot.rt-more { border-style: dashed; letter-spacing: 1px; }
.rt-dot.rt-more.done { border-color: var(--green); color: var(--green); background: var(--surface); }
.rt-dot.you { border-color: var(--accent); border-width: 2px; color: var(--accent); background: var(--surface); }
.rt-dot.done.you { background: var(--green); color: #fff; border-color: var(--accent); }
.rt-txt { display: block; font-size: 13.5px; line-height: 24px; color: var(--text); font-weight: 500; }
.rt-txt small { display: block; font-size: 11.5px; line-height: 1.3; font-weight: 400; color: var(--text-muted); margin-top: -2px; }
.rt-row.rt-you .rt-txt { color: var(--accent); font-weight: 600; }
.rt-me { font-weight: 600; }
.rt-carrow .rt-txt { color: var(--accent); }
.o-title { font-size: 14.5px; font-weight: 600; }
.o-sub { font-size: 12px; color: var(--text-muted); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
.empty-card { text-align: center; color: var(--text-muted); font-size: 13.5px; }

/* --- Order form ---------------------------------------------------------- */

.order-head { display: flex; flex-direction: column; gap: 3px; }

.banner {
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-size: 13.5px;
  font-weight: 500;
}
.banner-open { color: var(--green); background: var(--green-soft); }
.banner-shut { color: var(--text-muted); background: var(--gray-soft); }
/* Amber, not red: this is a warning about an exception being requested, not an
 * error. Red is the brand here and would read as decoration rather than caution. */
.banner-late {
  color: var(--amber);
  background: var(--amber-soft);
  border: 1px solid color-mix(in oklab, var(--amber) 30%, transparent);
  line-height: 1.5;
}

.order-body { display: flex; flex-direction: column; gap: 16px; }

.picker { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

.plist {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--hair);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.prow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px 8px;
  background: var(--surface);
  padding: 10px 10px 10px 13px;
  min-height: 60px;
  transition: background var(--dur-fast) var(--ease-out);
}
/* A line with a quantity on it is the signal worth carrying — tint the row so
 * the shop can see at a glance what it has actually put in the order. */
.prow.has { background: var(--accent-soft); }

.p-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 0; }
.p-name { font-size: 14.5px; font-weight: 500; }
.p-price { font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* One line: -big -small [quantity] +small +big (the bigger jumps are a touch wider so the labels fit). */
.stepper { display: flex; align-items: center; gap: 3px; flex: none; }

.step {
  width: 32px;
  height: 34px;
  font-size: 18px;
  line-height: 1;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
.step:active:not(:disabled) { transform: scale(0.92); background: var(--border); }

.step-big {
  width: 38px;
  padding: 0;
  font-family: var(--ui);
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}
.step-big.up { color: var(--text); }

.qty {
  width: 46px;
  font-family: var(--ui);
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 4px;
  min-height: 38px;
}
.qty:focus { outline: none; border-color: var(--accent); background: var(--surface); }
.qty::placeholder { color: var(--text-faint); font-weight: 400; }

/* --- Balance ------------------------------------------------------------- */

.balcard {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--surface-2);
  border-radius: var(--radius);
  padding: 20px 18px;
}
.bal-l { font-size: 12.5px; color: var(--text-muted); }
.bal-n { font-size: 28px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.bal-owed { background: var(--red-soft); }
.bal-owed .bal-l, .bal-owed .bal-n { color: var(--red); }
.bal-credit { background: var(--green-soft); }
.bal-credit .bal-l, .bal-credit .bal-n { color: var(--green); }

.amt-owed { color: var(--red); }
.amt-credit { color: var(--green); }

/* --- Link card ----------------------------------------------------------- */

.linkcard {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  text-align: left;
  font-family: var(--ui);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  min-height: 62px;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out);
}
.linkcard:active { background: var(--surface-2); }

.lc-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.lc-title { font-size: 15px; font-weight: 600; }
.lc-sub { font-size: 12.5px; color: var(--text-muted); }
.o-refused { color: var(--red); }
.lc-arrow { font-size: 22px; color: var(--text-faint); line-height: 1; flex: none; }

.orow-static { cursor: default; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field-label { font-size: 12px; font-weight: 500; color: var(--text-muted); }
.input {
  font-family: var(--ui);
  font-size: 15px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 12px;
  min-height: 46px;
  width: 100%;
}
.input:focus { outline: none; border-color: var(--accent); background: var(--surface); }

/* --- What HQ decided ----------------------------------------------------- */

.dlist {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--hair);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.drow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--surface);
  padding: 11px 13px;
  min-height: 58px;
}

.d-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.d-name { font-size: 14.5px; font-weight: 500; }
.d-sub { font-size: 12px; color: var(--text-muted); }
.d-sub b { color: var(--text); }

.d-side { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex: none; }
.d-qty { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.d-sum { font-size: 11.5px; color: var(--text-muted); font-variant-numeric: tabular-nums; }

.chip-added { color: var(--accent); background: var(--accent-soft); margin-left: 5px; }

.dtotal {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 14px;
  margin-top: 10px;
  background: var(--surface-2);
  border-radius: var(--radius);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-muted);
}
.d-total-n { font-size: 18px; color: var(--text); font-variant-numeric: tabular-nums; }

/* --- Summary ------------------------------------------------------------- */

.sum-card {
  display: flex;
  flex-direction: column;
  gap: 9px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.sum-line { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; font-size: 13.5px; color: var(--text-muted); }
.sum-n { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text); }
.sum-total { font-size: 15px; padding-top: 8px; border-top: 1px solid var(--hair); }
.sum-total .sum-n { font-size: 18px; }

.btn-textdanger {
  font-family: var(--ui);
  font-size: 13px;
  font-weight: 600;
  color: var(--red);
  background: none;
  border: 0;
  padding: 9px;
  cursor: pointer;
  border-radius: var(--radius-pill);
}

/* --- Desktop ------------------------------------------------------------- */
/* Shop owners do open this on a PC in the back office. The order form is the
 * screen that actually benefits: the product list and the running total stop
 * competing for the same vertical space. */

@media (min-width: 820px) {
  .frame { max-width: 980px; }

  .head { padding: 16px 24px; }
  .brandmark-sm { height: 24px; }
  .head-shopname { font-size: 16px; }
  .head-who { font-size: 12.5px; }

  .main { padding: 24px; gap: 20px; }

  .order-body {
    flex-direction: row;
    align-items: flex-start;
    gap: 24px;
  }

  .picker { flex: 1; }

  .summary { flex: 0 0 296px; position: sticky; top: 92px; }

  /* Two columns of products once there is room for them. */
  .plist { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; }

  .prow { min-height: 64px; }

  .rounds { padding: 18px 20px; }
  .round { padding: 11px 14px; min-height: 56px; }
}

/* A phone in landscape, or a small tablet: keep one column but let it breathe. */
@media (min-width: 560px) and (max-width: 819px) {
  .main { padding: 20px; }
}

/* The sign-out label costs more than it earns on a narrow phone, where the
 * shop name needs the room. The icon still reads as sign-out. */
@media (max-width: 440px) {
  .btn-quiet-label { display: none; }
  /* Four small controls and a shop name share this header: keep them compact so the name still reads. */
  .head { gap: 8px; }
  .head-actions { gap: 4px; }
  .head-brand .brandmark { height: 16px; }
  .head-shopname { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.2; }
  .head-who { font-size: 11.5px; }
  .btn-quiet { padding: 8px 10px; }
}

@media (hover: hover) {
  .orow:hover { background: var(--surface-2); }
  .btn-round:hover { background: var(--accent-dark); }
  .step:hover:not(:disabled) { background: var(--border); }
  .iconback:hover { background: var(--border); color: var(--text); }
  .btn-textdanger:hover { background: var(--red-soft); }
}

/* --- Motion -------------------------------------------------------------- */

@keyframes site-rise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

@keyframes site-err {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: none; }
}

/* Keep the fades — they say "something arrived" — but drop the travel. Not a
 * blanket transition kill, which would also remove useful press feedback. */
@media (prefers-reduced-motion: reduce) {
  @keyframes site-rise { from { opacity: 0; } to { opacity: 1; } }
  @keyframes site-err  { from { opacity: 0; } to { opacity: 1; } }

  .step:active:not(:disabled),
  .btn-round:active,
  .iconback:active { transform: none; }
}

/* Header controls sit together with a gap of their own. */
.head-actions { display: flex; align-items: center; gap: 8px; flex: none; }

/* --- Asking HQ to change a confirmed order ----------------------------------- */
.chgcard {
  margin-top: 14px;
  padding: 13px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  border-left-width: 5px;
  background: var(--surface);
}
.chgcard-wait { border-left-color: var(--amber); }
.chgcard-ok { border-left-color: var(--green); }
.chgcard-bad { border-left-color: var(--red); }
.chg-title { font-size: 14px; font-weight: 600; color: var(--text); }
.chg-lines { display: flex; flex-direction: column; gap: 3px; margin: 8px 0 4px; font-size: 13px; color: var(--text-muted); }
.chg-lines b { color: var(--text); font-weight: 600; }
.chg-note { margin-top: 6px; font-size: 13px; color: var(--text); }
.reqnote { margin-top: 16px; }

/* --- Order form: category tabs and the send bar --------------------------------- */

.main { --gutter: 16px; }
@media (min-width: 560px) and (max-width: 819px) { .main { --gutter: 20px; } }
@media (min-width: 820px) { .main { --gutter: 24px; } }

/* One scrollable strip of categories, pinned under the header so it is always
 * within reach however far down the list is. It bleeds to the screen edges so
 * products scrolling underneath never show in the gutters. */
.cattabs {
  position: sticky;
  top: var(--head-h, 62px);
  z-index: 4;
  display: flex;
  gap: 8px;
  margin-inline: calc(var(--gutter) * -1);
  padding: 10px var(--gutter);
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  background: var(--bg);
  border-bottom: 1px solid var(--hair);
}
.cattabs::-webkit-scrollbar { display: none; }

.cattab {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--ui);
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 8px 14px;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.cattab:active { transform: scale(0.97); }
.cattab.on { color: var(--on-accent); background: var(--accent); border-color: var(--accent); }
/* How many products of this category are already in the order. */
.cattab-n {
  font-style: normal;
  font-size: 11px;
  line-height: 18px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  text-align: center;
  border-radius: 9px;
  color: var(--on-accent);
  background: var(--accent);
}
.cattab.on .cattab-n { color: var(--accent); background: var(--on-accent); }

/* The send bar is for phones; beside the list a PC has the summary card. */
/* The bar with the count, the total and the send button sits at the bottom of the screen at every width. */
.sendbar {
  display: flex;
  align-items: center;
  gap: 14px;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 6;
  padding: 10px max(16px, calc((100% - 1040px) / 2)) calc(10px + env(safe-area-inset-bottom));
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.14);
}
.sendbar-sum { display: flex; flex-direction: column; gap: 1px; min-width: 0; line-height: 1.2; }
.sendbar-sum span { font-size: 11.5px; color: var(--text-muted); white-space: nowrap; }
.sendbar-sum b { font-size: 17px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sendbar .btn-primary { flex: 1; margin: 0; max-width: 420px; }
@media (min-width: 820px) { .sendbar .btn-primary { margin-left: auto; } }

/* Room under the list so the bar never covers its last line. */
.main.hasbar { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }

/* The bar carries the count, the total and the send button, so the card
   under the list keeps only what the bar does not: the note and Cancel. */
.main.hasbar .summary .sum-line,
.main.hasbar .summary .chosen,
.summary [data-act="send"],
.summary [data-act="send-request"] { display: none; }

@media (prefers-reduced-motion: reduce) {
  .cattab { transition: none; }
}

/* The shop owner's team screen. */
.teamcard {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.teamcode {
  font-family: var(--ui);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.teambtns { display: flex; flex-wrap: wrap; gap: 8px; }
.teambtns .btn-primary, .teambtns .btn-secondary { flex: 1 1 auto; }
.teamctl { display: flex; align-items: center; gap: 6px; flex: none; }
.teamctl .input { width: auto; min-width: 7.5em; min-height: 40px; padding: 8px 10px; }
.teamctl .btn-quiet { font-size: 22px; line-height: 1; padding: 6px 10px; }

/* The way to an order outside the schedule: reachable, but not shouting. */
.linkcard-off { border-style: dashed; border-color: color-mix(in oklab, var(--amber) 55%, var(--border)); }
.linkcard-off .lc-title { color: var(--amber); }

/* "Kelganini tekshiring": the shop counts a delivery before it signs */
.chklist { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin: 10px 0; }
.chk { display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 13px; }
.chk + .chk { border-top: 1px solid var(--border); }
.chk.diff { background: var(--accent-soft); }
.chk-tick { flex: none; width: 28px; height: 28px; border-radius: 8px; border: 1.5px solid var(--border-strong, var(--border)); background: transparent; color: #fff; font-size: 16px; line-height: 1; padding: 0; cursor: pointer; }
.chk-tick.on { background: var(--green); border-color: var(--green); }
.chk-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 0; }
.chk-name { font-size: 14.5px; font-weight: 500; }
.chk.off .chk-name { text-decoration: line-through; color: var(--text-muted); }
.chk-sub { font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.chk-sub b { color: var(--red); font-weight: 600; }
.chk-sum { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); font-size: 13.5px; color: var(--text-muted); margin-bottom: 10px; }
.chk-sum.diff { background: var(--accent-soft); color: var(--text); }
.chk-note { width: 100%; margin-bottom: 10px; font: inherit; padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); color: var(--text); }

/* What is in the order, across every category: in the summary card, and pulled up from the bar on a phone */
.chosen { display: flex; flex-direction: column; margin-bottom: 12px; }
.chosen-head { font-size: 12px; font-weight: 600; letter-spacing: 0.02em; color: var(--text-muted); margin-bottom: 4px; }
.chosen-chips { display: flex; flex-wrap: wrap; gap: 8px; padding-bottom: 6px; }
.chosen-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 6px 6px 6px 12px; border: 1px solid var(--border); border-radius: var(--radius-pill); background: var(--surface-2); font-size: 14px; }
.chosen-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chosen-qty { font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; }
.chosen-x { border: 0; background: transparent; color: var(--text-muted); font-size: 18px; line-height: 1; width: 24px; height: 24px; padding: 0; cursor: pointer; border-radius: 50%; }
.chosen-x:hover { color: var(--red); }
.sendbar-toggle { border: 0; background: transparent; padding: 0; text-align: left; font: inherit; color: inherit; cursor: pointer; }
.sendbar-toggle i { font-style: normal; font-size: 11px; color: var(--text-muted); margin-left: 4px; }
.sendlist {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 100%;
  max-height: 55vh;
  overflow-y: auto;
  padding: 12px 16px 8px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.14);
}
.order-foot { margin-top: 14px; }

/* Hisob: the shop's account day by day */
.sv-tabs { display: inline-flex; gap: 2px; padding: 3px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-pill); margin-bottom: 14px; }
.sv-tab { border: 0; background: transparent; color: var(--text-muted); font: inherit; font-size: 14px; padding: 8px 16px; border-radius: var(--radius-pill); cursor: pointer; }
.sv-tab.on { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 0 0 1px var(--border); }
.sv-back { margin-bottom: 10px; }
.sv-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 12px; overflow: hidden; }
.sv-tile { display: flex; flex-direction: column; gap: 3px; padding: 14px 6px; text-align: center; min-width: 0; }
.sv-tile + .sv-tile { border-left: 1px solid var(--border); }
.sv-tile b { font-size: clamp(14px, 4.4vw, 19px); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; white-space: nowrap; }
.sv-tile span { font-size: 11.5px; color: var(--text-muted); }
.sv-tile.bad b { color: var(--red); }
.sv-tile.ok b { color: var(--green); }
.sv-note { margin: 0 2px 12px; font-size: 13px; }
.sv-day { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 12px; overflow: hidden; }
.sv-day.today { border-style: dashed; }
.sv-day > header { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px 14px; font-size: 15px; }
.sv-day-sum { margin-left: auto; font-size: 13px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.sv-day-sum b { color: var(--text); }
/* Loose meat and skewers side by side, so each can be checked on its own (the same as HQ's sverka). */
.sv-tile .tile-kinds { display: flex; flex-direction: column; gap: 2px; margin-top: auto; padding: 6px 4px 0; border-top: 1px dashed var(--border); font-variant-numeric: tabular-nums; }
.sv-tile .tile-kinds .kind { display: flex; justify-content: space-between; gap: 6px; font-size: 11px; }
.sv-tile .tile-kinds .kind b { font-size: 11.5px; letter-spacing: 0; }
.kind b { color: var(--text); font-weight: 600; }
.sv-kinds { flex: 0 0 100%; display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.kinds-line { display: flex; flex-wrap: wrap; gap: 3px 14px; align-items: baseline; justify-content: flex-end; }
.kinds-line i { font-style: normal; margin-right: auto; }
.sv-kindhead { display: flex; justify-content: space-between; margin-top: 6px; padding-top: 6px; font-size: 11.5px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-muted); }
.sv-kindhead b { color: var(--text); }
.sv-empty { padding: 4px 14px 14px; font-size: 13px; color: var(--text-muted); }
.sv-order { border-top: 1px solid var(--border); }
.sv-order-head { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 14px; border: 0; background: transparent; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.sv-order-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.sv-order-main small { font-size: 12px; color: var(--text-muted); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.sv-order-amt { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; display: inline-flex; gap: 8px; align-items: center; }
.sv-order-amt i { font-style: normal; font-size: 11px; color: var(--text-muted); }
.sv-lines { padding: 0 14px 10px; }
.sv-line { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; font-size: 13.5px; font-variant-numeric: tabular-nums; border-top: 1px dashed var(--border); }
.sv-line small { color: var(--text-muted); margin-left: 4px; }
.sv-money { display: flex; justify-content: space-between; gap: 10px; padding: 11px 14px; border-top: 1px solid var(--border); font-size: 14px; font-variant-numeric: tabular-nums; }
.sv-money small { color: var(--text-muted); }
.sv-hist { cursor: pointer; width: 100%; text-align: left; font: inherit; color: inherit; background: transparent; border: 0; }
.amt-owed { color: var(--red); }
.amt-credit { color: var(--green); }

/* A person with several shops: the list they pick from. */
.shoplist { max-width: 420px; }
.shoplist-rows { width: 100%; display: flex; flex-direction: column; gap: 8px; }
.shoplist .linkcard { margin: 0; }
.shoplist .btn-secondary, .shoplist .btn-quiet { width: 100%; }
.alert-ok { color: var(--green); background: var(--green-soft); }

/* Qaytarish: a return opens to list its products (sellers too; goods only) */
.ret-item { background: var(--surface); }
.ret-head { cursor: pointer; }
.ret-side { display: inline-flex; align-items: center; gap: 8px; flex: none; }
.ret-side i { font-style: normal; font-size: 11px; color: var(--text-muted); }
.ret-diff { color: var(--amber); }
.ret-lines { padding-top: 2px; }
.ret-was { color: var(--text-muted); }
.ret-why { font-size: 12px; color: var(--red); padding: 0 0 6px; margin-top: -2px; }

/* Hisob: four tiles (the goods at the start of the period too) -- two by two on a narrow phone */
.sv-tiles.sv-tiles-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 520px) {
  .sv-tiles.sv-tiles-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sv-tiles.sv-tiles-4 .sv-tile:nth-child(3) { border-left: 0; }
  .sv-tiles.sv-tiles-4 .sv-tile:nth-child(n+3) { border-top: 1px solid var(--border); }
}

/* Hisob: the pay calculator */
.calc-open { margin: 0 0 14px; }
.calc { padding: 14px 16px; margin-bottom: 14px; }
.calc-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 6px; }
.calc-head b { font-size: 15px; }
.calc-row { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; font-size: 14px; font-variant-numeric: tabular-nums; border-top: 1px dashed var(--border); }
.calc-row span { color: var(--text-muted); }
.calc-row b { white-space: nowrap; }
.calc-sum span, .calc-due span { color: var(--text); font-weight: 600; }
.calc-due { border-top: 1px solid var(--text); font-size: 16px; }
.calc-pay { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0 10px; }
.calc-pay label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-muted); }
.calc-in { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.calc-out { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-deep); font-size: 14px; }
.calc-out b { font-size: 20px; font-variant-numeric: tabular-nums; }
.calc-out.ok { background: var(--green-soft); color: var(--green); font-weight: 600; justify-content: flex-start; }
.calc-note { margin: 8px 0 0; font-size: 12px; color: var(--text-muted); }
.calc-today { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-top: 1px dashed var(--border); cursor: pointer; }
.calc-today input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--accent); flex: none; }
.calc-today span { display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.calc-today small { font-size: 12px; color: var(--text-muted); }
.calc-warn { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; margin: 6px 0 8px; }
:root[data-theme="dark"] .calc-out:not(.ok) { color: var(--text); }

/* Qoldiq: the way out of the 'do not count today's delivery' note, for a count made earlier on the evening before */
.ost-tomorrow { display: block; margin-top: 8px; padding-left: 0; color: var(--amber); text-decoration: underline; text-underline-offset: 3px; }

/* ---- A partner's own account (js/partner.js): a supplier or a buyer, read-only ---- */
.pt-main { display: flex; flex-direction: column; gap: 12px; }
.pt-accs, .pt-periods { display: flex; flex-wrap: wrap; gap: 6px; }
.pt-acc, .pt-chip { font: 600 13px var(--font, inherit); color: var(--text-muted); background: var(--surface); border: 1px solid var(--border); border-radius: 99px; padding: 7px 12px; cursor: pointer; }
.pt-acc small { font-weight: 500; opacity: .8; }
.pt-acc.on, .pt-chip.on { color: #fff; background: var(--accent); border-color: var(--accent); }
.pt-dates { display: flex; align-items: center; gap: 8px; }
.pt-dates .input { flex: 1; min-width: 0; }
.pt-hero { display: flex; flex-direction: column; gap: 4px; padding: 18px 18px 16px; }
.pt-hero > span { font-size: 14px; font-weight: 600; color: var(--text-muted); }
.pt-hero > b { font-size: 30px; font-weight: 700; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.pt-hero > b small { font-size: 15px; font-weight: 600; color: var(--text-muted); }
.pt-hero > small { font-size: 12px; color: var(--text-faint); }
.pt-hero.good > b, .pt-sum b.good, .pt-entry-h b.good { color: var(--green); }
.pt-hero.bad > b, .pt-sum b.bad { color: var(--accent); }
.pt-sums { padding: 6px 16px 10px; }
.pt-range { font-size: 12px; color: var(--text-faint); padding: 8px 0 4px; }
.pt-sum { display: grid; grid-template-columns: 1fr auto; column-gap: 12px; align-items: baseline; padding: 8px 0; border-top: 1px solid var(--border); font-size: 14px; }
.pt-sum:first-of-type { border-top: 0; }
.pt-sum > span { color: var(--text-muted); }
.pt-sum > b { font-variant-numeric: tabular-nums; }
.pt-sum > small { grid-column: 2; text-align: right; font-size: 11.5px; color: var(--text-faint); }
.pt-days { display: flex; flex-direction: column; gap: 12px; } /* the day cards are not children of .pt-main's gap */
.pt-day { padding: 12px 16px 6px; }
.pt-day-h { font-size: 12px; font-weight: 700; letter-spacing: .06em; color: var(--text-faint); margin-bottom: 4px; }
.pt-entry { padding: 10px 0; border-top: 1px solid var(--border); }
.pt-day-h + .pt-entry { border-top: 0; }
.pt-entry-h { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; font-weight: 600; }
.pt-entry-h b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.pt-lines { margin-top: 6px; display: flex; flex-direction: column; gap: 4px; }
.pt-line { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: baseline; font-size: 13px; }
.pt-line > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.pt-line > span:nth-child(2) { color: var(--text-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.pt-line > b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.pt-note { margin-top: 4px; font-size: 12.5px; color: var(--text-muted); }
.pt-prices { padding: 12px 16px; display: flex; flex-direction: column; gap: 6px; }
.pt-empty { padding: 18px; text-align: center; color: var(--text-muted); font-size: 14px; }
.pt-main .dim { opacity: .55; }

/* the partner's prices and its price-change request */
.pt-hint { margin: 0 0 4px; font-size: 12.5px; color: var(--text-muted); }
.pt-pf { display: grid; grid-template-columns: minmax(0, 1fr) 140px; gap: 10px; align-items: center; padding: 6px 0; border-top: 1px solid var(--border); }
.pt-pf > span { font-size: 14px; font-weight: 600; min-width: 0; }
.pt-pf > span small { display: block; font-size: 12px; font-weight: 400; color: var(--text-muted); }
.pt-pf .input { text-align: right; font-variant-numeric: tabular-nums; }
.pt-pf-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.pt-price-btn { margin-top: 6px; }
.pt-req { display: flex; flex-direction: column; gap: 3px; margin-top: 6px; padding: 10px 12px; border-radius: 12px; font-size: 13px; }
.pt-req small { color: var(--text-muted); }
.pt-req.wait { background: var(--amber-soft); color: var(--amber); }
.pt-req.ok { background: var(--green-soft); color: var(--green); }
.pt-req.bad { background: var(--accent-soft); color: var(--accent); }
.pt-req span { color: var(--text); }
