/* ===== точечные правки: адаптивность, чат, heatmap ===== */
html{-webkit-text-size-adjust:100%;touch-action:manipulation;overflow-x:hidden}
body,.app{width:100%;max-width:100vw;overflow-x:hidden}
input,textarea,select,button,.input,.btn{font-size:16px!important}
textarea{resize:vertical;line-height:1.35}
img,iframe,canvas{max-width:100%}
.row-card,.card,.meta-line{min-width:0}.grow{min-width:0}

/* ===== clean shared fixes ===== */
.avatar-upload{display:flex;align-items:center;gap:14px;margin:4px 0 14px}
.avatar-upload label{cursor:pointer;flex:0 0 auto}
.avatar-upload small{display:block;color:var(--muted);font-size:12px;margin-top:4px}
.profile-card .value-big,.metric-card .value-big{word-break:normal;overflow-wrap:normal}
.delta-pill,.delta-up,.delta-down,.avg-pill{width:auto!important;min-width:44px!important;max-width:none!important;height:26px!important;display:inline-flex!important;align-items:center!important;justify-content:center!important;padding:0 10px!important;border-radius:999px!important;white-space:nowrap!important;box-sizing:border-box!important;line-height:26px!important;font-size:11px!important;font-weight:1000!important;overflow:hidden!important;text-overflow:ellipsis!important}
.delta-up{background:linear-gradient(135deg,rgba(255,76,57,.95),rgba(130,17,9,.9));color:#fff}
.delta-down{background:linear-gradient(135deg,rgba(163,255,18,.95),rgba(32,100,8,.9));color:#071000}
.exercise-grid-fixed{display:grid;grid-template-columns:1fr;gap:12px;margin-top:12px}
.exercise-detail-fixed{min-width:0}
@media(min-width:760px){.exercise-grid-fixed{grid-template-columns:minmax(260px,.9fr) minmax(320px,1.1fr)}.exercise-detail-fixed{position:sticky;top:10px;align-self:start}}

/* ===== final chat styles: one implementation only ===== */
.chat-screen-head{margin:6px 0 22px}.chat-screen-head span,.chat-conversation-head span{display:block;color:var(--lime);font-size:11px;font-weight:900;letter-spacing:.14em}.chat-screen-head h1{margin:4px 0 0;font-size:clamp(32px,7vw,52px);line-height:1}.chat-conversation{width:min(100%,900px);margin:0 auto}.chat-conversation-head{padding:6px 2px 14px}.chat-conversation-head h2{margin:3px 0 0;font-size:22px;line-height:1.1}.chat-conversation-head small{display:block;color:var(--muted);margin-top:4px}.chat-card-final{height:clamp(430px,62dvh,760px);min-height:430px;padding:0!important;display:flex;flex-direction:column;overflow:hidden;border-radius:0;background:#000;border:0;box-shadow:none}
#chat.active{display:flex;flex-direction:column;height:calc(100dvh - 102px);overflow:hidden}#chat.active .chat-screen-head,#chat.active .trainer-chat-selector{flex:0 0 auto}#chat.active .chat-conversation{flex:1 1 auto;min-height:0;display:flex;flex-direction:column}#chat.active .chat-conversation-head{flex:0 0 auto}#chat.active .chat-card-final{flex:1 1 auto;height:auto;min-height:0}
.chat-load-older{flex:0 0 auto;padding:8px 10px 0;background:#000}.chat-load-older:empty{display:none}
.chat-list-final{flex:1 1 auto;min-height:0;overflow-y:auto;overflow-x:hidden;padding:14px 2px 12px;display:flex;flex-direction:column;gap:9px;background:#000;scroll-behavior:auto;overscroll-behavior:contain;overflow-anchor:auto}
.msg-row{width:100%;display:flex;min-width:0;margin:0;padding:0;animation:none!important;transition:none!important;contain:layout paint style}
.msg-row.mine{justify-content:flex-end}
.msg-row.theirs{justify-content:flex-start}
.chat-bubble-final{width:auto;max-width:min(84%,520px);min-width:0;padding:10px 13px 8px;border-radius:22px;border:0;box-shadow:none;overflow:hidden;word-break:break-word;overflow-wrap:anywhere;hyphens:auto;animation:none!important;transition:none!important;backface-visibility:hidden;contain:layout paint style}
.msg-row.mine .chat-bubble-final{background:#1d2b11;color:#f4f7ef;border-bottom-right-radius:7px}
.msg-row.theirs .chat-bubble-final{background:#1c1c1e;color:#fff;border-bottom-left-radius:7px}
.msg-row.mine .tag{background:rgba(163,255,18,.16);border:1px solid rgba(163,255,18,.28);color:var(--lime)}
.chat-top-final{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:4px}
.chat-author-final{font-size:11px;font-weight:900;opacity:.72;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.reply-btn-final{border:0;background:rgba(255,255,255,.14);color:inherit;border-radius:999px;height:24px;min-height:24px;padding:0 8px;font-size:11px!important;font-weight:900;line-height:24px;flex:0 0 auto;cursor:pointer}
.reply-preview-final{margin:4px 0 7px;padding:7px 9px;border-radius:13px;background:rgba(0,0,0,.18);border-left:3px solid currentColor;max-width:100%;cursor:pointer}
.reply-preview-final b,.reply-preview-final small{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.reply-preview-final b{font-size:11px}.reply-preview-final small{font-size:10px;opacity:.72;margin-top:2px}
.chat-text-final,.msg-text{margin:0;font-size:15px;line-height:1.34;white-space:pre-wrap;overflow-wrap:anywhere;word-break:break-word;color:inherit}
.chat-meta-final,.msg-meta{display:flex;justify-content:flex-end;align-items:center;gap:4px;margin-top:5px;font-size:10px;opacity:.64;white-space:nowrap;color:inherit}
.chat-bottom-final{flex:0 0 auto;border:0;background:#000;padding:10px 0 calc(9px + env(safe-area-inset-bottom));display:grid;gap:6px}
.replybar-final{border:1px solid rgba(163,255,18,.3);background:rgba(163,255,18,.08);border-radius:16px;padding:8px;max-height:86px;overflow:hidden}
.replybar-top-final{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:6px}
.reply-cancel-final{border:1px solid #333;background:#111;color:#fff;border-radius:999px;min-height:28px;height:28px;padding:0 10px;font-size:12px!important;font-weight:900}
.chat-input-final{min-height:54px;display:grid;grid-template-columns:38px minmax(0,1fr) 48px;gap:4px;align-items:center;padding:4px 5px 4px 8px;border:1px solid rgba(255,255,255,.08);border-radius:28px;background:#1c1c1e}
.chat-compose-icon{width:34px;height:34px;display:grid;place-items:center;color:#89909c}.chat-compose-icon svg{width:27px;height:27px;fill:none;stroke:currentColor;stroke-width:1.65;stroke-linecap:round;stroke-linejoin:round}
.chat-input-final textarea{width:100%;height:44px;min-height:44px;max-height:104px;margin:0;padding:11px 3px;border:0!important;outline:0;background:transparent!important;color:#fff;resize:none;line-height:1.35;border-radius:0!important;overflow-y:auto;box-shadow:none!important}
.chat-input-final textarea::placeholder{color:#858b96}
.send-final{width:44px;height:44px;min-height:44px;border:0;border-radius:50%;padding:10px;background:var(--lime);color:#071000;display:grid;place-items:center;box-shadow:0 0 0 4px rgba(163,255,18,.08)}.send-final svg{width:23px;height:23px;fill:none;stroke:currentColor;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round}
#chat .typing-final,#chat .typing-line,#typingLine{display:none!important;min-height:0!important;height:0!important;padding:0!important;margin:0!important}
@media(max-width:420px){.chat-screen-head{margin-bottom:14px}.chat-bubble-final{max-width:88%}.delta-pill,.delta-up,.delta-down,.avg-pill{min-width:48px;height:25px;line-height:25px;padding:0 9px}}
@media(min-width:900px){#chat{max-width:1120px!important}.trainer-chat-selector{width:min(100%,900px);margin-left:auto!important;margin-right:auto!important}.chat-card-final{height:min(68dvh,760px)}}

/* Shared in-app back control: one visual and one navigation implementation. */
.app-back-row{width:100%;min-height:44px;display:flex;align-items:center;margin:0 0 10px}
.app-back-button{width:40px!important;height:40px!important;min-width:40px!important;min-height:40px!important;padding:0!important;border:0!important;border-radius:50%!important;background:transparent!important;color:#f5f5f7!important;display:grid!important;place-items:center!important;cursor:pointer}
.app-back-button svg{width:24px;height:24px;fill:none;stroke:currentColor;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round}
.app-back-button:active{background:rgba(255,255,255,.08)!important;transform:scale(.96)}

/* Full-screen messenger surface: only the client divider and composer remain visible. */
.chat-card-final{border:0!important;border-radius:0!important;background:#000!important}
.chat-list-final{padding-left:12px;padding-right:12px}
.chat-bottom-final{padding-left:0;padding-right:0}
#chat.active>.app-back-row{flex:0 0 auto}
#chat.active .trainer-chat-selector{order:0;margin-bottom:6px}
#chat.active .chat-conversation{order:1}

#chat.active>.app-back-row{min-height:34px;margin-bottom:2px}
#chat.active>.app-back-row .app-back-button{width:34px!important;height:34px!important;min-width:34px!important;min-height:34px!important}

@media(max-width:520px){
  #chat.active{height:calc(100dvh - 96px)}
  #chat.active .trainer-chat-selector{margin-bottom:3px}
  #chat.active .chat-list-final{padding-left:2px;padding-right:2px}
}

.chat-empty-final{flex:1 1 auto;min-height:180px;display:grid;place-content:center;justify-items:center;gap:14px;margin:0;color:#777f8d;text-align:center;font-size:16px}
.chat-empty-final svg{width:62px;height:62px;fill:none;stroke:#555d69;stroke-width:2.4;stroke-linecap:round;stroke-linejoin:round}
.chat-empty-final svg circle{fill:#555d69;stroke:none}

@media(min-width:900px){
  body:has(#workouts.active) .app,body:has(#about.active) .app,body:has(#chat.active) .app,body:has(#settings.active) .app{max-width:1280px!important;padding-left:38px!important;padding-right:38px!important}
  #chat.active{width:min(100%,1120px);margin:0 auto}
  #chat.active .trainer-chat-selector{width:min(100%,1040px)}
  #chat.active .chat-conversation{width:min(100%,1040px)}
}

/* ===== compact volume indicators instead of heatmap cards ===== */


.workout-subtabs{margin:0 0 12px}
.bottom{grid-template-columns:repeat(4,1fr)}
