:root {
  --bg: var(--tg-theme-bg-color, #ffffff);
  --bg2: var(--tg-theme-secondary-bg-color, #f1f2f6);
  --text: var(--tg-theme-text-color, #111111);
  --hint: var(--tg-theme-hint-color, #8a8f98);
  --link: var(--tg-theme-link-color, #2a7ae2);
  --btn: var(--tg-theme-button-color, #2a7ae2);
  --btn-text: var(--tg-theme-button-text-color, #ffffff);
  --danger: var(--tg-theme-destructive-text-color, #e5484d);
  --section: var(--tg-theme-section-bg-color, var(--bg));
  --sep: rgba(127, 127, 127, .18);
  --hot: #e5484d; --warm: #f0a020; --cold: #4a90d9; --ok: #2fa84f;
  --r: 12px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; background: var(--bg2); color: var(--text);
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
body { padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
button, input, select, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--hint); }
.center { text-align: center; padding: 40px 16px; }
.small { font-size: 13px; }

/* шапка */
.top { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: 10px 12px 8px;
  border-bottom: 1px solid var(--sep); }
.top h1 { font-size: 17px; margin: 0 0 8px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.top h1 .sub { font-size: 13px; font-weight: 400; color: var(--hint); }
.days { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.days::-webkit-scrollbar { display: none; }
.day { flex: 0 0 auto; border: 0; background: var(--bg2); border-radius: 10px; padding: 6px 12px; cursor: pointer;
  text-align: center; min-width: 58px; }
.day b { display: block; font-size: 16px; }
.day span { font-size: 12px; color: var(--hint); }
.day.on { background: var(--btn); color: var(--btn-text); }
.day.on span { color: var(--btn-text); opacity: .8; }
.day .cnt { font-size: 11px; }
.filter { margin-top: 8px; width: 100%; padding: 7px 10px; border-radius: 10px; border: 1px solid var(--sep); background: var(--bg2); }

/* список встреч */
.list { padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.card { background: var(--section); border-radius: var(--r); padding: 11px 12px; display: flex; gap: 12px; cursor: pointer;
  border-left: 4px solid transparent; }
.card.partner { border-left-color: #8e5cf6; }
.card.merchant { border-left-color: var(--ok); }
.card.cancelled, .card.no_show { opacity: .5; }
.card .time { min-width: 46px; font-weight: 600; }
.card .time small { display: block; font-weight: 400; color: var(--hint); font-size: 12px; }
.card .body { flex: 1; min-width: 0; }
.card .title { font-weight: 600; display: flex; gap: 6px; align-items: center; }
.card .title span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .meta { color: var(--hint); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .sum { font-size: 13px; margin-top: 4px; white-space: pre-line; display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden; }
.badge { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 8px; background: var(--bg2); color: var(--hint); font-weight: 500; }
.badge.hot { background: var(--hot); color: #fff; } .badge.warm { background: var(--warm); color: #fff; }
.badge.cold { background: var(--cold); color: #fff; } .badge.done { background: var(--ok); color: #fff; }
.now-line { font-size: 12px; color: var(--danger); display: flex; align-items: center; gap: 6px; }
.now-line::after { content: ""; flex: 1; height: 1px; background: var(--danger); }

/* кнопки */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 10px;
  padding: 10px 14px; background: var(--btn); color: var(--btn-text); font-weight: 600; cursor: pointer; }
.btn.sec { background: var(--bg2); color: var(--link); }
.btn.danger { background: transparent; color: var(--danger); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; }
.row { display: flex; gap: 8px; }
.row > * { flex: 1; min-width: 0; }
.fab { position: fixed; right: 16px; bottom: calc(78px + env(safe-area-inset-bottom)); width: 54px; height: 54px; border-radius: 50%;
  border: 0; background: var(--btn); color: var(--btn-text); font-size: 28px; box-shadow: 0 4px 14px rgba(0,0,0,.2); z-index: 6; }

/* нижнее меню */
.tabs { position: fixed; bottom: 0; left: 0; right: 0; display: flex; background: var(--bg); border-top: 1px solid var(--sep);
  padding-bottom: env(safe-area-inset-bottom); z-index: 7; }
.tabs button { flex: 1; border: 0; background: none; padding: 8px 0 10px; color: var(--hint); font-size: 11px; }
.tabs button i { display: block; font-style: normal; font-size: 20px; }
.tabs button.on { color: var(--link); }

/* формы и разделы */
.page { padding: 10px 12px 20px; }
.sec { background: var(--section); border-radius: var(--r); padding: 12px; margin-bottom: 10px; }
.sec h3 { margin: 0 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .02em; color: var(--hint); font-weight: 600;
  display: flex; justify-content: space-between; align-items: center; }
.field { margin-bottom: 10px; }
.field:last-child { margin-bottom: 0; }
.field label { display: block; font-size: 12px; color: var(--hint); margin-bottom: 3px; }
.field input, .field select, .field textarea { width: 100%; min-width: 0; max-width: 100%; -webkit-appearance: none; appearance: none; min-height: 40px; border: 1px solid var(--sep); border-radius: 10px; padding: 9px 10px;
  background: var(--bg2); outline: none; }
.field textarea { resize: vertical; min-height: 64px; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--btn); }
.company-input { font-size: 19px !important; font-weight: 700; background: transparent !important; border-color: transparent !important; padding: 2px 0 !important; }
.seg { display: flex; background: var(--bg2); border-radius: 10px; padding: 3px; gap: 3px; }
.seg button { flex: 1; border: 0; background: none; border-radius: 8px; padding: 7px 4px; font-size: 13px; cursor: pointer; }
.seg button.on { background: var(--bg); box-shadow: 0 1px 3px rgba(0,0,0,.12); font-weight: 600; }
.seg.lead button.on.hot { background: var(--hot); color: #fff; } .seg.lead button.on.warm { background: var(--warm); color: #fff; }
.seg.lead button.on.cold { background: var(--cold); color: #fff; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--sep); background: var(--bg2); border-radius: 16px; padding: 5px 11px; font-size: 13px; cursor: pointer; }
.chip.on { background: var(--btn); color: var(--btn-text); border-color: var(--btn); }

/* голос */
.rec { display: flex; align-items: center; gap: 12px; }
.rec-btn { width: 64px; height: 64px; border-radius: 50%; border: 0; background: var(--danger); color: #fff; font-size: 26px; flex: 0 0 auto; cursor: pointer; }
.rec-btn.on { animation: pulse 1.2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(229,72,77,.5); } 70% { box-shadow: 0 0 0 16px rgba(229,72,77,0); } 100% { box-shadow: 0 0 0 0 rgba(229,72,77,0); } }
.rec-time { font-size: 17px; font-variant-numeric: tabular-nums; font-weight: 600; }
.voice { border-top: 1px solid var(--sep); padding-top: 8px; margin-top: 8px; font-size: 14px; }
.voice .vh { display: flex; justify-content: space-between; color: var(--hint); font-size: 12px; }
.voice .vt { white-space: pre-wrap; margin-top: 3px; }
.voice .vt.collapsed { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.linkbtn { border: 0; background: none; color: var(--link); padding: 0; font-size: 12px; cursor: pointer; }
.summary { white-space: pre-wrap; font-size: 14px; }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--hint); border-top-color: transparent; border-radius: 50%;
  animation: spin .8s linear infinite; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }
.report-text { width: 100%; min-height: 320px; border: 1px solid var(--sep); border-radius: 10px; padding: 10px; background: var(--bg2); }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(84px + env(safe-area-inset-bottom)); background: rgba(0,0,0,.82);
  color: #fff; padding: 9px 14px; border-radius: 10px; font-size: 14px; z-index: 20; max-width: 90%; text-align: center; }
.user-row { display: flex; justify-content: space-between; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--sep); gap: 8px; }
.user-row:last-child { border-bottom: 0; }
ol.steps { margin: 4px 0 10px; padding-left: 20px; font-size: 13px; }
ol.steps li { margin-bottom: 3px; }
.empty { text-align: center; color: var(--hint); padding: 40px 20px; }
.save-state { font-size: 12px; color: var(--hint); font-weight: 400; }

.post .vh { display: flex; justify-content: space-between; }
.post-text { white-space: pre-wrap; word-break: break-word; }
.post-text a { color: var(--link); }
.post-img, .card-img { display: block; max-width: 100%; max-height: 220px; border-radius: 10px; margin-top: 8px; object-fit: cover; cursor: zoom-in; }
.card-img { max-height: 200px; margin: 0 auto; }
.post-img.big, .card-img.big { max-height: none; width: 100%; object-fit: contain; }
.top .row .btn { padding: 10px; }
.top .filter { margin-top: 8px; }
.top .chips { overflow-x: auto; flex-wrap: nowrap; }
.chip { white-space: nowrap; flex: 0 0 auto; }

/* иконки */
.ic { width: 18px; height: 18px; display: inline-block; vertical-align: -3px; flex: 0 0 auto; }
.ic.sm { width: 14px; height: 14px; vertical-align: -2px; }
.tabs button i { display: flex; justify-content: center; margin-bottom: 2px; }
.tabs button i .ic { width: 23px; height: 23px; stroke-width: 1.8; }
.tabs button.on i .ic { stroke-width: 2.2; }
.fab { display: flex; align-items: center; justify-content: center; }
.fab .ic { width: 26px; height: 26px; stroke-width: 2.4; }
.rec-btn { display: flex; align-items: center; justify-content: center; }
.rec-btn .ic { width: 28px; height: 28px; }
.badge .ic { width: 12px; height: 12px; vertical-align: -1px; stroke-width: 3; }
.badge { display: inline-flex; align-items: center; gap: 2px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.dot.hot { background: var(--hot); } .dot.warm { background: var(--warm); } .dot.cold { background: var(--cold); }
.seg.lead button.on .dot { background: #fff; }
.btn .ic { width: 18px; height: 18px; }
.meta .ic.sm { vertical-align: -2px; margin-right: 1px; }
.muted.ic, .ic.muted { color: var(--hint); }

/* офлайн */
.netbar { position: fixed; left: 0; right: 0; bottom: calc(58px + env(safe-area-inset-bottom)); z-index: 20;
  background: #3a3f47; color: #fff; font-size: 13px; padding: 6px 12px; display: flex; gap: 6px; align-items: center; justify-content: center; }
body.has-net { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
/* досье, помощь, команда, инфо */
.dos { display: flex; gap: 8px; padding: 7px 0; border-top: 1px solid var(--sep); cursor: pointer; }
.dos:first-of-type { border-top: 0; }
.dos > div { min-width: 0; }
.dos .small { white-space: pre-line; }
.help-box { background: var(--bg2); border-radius: 10px; padding: 10px; margin-top: 8px; }
.chips.qn { margin-top: 6px; }
.chips.qn .chip { font-size: 12px; padding: 4px 9px; }
.tm { padding: 8px 0; border-top: 1px solid var(--sep); }
.tm:first-child { border-top: 0; }
.tm-h { display: flex; gap: 6px; align-items: baseline; }
.tm-h .linkbtn { margin-left: auto; }
.tm-st { margin: 1px 0; }
.tm .busy { color: var(--danger); font-weight: 500; }
.tm .free { color: var(--ok); font-weight: 500; }
.info-item { border-top: 1px solid var(--sep); padding: 8px 0; }
.info-item:first-child { border-top: 0; }
.info-item summary { font-weight: 600; cursor: pointer; }
.info-item .post-text { margin-top: 6px; }
.info-act { display: flex; gap: 14px; margin-top: 6px; }
.sec h3 { justify-content: flex-start; gap: 6px; }
.sec h3 .linkbtn { margin-left: auto; text-transform: none; letter-spacing: 0; }
.exh { display: flex; gap: 8px; align-items: center; padding: 8px 0; border-top: 1px solid var(--sep); cursor: pointer; }
.exh:first-child { border-top: 0; }
.exh-b { flex: 1; min-width: 0; }
.exh-pay { display: flex; gap: 6px; align-items: center; margin: 8px 0 4px; }
/* .btn.sec совпадал с классом секции .sec (отступы и поля) — кнопки были разной высоты */
.btn { min-height: 44px; line-height: 1.2; }
.btn.sec { padding: 10px 14px; margin: 0; border-radius: 10px; }
.top .row .btn { padding: 10px 14px; }
.row { align-items: stretch; }
