:root {
  --bg: var(--tg-theme-secondary-bg-color, #efeff4);
  --card: var(--tg-theme-section-bg-color, var(--tg-theme-bg-color, #fff));
  --text: var(--tg-theme-text-color, #000);
  --hint: var(--tg-theme-hint-color, #8e8e93);
  --accent: var(--tg-theme-button-color, #2481cc);
  --accent-text: var(--tg-theme-button-text-color, #fff);
  --link: var(--tg-theme-link-color, #2481cc);
  --sep: var(--tg-theme-section-separator-color, rgba(128,128,128,.2));
  --danger: var(--tg-theme-destructive-text-color, #e53935);
  --header: var(--tg-theme-section-header-text-color, var(--hint));
  --input: var(--tg-theme-bg-color, #fff);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.35 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
body { padding: 12px 12px calc(24px + env(safe-area-inset-bottom)); }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, textarea { font: inherit; color: var(--text); }
[hidden] { display: none !important; }

.row { display: flex; gap: 8px; align-items: center; }
.grow { flex: 1; min-width: 0; }

.field { background: var(--card); border-radius: 12px; padding: 0 12px; height: 42px;
  display: flex; align-items: center; gap: 8px; }
.field input { border: 0; outline: 0; background: transparent; flex: 1; min-width: 0; height: 100%; }
.icon-btn { width: 42px; height: 42px; border-radius: 12px; background: var(--card);
  display: grid; place-items: center; font-size: 20px; flex: none; }
.icon-btn.primary { background: var(--accent); color: var(--accent-text); font-size: 24px; }
.icon-btn:disabled { opacity: .5; }

.section-title { color: var(--header); font-size: 13px; text-transform: uppercase;
  letter-spacing: .02em; margin: 18px 12px 6px; }
.section-note { color: var(--hint); font-size: 13px; margin: 6px 12px 0; }

.list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.card { background: var(--card); border-radius: 14px; overflow: hidden; }
.card-head { display: flex; align-items: center; gap: 12px; padding: 10px 12px; width: 100%; text-align: left; }
.avatar { width: 44px; height: 44px; border-radius: 50%; flex: none; object-fit: cover;
  display: grid; place-items: center; color: #fff; font-weight: 600; font-size: 17px; }
.name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sub { color: var(--hint); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badges { display: flex; gap: 4px; flex: none; font-size: 14px; }
.badges span { opacity: .25; }
.badges span.on { opacity: 1; }
.chev { color: var(--hint); transition: transform .2s; flex: none; font-size: 18px; }
.card.open .chev { transform: rotate(180deg); }
.card-body { border-top: 1px solid var(--sep); }

.item { display: flex; align-items: center; gap: 12px; padding: 12px; min-height: 48px; }
.item + .item { border-top: 1px solid var(--sep); }
.item .label { flex: 1; }
.item .desc { color: var(--hint); font-size: 13px; }
.action { color: var(--link); width: 100%; text-align: left; }
.action.danger { color: var(--danger); }

.switch { position: relative; width: 51px; height: 31px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch .track { position: absolute; inset: 0; border-radius: 31px; background: var(--sep); transition: background .2s; }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px;
  border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0,0,0,.2); transition: transform .2s; }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(20px); }
.switch input:disabled + .track { opacity: .5; }

.group { background: var(--card); border-radius: 14px; overflow: hidden; }
textarea { width: 100%; border: 0; outline: 0; background: transparent; resize: vertical;
  min-height: 90px; padding: 12px; display: block; }
.radio { display: flex; align-items: center; gap: 12px; padding: 12px; width: 100%; text-align: left; cursor: pointer; }
.radio + .radio { border-top: 1px solid var(--sep); }
.radio .dot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--hint); flex: none;
  display: grid; place-items: center; }
.radio.on .dot { border-color: var(--accent); }
.radio.on .dot::after { content: ""; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); }
.hours { width: 64px; text-align: center; border: 1px solid var(--sep); border-radius: 8px;
  height: 32px; background: var(--input); outline: 0; }

.empty, .msg { text-align: center; color: var(--hint); padding: 40px 16px; }
.header { display: flex; align-items: center; gap: 8px; }
.header h1 { font-size: 20px; margin: 0 4px; flex: 1; }

/* Демо-режим (вне Telegram): баннер и заменители нативных кнопок */
.demo-banner { background: #fff3cd; color: #664d03; border-radius: 12px; padding: 10px 12px;
  font-size: 13px; margin-bottom: 12px; }
.back-btn { color: var(--link); font-size: 16px; padding: 6px 4px; }
.save-btn { position: sticky; bottom: calc(12px + env(safe-area-inset-bottom)); width: 100%; margin-top: 16px;
  height: 48px; border-radius: 12px; background: var(--accent); color: var(--accent-text); font-weight: 600; }
