: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, #6b7280);
  --link: var(--tg-theme-link-color, #2481cc);
  --btn: var(--tg-theme-button-color, #2481cc);
  --btn-text: var(--tg-theme-button-text-color, #ffffff);
  --card: var(--tg-theme-section-bg-color, var(--tg-theme-bg-color, #ffffff));
  --danger: #d33a2c;
  --ok: #2e9e5b;
  --warn: #c98a00;
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg2);
  padding-bottom: calc(64px + env(safe-area-inset-bottom));
}
a { color: var(--link); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
.muted { color: var(--hint); }
.small { font-size: 13px; }
.center { text-align: center; padding: 32px 16px; }
.top { background: var(--bg); padding: 10px 16px; border-bottom: 1px solid rgba(0,0,0,.06); position: sticky; top: 0; z-index: 5; }
.top-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.top h1 { font-size: 20px; margin: 0; }
.view { padding: 12px 12px 16px; }
.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; display: flex; background: var(--bg);
  border-top: 1px solid rgba(0,0,0,.08); padding-bottom: env(safe-area-inset-bottom); z-index: 5;
}
.tabs a { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 8px 4px 6px; font-size: 11px; color: var(--hint); gap: 2px; }
.tabs a span { line-height: 1; }
.tabs a.active { color: var(--btn); }
.seg { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; -webkit-overflow-scrolling: touch; }
.seg button { white-space: nowrap; border: 1px solid rgba(0,0,0,.12); background: var(--bg); border-radius: 999px; padding: 6px 12px; font-size: 14px; }
.seg button.active { background: var(--btn); color: var(--btn-text); border-color: var(--btn); }
.seg .n { opacity: .7; font-size: 12px; margin-left: 4px; }
.search { width: 100%; padding: 10px 12px; border-radius: var(--radius); border: 1px solid rgba(0,0,0,.12); background: var(--bg); margin-bottom: 10px; }
.card { background: var(--card); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 10px; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.card.tap { cursor: pointer; }
.row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.row + .row { margin-top: 4px; }
.badge { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--bg2); color: var(--hint); }
.badge.orders { background: #fff4d6; color: #8a5a00; }
.badge.kuryerda { background: #e3f0ff; color: #1b5e9e; }
.badge.yetkazildi { background: #e3f7ea; color: #1e6e3a; }
.badge.bekor { background: #fde7e5; color: #8a1f17; }
.title { font-weight: 600; }
.money { font-weight: 600; white-space: nowrap; }
.btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.btn { border: 0; border-radius: 10px; padding: 10px 14px; background: var(--btn); color: var(--btn-text); font-weight: 600; }
.btn.secondary { background: var(--bg2); color: var(--text); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 13px; color: var(--hint); margin-bottom: 4px; }
.field input, .field select, .field textarea { width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid rgba(0,0,0,.14); background: var(--bg); }
.field textarea { min-height: 70px; resize: vertical; }
.lines .line { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid rgba(0,0,0,.06); }
.lines .line:last-child { border-bottom: 0; }
.lines .name { flex: 1; }
.qty { display: inline-flex; align-items: center; gap: 6px; }
.qty button { width: 32px; height: 32px; border-radius: 8px; border: 1px solid rgba(0,0,0,.14); background: var(--bg); font-size: 18px; line-height: 1; }
.qty b { min-width: 20px; text-align: center; }
pre.report { white-space: pre-wrap; word-break: break-word; font: 14px/1.45 ui-monospace, Menlo, Consolas, monospace; background: var(--bg2); padding: 10px 12px; border-radius: 10px; margin: 0; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; }
.kv .muted { font-size: 14px; }
.history { font-size: 14px; }
.history div { padding: 4px 0; border-bottom: 1px dashed rgba(0,0,0,.08); }
.history div:last-child { border-bottom: 0; }
.toast { position: fixed; left: 12px; right: 12px; bottom: calc(76px + env(safe-area-inset-bottom)); background: #222; color: #fff; padding: 10px 14px; border-radius: 10px; z-index: 20; font-size: 14px; }
.toast.err { background: var(--danger); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid rgba(0,0,0,.06); }
td.num, th.num { text-align: right; white-space: nowrap; }
.inline-input { width: 110px; padding: 6px 8px; border-radius: 8px; border: 1px solid rgba(0,0,0,.14); background: var(--bg); text-align: right; }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--hint); margin: 16px 0 6px; }
.back { display: inline-block; margin-bottom: 8px; }
