/* Цвета — из темы Telegram (переменные --tg-theme-*), с запасными значениями для браузера. */
:root {
  --bg: var(--tg-theme-bg-color, #ffffff);
  --sec: var(--tg-theme-secondary-bg-color, #f1f3f6);
  --text: var(--tg-theme-text-color, #111a24);
  --hint: var(--tg-theme-hint-color, #7d8893);
  --link: var(--tg-theme-link-color, #2a7fc4);
  --btn: var(--tg-theme-button-color, #3390ec);
  --btn-text: var(--tg-theme-button-text-color, #ffffff);
  --line: color-mix(in srgb, var(--hint) 50%, transparent);
  --meta: color-mix(in srgb, var(--hint) 55%, var(--text));   /* подписи темнее обычной hint — контрастнее */
  --sel: color-mix(in srgb, var(--btn) 14%, var(--bg));
  --soft: color-mix(in srgb, var(--btn) 20%, var(--bg));   /* заливка второстепенных кнопок */
  --edge: var(--btn);                                       /* рамка кнопок — полным цветом */
  --ok: #2f9e5b;
  --warn: #c98512;
  --bad: #d14b4b;
  --num: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--sec); color: var(--text); font: 15px/1.45 -apple-system, "SF Pro Text", Roboto, "Segoe UI", system-ui, sans-serif; }
#app { height: 100%; display: flex; flex-direction: column; position: relative; overflow: hidden; }
button { font: inherit; color: inherit; }
button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }

.apphead { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 10px 14px 6px; }
.apphead b { font-size: 16px; }
.apphead span { color: var(--hint); font-size: 12.5px; text-align: right; }
.tabs { display: flex; gap: 4px; padding: 0 10px 8px; }
.tabs button { flex: 1; font-weight: 600; font-size: 12.5px; padding: 9px 2px; border-radius: 10px; border: 1.5px solid var(--edge); background: var(--soft); color: var(--link); cursor: pointer; white-space: nowrap; }
.tabs button[aria-selected="true"] { background: var(--btn); border-color: var(--btn); color: var(--btn-text); }
.tabs .cnt { font-family: var(--num); font-size: 11px; margin-left: 3px; }
.filters { padding: 0 12px 6px; display: grid; gap: 7px; }
.seg { display: flex; gap: 4px; background: var(--soft); border: 1.5px solid var(--edge); border-radius: 11px; padding: 3px; }
.seg button { flex: 1; font-weight: 600; font-size: 13px; padding: 7px 4px; border-radius: 8px; border: 0; background: transparent; color: var(--link); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--btn); color: var(--btn-text); }
.search { width: 100%; font: 14px inherit; font-family: inherit; padding: 9px 11px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--bg); color: var(--text); }
textarea.search { resize: vertical; }
.cpick { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 10px 12px; border-radius: 12px; border: 1.5px solid var(--edge); background: var(--soft); cursor: pointer; }
.cpick .nm { font-weight: 600; font-size: 16px; }
.cpick .st { color: var(--hint); font-size: 12.5px; }
.cpick .chev { background: var(--btn); color: var(--btn-text); font-weight: 600; font-size: 13px; padding: 6px 10px; border-radius: 8px; }
.cc { display: inline-grid; place-items: center; min-width: 34px; height: 26px; padding: 0 4px; border-radius: 7px; background: var(--btn); color: var(--btn-text); font: 600 12px/1 var(--num); }
.list { flex: 1; overflow: auto; padding: 4px 0 8px; -webkit-overflow-scrolling: touch; }
.row { display: grid; grid-template-columns: 26px minmax(0,1fr) auto; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--bg); cursor: pointer; }
.row.plain { grid-template-columns: minmax(0,1fr) auto; cursor: default; align-items: start; }
.row.on { background: var(--soft); box-shadow: inset 4px 0 0 var(--btn); }
.row.off { opacity: .55; cursor: default; }
.box { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--edge); display: grid; place-items: center; }
.row.on .box { background: var(--btn); border-color: var(--btn); }
.row.on .box::after { content: ""; width: 9px; height: 5px; border: 2px solid var(--btn-text); border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px,-1px); }
.num { font: 500 15px/1.25 var(--num); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.meta { color: var(--meta); font-size: 12.5px; }
.price { font-weight: 600; font-variant-numeric: tabular-nums; }
.r { text-align: right; }
.copy { font-size: 12px; font-weight: 600; color: var(--link); background: var(--soft); border: 1px solid var(--edge); border-radius: 7px; padding: 3px 8px; margin-top: 4px; cursor: pointer; }
.pill { display: inline-block; font-weight: 600; font-size: 11.5px; line-height: 1; padding: 4px 7px; border-radius: 99px; white-space: nowrap; }
.pill.ok { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.pill.warn { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.pill.bad { background: color-mix(in srgb, var(--bad) 16%, transparent); color: var(--bad); }
.pill.hint { background: var(--sec); color: var(--hint); }
.empty { padding: 34px 20px; text-align: center; color: var(--meta); }
.mainbtn { margin: 8px 12px 12px; font-weight: 600; font-size: 15px; padding: 14px; border: 0; border-radius: 12px; background: var(--btn); color: var(--btn-text); cursor: pointer; }
.mainbtn.sec { background: var(--soft); color: var(--link); border: 1.5px solid var(--edge); }
.mainbtn:disabled { opacity: .45; cursor: default; }
.foot { padding-bottom: env(safe-area-inset-bottom, 0px); }
.btnrow { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 8px 12px 12px; }
.btnrow .mainbtn { margin: 0; }
.full { width: calc(100% - 24px); }

.screen { position: absolute; inset: 0; background: var(--sec); display: flex; flex-direction: column; z-index: 5; }
.screen .top { display: flex; align-items: center; gap: 10px; padding: 12px 12px 8px; }
.screen .top button { border: 1.5px solid var(--edge); background: var(--soft); color: var(--link); font-weight: 600; cursor: pointer; padding: 6px 10px; border-radius: 9px; }
.screen .top b { font-size: 16px; }
.sec-h { padding: 10px 14px 4px; color: var(--hint); font-weight: 600; font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; }
.crow { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--bg); cursor: pointer; }
.crow.cur { background: var(--soft); box-shadow: inset 4px 0 0 var(--btn); }
.crow.zero { opacity: .45; }
.crow .nm { font-weight: 500; }
.crow .ct { font-size: 12.5px; color: var(--hint); text-align: right; white-space: nowrap; }
.crow .ct b { color: var(--text); font-weight: 600; }

.back { position: absolute; inset: 0; background: rgba(0,0,0,.35); display: flex; align-items: flex-end; z-index: 9; }
.sheet { width: 100%; background: var(--bg); border-radius: 16px 16px 0 0; padding: 16px 16px calc(6px + env(safe-area-inset-bottom, 0px)); max-height: 85%; overflow: auto; }
.sheet h3 { margin: 0 0 4px; font-size: 17px; }
.sheet .sub { color: var(--hint); font-size: 13px; margin-bottom: 10px; }
.sheet .li { padding: 7px 0; border-bottom: 1px solid var(--line); }
.sheet .tot { display: flex; justify-content: space-between; font-weight: 700; padding: 8px 0 2px; }
.sheet .tot.l { font-weight: 500; padding-top: 2px; }
.sheet .btnrow { margin: 12px 0 10px; }
.toast { position: absolute; left: 12px; right: 12px; bottom: calc(80px + env(safe-area-inset-bottom, 0px)); background: rgba(20,28,38,.92); color: #fff; padding: 11px 13px; border-radius: 12px; font-size: 13.5px; z-index: 20; }
.err { margin: 8px 12px; padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, var(--bad) 12%, transparent); color: var(--bad); font-size: 13.5px; }
