/* Малое скругление сохраняет направление пузыря. */
#dialogsView .message.inbound,.appearance-preview .message.inbound { border-top-left-radius:min(4px,var(--message-radius)); }
#dialogsView .message.outbound,.appearance-preview .message.outbound { border-bottom-right-radius:min(4px,var(--message-radius)); }
.message-image-viewer img { background:#fafafa; border-radius:12px; }
#appView .cabinet-video-player>button.video-play { background:var(--chat-accent,#53b559); color:#fff; -webkit-tap-highlight-color:transparent; }
#appView .cabinet-video-player>button.video-play:hover:not(:disabled) { background:var(--chat-accent,#53b559); color:#fff; filter:brightness(1.08); }
#appView .cabinet-video-player>button.video-play:active:not(:disabled) { background:var(--chat-accent,#53b559); filter:brightness(.94); }
#appView #dialogsView .appeals-list-body { padding-inline:0; min-width:0; }
#appView #dialogsView .deleted-bulk { margin:8px 0 0; padding:0; min-width:0; flex:none; width:auto; }
#appView #deletedSelectedCount { margin-left:auto; }
#appView #appNavigation .nav-btn.active { background:var(--control-bg,#ececec); color:var(--ink); box-shadow:none; }
@media(min-width:721px){
 #appView>.topbar { padding-top:8px; }
 #appView .topbar #homeLogo { flex:none; height:48px; min-height:48px; padding:6px; margin:0; justify-content:flex-start; }
 #appView #appNavigation .nav-btn,#appView .navigation-profile { display:grid; grid-template-columns:24px minmax(0,1fr); justify-content:start; align-items:center; gap:12px; min-height:44px; height:44px; padding:10px 12px; }
 #appView #appNavigation .nav-icon { justify-self:center; }
 #appView #appNavigation .nav-label { text-align:left; }
 #appView .navigation-status { display:block; min-height:44px; }
 #appView .navigation-status .appeals-reception-summary { display:grid; grid-template-columns:24px minmax(0,1fr); align-items:center; gap:12px; width:100%; min-height:44px; padding:10px 12px; }
 #appView .navigation-status .reception-dot { justify-self:center; }
 #appView:not([data-section=home]) #appealsReceptionLabel { display:none; }
 #appView .navigation-profile { flex:none; }
}
@media(max-width:720px){
 #appView #dialogsView .deleted-bulk { margin-inline:10px; }
}
.cleanup-panel { max-width:520px; }
.cleanup-panel label { display:grid; gap:7px; margin-bottom:16px; }
.cleanup-summary { padding:12px; border:1px solid var(--line); border-radius:12px; margin:16px 0; }
.cleanup-actions { display:flex; gap:8px; flex-wrap:wrap; }
@media(min-width:721px){
 #appView:not([data-section=home]) #appNavigation .nav-btn,#appView:not([data-section=home]) .navigation-profile,#appView:not([data-section=home]) .navigation-status .appeals-reception-summary { grid-template-columns:24px; gap:0; }
}

/* Плашка занимает всю ширину списка; текст и аватар сохраняют внутренний отступ. */
#appView #dialogsView .dialog { display:grid; grid-template-columns:42px minmax(0,1fr) auto; align-items:center; gap:10px; width:100%; border-radius:0; margin:0; padding:12px; text-align:left; }
#appView #dialogsView .dialog-content { min-width:0; }
#appView #dialogsView .dialog-row { display:flex; flex-wrap:nowrap; gap:6px; min-width:0; }
#appView #dialogsView .dialog-title { min-width:0; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
#appView #dialogsView .dialog-preview { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
#appView #dialogsView .dialog-time-wrap { align-self:start; display:flex; flex-direction:column; align-items:flex-end; gap:5px; margin:0; }
#appView #dialogsView .dialog-time { font-size:12px!important; line-height:1.3; }
#appView #dialogsView .dialog-unread-count { display:grid; place-items:center; min-width:20px; height:20px; padding:0 5px; border-radius:10px; font-size:12px!important; line-height:1; background:var(--chat-accent,#53b559); color:#fff; }
.dialog-avatar { display:grid; place-items:center; position:relative; width:42px; height:42px; border-radius:50%; overflow:hidden; color:#fff; font-size:15px; font-weight:500; }
.dialog-avatar img { position:absolute; inset:0; width:100%; height:100%; object-fit:cover; }
.dialog-avatar [hidden] { display:none; }
#appView .general-settings-nav .settings-search { background:var(--card); margin-top:0; padding-top:0; }
#appView .message-link-card,#replyLinkDescription .message-link-card { background:transparent; }
/* Формы очистки находятся в общей панели, а не внутри #appView. */
#conversationCleanup { color:var(--ink); background:var(--bg); }
#conversationCleanup .panel-form { font-size:16px; line-height:1.5; }
#conversationCleanup :is(input,select) { box-sizing:border-box; width:100%; min-height:42px; padding:10px 12px; border:1px solid var(--line); border-radius:12px; background:var(--card); color:var(--ink); font:inherit; }
#conversationCleanup :is(input,select):focus-visible { outline:2px solid var(--chat-accent,#53b559); outline-offset:2px; }
#conversationCleanup small { color:var(--muted); font-size:13px; }
#conversationCleanup h2 { font-size:18px; font-weight:500; }
#conversationCleanup .cleanup-contact { font-weight:500; }
#conversationCleanup .cleanup-actions .btn { min-height:42px; padding:10px 14px; border-radius:12px; font:inherit; }
#conversationCleanup .cleanup-preview { background:var(--control-bg); color:var(--ink); }
#conversationCleanup .cleanup-preview:hover { background:var(--control-hover); }
#conversationCleanup .cleanup-summary { background:var(--card); }
@media(min-width:721px){
 #appView #dialogsView .appeals-list-body { margin-inline:-12px; width:calc(100% + 24px); }
 #appView #dialogsView .dialog-section-title { padding-inline:12px; }
 #appView #dialogsView .deleted-bulk { margin-inline:12px; }
}
@media(max-width:720px){
 #appView #dialogsView .appeals-list-body,#appView #dialogsView .dialogs { margin-inline:0; padding-inline:0; width:100%; }
 #appView #dialogsView .dialog { padding-inline:10px; }
 #appView #dialogsView .dialog-section-title { padding-inline:10px; }
}

/* Самостоятельные страницы используют всю правую панель без боковой категории. */
#appView #bookingView #bk-bookingRoot,#appView #paymentsView .payments-shell.section-shell { grid-template-columns:minmax(0,1fr); grid-template-rows:minmax(0,1fr); }
#appView :is(#bookingView,#paymentsView) .section-content { grid-column:1; grid-row:1; }
/* Обводка находится внутри слота, не обрезается прокруткой и не накладывается на край. */
#appView #bookingView .slot.selected { border:1px solid #285c3c; outline:none; box-shadow:none; background-clip:padding-box; }
#appView #bookingView .slot.selected:focus-visible { box-shadow:none; }
#appView #bookingView .slot:not(.selected):focus-visible { outline:none; box-shadow:inset 0 0 0 1px #285c3c; }
@media(max-width:720px){
 #appView #dialogsView .side-primary { padding-top:0; margin-top:0; }
}
/* Поиск и меню заменяют отдельную колонку/ряд разделов. */
#appView #settingsView .general-settings-shell.section-shell { grid-template-columns:minmax(0,1fr); grid-template-rows:minmax(0,1fr); }
#appView #settingsView .section-content { grid-column:1; grid-row:1; }
#appView #settingsView .settings-search-toolbar { position:sticky; top:0; z-index:12; padding:8px 0; background:var(--card); }
#appView #settingsView .settings-search-toolbar>.section-search-controls { width:calc(100% - 2*var(--content-inset)); max-width:var(--cabinet-content-width); margin:0 auto; }
#appView .section-search-controls,#appView #dialogsView .side-primary.section-search-controls { display:grid; grid-template-columns:minmax(0,1fr) 40px; align-items:center; gap:6px; }
#appView .section-search-controls .settings-search { min-width:0; margin:0; padding:0; }
#appView .section-menu-toggle { display:grid; place-items:center; width:40px; height:40px; padding:9px; background:transparent; border:0; border-radius:50%; }
.section-menu-toggle svg { width:22px; height:22px; fill:none; stroke:currentColor; stroke-width:1.7; stroke-linecap:round; }
.section-selection-menu { font:inherit; }
.section-selection-menu button { font:inherit; line-height:1.4; }
.section-selection-menu button.active { background:var(--control-bg); }
#dialogFilters .filter-icon { display:none; }
#dialogFilters .filter-label { display:block; }
#appView #settingsView .settings-flow { display:block; }
#appView #settingsView .settings-flow.hidden { display:none; }
#appView #settingsView .settings-flow-section { margin:0 0 32px; min-width:0; scroll-margin-top:80px; }
#appView #settingsView .settings-section-title { margin:0 0 16px; font-size:22px!important; font-weight:500; line-height:1.3; }
#appView #settingsView .settings-flow-section>.settings-card { margin:0 0 20px; width:100%; }
#appView #settingsView .settings-flow-section>.settings-card>h2 { display:block; font-size:18px!important; font-weight:500; }
#appView #settingsView .settings-flow-section h3 { font-size:16px!important; font-weight:500; }
#appView #settingsView #generalSettingsSearchEmpty { width:calc(100% - 2*var(--content-inset)); max-width:var(--cabinet-content-width); margin:4px auto 0; }
#appView #dialogsView .appeals-list-heading { display:flex; align-items:center; justify-content:space-between; gap:8px; margin:0 0 8px; }
#appView #dialogsView .appeals-list-heading h1 { margin:0; font-size:18px!important; }
#appView #appealsReceptionSummary.reception-toggle { display:grid; place-items:center; flex:none; width:36px; height:36px; padding:7px; border:0; border-radius:50%; background:transparent; }
#appView #appealsReceptionSummary .reception-dot { display:grid; place-items:center; width:22px; height:22px; background:transparent; }
#appView #appealsReceptionSummary .reception-dot-open { color:#4c9f58; }
#appView #appealsReceptionSummary .reception-dot-closed { color:#bb4e4e; }
#appView #appealsReceptionSummary svg { display:block; width:22px; height:22px; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; }
#appView #appealsListTitle { flex:none; margin:8px 12px; font-size:14px!important; font-weight:500; color:var(--muted); }
#appView #appNavigation .navigation-profile { margin-top:auto; }
.mobile-page-title-line { display:flex; align-items:center; gap:8px; min-width:0; }
@media(max-width:720px){
 #appView #dialogsView .appeals-list-heading { display:none; }
 #appView #settingsView .settings-search-toolbar { padding-top:0; }
 #appView #settingsView .settings-search-toolbar>.section-search-controls { width:calc(100% - 20px); }
 #appView #dialogsView .side-primary.section-search-controls { padding:0 10px; }
 #appView #appealsReceptionSummary.reception-toggle { width:32px; height:32px; padding:5px; }
}


/* Message bubbles use at most four fifths of the usable conversation column. */
#appView #dialogsView .message,.appearance-preview .message { width:fit-content; max-width:min(580px,80%); box-sizing:border-box; }
#appView #dialogsView .message .media-audio { width:240px; max-width:100%; gap:8px; }
#appView #dialogsView .message .media-audio .voice-play { width:38px; height:38px; padding:9px; }
#appView #dialogsView .message .media-audio .voice-play svg { width:18px; height:18px; }
#appView #dialogsView .message .video-play { width:44px; height:44px; padding:10px; }
#appView #dialogsView .message .video-play svg { width:18px; height:18px; }

/* Media touches the conversation background without a white outline. */
#appView #dialogsView :is(.message-with-video,.message-with-image,.media-image) { border:0; }
#appView #dialogsView .media-image .image-open img { background:#fafafa; }

/* Message-action button floats into the existing empty gutter. Never move the bubble. */
#messages .message{position:relative}
#messages .message-actions{position:absolute;top:0;z-index:30;width:36px;height:36px;pointer-events:none}
#messages .message.outbound .message-actions{left:-36px}
#messages .message.inbound .message-actions{right:-36px}
#messages .message-actions-toggle{display:grid;place-items:center;width:30px;height:30px;margin:2px 3px;padding:0;border:1px solid #7774;border-radius:50%;background:color-mix(in srgb,var(--chat-composer-bg,#fff) 75%,transparent);color:var(--chat-muted,#59645d);font-size:23px;line-height:1;opacity:0;pointer-events:none;transition:opacity .12s}
#messages .message.actions-open .message-actions-toggle,
#messages .message.actions-visible .message-actions-toggle,
#messages .message-actions:hover .message-actions-toggle,
#messages .message:focus-within .message-actions-toggle{opacity:.85;pointer-events:auto}
@media(hover:hover){#messages .message:hover .message-actions-toggle{opacity:.85;pointer-events:auto}}
#messages .message-actions-menu{position:fixed;z-index:100;pointer-events:auto;box-sizing:border-box;min-width:132px;padding:5px;background:var(--chat-composer-bg,#fff);border:1px solid var(--line,#ddd);border-radius:12px;box-shadow:0 8px 24px #0003}
#messages .message-actions-menu[hidden]{display:none}
#messages .message-actions-menu button{width:100%;padding:10px 12px;text-align:left;border:0;border-radius:8px;background:transparent;color:var(--ink,#17201b);font-size:14px}
#messages .message-actions-menu button:hover,#messages .message-actions-menu button:focus-visible{background:var(--control-hover,#eee)}
/* The old mobile margins and width reductions must not be reintroduced. */
@media(max-width:720px){
 #messages .message.outbound .message-actions{left:-36px}
 #messages .message.inbound .message-actions{right:-36px}
}

/* Large reliable touch target with the original 30px visual circle. */
#messages .message-actions{width:44px;height:44px}
#messages .message.inbound .message-actions{right:-44px}
#messages .message.outbound .message-actions{left:-44px}
#messages .message-actions-toggle{position:relative;isolation:isolate;width:44px;height:44px;margin:0;border:0;background:transparent;display:grid;place-items:center;font-size:23px;touch-action:manipulation;-webkit-tap-highlight-color:transparent}
#messages .message-actions-toggle::before{content:"";position:absolute;inset:7px;border:1px solid #7774;border-radius:50%;background:color-mix(in srgb,var(--chat-composer-bg,#fff) 75%,transparent);z-index:-1}
@media(max-width:720px){
 #messages .message.inbound .message-actions{right:-44px}
 #messages .message.outbound .message-actions{left:-44px}
}
