/* «Ещё → Сообщения» на телефоне (SPEC §8.29): шкала телефона (--ph-*).
   Ящик — отбор чипами со счётчиками, поиск колодцем, строки от 72 px:
   знак человека, имя 17, последняя строка 15 тише, справа час и «ждёт»
   тоном ожидания. Переписка — свой лист: шапка с дорогой назад к ящику
   вместо шапки подэкрана, лента посередине, поле ответа над панелью.
   Гость — слева на бумаге, мы — справа чернилами, заметка для своих —
   листок с пунктиром: тот же язык, что у стойки на компьютере. Разметка —
   общая (chat-markup.mjs), поэтому всё здесь — под #phChats. */

#phChats{--cht-out:var(--accent);--cht-out-ink:var(--accent-ink)}
html[data-ui-theme="dark"] #phChats{--cht-out:color-mix(in srgb,var(--ink) 15%,var(--card));--cht-out-ink:var(--ink)}
#phChatsBody{padding:12px 0 calc(24px + var(--tel-bar))}
#phChatsBody > *{flex:none}
/* В переписке шапка подэкрана уступает место своей: назад — к ящику. */
#phChats.in-thread .tel-sub-h{display:none}
#phChatsBody.thread{padding:0 0 var(--tel-bar);overflow:hidden}
/* Лента — единственное, что сжимается: шапка и поле ответа остаются на месте. */
#phChatsBody.thread > .tch-feed-w{flex:1 1 auto;min-height:0;position:relative;display:flex;flex-direction:column}

/* ── ящик ── */
.tch-top{padding:0 var(--ph-gutter)}
.tch-chips{display:flex;gap:6px;margin:0 calc(-1 * var(--ph-gutter)) 10px;padding:0 var(--ph-gutter);overflow-x:auto;scrollbar-width:none}
.tch-chips::-webkit-scrollbar{display:none}
.tch-chip{
  display:inline-flex;align-items:center;gap:6px;flex:none;height:36px;padding:0 14px;border-radius:var(--r-pill);
  font-size:var(--ph-s);font-weight:550;color:var(--ink-2);box-shadow:inset 0 0 0 1px var(--rule);
  transition:transform var(--t-tap) var(--ease);
}
.tch-chip u{text-decoration:none;font-weight:650;color:var(--wait);font-variant-numeric:tabular-nums}
.tch-chip.on{background:var(--ink);color:var(--card);box-shadow:none}
.tch-chip.on u{color:inherit;opacity:.75}
.tch-chip:active{transform:scale(.96)}
.tch-search{display:flex;align-items:center;gap:8px;height:44px;margin:0 0 6px;padding:0 12px;border-radius:var(--r);background:var(--sunk);color:var(--ink-3)}
.tch-search svg{width:18px;height:18px;flex:none}
.tch-search input{flex:1;min-width:0;height:100%;border:0;background:none;font:inherit;font-size:16px;color:var(--ink);outline:none}
.tch-search input::placeholder{color:var(--ink-3)}
.tch-down{display:flex;gap:8px;align-items:flex-start;margin:8px var(--ph-gutter) 0;padding:10px 12px;border-radius:var(--r);
  background:var(--late-bg);box-shadow:inset 0 0 0 1px var(--late-line);font-size:var(--ph-s);line-height:1.45;color:var(--late)}
.tch-down svg{width:16px;height:16px;flex:none;margin-top:1px}

#phChats .cht-accts{display:flex;gap:6px;overflow-x:auto;scrollbar-width:none;padding:8px var(--ph-gutter) 2px}
#phChats .cht-acct{
  display:inline-flex;align-items:center;gap:6px;flex:none;height:32px;padding:0 12px;border-radius:var(--r-pill);
  font-size:var(--ph-xs);font-weight:550;color:var(--ink-2);box-shadow:inset 0 0 0 1px var(--rule-2);
}
#phChats .cht-acct span{max-width:150px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
#phChats .cht-acct.on{background:var(--ink);color:var(--card);box-shadow:none}
#phChats .cht-acct.down:not(.on){color:var(--late)}

#phChats .cht-list{list-style:none;margin:6px 0 0;padding:0}
#phChats .cht-row{
  position:relative;display:grid;grid-template-columns:48px minmax(0,1fr);align-items:center;gap:12px;width:100%;min-height:72px;
  padding:10px var(--ph-gutter);text-align:left;color:var(--ink);transition:background-color var(--t-tap) var(--ease);
}
/* Черта между строками — от текста, а не от края: знак человека её не режет. */
#phChats .cht-list li + li .cht-row::before{content:"";position:absolute;top:0;left:calc(var(--ph-gutter) + 60px);right:0;height:1px;background:var(--rule-2)}
#phChats .cht-row:active{background:var(--paper)}
#phChats .cht-row.down{opacity:.72}
#phChats .cht-row-main{display:flex;flex-direction:column;gap:3px;min-width:0}
#phChats .cht-row-top{display:flex;align-items:center;gap:6px;min-width:0}
#phChats .cht-row-top b{min-width:0;font-size:var(--ph-h);font-weight:600;letter-spacing:-.015em;line-height:1.25;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
#phChats .cht-row-top time{margin-left:auto;padding-left:8px;font-size:var(--ph-xs);color:var(--ink-3);white-space:nowrap;font-variant-numeric:tabular-nums}
#phChats .cht-row.unread time{color:var(--ink);font-weight:600}
#phChats .cht-row.unread time::before{content:"";display:inline-block;width:8px;height:8px;margin:0 6px 1px 0;border-radius:50%;background:var(--accent);vertical-align:middle}
#phChats .cht-row-sub{display:flex;align-items:center;gap:8px;min-width:0}
#phChats .cht-prev{flex:1;min-width:0;font-size:var(--ph-b);line-height:1.35;color:var(--ink-3);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
#phChats .cht-row.unread .cht-prev{color:var(--ink-2)}
#phChats .cht-you{font-style:normal}
#phChats .cht-row-sub em{flex:none;font-style:normal;font-size:var(--ph-xs);white-space:nowrap;font-variant-numeric:tabular-nums}
/* Ожидание — словом тоном, без плашки (16.10), как на компьютере. */
#phChats .cht-wait{color:var(--wait);font-weight:650}
#phChats .cht-later{display:inline-flex;align-items:center;gap:4px;color:var(--ink-3)}
#phChats .cht-later svg{width:12px;height:12px}
#phChats .cht-done{color:var(--ink-3)}
#phChats .cht-kind{display:inline-flex;flex:none;width:16px;height:16px}
#phChats .cht-kind svg{width:100%;height:100%}
#phChats .cht-face{
  width:48px;height:48px;display:flex;align-items:center;justify-content:center;flex:none;
  border-radius:var(--r-mark);background:var(--av,var(--stop));color:var(--av-ink);
  font-size:15px;font-style:normal;font-weight:600;letter-spacing:.03em;box-shadow:inset 0 0 0 1px rgb(0 0 0 / .06);
}
#phChats .cht-face .face-glyph{width:24px;height:24px;stroke-width:1.9;font-size:22px}
/* Мессенджер — значком на углу знака человека, кольцом цвета листа. */
#phChats .cht-face-w{position:relative;display:inline-flex;flex:none;--cht-ring:var(--card)}
#phChats .cht-badge{position:absolute;right:-3px;bottom:-3px;display:grid;place-items:center;width:20px;height:20px;border-radius:50%;
  background:var(--card);box-shadow:0 0 0 2px var(--cht-ring),0 1px 2px rgb(25 24 21 / .12)}
#phChats .cht-badge svg{width:16px;height:16px}
#phChats .cht-row:active .cht-face-w{--cht-ring:var(--paper)}
#phChats .tch-who .cht-face-w{--cht-ring:var(--paper)}
#phChats .tch-who .cht-badge{width:16px;height:16px;right:-3px;bottom:-3px}
#phChats .tch-who .cht-badge svg{width:13px;height:13px}
#phChats .cht-more{display:block;width:calc(100% - 2 * var(--ph-gutter));height:44px;margin:10px var(--ph-gutter) 0;border-radius:var(--r);
  font-size:var(--ph-s);font-weight:550;color:var(--ink-2);box-shadow:inset 0 0 0 1px var(--rule)}
#phChats .cht-none{padding:24px var(--ph-gutter) 0}
.tch-blank{padding:24px var(--ph-gutter) 0}
.tch-fail{margin:24px var(--ph-gutter);font-size:var(--ph-s);line-height:1.5;color:var(--late);text-align:center}
.tch-fail button{color:var(--ink);text-decoration:underline}
.tch-skel{padding:6px var(--ph-gutter)}
.tch-skel i{display:block;height:64px;margin-bottom:8px;border-radius:var(--r);background:var(--sunk)}
.tch-skel.thread{padding:80px var(--ph-gutter) 0}
.tch-skel.thread i{height:44px;width:62%;border-radius:var(--r-lg)}
.tch-skel.thread i.r{margin-left:auto;width:46%}

/* ── переписка ── */
.tch-head{
  position:relative;z-index:3;display:flex;align-items:center;gap:4px;flex:none;
  min-height:calc(56px + env(safe-area-inset-top,0px));padding:env(safe-area-inset-top,0px) 10px 0 4px;
  background:var(--paper);box-shadow:inset 0 -1px 0 var(--rule-2);
}
.tch-who{display:flex;align-items:center;gap:10px;flex:1;min-width:0;padding:6px 4px;border-radius:var(--r);text-align:left;color:var(--ink)}
button.tch-who:active{background:var(--sunk)}
#phChats .tch-who .cht-face{width:36px;height:36px;font-size:12px}
.tch-who-t{display:flex;flex-direction:column;gap:1px;min-width:0}
.tch-who-t b{display:flex;align-items:center;gap:6px;min-width:0;font-size:var(--ph-b);font-weight:600;letter-spacing:-.01em;line-height:1.25;white-space:nowrap}
.tch-who-t b{overflow:hidden;text-overflow:ellipsis}
.tch-who-t > span{font-size:var(--ph-xs);color:var(--ink-3);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.tch-acts{display:flex;align-items:center;gap:4px;flex:none}
.tch-ico{display:grid;place-items:center;width:40px;height:40px;border-radius:var(--r-pill);color:var(--ink-2);transition:transform var(--t-tap) var(--ease)}
.tch-ico svg{width:20px;height:20px}
.tch-ico[aria-expanded="true"]{background:var(--sunk);color:var(--ink)}
.tch-done{
  display:inline-flex;align-items:center;gap:5px;height:36px;padding:0 14px;border-radius:var(--r-pill);
  font-size:var(--ph-s);font-weight:600;color:var(--ink);box-shadow:inset 0 0 0 1px var(--rule);
  transition:transform var(--t-tap) var(--ease);
}
.tch-done svg{width:16px;height:16px}
.tch-ico:active,.tch-done:active{transform:scale(.95)}

/* Меню «Позже» и готовых ответов — листком под пальцем, а не окном. */
.tch-pop{position:absolute;z-index:6;left:var(--ph-gutter);right:var(--ph-gutter);top:calc(58px + env(safe-area-inset-top,0px))}
.tch-pop.tch-up{top:auto;bottom:calc(100% + 6px);left:12px;right:12px}
.tch-pop .cht-menu{
  display:flex;flex-direction:column;max-height:min(52dvh,420px);overflow-y:auto;padding:6px;border-radius:var(--r-lg);
  background:var(--card);box-shadow:var(--sh-modal);transform-origin:top right;animation:tchPop .18s cubic-bezier(.23,1,.32,1) both;
}
.tch-pop.tch-up .cht-menu{transform-origin:bottom left}
.tch-pop .cht-menu > button{display:flex;flex-direction:column;align-items:flex-start;gap:2px;min-height:48px;padding:9px 12px;border-radius:var(--r);
  text-align:left;font-size:var(--ph-b);font-weight:550;color:var(--ink)}
.tch-pop .cht-menu > button em{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;font-style:normal;font-weight:400;
  font-size:var(--ph-s);line-height:1.35;color:var(--ink-3)}
.tch-pop .cht-menu > button:active,.tch-pop .cht-menu > button.on{background:var(--sunk)}
.tch-pop .cht-menu-own{display:flex;flex-direction:column;gap:6px;margin:4px 0 0;padding:10px 12px 6px;border-top:1px solid var(--rule-2);font-size:var(--ph-s);color:var(--ink-3)}
.tch-pop .cht-menu-own input{height:44px;padding:0 12px;border:1px solid var(--rule);border-radius:var(--r);background:var(--card);font:inherit;font-size:16px;color:var(--ink)}
.tch-pop .cht-menu-said{margin:0;padding:10px 12px;font-size:var(--ph-s);line-height:1.5;color:var(--ink-3)}
@keyframes tchPop{from{opacity:0;transform:scale(.96)}}

.tch-feed{flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain;padding:4px 10px 12px;background:var(--paper);
  /* Край прокрутки гаснет под шапкой, как на компьютере, а не режет пузырь пополам. */
  mask-image:linear-gradient(to bottom,transparent,#000 24px,#000 calc(100% - 8px),transparent)}
#phChats .cht-msgs{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:2px}
#phChats .cht-day{display:flex;justify-content:center;padding:14px 0 8px}
#phChats .cht-day span{padding:3px 11px;border-radius:var(--r-pill);background:color-mix(in srgb,var(--card) 75%,transparent);
  font-size:var(--ph-xs);font-weight:500;color:var(--ink-3)}
#phChats .cht-older{font-size:var(--ph-s);color:var(--ink-2);text-decoration:underline}
#phChats .cht-m{display:flex;flex-direction:column;align-items:flex-start;max-width:82%}
#phChats .cht-m.out{align-self:flex-end;align-items:flex-end}
/* Реплики одного человека подряд — вплотную, новая группа — с шагом. */
#phChats .cht-m.g-start{margin-top:10px}
#phChats .cht-day + .cht-m{margin-top:0}
#phChats .cht-by{margin:0 10px 4px;font-size:var(--ph-xs);font-weight:500;color:var(--ink-3)}
#phChats .cht-bubble{position:relative;padding:8px 12px 7px;border-radius:18px;font-size:var(--ph-b);line-height:1.4;color:var(--ink);overflow-wrap:anywhere}
#phChats .cht-bubble p{margin:0}
#phChats .cht-bubble a{color:inherit;text-decoration:underline;text-underline-offset:2px}
#phChats .cht-m.in .cht-bubble{background:var(--card);box-shadow:var(--sh-1);border-bottom-left-radius:6px}
#phChats .cht-m.in:not(.g-start) .cht-bubble{border-top-left-radius:6px}
#phChats .cht-m.out .cht-bubble{background:var(--cht-out);color:var(--cht-out-ink);border-bottom-right-radius:6px}
#phChats .cht-m.out:not(.g-start) .cht-bubble{border-top-right-radius:6px}
#phChats .cht-m.queued .cht-bubble{opacity:.6}
#phChats .cht-m.failed .cht-bubble{box-shadow:0 0 0 1.5px var(--late)}
#phChats .cht-gone{color:var(--ink-3);font-style:italic}
#phChats .cht-m.out .cht-gone{color:inherit;opacity:.7}
#phChats .cht-att{display:flex;align-items:center;gap:10px;padding:2px 0 6px}
#phChats .cht-att > i{display:grid;place-items:center;flex:none;width:38px;height:38px;border-radius:12px;background:var(--sunk);color:var(--ink-2)}
#phChats .cht-m.out .cht-att > i{background:color-mix(in srgb,var(--cht-out-ink) 14%,transparent);color:inherit}
#phChats .cht-att > i svg{width:19px;height:19px}
#phChats .cht-att > span{display:flex;flex-direction:column;gap:1px;min-width:0}
#phChats .cht-att b{font-size:var(--ph-s);font-weight:600}
#phChats .cht-att em{font-style:normal;font-size:var(--ph-xs);opacity:.7}
/* Час и галочки — в углу пузыря, место держит невидимая копия в конце текста. */
#phChats .cht-meta,#phChats .cht-meta-pad{display:inline-flex;align-items:center;gap:3px;font-size:11px;line-height:1;white-space:nowrap;font-variant-numeric:tabular-nums}
#phChats .cht-meta{position:absolute;right:11px;bottom:7px;color:var(--ink-3)}
#phChats .cht-m.out .cht-meta{color:color-mix(in srgb,var(--cht-out-ink) 58%,transparent)}
#phChats .cht-meta-pad{visibility:hidden;margin-left:12px;vertical-align:-1px}
#phChats .cht-only{line-height:1}
#phChats .cht-st{display:inline-flex;width:15px;height:15px}
#phChats .cht-st svg{width:100%;height:100%}
#phChats .cht-m.out .cht-st.read{color:var(--cht-out-ink)}
#phChats .cht-failed{display:inline-flex;align-items:center;gap:6px;flex-wrap:wrap;justify-content:flex-end;margin-top:4px;font-size:var(--ph-s);color:var(--late)}
#phChats .cht-failed svg{width:14px;height:14px}
#phChats .cht-failed button{min-height:36px;padding:0 4px;font:inherit;font-weight:600;color:inherit;text-decoration:underline}
#phChats .cht-m.note{align-self:flex-end;max-width:86%;margin-top:10px}
#phChats .cht-note{padding:9px 13px 10px;border:1px dashed color-mix(in srgb,var(--ink) 35%,transparent);border-radius:16px;background:var(--card)}
#phChats .cht-note-h{display:flex;align-items:center;gap:6px;margin-bottom:4px;font-size:var(--ph-xs);font-weight:500;color:var(--ink-3)}
#phChats .cht-note-h svg{width:13px;height:13px}
#phChats .cht-note-h time{margin-left:8px;font-variant-numeric:tabular-nums}
#phChats .cht-note p{margin:0;font-size:var(--ph-b);line-height:1.45;color:var(--ink-2);overflow-wrap:anywhere}
@media (prefers-reduced-motion:no-preference){
  #phChats .cht-m.in[data-fresh]{transform-origin:left bottom;animation:tchIn 260ms cubic-bezier(.23,1,.32,1) both}
  #phChats .cht-m.out[data-fresh],#phChats .cht-m.note[data-fresh]{transform-origin:right bottom;animation:tchOut 340ms cubic-bezier(.23,1,.32,1) both}
  #phChats .cht-m.now-sent .cht-bubble{animation:tchSettle 280ms ease-out both}
  #phChats .cht-m.now-sent .cht-st path[pathLength]{animation:tchDraw 340ms cubic-bezier(.23,1,.32,1) 60ms both}
  #phChats .cht-m.now-read .cht-st{animation:tchRead 420ms ease-out both}
  #phChats .cht-m.now-read .cht-st path[pathLength]:last-child{animation:tchDraw 360ms cubic-bezier(.23,1,.32,1) both}
  #phChats .cht-m.now-failed .cht-bubble{animation:tchNo 420ms cubic-bezier(.36,.07,.19,.97) both}
}
/* Движение ленты — как у стойки (chat-motion.mjs): наше поднимается из поля, гостя проявляется,
   галочки рисуются штрихом, не ушедшее вздрагивает. */
#phChats .cht-st path[pathLength]{stroke-dasharray:1;stroke-dashoffset:0}
@keyframes tchIn{from{opacity:0;transform:translateY(8px) scale(.97)}}
@keyframes tchOut{from{opacity:0;transform:translateY(20px) scale(.94)}}
@keyframes tchSettle{from{opacity:.6}}
@keyframes tchDraw{from{stroke-dashoffset:1}}
@keyframes tchRead{from{color:color-mix(in srgb,var(--cht-out-ink) 58%,transparent)}}
@keyframes tchNo{20%{transform:translateX(-3px)}40%{transform:translateX(3px)}60%{transform:translateX(-2px)}80%{transform:translateX(1px)}}

/* ── поле ответа ── */
.tch-compose{position:relative;flex:none;display:flex;flex-direction:column;gap:8px;padding:8px 12px 10px;background:var(--paper);box-shadow:inset 0 1px 0 var(--rule-2)}
.tch-tools{display:flex;align-items:center;gap:8px}
.tch-modes{display:inline-flex;padding:3px;border-radius:var(--r-pill);background:var(--sunk)}
.tch-modes button{height:30px;padding:0 12px;border-radius:var(--r-pill);font-size:var(--ph-xs);font-weight:600;color:var(--ink-3)}
.tch-modes button.on{background:var(--card);color:var(--ink);box-shadow:var(--sh-1)}
.tch-tool{display:inline-flex;align-items:center;gap:6px;height:36px;margin-left:auto;padding:0 12px;border-radius:var(--r-pill);font-size:var(--ph-s);font-weight:550;color:var(--ink-2)}
.tch-tool svg{width:17px;height:17px}
.tch-tool[aria-expanded="true"],.tch-tool:active{background:var(--sunk);color:var(--ink)}
/* Поле — капсула; отправка — круг в её правом краю, у большого пальца. */
.tch-input{position:relative;display:flex;align-items:flex-end}
/* 16 px: меньший кегль заставляет iPhone увеличивать страницу при касании поля. */
.tch-input textarea{
  flex:1;min-width:0;min-height:44px;max-height:140px;padding:11px 50px 11px 14px;resize:none;border:1px solid var(--rule);border-radius:22px;box-shadow:var(--sh-1);
  background:var(--card);font:inherit;font-size:16px;line-height:1.35;color:var(--ink);outline:none;
}
.tch-input textarea:focus{border-color:var(--ink-3)}
.tch-input textarea::placeholder{color:var(--ink-3)}
.tch-compose.note .tch-input textarea{background:var(--paper);border-style:dashed;border-color:var(--ink-3)}
.tch-send{position:absolute;right:5px;bottom:5px;display:grid;place-items:center;width:34px;height:34px;border-radius:50%;
  background:var(--accent);color:var(--accent-ink);transition:transform 200ms cubic-bezier(.23,1,.32,1),opacity 140ms var(--ease)}
/* Палец промахивается — круг ловит касание шире себя. */
.tch-send::before{content:"";position:absolute;inset:-5px}
.tch-send svg{width:19px;height:19px;transition:transform 280ms cubic-bezier(.23,1,.32,1),opacity 200ms var(--ease)}
/* Отправили — стрелка улетает вверх. */
.tch-send.launch svg{transform:translateY(-130%);opacity:0}
.tch-send:disabled{opacity:0;transform:scale(.8);pointer-events:none}
.tch-send.busy:disabled{opacity:.4;transform:none}
.tch-send:not(:disabled):active{transform:scale(.9)}
.tch-err{margin:0;font-size:var(--ph-s);line-height:1.45;color:var(--late)}
.tch-cant{display:flex;gap:8px;align-items:flex-start;flex:none;margin:0;padding:12px var(--ph-gutter) 14px;background:var(--paper);
  box-shadow:inset 0 1px 0 var(--rule-2);font-size:var(--ph-s);line-height:1.45;color:var(--ink-2)}
.tch-cant svg{width:16px;height:16px;flex:none;margin-top:1px;color:var(--late)}

/* ── фото и голосовые в ленте на телефоне (§8.29) ── тот же язык, что у стойки, под палец:
   фото во всю ширину пузыря в своей пропорции, время на снимке без подписи;
   голосовое — кнопка и волна, перемотка протяжкой пальца по волне. */
#phChats .cht-bubble.photo{padding:0;overflow:hidden;width:min(var(--pw,300px),100%)}
#phChats .cht-bubble.photo > p{padding:8px 12px 7px}
#phChats .cht-photo{position:relative;display:block;width:100%;aspect-ratio:var(--ar,4 / 3);overflow:hidden;background:var(--sunk)}
#phChats .cht-m.out .cht-photo{background:color-mix(in srgb,var(--cht-out-ink) 12%,var(--cht-out))}
#phChats .cht-photo img{display:block;width:100%;height:100%;object-fit:cover;opacity:0;transition:opacity 260ms var(--ease)}
#phChats .cht-photo.ok img{opacity:1}
#phChats .cht-photo::before{content:"";position:absolute;inset:0;z-index:1;pointer-events:none;
  background:linear-gradient(100deg,transparent 30%,color-mix(in srgb,var(--card) 55%,transparent) 50%,transparent 70%);
  transform:translateX(-100%);animation:tchShine 1400ms cubic-bezier(.4,0,.2,1) infinite}
#phChats .cht-photo.ok::before,#phChats .cht-photo.failed::before{display:none}
@keyframes tchShine{to{transform:translateX(100%)}}
#phChats .cht-bubble.photo.bare .cht-meta{right:8px;bottom:8px;padding:3px 7px;border-radius:var(--r-pill);background:rgb(20 18 16 / .52);color:rgb(255 255 255)}
#phChats .cht-bubble.photo.bare .cht-meta .cht-st{color:rgb(255 255 255)}
#phChats .cht-photo-fail{display:none;align-items:center;gap:10px;padding:10px 12px;text-align:left}
#phChats .cht-photo-fail > i{display:grid;place-items:center;flex:none;width:38px;height:38px;border-radius:12px;background:var(--sunk);color:var(--ink-2)}
#phChats .cht-photo-fail > i svg{width:19px;height:19px}
#phChats .cht-photo-fail > span{display:flex;flex-direction:column;gap:1px}
#phChats .cht-photo-fail b{font-size:var(--ph-s);font-weight:600}
#phChats .cht-photo-fail em{font-style:normal;font-size:var(--ph-xs);opacity:.7}
#phChats .cht-photo.failed{aspect-ratio:auto;background:none}
#phChats .cht-photo.failed img{display:none}
#phChats .cht-photo.failed .cht-photo-fail{display:flex}
#phChats .cht-bubble.photo:has(.cht-photo.failed){width:auto}
#phChats .cht-bubble.photo.bare:has(.cht-photo.failed) .cht-meta{position:static;display:flex;justify-content:flex-end;padding:0 10px 7px;background:none;color:var(--ink-3)}
#phChats .cht-bubble.voice{padding:8px 12px 8px 8px}
#phChats .cht-voice{display:flex;align-items:center;gap:10px;--p:0}
#phChats .cht-voice audio{display:none}
#phChats .cht-play{position:relative;display:grid;place-items:center;flex:none;width:44px;height:44px;border-radius:50%;
  background:color-mix(in srgb,var(--ink) 7%,transparent);color:var(--ink);transition:transform var(--t-tap) var(--ease)}
#phChats .cht-m.out .cht-play{background:color-mix(in srgb,var(--cht-out-ink) 16%,transparent);color:var(--cht-out-ink)}
#phChats .cht-play svg{width:19px;height:19px}
#phChats .cht-play .i-play{margin-left:2px}
#phChats .cht-play .i-pause,#phChats .cht-voice.playing .cht-play .i-play{display:none}
#phChats .cht-voice.playing .cht-play .i-pause{display:block}
#phChats .cht-play:active{transform:scale(.94)}
#phChats .cht-voice.loading .cht-play::after{content:"";position:absolute;inset:0;border-radius:50%;border:2px solid transparent;border-top-color:currentColor;
  animation:tchSpin 800ms linear infinite}
@keyframes tchSpin{to{transform:rotate(360deg)}}
#phChats .cht-vbody{display:flex;flex-direction:column;gap:5px;min-width:0}
#phChats .cht-wave{position:relative;display:block;width:164px;height:30px;touch-action:none}
#phChats .cht-wave > span{position:absolute;inset:0;display:flex;align-items:center;gap:2px}
#phChats .cht-wave i{flex:1;height:var(--h);min-height:3px;border-radius:2px;background:currentColor}
#phChats .cht-wave .w-base{opacity:.28}
#phChats .cht-wave .w-fill{clip-path:inset(0 calc((1 - var(--p)) * 100%) 0 0)}
#phChats .cht-voice.flat .cht-wave i{height:3px}
#phChats .cht-vline{display:flex;align-items:center;gap:8px;min-height:20px;padding-right:48px}
#phChats .cht-dur{font-size:var(--ph-xs);font-weight:500;color:var(--ink-3);font-variant-numeric:tabular-nums}
#phChats .cht-m.out .cht-dur{color:color-mix(in srgb,var(--cht-out-ink) 70%,transparent)}
#phChats .cht-speed{display:none;height:22px;padding:0 8px;border-radius:var(--r-pill);font-size:11px;font-weight:700;color:inherit;
  background:color-mix(in srgb,currentColor 12%,transparent);font-variant-numeric:tabular-nums}
#phChats .cht-voice.started .cht-speed{display:inline-flex;align-items:center}
#phChats .cht-bubble.voice .cht-meta{bottom:10px}
#phChats .cht-voice-fail{display:none;font-size:var(--ph-s);line-height:1.4;opacity:.75;padding:2px 4px}
#phChats .cht-voice.failed > :not(.cht-voice-fail){display:none}
#phChats .cht-voice.failed .cht-voice-fail{display:block}
/* Сразу после «не по работе» — капсула над панелью: кто скрыт и «Вернуть». */
#phChats .cht-undo{
  position:fixed;left:12px;right:12px;bottom:calc(var(--tel-bar) + 12px);z-index:30;display:flex;align-items:center;gap:12px;
  min-height:52px;padding:6px 6px 6px 16px;border-radius:var(--r-lg);background:var(--accent);color:var(--accent-ink);box-shadow:var(--sh-3);
  font-size:var(--ph-s);
}
#phChats .cht-undo span{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
#phChats .cht-undo b{font-weight:600}
#phChats .cht-undo button{flex:none;height:40px;padding:0 16px;border-radius:var(--r);font-size:var(--ph-s);font-weight:600;color:inherit;
  background:color-mix(in srgb,var(--accent-ink) 16%,transparent);transition:transform var(--t-tap) var(--ease)}
#phChats .cht-undo button:active{transform:scale(.96)}
@media (prefers-reduced-motion:no-preference){ #phChats .cht-undo{animation:tchUndo 240ms cubic-bezier(.23,1,.32,1) both} }
@keyframes tchUndo{from{opacity:0;transform:translateY(10px)}}

/* Лента прокручена вверх — круг «к последним» над полем ответа. */
#phChats .cht-tobottom{
  position:absolute;right:12px;bottom:12px;z-index:2;display:grid;place-items:center;width:40px;height:40px;border-radius:50%;
  background:var(--card);color:var(--ink-2);box-shadow:var(--sh-2);
  opacity:0;transform:translateY(6px) scale(.92);visibility:hidden;pointer-events:none;
  transition:opacity 160ms var(--ease),transform 220ms cubic-bezier(.23,1,.32,1),visibility 0s linear 220ms;
}
#phChats .cht-tobottom.on{opacity:1;transform:none;visibility:visible;pointer-events:auto;transition-delay:0s}
#phChats .cht-tobottom svg{width:19px;height:19px}
#phChats .cht-tobottom:active{transform:scale(.94)}
.cht-lb{position:fixed;inset:0;z-index:1000;display:grid;place-items:center;padding:calc(56px + env(safe-area-inset-top,0px)) 12px 24px;
  background:rgb(12 11 10 / .94);opacity:0;transition:opacity 220ms var(--ease)}
.cht-lb.on{opacity:1}
.cht-lb-fig{display:grid;justify-items:center;gap:12px;margin:0;max-width:100%}
.cht-lb-fig img{display:block;max-width:100%;max-height:72dvh;border-radius:10px;object-fit:contain}
.cht-lb-fig figcaption{display:grid;justify-items:center;gap:3px;text-align:center;color:rgb(255 255 255 / .92);font-size:var(--ph-b);line-height:1.45;
  opacity:0;transition:opacity 220ms var(--ease) 120ms}
.cht-lb.on figcaption{opacity:1}
.cht-lb-fig figcaption span{font-size:var(--ph-xs);color:rgb(255 255 255 / .6)}
.cht-lb-x{position:absolute;top:calc(10px + env(safe-area-inset-top,0px));right:10px;display:grid;place-items:center;width:44px;height:44px;border-radius:50%;
  background:rgb(255 255 255 / .16);color:rgb(255 255 255)}
.cht-lb-x svg{width:20px;height:20px}

/* ── «Переписка» в карточке брони и гостя на телефоне (SPEC §8.29) ──
   Тот же блок, что на компьютере (chat-card.mjs), в шкале телефона: строки
   крупнее, кнопки под палец, «Написать» — плашками по две в ряд. */
.cc{display:grid;gap:12px;--cc-out:var(--accent);--cc-out-ink:var(--accent-ink)}
html[data-ui-theme="dark"] .cc{--cc-out:color-mix(in srgb,var(--ink) 15%,var(--card));--cc-out-ink:var(--ink)}
.cc-h{display:flex;align-items:center;gap:10px;min-width:0}
.cc-kind{display:grid;place-items:center;flex:none;width:32px;height:32px}
.cc-kind svg{width:26px;height:26px}
.cc-h b{flex:1;min-width:0;font-size:var(--ph-b);font-weight:600;color:var(--ink);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.cc-open{display:inline-flex;align-items:center;gap:6px;flex:none;min-height:36px;padding:0 12px;border-radius:var(--r-pill);
  font-size:var(--ph-s);font-weight:550;color:var(--ink-2);box-shadow:inset 0 0 0 1px var(--rule);transition:transform var(--t-tap) var(--ease)}
.cc-open svg{width:15px;height:15px}
.cc-open:active{transform:scale(.96)}
.cc-said{margin:0;font-size:var(--ph-s);line-height:1.5;color:var(--ink-3)}
.cc-feed{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:5px}
.cc-m{display:flex;align-items:flex-end;gap:6px;max-width:88%}
.cc-m.out{align-self:flex-end;flex-direction:row-reverse}
.cc-m p{margin:0;padding:8px 12px;border-radius:16px;font-size:var(--ph-s);line-height:1.4;color:var(--ink);background:var(--sunk);
  display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3;overflow:hidden;overflow-wrap:anywhere}
.cc-m.in p{border-bottom-left-radius:5px}
.cc-m.out p{background:var(--cc-out);color:var(--cc-out-ink);border-bottom-right-radius:5px}
.cc-m time{flex:none;padding-bottom:3px;font-size:11px;color:var(--ink-3);font-variant-numeric:tabular-nums;white-space:nowrap}
.cc-write{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
.cc-write > span{grid-column:1 / -1;font-size:var(--ph-xs);font-weight:500;color:var(--ink-3)}
.cc-text{display:grid;gap:2px;min-height:52px;padding:9px 12px;border-radius:14px;text-align:left;background:var(--card);box-shadow:inset 0 0 0 1px var(--rule);
  transition:transform var(--t-tap) var(--ease),background-color var(--t-tap) var(--ease)}
.cc-text b{font-size:var(--ph-s);font-weight:600;color:var(--ink)}
.cc-text em{font-style:normal;font-size:var(--ph-xs);line-height:1.35;color:var(--ink-3)}
.cc-text:active{transform:scale(.97);background:var(--sunk)}
.tel-gs-paper .cc{margin:4px 0 6px}

@media (prefers-reduced-motion:reduce){
  #phChats .cht-photo img,#phChats .cht-play,.cht-lb,.cht-lb-fig figcaption,#phChats .cht-tobottom{transition:none}
  #phChats .cht-tobottom,#phChats .cht-tobottom:active,.tch-send:disabled{transform:none}
  #phChats .cht-photo::before{animation:none;opacity:0}
  #phChats .cht-voice.loading .cht-play::after{animation:none;border-color:currentColor;opacity:.3}
}

@media (prefers-reduced-motion:reduce){
  .cc-open,.cc-text{transition:none}
  .cc-open:active,.cc-text:active{transform:none}
}

@media (prefers-reduced-motion:reduce){
  .tch-pop .cht-menu{animation:none}
  .tch-chip,.tch-done,.tch-ico,.tch-send{transition:none}
}
