:root {
  --bg: #f6f1ea; --card: #ffffff; --ink: #2b2118; --muted: #7c6d5f; --line: #e8ddcf;
  --brand: #8a5a2b; --brand-2: #b07a45; --brand-soft: #f1e4d3; --ok: #2f7d4f; --ok-soft: #e3f2e8;
  --warn: #a8641b; --warn-soft: #fbefdc; --bad: #b3392f; --bad-soft: #f9e3e0;
  --card-x: 0; --field: #ffffff; --brand-ink: #ffffff; --radius: 16px; --shadow: 0 1px 2px rgba(60,40,20,.06), 0 4px 14px rgba(60,40,20,.06);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
body { min-height: 100vh; -webkit-tap-highlight-color: transparent; }
.wrap { max-width: 560px; margin: 0 auto; padding: 16px 16px 96px; }
h1 { font-size: 22px; margin: 4px 0 4px; letter-spacing: -.01em; }
h2 { font-size: 17px; margin: 18px 0 10px; }
p.sub { margin: 0 0 16px; color: var(--muted); font-size: 14px; }
.brand { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.logo { width: 40px; height: 40px; border-radius: 12px; background: var(--brand); color: var(--brand-ink);
  display: grid; place-items: center; font-weight: 700; font-size: 18px; flex: none; }
.brand b { display: block; font-size: 15px; }
.brand small { color: var(--muted); font-size: 12px; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin: 14px 0 6px; }
input[type=text], input[type=tel], input[type=password], input[type=search], input[type=number], select {
  width: 100%; height: 48px; border: 1.5px solid var(--line); border-radius: 12px; padding: 0 14px;
  font: inherit; background: var(--field); color: var(--ink); outline: none; }
input:focus, select:focus { border-color: var(--brand-2); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 50px; padding: 0 18px;
  border: 0; border-radius: 14px; font-family: inherit; font-weight: 600; font-size: 16px; line-height: 1; cursor: pointer;
  background: var(--brand); color: var(--brand-ink); width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.ghost { background: var(--brand-soft); color: var(--brand); }
.btn.ok { background: var(--ok); }
.btn.bad { background: var(--bad-soft); color: var(--bad); }
.btn.sm { height: 40px; font-size: 14px; border-radius: 11px; width: auto; }
.sections { display: grid; gap: 10px; }
.sec { display: flex; align-items: center; gap: 12px; padding: 14px; border: 1.5px solid var(--line);
  border-radius: 14px; background: var(--card); cursor: pointer; text-align: left; font: inherit; color: inherit; width: 100%; }
.sec .num { width: 38px; height: 38px; border-radius: 11px; background: var(--brand-soft); color: var(--brand);
  display: grid; place-items: center; font-weight: 700; flex: none; }
.sec b { display: block; font-size: 15px; }
.sec small { color: var(--muted); font-size: 13px; }
.sec[aria-pressed=true] { border-color: var(--brand); background: var(--brand-soft); box-shadow: inset 0 0 0 1px var(--brand); }
.sec[aria-pressed=true] .num { background: var(--brand); color: var(--brand-ink); }
.err { color: var(--bad); font-size: 14px; margin-top: 12px; min-height: 1em; }
.banner { border-radius: 12px; padding: 10px 12px; font-size: 13px; margin-bottom: 12px; }
.banner.warn { background: var(--warn-soft); color: var(--warn); }
.banner.ok { background: var(--ok-soft); color: var(--ok); }
.pending { text-align: center; padding: 28px 18px; }
.pending .ico { width: 64px; height: 64px; border-radius: 50%; background: var(--warn-soft); color: var(--warn);
  display: grid; place-items: center; margin: 0 auto 12px; font-size: 30px; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.chip { display: inline-block; padding: 4px 10px; border-radius: 99px; background: var(--brand-soft); color: var(--brand);
  font-size: 12px; font-weight: 600; white-space: nowrap; }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.rc { background: var(--card); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; cursor: pointer; border: 0;
  padding: 0; text-align: left; font: inherit; color: inherit; display: flex; flex-direction: column; }
.rc img { width: 100%; aspect-ratio: 1/1; object-fit: cover; background: #f4ede3; display: block; }
.rc .b { padding: 9px 10px 11px; }
.rc .n { font-weight: 600; font-size: 13.5px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden; min-height: 2.5em; }
.rc .w { color: var(--brand); font-size: 12.5px; font-weight: 600; margin-top: 4px; }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }
.sheet-bg { position: fixed; inset: 0; background: rgba(30,20,10,.45); display: none; z-index: 10; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; background: var(--card); border-radius: 22px 22px 0 0; z-index: 11;
  max-width: 560px; margin: 0 auto; padding: 14px 16px 22px; transform: translateY(105%); transition: transform .22s ease, visibility .22s;
  max-height: 92vh; overflow: auto; visibility: hidden; }
.sheet.open { transform: none; visibility: visible; }
.sheet-bg.open { display: block; }
.grab { width: 40px; height: 5px; border-radius: 9px; background: var(--line); margin: 0 auto 12px; }
.sh-head { display: flex; gap: 12px; align-items: center; }
.sh-head img { width: 76px; height: 76px; border-radius: 14px; object-fit: cover; background: #f4ede3; flex: none; }
.sh-head b { font-size: 16px; display: block; }
.uses { margin: 12px 0 0; padding: 10px 12px; background: var(--bg); border-radius: 12px; font-size: 13px; color: var(--muted); }
.uses b { color: var(--ink); font-weight: 600; }
.stepper { display: grid; grid-template-columns: 56px 1fr 56px; gap: 10px; margin-top: 8px; }
.stepper button { height: 56px; border-radius: 14px; border: 0; background: var(--brand-soft); color: var(--brand);
  font-size: 26px; font-weight: 600; cursor: pointer; }
.stepper input { height: 56px; text-align: center; font-size: 24px; font-weight: 700; }
.total { display: flex; justify-content: space-between; align-items: baseline; margin: 14px 2px; font-size: 14px; color: var(--muted); }
.total b { font-size: 20px; color: var(--ink); }
.toast { position: fixed; left: 16px; right: 16px; bottom: 18px; max-width: 528px; margin: 0 auto; padding: 14px 16px;
  border-radius: 14px; background: #24331f; color: #fff; box-shadow: 0 8px 24px rgba(0,0,0,.2); z-index: 20;
  font-size: 14px; display: none; white-space: pre-line; }
.toast.show { display: block; }
.toast.bad { background: #5a1f1a; }
.tabs { display: flex; gap: 6px; background: var(--brand-soft); padding: 4px; border-radius: 12px; margin: 6px 0 12px; }
.tabs button { flex: auto; padding: 0 6px; white-space: nowrap; height: 38px; border: 0; border-radius: 9px; background: transparent; font-weight: 600; font-size: 13.5px;
  font-family: inherit; color: var(--muted); cursor: pointer; }
.tabs button[aria-selected=true] { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.wk { background: var(--card); border-radius: 14px; box-shadow: var(--shadow); padding: 14px; margin-bottom: 10px; }
.wk .row { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.wk b { font-size: 15.5px; }
.wk .meta { color: var(--muted); font-size: 13px; margin-top: 3px; }
.wk .acts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.wk select { height: 40px; margin-top: 10px; font-size: 14px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; word-break: break-all; }
details.call { background: var(--card); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; box-shadow: var(--shadow); }
details.call summary { cursor: pointer; font-size: 13px; font-weight: 600; }
details.call pre { white-space: pre-wrap; margin: 8px 0 0; }
.hidden { display: none !important; }
.search { margin-top: 4px; }

/* Telegram Mini App: native MainButton/BackButton replace the in-page ones */
.in-tg .tg-hide { display: none !important; }
.in-tg .wrap { padding-bottom: 24px; }
