:root {
  --bg: var(--tg-theme-bg-color, #ffffff);
  --bg2: var(--tg-theme-secondary-bg-color, #f2f3f5);
  --text: var(--tg-theme-text-color, #111111);
  --hint: var(--tg-theme-hint-color, #8a8f98);
  --link: var(--tg-theme-link-color, #2481cc);
  --button: var(--tg-theme-button-color, #2481cc);
  --button-text: var(--tg-theme-button-text-color, #ffffff);
  --danger: var(--tg-theme-destructive-text-color, #d93a3a);
  --ok: #2e9e5b;
  --warn: #d9822b;
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg2); color: var(--text); font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
main { padding: 12px 16px 120px; max-width: 720px; margin: 0 auto; }
h2 { font-size: 18px; margin: 16px 0 8px; }
.muted { color: var(--hint); }
.center { text-align: center; }
.small { font-size: 13px; }
.row { display: flex; gap: 8px; align-items: center; }
.row > .grow { flex: 1; min-width: 0; }
.spread { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }

#tabs { position: sticky; top: 0; z-index: 5; display: flex; background: var(--bg); border-bottom: 1px solid var(--bg2); }
#tabs a { flex: 1; text-align: center; padding: 12px 4px; color: var(--hint); text-decoration: none; font-weight: 600; border-bottom: 2px solid transparent; }
#tabs a.active { color: var(--link); border-bottom-color: var(--link); }

.card { background: var(--bg); border-radius: var(--radius); padding: 12px 14px; margin: 8px 0; }
a.card { display: block; color: inherit; text-decoration: none; }
.card .title { font-weight: 600; }
.card.notes { border-left: 4px solid var(--warn); }
.card.notes ul { margin: 6px 0; padding-left: 18px; }

input, select, textarea, button { font: inherit; color: inherit; }
input[type=text], input[type=search], input[type=number], input[type=date], input[type=datetime-local], textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--bg2); border-radius: 10px; background: var(--bg); outline: none;
}
textarea { min-height: 70px; resize: vertical; }
label { display: block; margin: 12px 0 4px; font-size: 14px; color: var(--hint); }

.btn { display: inline-block; border: 0; border-radius: 10px; padding: 11px 16px; background: var(--button); color: var(--button-text); font-weight: 600; cursor: pointer; text-align: center; text-decoration: none; }
.btn.block { display: block; width: 100%; margin-top: 12px; }
.btn.light { background: var(--bg2); color: var(--link); }
.btn.danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
.btn:disabled { opacity: .45; cursor: default; }
.icon-btn { border: 0; background: var(--bg2); width: 34px; height: 34px; border-radius: 50%; font-size: 18px; cursor: pointer; }

.chips { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--bg2); background: var(--bg); color: var(--text); border-radius: 999px; padding: 6px 12px; font-size: 14px; cursor: pointer; white-space: nowrap; }
.chip.on { background: var(--button); color: var(--button-text); border-color: var(--button); }
.wrap { flex-wrap: wrap; overflow: visible; }

.badge { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .03em; padding: 3px 7px; border-radius: 6px; color: #fff; white-space: nowrap; }
.s-not_confirmed { background: var(--warn); }
.s-confirmed { background: var(--link); }
.s-delivered { background: var(--ok); }
.s-refused { background: var(--hint); }
.approx { color: var(--warn); font-weight: 600; }

.product { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.product .price { color: var(--hint); font-size: 14px; }

.basket-bar { position: fixed; left: 0; right: 0; bottom: 0; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: var(--bg); border-top: 1px solid var(--bg2); z-index: 6; }
.basket-bar .btn { display: flex; justify-content: space-between; width: 100%; max-width: 688px; margin: 0 auto; }

.sheet { position: fixed; inset: 0; z-index: 10; background: rgba(0,0,0,.4); display: flex; align-items: flex-end; }
.sheet[hidden] { display: none; }
.sheet .panel { background: var(--bg); width: 100%; max-height: 88vh; overflow-y: auto; border-radius: 16px 16px 0 0; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); max-width: 720px; margin: 0 auto; }

.toggle { display: flex; background: var(--bg2); border-radius: 10px; padding: 3px; }
.toggle button { flex: 1; border: 0; background: transparent; padding: 8px; border-radius: 8px; cursor: pointer; font-weight: 600; color: var(--hint); }
.toggle button.on { background: var(--bg); color: var(--text); }

.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stats-grid .card { margin: 0; }
.big { font-size: 22px; font-weight: 700; }
.bar { height: 8px; background: var(--button); border-radius: 4px; margin-top: 4px; }

.toast { position: fixed; left: 16px; right: 16px; bottom: 90px; z-index: 20; background: #222; color: #fff; padding: 12px 14px; border-radius: 10px; text-align: center; }
.toast.error { background: var(--danger); }
.card.pick { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.card.pick input { margin-top: 4px; width: 20px; height: 20px; }
.msg { white-space: pre-wrap; margin: 6px 0; }
label.check { display: flex; gap: 8px; align-items: center; margin-top: 10px; cursor: pointer; }
label.check input { width: 20px; height: 20px; }
.fees { display: flex; flex-wrap: nowrap; justify-content: space-between; gap: 6px; }
.fees label.check { margin-top: 4px; gap: 4px; white-space: nowrap; font-size: 15px; }
