/* ═══════════════════════════════════════════════════
   EX FITNESS — Dark Chat UI
   ═══════════════════════════════════════════════════ */

:root {
  --bg-deep:       #0B0B2B;
  --bg-surface:    #12123a;
  --bg-card:       #181848;
  --bg-bubble-bot: #1f1f55;
  --bg-bubble-usr: #2a1c32;

  --border:        rgba(255,255,255,0.08);
  --border-active: rgba(255,255,255,0.18);

  --text-primary:  #f5f7fb;
  --text-muted:    rgba(245,247,251,0.58);
  --text-dim:      rgba(245,247,251,0.32);

  --accent-red:    #e4002b;
  --accent-red-2:  #ff304f;
  --accent-green:  #1db954;
  --accent-gold:   #f0bf4c;
  --accent-pink:   #cc4c79;
  --accent-blue:   #70a7ff;

  --bg-radial-1:   rgba(228,0,43,0.14);
  --bg-radial-2:   rgba(112,167,255,0.08);
  --logo-box-bg:   #05070c;
  --bubble-bot-tint: rgba(255,255,255,0.03);
  --bubble-usr-grad: linear-gradient(135deg, rgba(228,0,43,0.26), rgba(42,28,50,0.96));
  --link-color:    #9fc2ff;

  --radius-btn:    999px;
  --radius-bubble: 20px;
  --radius-card:   18px;

  --header-h:      68px;
  --footer-h:      78px;

  --font-display:  'Manrope', 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-body:     'Manrope', 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --shadow-glow:   0 0 28px rgba(228, 0, 43, 0.18);
  --shadow-shell:  0 24px 90px rgba(0,0,0,0.48);
}

/* ── Light theme ── */
[data-theme="light"] {
  --bg-deep:       #eef1f7;
  --bg-surface:    #ffffff;
  --bg-card:       #ffffff;
  --bg-bubble-bot: #f1f3f8;
  --bg-bubble-usr: #fff3f5;

  --border:        rgba(15,23,42,0.08);
  --border-active: rgba(15,23,42,0.18);

  --text-primary:  #0f1729;
  --text-muted:    rgba(15,23,41,0.62);
  --text-dim:      rgba(15,23,41,0.38);

  --accent-red:    #e4002b;
  --accent-red-2:  #ff304f;
  --accent-green:  #16a34a;
  --accent-gold:   #b8862c;
  --accent-pink:   #cc4c79;
  --accent-blue:   #2563eb;

  --bg-radial-1:   rgba(228,0,43,0.07);
  --bg-radial-2:   rgba(37,99,235,0.05);
  --logo-box-bg:   #f3f5fa;
  --bubble-bot-tint: rgba(15,23,42,0.015);
  --bubble-usr-grad: linear-gradient(135deg, rgba(228,0,43,0.10), rgba(255,235,238,1));
  --link-color:    #2563eb;

  --shadow-glow:   0 0 24px rgba(228,0,43,0.10);
  --shadow-shell:  0 16px 60px rgba(15,23,42,0.10);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overflow: hidden;
  line-height: 1.5;
  background:
    radial-gradient(circle at top left, var(--bg-radial-1), transparent 34%),
    radial-gradient(circle at bottom right, var(--bg-radial-2), transparent 32%),
    var(--bg-deep);
  color: var(--text-primary);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background 0.3s ease, color 0.3s ease;
}

button, input, textarea, select { font: inherit; }
a { color: var(--accent-blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── App shell ── */
.app-wrapper {
  display: flex;
  font-family: var(--font-body);
  flex-direction: column;
  width: 100%;
  max-width: 520px;
  height: 100dvh;
  margin: 0 auto;
  position: relative;
  background: var(--bg-surface);
  box-shadow: var(--shadow-shell);
}

/* ════════════════════════════
   HEADER
   ════════════════════════════ */
.chat-header {
  height: var(--header-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 18px;
  gap: 13px;
  flex-shrink: 0;
  position: relative;
}

.chat-header::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-red), transparent);
  opacity: 0.55;
}

.header-logo {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--logo-box-bg);
  border: 1px solid var(--border);
  box-shadow: 0 10px 30px rgba(0,0,0,0.18), var(--shadow-glow);
  overflow: hidden;
}

.logo-image {
  width: 88%;
  height: 88%;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 4px 10px rgba(228,0,43,0.24));
}

.header-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.header-title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 16px;
  line-height: 1;
  letter-spacing: 0.04em;
}

.header-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.header-status { margin-left: auto; }

.status-dot {
  display: block;
  width: 10px; height: 10px;
  border-radius: 50%;
}
.status-dot.active   { background: var(--accent-green); box-shadow: 0 0 10px var(--accent-green); }
.status-dot.inactive { background: var(--accent-red);   box-shadow: 0 0 10px var(--accent-red); }

/* ════════════════════════════
   CHAT BODY
   ════════════════════════════ */
.chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 14px 12px;
  scroll-behavior: smooth;
  overscroll-behavior: contain;
  overflow-anchor: none;
}

.chat-body.history-scroll-locked {
  overflow-y: hidden;
  overscroll-behavior: none;
  touch-action: none;
}

.chat-body::-webkit-scrollbar { width: 5px; }
.chat-body::-webkit-scrollbar-track { background: transparent; }
.chat-body::-webkit-scrollbar-thumb { background: var(--border-active); border-radius: 999px; }

.new-message-btn {
  position: sticky;
  z-index: 5;
  bottom: 12px;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 8px 10px 2px auto;
  padding: 0;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 50%;
  background: rgba(31,31,85,0.92);
  color: var(--text-primary);
  font-size: 20px;
  line-height: 1;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(0,0,0,0.22);
  cursor: pointer;
  backdrop-filter: blur(10px);
  transition: transform .18s ease, opacity .18s ease, background .18s ease, box-shadow .18s ease;
}

.new-message-btn:hover {
  transform: translateY(-1px);
  background: rgba(42,42,96,0.96);
  box-shadow: 0 10px 22px rgba(0,0,0,0.26);
}

.new-message-arrow {
  transform: translateY(-1px);
}

.new-message-btn[hidden] {
  display: none !important;
}

.new-message-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-surface);
  border-radius: 999px;
  background: var(--accent-red);
  color: #fff;
  font-size: 10px;
  line-height: 1;
  font-weight: 900;
}

.new-message-badge[hidden] {
  display: none !important;
}

[data-theme="light"] .new-message-btn {
  border-color: rgba(15,23,42,0.10);
  background: rgba(255,255,255,0.94);
  color: var(--text-primary);
  box-shadow: 0 8px 18px rgba(15,23,42,0.14);
}

[data-theme="light"] .new-message-btn:hover {
  background: rgba(248,250,252,0.98);
  box-shadow: 0 10px 22px rgba(15,23,42,0.18);
}

.messages-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-anchor: none;
}


/* ── Global text rhythm ── */
p, h1, h2, h3, h4, h5, h6 { margin: 0; }

.message-bubble,
.message-bubble * {
  font-family: inherit;
}

.message-bubble {
  padding: 13px 16px;
  border-radius: var(--radius-bubble);
  font-size: 15px;
  line-height: 1.46;
  letter-spacing: -0.01em;
}

.message-bubble p {
  margin: 0;
  line-height: 1.46;
}

.message-bubble p + p {
  margin-top: 1.46em;
}

.message-bubble br {
  content: '';
  display: block;
  margin-top: 0;
}

.message-bubble strong,
.message-bubble b {
  font-weight: 800;
  color: var(--text-primary);
}

.message-bubble a {
  color: var(--link-color);
}

/* ── Base message ── */
.message {
  display: flex;
  flex-direction: column;
  max-width: 88%;
  animation: msgIn 0.28s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes msgIn {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.bot-message  { align-self: flex-start; }
.user-message { align-self: flex-end; }

/* ── Bubbles ── */
.message-bubble {
  padding: 13px 16px;
  border-radius: var(--radius-bubble);
  border: 1px solid var(--border);
  box-shadow: 0 10px 28px rgba(0,0,0,0.14);
}

.bot-message .message-bubble {
  background: linear-gradient(180deg, var(--bubble-bot-tint), transparent 60%), var(--bg-bubble-bot);
  border-radius: var(--radius-bubble) var(--radius-bubble) var(--radius-bubble) 5px;
}

.bot-message .support-reply-bubble {
  border-color: rgba(54, 162, 235, 0.38);
  background: linear-gradient(180deg, rgba(54, 162, 235, 0.12), transparent 62%), var(--bg-bubble-bot);
}

.support-reply-label {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  margin: 0 0 8px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(54, 162, 235, 0.14);
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: 0;
  white-space: nowrap;
  vertical-align: top;
}

.support-reply-bubble.has-image .support-reply-label,
.support-reply-bubble.has-files .support-reply-label {
  margin: 10px 12px 8px;
}

.user-message .user-bubble {
  background: var(--bubble-usr-grad);
  border-color: rgba(228, 0, 43, 0.28);
  border-radius: var(--radius-bubble) var(--radius-bubble) 5px var(--radius-bubble);
  text-align: right;
}

.warning-bubble {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: rgba(228, 0, 43, 0.09) !important;
  border-color: rgba(228, 0, 43, 0.32) !important;
}

.status-indicator.inactive {
  color: var(--accent-red);
  font-size: 12px;
  margin-top: 2px;
  flex-shrink: 0;
}

.warning-bubble p { font-size: 13px; line-height: 1.45; color: var(--text-muted); margin-top: 4px; }
.warning-bubble strong { color: #ff6678; font-size: 14px; line-height: 1.35; }

.faq-address-link {
  color: var(--text-primary);
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.faq-address-link::after {
  content: "↗";
  margin-left: 4px;
  font-size: 11px;
  color: var(--text-muted);
}

.message-time {
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 4px;
  padding: 0 5px;
}
.user-message .message-time { text-align: right; }

/* ── Inline buttons ── */
.inline-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 9px;
  max-width: 100%;
}

.inline-btn {
  cursor: pointer;
  line-height: 1.2;
  border: 1px solid var(--border-active);
  background: rgba(255,255,255,0.03);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 700;
  padding: 8px 14px;
  min-height: 36px;
  border-radius: var(--radius-btn);
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.inline-btn:hover {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.26);
  transform: translateY(-1px);
}

.inline-btn:active { transform: scale(0.97); }

.inline-btn.btn-primary {
  background: linear-gradient(135deg, var(--accent-red), var(--accent-red-2));
  border-color: rgba(255,255,255,0.14);
  color: #fff;
  box-shadow: 0 10px 28px rgba(228,0,43,0.24);
}
.inline-btn.btn-primary:hover { filter: brightness(1.06); }

.inline-btn.btn-back {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  border-color: rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.02);
}

.inline-btn.btn-green {
  border-color: rgba(29,185,84,0.45);
  color: #66e395;
}

.btn-icon {
  display: inline-flex;
  width: 16px;
  height: 16px;
  align-items: center;
  justify-content: center;
  flex: 0 0 16px;
}

.btn-svg,
.nav-icon {
  width: 1em;
  height: 1em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.85;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.btn-svg { font-size: 16px; }

.btn-icon-img {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  object-fit: contain;
  display: block;
}

.inline-btn.btn-primary .btn-icon-img {
  filter: brightness(0) invert(1);
  opacity: 0.96;
}

/* ════════════════════════════
   FOOTER NAV
   ════════════════════════════ */
.chat-footer {
  min-height: var(--footer-h);
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  position: relative;
}

.chat-footer::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-gold), transparent);
  opacity: 0.4;
}

.footer-buttons {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: stretch;
  width: 100%;
  gap: 5px;
}

.nav-btn {
  display: flex;
  line-height: 1.15;
  min-width: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 9.5px;
  font-weight: 800;
  padding: 8px 3px;
  border-radius: 15px;
  transition: transform 0.18s ease, background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.nav-btn span {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-icon {
  font-size: 22px;
  padding: 1px;
  opacity: 0.96;
}

.nav-btn:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.08);
}

.nav-btn:active { transform: scale(0.94); }

.nav-btn.btn-door {
  color: var(--accent-gold);
  position: relative;
  background: rgba(240,191,76,0.08);
  border-color: rgba(240,191,76,0.22);
}

.nav-btn.btn-door:hover {
  background: rgba(240, 191, 76, 0.14);
  border-color: rgba(240,191,76,0.34);
}

/* ════════════════════════════
   LOADER
   ════════════════════════════ */
.chat-loader {
  position: absolute;
  bottom: calc(var(--footer-h) + 12px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 8px 18px;
  display: none;
  z-index: 100;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

.chat-loader.visible { display: block; }

.loader-dots {
  display: flex;
  gap: 5px;
  align-items: center;
}

.loader-dots span {
  width: 7px; height: 7px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: dotBounce 1.2s infinite ease-in-out;
}

.loader-dots span:nth-child(1) { animation-delay: 0s; }
.loader-dots span:nth-child(2) { animation-delay: 0.2s; }
.loader-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dotBounce {
  0%, 80%, 100% { transform: scale(0.7); opacity: 0.4; }
  40%           { transform: scale(1.2); opacity: 1; }
}

/* ════════════════════════════
   MODAL
   ════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.72);
  backdrop-filter: blur(8px);
  z-index: 200;
  display: none;
  align-items: flex-end;
  justify-content: center;
  padding: 0 12px;
}

.modal-overlay.open { display: flex; }

.modal-card {
  background: var(--bg-card);
  border-radius: 26px 26px 0 0;
  border: 1px solid var(--border);
  border-bottom: none;
  padding: 24px 20px calc(36px + env(safe-area-inset-bottom));
  width: 100%;
  max-width: 520px;
  animation: slideUp 0.3s cubic-bezier(0.34, 1.2, 0.64, 1);
  position: relative;
  box-shadow: 0 -18px 70px rgba(0,0,0,0.4);
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

.modal-close {
  position: absolute;
  top: 16px; right: 20px;
  background: var(--bg-bubble-bot);
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 32px; height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.15s;
}
.modal-close:hover { color: var(--text-primary); background: rgba(255,255,255,0.08); }

.modal-title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 19px;
  margin-bottom: 20px;
  letter-spacing: -0.02em;
}

.subscription-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sub-option {
  background: var(--bg-bubble-bot);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: border-color 0.2s, background 0.2s;
}

.sub-option.featured {
  border-color: rgba(228,0,43,0.42);
  background: rgba(228, 0, 43, 0.10);
}

.sub-name  { font-weight: 800; font-size: 14px; flex: 1; letter-spacing: -0.01em; }
.sub-desc { max-width: 100%; margin-top: 6px; color: var(--text-muted); font-size: 12px; line-height: 1.38; overflow-wrap: anywhere; }
.sub-price { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.sub-btn {
  background: linear-gradient(135deg, var(--accent-red), var(--accent-red-2));
  color: #fff;
  border: none;
  border-radius: var(--radius-btn);
  padding: 9px 18px;
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: filter 0.15s, transform 0.15s;
}
.sub-btn:hover { filter: brightness(1.07); }
.sub-btn:active { transform: scale(0.97); }

@media (max-width: 520px) {
  .sub-option {
    align-items: stretch;
    flex-direction: column;
  }

  .sub-btn {
    width: 100%;
  }
}

/* ════════════════════════════
   UTILITIES
   ════════════════════════════ */
.nav-btn.active { color: var(--accent-red); }

/* Wider desktop layout */
@media (min-width: 768px) {
  :root {
    --header-h: 74px;
    --footer-h: 86px;
  }

  .app-wrapper {
    max-width: 760px;
    margin: 22px auto;
    height: calc(100dvh - 44px);
    border-radius: 24px;
    overflow: hidden;
    border: 1px solid var(--border);
  }

  .chat-header { padding: 0 24px; }
  .header-logo { width: 50px; height: 50px; border-radius: 16px; }
  .header-title { font-size: 18px; }
  .header-subtitle { font-size: 13px; }

  .chat-body { padding: 22px 28px 16px; }
  .message { max-width: 78%; }
  .message-bubble { font-size: 16px; padding: 13px 16px; }
  .inline-buttons { max-width: 620px; gap: 8px; }
  .inline-btn { font-size: 14px; padding: 9px 15px; }

  .chat-footer { padding: 10px 16px; }
  .footer-buttons { gap: 8px; }
  .nav-btn { font-size: 11px; padding: 10px 8px; border-radius: 18px; }
  .nav-icon { font-size: 24px; }

  .modal-card {
    max-width: 640px;
    border-radius: 26px;
    border-bottom: 1px solid var(--border);
    margin: 0 auto;
    padding: 26px 24px;
  }
  .modal-overlay { align-items: center; padding: 20px; }
}

@media (max-width: 360px) {
  .chat-header { padding: 0 14px; }
  .header-logo { width: 40px; height: 40px; }
  .chat-body { padding-left: 10px; padding-right: 10px; }
  .nav-btn { font-size: 8.5px; padding-left: 2px; padding-right: 2px; }
  .nav-icon { font-size: 20px; }
}



/* ════════════════════════════
   PAGE SHELL + SIDE PANEL
   ════════════════════════════ */
body.drawer-open {
  overflow: hidden;
}

.page-shell {
  width: 100%;
  height: 100dvh;
}

.app-stage {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.desktop-side-panel {
  display: none;
}

.menu-toggle-btn {
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255,255,255,0.03);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  outline: none;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.menu-toggle-btn:hover {
  background: rgba(255,255,255,0.06);
  border-color: var(--border-active);
}

.menu-toggle-btn:active {
  background: rgba(255,255,255,0.09);
  border-color: var(--border-active);
}

.menu-toggle-btn:focus-visible {
  outline: 2px solid var(--accent-red);
  outline-offset: 2px;
}

.menu-toggle-btn:focus:not(:focus-visible) {
  outline: none;
}

[data-theme="light"] .menu-toggle-btn {
  background: rgba(15,23,42,0.04);
}
[data-theme="light"] .menu-toggle-btn:hover {
  background: rgba(15,23,42,0.08);
}
[data-theme="light"] .menu-toggle-btn:active {
  background: rgba(15,23,42,0.12);
}

.menu-toggle-btn span {
  width: 18px;
  height: 2px;
  border-radius: 99px;
  background: var(--text-primary);
  display: block;
}

.mobile-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(3, 8, 18, 0.62);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
  z-index: 40;
}

.mobile-drawer-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.mobile-drawer {
  position: fixed;
  top: 0;
  left: 0;
  width: min(88vw, 360px);
  height: 100dvh;
  background: linear-gradient(180deg, rgba(255,255,255,0.03), transparent 16%), #07071e;
  border-right: 1px solid var(--border);
  transform: translateX(-104%);
  transition: transform 0.24s ease;
  z-index: 41;
  box-shadow: 0 24px 70px rgba(0,0,0,0.42);
  overflow: hidden;
}

.mobile-drawer.open {
  transform: translateX(0);
}

.mobile-drawer-head {
  height: 72px;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
}

.mobile-drawer-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 800;
  line-height: 1.1;
}

.mobile-drawer-subtitle {
  margin-top: 3px;
  font-size: 12px;
  color: var(--text-muted);
}

.mobile-drawer-close {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  color: var(--text-primary);
  font-size: 18px;
  cursor: pointer;
}

.side-panel,
.mobile-drawer {
  color: var(--text-primary);
}

.side-panel-inner {
  height: 100%;
  overflow-y: auto;
  padding: 20px 18px 22px;
}

.mobile-drawer .side-panel-inner {
  height: calc(100dvh - 72px);
  padding-top: 18px;
}

.side-panel-inner::-webkit-scrollbar {
  width: 5px;
}

.side-panel-inner::-webkit-scrollbar-thumb {
  background: var(--border-active);
  border-radius: 999px;
}

.side-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.side-brand-logo {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: #05070c;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-glow);
}

.side-brand-logo img {
  width: 82%;
  height: 82%;
  object-fit: contain;
}

.side-brand-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 800;
  line-height: 1.1;
}

.side-brand-subtitle {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 12px;
}

.side-card {
  background: rgba(22, 33, 54, 0.92);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 16px;
  box-shadow: 0 14px 32px rgba(0,0,0,0.2);
}

.side-card + .side-card {
  margin-top: 12px;
}

.side-card-top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.side-card-headline h3,
.side-card-top h3 {
  font-size: 16px;
  font-weight: 800;
  line-height: 1.15;
  margin: 0;
}

.side-card-headline p,
.side-card-top p {
  margin: 6px 0 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-muted);
}

.side-icon-badge,
.list-link-icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}

.side-icon,
.social-icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.side-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.side-actions.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.side-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  text-decoration: none;
  cursor: pointer;
  font-weight: 800;
  font-size: 13px;
  line-height: 1.2;
  transition: transform 0.15s ease, filter 0.15s ease, border-color 0.15s ease;
}

.side-btn:hover {
  filter: brightness(1.05);
}

.side-btn-primary {
  background: linear-gradient(135deg, var(--accent-red), var(--accent-red-2));
  color: #fff;
  border-color: rgba(255,255,255,0.08);
}

.side-btn-secondary {
  background: rgba(255,255,255,0.03);
  color: var(--text-primary);
}

.subscription-card.is-active {
  border-color: rgba(29,185,84,0.26);
}

.subscription-card.is-inactive {
  border-color: rgba(228, 0, 43, 0.2);
}

.social-links {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 14px;
}

.social-link {
  min-height: 76px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-primary);
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
  padding: 8px;
}

.link-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}

.link-list.compact {
  gap: 8px;
}

.list-link {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 46px;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  color: var(--text-primary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
}

.list-link:hover,
.social-link:hover,
.side-btn:hover {
  transform: translateY(-1px);
}

@media (min-width: 1024px) {
  .page-shell {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 22px;
    padding: 22px;
  }

  .desktop-side-panel {
    display: block;
    width: min(340px, 30vw);
    height: calc(100dvh - 44px);
    background: linear-gradient(180deg, rgba(255,255,255,0.02), transparent 20%), var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 24px;
    overflow: hidden;
    box-shadow: var(--shadow-shell);
  }

  .app-stage {
    width: auto;
    flex: 1;
    justify-content: flex-start;
  }

  .app-wrapper {
    margin: 0;
  }

  .menu-toggle-btn,
  .mobile-drawer,
  .mobile-drawer-overlay {
    display: none !important;
  }
}

@media (max-width: 1023px) {
  .chat-header {
    gap: 10px;
    padding: 0 14px;
  }

  .header-logo {
    width: 42px;
    height: 42px;
  }

  .header-title {
    font-size: 15px;
  }
}

/* ════════════════════════════
   SIDEBAR REFINEMENT
   ════════════════════════════ */
.side-panel-compact {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.side-summary {
  padding: 18px 18px 16px;
  border-radius: 24px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.015));
  box-shadow: 0 18px 42px rgba(0,0,0,0.2);
}

.side-brand-compact {
  margin-bottom: 18px;
}

.side-account-row,
.side-subscription-row {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.side-kicker {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.side-main-title {
  margin-top: 3px;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.18;
}

.side-main-text {
  margin-top: 6px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-muted);
  overflow-wrap: break-word;
  word-break: break-word;
}

.side-divider {
  height: 1px;
  margin: 16px 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.16), transparent);
}

.side-inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.side-btn-ghost {
  background: transparent;
  border-color: rgba(255,255,255,0.12);
  color: var(--text-primary);
}

.side-link-section {
  padding: 0 2px;
}

.side-link-heading {
  margin-bottom: 12px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
}

.icon-link-grid {
  display: grid;
  gap: 12px;
}

.social-icon-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.map-icon-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.icon-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 110px;
  padding: 14px 10px;
  border-radius: 22px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.02);
  color: var(--text-primary);
  text-decoration: none;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.icon-link:hover {
  transform: translateY(-2px);
  background: rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.16);
}

.icon-link span {
  font-size: 12px;
  font-weight: 700;
  color: rgba(245,247,251,0.86);
}

.brand-logo-icon {
  width: 46px;
  height: 46px;
  stroke: #fff;
  stroke-width: 1.6;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand-logo-square {
  width: 52px;
  height: 52px;
}

.brand-fill-dot {
  fill: #fff;
  stroke: none;
}

.side-legal-note {
  margin-top: auto;
  display: flex;
  justify-content: center;
  padding: 8px 2px 0;
  font-size: 11px;
  line-height: 1.5;
  color: var(--text-dim);
}

.side-legal-note a {
  color: var(--text-muted);
  text-decoration: none;
}

.side-legal-note a:hover {
  color: var(--text-primary);
}

.side-legal-note span {
  margin: 0 5px;
}

@media (min-width: 1024px) {
  .desktop-side-panel .side-panel-inner {
    padding: 22px 20px 18px;
  }
}

@media (max-width: 1023px) {
  .mobile-drawer .side-panel-inner {
    padding: 18px 18px 22px;
  }

  .icon-link {
    min-height: 98px;
  }
}


/* ════════════════════════════
   FINAL SIDEBAR + CHAT WIDTH TUNING
   ════════════════════════════ */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.logo-only {
  min-height: 108px;
  padding: 12px;
  gap: 0;
}

.logo-only span {
  display: none;
}

.social-icon-grid,
.map-icon-grid {
  gap: 14px;
}

.brand-logo-icon {
  width: 56px;
  height: 56px;
  stroke: rgba(255,255,255,0.96);
  stroke-width: 1.7;
}

.map-link .brand-logo-icon {
  width: 64px;
  height: 64px;
}

.icon-link.logo-only {
  background: linear-gradient(180deg, rgba(255,255,255,0.025), rgba(255,255,255,0.015));
  border-color: rgba(255,255,255,0.07);
}

.icon-link.logo-only:hover {
  border-color: rgba(255,255,255,0.16);
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
}

.desktop-side-panel {
  flex: 0 0 320px;
}

.app-stage {
  min-width: 0;
}

@media (min-width: 1024px) {
  .page-shell {
    align-items: stretch;
    justify-content: flex-start;
    gap: 18px;
    padding: 18px;
  }

  .desktop-side-panel {
    width: 320px;
    height: calc(100dvh - 36px);
  }

  .app-stage {
    flex: 1 1 auto;
    width: auto;
    max-width: none;
    justify-content: flex-start;
  }

  .app-wrapper {
    width: 100%;
    max-width: none;
    height: calc(100dvh - 36px);
    margin: 0;
  }

  .chat-header {
    padding: 0 26px;
  }

  .chat-body {
    padding: 22px 30px 18px;
  }

  .messages-container {
    width: 100%;
  }

  .message {
    max-width: min(840px, 86%);
  }

  .inline-buttons {
    max-width: min(840px, 86%);
  }
}

@media (min-width: 1440px) {
  .desktop-side-panel {
    width: 340px;
    flex-basis: 340px;
  }

  .message {
    max-width: min(900px, 88%);
  }

  .inline-buttons {
    max-width: min(900px, 88%);
  }
}

@media (max-width: 1023px) {
  .logo-only {
    min-height: 96px;
  }

  .brand-logo-icon {
    width: 50px;
    height: 50px;
  }

  .map-link .brand-logo-icon {
    width: 58px;
    height: 58px;
  }
}

/* ═══════════════════════════════════════════════════
   THEME TOGGLE BUTTON
   ═══════════════════════════════════════════════════ */
.header-status {
  display: flex;
  align-items: center;
  gap: 10px;
}

.theme-toggle {
  background: transparent;
  border: 1px solid var(--border-active);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all 0.2s ease;
  position: relative;
  padding: 0;
}

.theme-toggle:hover {
  color: var(--text-primary);
  background: var(--bg-bubble-bot);
  transform: rotate(15deg);
}

.theme-icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  position: absolute;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

/* Default (dark): show sun (so user knows clicking will go to light) */
[data-theme="dark"] .theme-icon-sun  { opacity: 1; transform: rotate(0deg) scale(1); }
[data-theme="dark"] .theme-icon-moon { opacity: 0; transform: rotate(-90deg) scale(0.6); }

/* Light: show moon */
[data-theme="light"] .theme-icon-sun  { opacity: 0; transform: rotate(90deg) scale(0.6); }
[data-theme="light"] .theme-icon-moon { opacity: 1; transform: rotate(0deg) scale(1); }

/* ═══════════════════════════════════════════════════
   LIGHT THEME OVERRIDES
   Переопределяем места с захардкоженными белыми прозрачностями
   ═══════════════════════════════════════════════════ */
[data-theme="light"] .app-wrapper {
  background: var(--bg-surface);
  box-shadow: var(--shadow-shell);
}

[data-theme="light"] .chat-header {
  background: var(--bg-surface);
}

[data-theme="light"] .chat-footer {
  background: var(--bg-surface);
}

/* (старые правила переопределены новым блоком в v21 ниже) */

/* Минимальная шапка */
.chat-header-minimal {
  height: 48px !important;
  padding: 0 14px !important;
  justify-content: space-between;
}

.header-status-dot-only {
  display: flex;
  align-items: center;
}

[data-theme="light"] .nav-btn:hover {
  background: rgba(15,23,42,0.04);
}

[data-theme="light"] .modal-overlay {
  background: rgba(15,23,42,0.45);
  backdrop-filter: blur(8px);
}

[data-theme="light"] .modal-card {
  box-shadow: 0 -18px 70px rgba(15,23,42,0.18);
}

[data-theme="light"] .modal-close {
  background: rgba(15,23,42,0.06);
}

[data-theme="light"] .modal-close:hover {
  background: rgba(15,23,42,0.12);
}

[data-theme="light"] .menu-toggle-btn span {
  background: var(--text-primary);
}

[data-theme="light"] .side-panel,
[data-theme="light"] .desktop-side-panel,
[data-theme="light"] .mobile-drawer {
  background: var(--bg-surface);
}

[data-theme="light"] .mobile-drawer-head {
  background: var(--bg-surface);
}

[data-theme="light"] .side-account-row,
[data-theme="light"] .side-subscription-row,
[data-theme="light"] .side-summary {
  background: rgba(15,23,42,0.025);
  border-color: rgba(15,23,42,0.06);
}

[data-theme="light"] .side-btn-primary {
  color: #fff;
}

[data-theme="light"] .side-btn-ghost {
  border-color: rgba(15,23,42,0.12);
  background: transparent;
}

[data-theme="light"] .icon-link {
  background: rgba(15,23,42,0.025);
  border-color: rgba(15,23,42,0.06);
}

[data-theme="light"] .icon-link:hover {
  background: rgba(15,23,42,0.05);
  border-color: rgba(15,23,42,0.14);
}

[data-theme="light"] .icon-link.logo-only {
  background: linear-gradient(180deg, rgba(15,23,42,0.025), rgba(15,23,42,0.01));
  border-color: rgba(15,23,42,0.07);
}

[data-theme="light"] .icon-link.logo-only:hover {
  background: linear-gradient(180deg, rgba(15,23,42,0.05), rgba(15,23,42,0.025));
  border-color: rgba(15,23,42,0.14);
}

[data-theme="light"] .side-divider {
  background: rgba(15,23,42,0.08);
}

[data-theme="light"] .chat-loader {
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: 0 4px 20px rgba(15,23,42,0.10);
}

[data-theme="light"] .message {
  filter: none;
}

[data-theme="light"] .message-bubble {
  box-shadow: 0 6px 18px rgba(15,23,42,0.05);
  color: var(--text-primary);
}

[data-theme="light"] .warning-bubble {
  background: rgba(228,0,43,0.06) !important;
  border-color: rgba(228,0,43,0.22) !important;
  color: var(--text-primary);
}

[data-theme="light"] .status-message strong {
  color: var(--accent-red);
}

/* Smooth transition between themes */
.app-wrapper,
.chat-header,
.chat-footer,
.message-bubble,
.inline-btn,
.nav-btn,
.icon-link,
.side-account-row,
.side-subscription-row,
.modal-card {
  transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}

/* ═══════════════════════════════════════════════════
   BRAND ICON RESET — позволяем иконкам использовать свои цвета
   ═══════════════════════════════════════════════════ */
.icon-link.brand-instagram .brand-logo-icon,
.icon-link.brand-telegram  .brand-logo-icon,
.icon-link.brand-vk        .brand-logo-icon,
.icon-link.brand-yandex    .brand-logo-icon,
.icon-link.brand-2gis      .brand-logo-icon {
  stroke: none;
  fill: initial;
  width: 56px;
  height: 56px;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,0.15));
}

.map-link.brand-yandex  .brand-logo-icon,
.map-link.brand-2gis    .brand-logo-icon {
  width: 64px;
  height: 64px;
}

/* Лёгкий hover на иконках */
.icon-link.brand-instagram:hover .brand-logo-icon,
.icon-link.brand-telegram:hover  .brand-logo-icon,
.icon-link.brand-vk:hover        .brand-logo-icon,
.icon-link.brand-yandex:hover    .brand-logo-icon,
.icon-link.brand-2gis:hover      .brand-logo-icon {
  transform: scale(1.06);
  transition: transform 0.18s ease;
}

.header-spacer { flex: 1; }

/* ═══════════════════════════════════════════════════
   v6 FIXES
   ═══════════════════════════════════════════════════ */

/* ── Theme toggle: позиционируем в правый верхний угол сайдбара ── */
.side-panel-inner {
  position: relative;
}

.theme-toggle {
  position: absolute;
  top: 12px;
  right: 14px;
  z-index: 5;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border-active);
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.2s ease;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

.theme-toggle:hover,
.theme-toggle:active {
  color: var(--text-primary);
  background: var(--bg-bubble-bot);
  transform: rotate(15deg);
}

/* Иконки солнца/луны */
.theme-icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  position: absolute;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

[data-theme="dark"] .theme-icon-sun  { opacity: 1; transform: rotate(0deg) scale(1); }
[data-theme="dark"] .theme-icon-moon { opacity: 0; transform: rotate(-90deg) scale(0.6); }
[data-theme="light"] .theme-icon-sun  { opacity: 0; transform: rotate(90deg) scale(0.6); }
[data-theme="light"] .theme-icon-moon { opacity: 1; transform: rotate(0deg) scale(1); }

/* Чтобы заголовок брендa не наезжал на кнопку темы */
.side-brand.side-brand-compact {
  padding-right: 56px;
}

/* ── Скрытие скроллбара в сайдбаре ── */
.side-panel-inner,
.side-panel,
.desktop-side-panel,
.mobile-drawer {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.side-panel-inner::-webkit-scrollbar,
.side-panel::-webkit-scrollbar,
.desktop-side-panel::-webkit-scrollbar,
.mobile-drawer::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

/* ── Унификация кнопок в сайдбаре (одинаковая высота, выравнивание) ── */
.side-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding: 0 18px;
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.1px;
  white-space: nowrap;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.18s ease;
  text-decoration: none;
  box-sizing: border-box;
}

.side-btn-primary {
  background: linear-gradient(135deg, var(--accent-red), var(--accent-red-2));
  color: #fff;
  box-shadow: 0 8px 22px rgba(228,0,43,0.24);
  border-color: rgba(255,255,255,0.14);
}
.side-btn-primary:hover { filter: brightness(1.08); }

.side-btn-ghost {
  background: transparent;
  color: var(--text-primary);
  border-color: var(--border-active);
}
.side-btn-ghost:hover {
  background: rgba(255,255,255,0.05);
  border-color: var(--border-active);
}

[data-theme="light"] .side-btn-ghost:hover {
  background: rgba(15,23,42,0.05);
}

.side-inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

/* ── Кнопка двери — теперь зелёная ── */
.nav-btn.btn-door {
  color: var(--accent-green) !important;
  background: rgba(29,185,84,0.10) !important;
  border-color: rgba(29,185,84,0.28) !important;
}

.nav-btn.btn-door:hover {
  background: rgba(29,185,84,0.18) !important;
  border-color: rgba(29,185,84,0.45) !important;
}

[data-theme="light"] .nav-btn.btn-door {
  color: var(--accent-green) !important;
  background: rgba(22,163,74,0.10) !important;
  border-color: rgba(22,163,74,0.28) !important;
}

/* Убираем верхнюю золотую полоску над футером (она теперь не подходит к зелёной кнопке) */
.chat-footer::before {
  background: linear-gradient(90deg, transparent, rgba(29,185,84,0.45), transparent) !important;
}

/* ════════════════════════════
   ШАПКА ЧАТА С ИНФО О ПОДПИСКЕ
   ════════════════════════════ */
.chat-header.chat-header-info {
  height: 64px !important;
  min-height: 64px;
  padding: 0 14px !important;
  gap: 14px;
  align-items: center;
}

.header-sub-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  overflow: hidden;
}

.header-sub-row {
  display: flex;
  align-items: center;
  gap: 10px;
  line-height: 1;
}

.header-sub-kicker {
  font-size: 10.5px;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.7px;
}

.header-sub-status {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.header-sub-status.active   { color: var(--accent-green); }
.header-sub-status.inactive { color: var(--accent-red); }

.header-sub-meta {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-sub-meta strong {
  color: var(--accent-red);
  font-weight: 800;
}

[data-theme="light"] .header-sub-meta strong {
  color: var(--accent-red);
}

.header-sub-cta {
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--accent-red);
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.header-sub-cta:hover {
  opacity: 0.75;
}

/* На очень узких экранах — компактнее */
@media (max-width: 380px) {
  .chat-header.chat-header-info { gap: 10px; padding: 0 12px !important; }
  .header-sub-kicker { font-size: 9.5px; }
  .header-sub-meta { font-size: 12px; }
}

/* Приглушённая meta когда подписка неактивна */
.header-sub-meta-muted {
  color: var(--text-muted) !important;
  font-weight: 500 !important;
}

/* Когда одна строка — центрируем по вертикали */
.header-sub-info:has(.header-sub-row-single):not(:has(.header-sub-meta)) {
  justify-content: center;
}
.header-sub-row-single {
  align-items: baseline;
}

/* Унификация интервалов внутри bubble - одна пустая строка между блоками */
.message-bubble p {
  margin: 0;
}
.message-bubble p + p {
  margin-top: 1em;
}
.message-bubble br + br {
  /* двойной br = одна пустая строка - ровно как нужно */
}

/* ═══════════════════════════════════════════════════
   v11 FIXES
   ═══════════════════════════════════════════════════ */

/* ── Кнопка темы — обычный flex-элемент в строке с лого ── */
.side-brand.side-brand-compact {
  position: static !important;
  padding-right: 0 !important;
  display: flex !important;
  align-items: center !important;
  gap: 12px;
}

.side-brand-text {
  flex: 1;
  min-width: 0;
}

.side-brand.side-brand-compact .theme-toggle {
  position: static !important;
  margin-left: auto;
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border-active);
  background: var(--bg-card);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0;
  position: relative;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: rgba(0,0,0,0);
}

.side-brand.side-brand-compact .theme-toggle:hover,
.side-brand.side-brand-compact .theme-toggle:active {
  color: var(--text-primary);
  background: var(--bg-bubble-bot);
  transform: rotate(15deg);
}

.side-brand.side-brand-compact .theme-toggle .theme-icon {
  position: absolute;
  width: 18px;
  height: 18px;
}

/* ── Шапка чата: увеличиваем "Ваша подписка не активна" ── */
.chat-header.chat-header-info {
  height: auto !important;
  min-height: 64px;
  padding: 10px 14px !important;
}

.header-sub-row.header-sub-row-single {
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  line-height: 1.2;
}

.header-sub-row.header-sub-row-single .header-sub-kicker {
  font-size: 10.5px;
}

.header-sub-row.header-sub-row-single .header-sub-status {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.1px;
}

/* ── Фейк-тоггл подписки (DEV) ── */
.side-fake-toggle {
  margin-top: 10px;
  padding: 12px 14px;
  background: rgba(240,191,76,0.08);
  border: 1px dashed rgba(240,191,76,0.4);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

[data-theme="light"] .side-fake-toggle {
  background: rgba(184,134,44,0.08);
  border-color: rgba(184,134,44,0.45);
}

.side-fake-label {
  font-size: 10px;
  font-weight: 800;
  color: var(--accent-gold);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.side-fake-btn {
  background: transparent;
  border: 1px solid var(--accent-gold);
  color: var(--accent-gold);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 700;
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.side-fake-btn:hover,
.side-fake-btn:active {
  background: var(--accent-gold);
  color: #1a120a;
}

/* ═══════════════════════════════════════════════════
   v12 FIXES
   ═══════════════════════════════════════════════════ */

/* ── 1. Шапка чата: всё в одну строку ── */
.chat-header.chat-header-info {
  height: 56px !important;
  min-height: 56px !important;
  padding: 0 14px !important;
  align-items: center !important;
}

.header-sub-info {
  flex-direction: row !important;
  align-items: baseline;
  gap: 10px;
  flex-wrap: nowrap;
  overflow: hidden;
}

.header-sub-row.header-sub-row-single {
  flex-direction: row !important;
  align-items: baseline !important;
  gap: 10px;
}

.header-sub-row.header-sub-row-single .header-sub-kicker {
  font-size: 11.5px;
  white-space: nowrap;
}

.header-sub-row.header-sub-row-single .header-sub-status {
  font-size: 15px;
  font-weight: 800;
  white-space: nowrap;
}

/* ── 2. Фикс иконок темы при перезагрузке ── */
/* Дефолтные правила, чтобы было правильное состояние ВСЕГДА */
.theme-icon-sun  { opacity: 1; transform: rotate(0deg) scale(1); }
.theme-icon-moon { opacity: 0; transform: rotate(-90deg) scale(0.6); }

[data-theme="light"] .theme-icon-sun  { opacity: 0; transform: rotate(90deg) scale(0.6); }
[data-theme="light"] .theme-icon-moon { opacity: 1; transform: rotate(0deg) scale(1); }

/* ── 5. Все inline-кнопки красные, только btn-back — приглушённая ── */
.inline-btn {
  min-height: 38px !important;
  padding: 8px 16px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  line-height: 1.2 !important;
  background: linear-gradient(135deg, var(--accent-red), var(--accent-red-2)) !important;
  border: 1px solid rgba(255,255,255,0.14) !important;
  color: #fff !important;
  box-shadow: 0 6px 18px rgba(228,0,43,0.22) !important;
  border-radius: 999px !important;
  gap: 7px;
  white-space: nowrap;
}

.inline-btn:hover {
  filter: brightness(1.06);
}

/* Кнопка "Назад" — приглушённая */
.inline-btn.btn-back {
  background: transparent !important;
  border-color: var(--border-active) !important;
  color: var(--text-muted) !important;
  box-shadow: none !important;
  font-weight: 600 !important;
  font-size: 12.5px !important;
}

.inline-btn.btn-back:hover {
  background: rgba(255,255,255,0.05) !important;
  color: var(--text-primary) !important;
}

[data-theme="light"] .inline-btn.btn-back {
  background: transparent !important;
  border-color: rgba(15,23,42,0.10) !important;
  color: var(--text-muted) !important;
}

[data-theme="light"] .inline-btn.btn-back:hover {
  background: rgba(15,23,42,0.05) !important;
}

/* ── 6. Иконки соцсетей и карт — в равных квадратах ── */
.icon-square-grid {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.icon-square {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: var(--bg-bubble-bot);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.18s ease;
  flex-shrink: 0;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.icon-square:hover {
  transform: translateY(-2px) scale(1.04);
  border-color: var(--border-active);
  background: var(--bg-card);
}

.icon-square svg {
  width: 40px;
  height: 40px;
  display: block;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,0.18));
}

[data-theme="light"] .icon-square {
  background: rgba(15,23,42,0.025);
  border-color: rgba(15,23,42,0.08);
}

[data-theme="light"] .icon-square:hover {
  background: rgba(15,23,42,0.05);
}

/* ── 5b. Кнопки в сайдбаре одного размера ── */
.side-btn {
  height: 40px !important;
  padding: 0 18px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  line-height: 1 !important;
  border-radius: 999px !important;
  white-space: nowrap;
  text-decoration: none !important;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.18s ease;
  box-sizing: border-box;
}

.side-btn-primary {
  background: linear-gradient(135deg, var(--accent-red), var(--accent-red-2)) !important;
  color: #fff !important;
  box-shadow: 0 8px 22px rgba(228,0,43,0.24);
  border-color: rgba(255,255,255,0.14) !important;
}

.side-btn-primary:hover {
  filter: brightness(1.08);
}

.side-btn-ghost {
  background: transparent !important;
  color: var(--text-primary) !important;
  border-color: var(--border-active) !important;
  box-shadow: none !important;
}

.side-btn-ghost:hover {
  background: rgba(255,255,255,0.05) !important;
}

[data-theme="light"] .side-btn-ghost:hover {
  background: rgba(15,23,42,0.05) !important;
}

.side-logout-form { margin: 0; padding: 0; }

/* ── Account row layout fix ── */
.side-account-row,
.side-subscription-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-start;
}

.side-account-info,
.side-subscription-info {
  flex: 1;
  min-width: 180px;
}


/* ═══════════════════════════════════════════════════
   AUTH / LOGIN PAGE
   ═══════════════════════════════════════════════════ */
.auth-shell {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at top left, var(--bg-radial-1), transparent 34%),
    radial-gradient(circle at bottom right, var(--bg-radial-2), transparent 32%),
    var(--bg-deep);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 36px 28px;
  box-shadow: var(--shadow-shell);
  text-align: center;
}

.auth-logo {
  width: 72px;
  height: 72px;
  margin: 0 auto 18px;
  background: var(--logo-box-bg);
  border: 1px solid var(--border);
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: var(--shadow-glow);
}

.auth-logo img {
  width: 56px;
  height: 56px;
  object-fit: contain;
}

.auth-title {
  font-size: 24px;
  font-weight: 900;
  letter-spacing: 0.5px;
  color: var(--text-primary);
}

.auth-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
  margin-bottom: 28px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
}

.auth-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.auth-input-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-bubble-bot);
  border: 1px solid var(--border-active);
  border-radius: 14px;
  padding: 0 14px;
  height: 52px;
  transition: border-color 0.15s ease;
}

.auth-input-wrap:focus-within {
  border-color: var(--accent-red);
  box-shadow: 0 0 0 4px rgba(228,0,43,0.12);
}

.auth-input-wrap.has-error {
  border-color: var(--accent-red);
}

.auth-input-prefix {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  padding-right: 6px;
  border-right: 1px solid var(--border);
}

.auth-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  padding: 0 0 0 8px;
  letter-spacing: 0.5px;
  height: 100%;
}

.auth-input::placeholder {
  color: var(--text-dim);
  font-weight: 500;
}

.auth-error {
  color: var(--accent-red);
  font-size: 12.5px;
  font-weight: 600;
  margin-top: 2px;
}

.auth-submit {
  margin-top: 16px;
  height: 52px;
  background: linear-gradient(135deg, var(--accent-red), var(--accent-red-2));
  color: #fff;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.3px;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  box-shadow: 0 12px 32px rgba(228,0,43,0.28);
  transition: filter 0.15s ease, transform 0.1s ease;
}

.auth-submit:hover { filter: brightness(1.08); }
.auth-submit:active { transform: scale(0.98); }

.auth-legal {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 18px;
  line-height: 1.5;
  text-align: center;
}

.auth-legal a {
  color: var(--accent-red);
  text-decoration: none;
}

.auth-legal a:hover { text-decoration: underline; }

[data-theme="light"] .side-account-row,
[data-theme="light"] .side-subscription-row {
  background: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
}
/* ═══════════════════════════════════════════════════
   v13 FIXES
   ═══════════════════════════════════════════════════ */

/* ── Шапка чата: единый стиль для активной/неактивной подписки ── */
.header-sub-info {
  flex: 1;
  display: flex;
  flex-direction: row !important;
  align-items: center !important;
  min-width: 0;
  overflow: hidden;
}

.header-sub-row {
  display: flex !important;
  flex-direction: row !important;
  align-items: baseline !important;
  gap: 8px !important;
  flex-wrap: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-sub-kicker {
  font-size: 11.5px;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  white-space: nowrap;
  flex-shrink: 0;
}

.header-sub-status {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.1px;
  white-space: nowrap;
  flex-shrink: 0;
}

.header-sub-status.active   { color: var(--accent-green); }
.header-sub-status.inactive { color: var(--accent-red); }

.header-sub-divider {
  color: var(--text-dim);
  font-weight: 800;
  flex-shrink: 0;
}

.header-sub-meta-inline {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.header-sub-meta-inline strong {
  color: var(--text-primary);
  font-weight: 800;
}

@media (max-width: 380px) {
  .header-sub-divider, .header-sub-meta-inline { display: none; }
}

/* Подчищаем старые правила, которые могут конфликтовать */
.header-sub-row.header-sub-row-single { display: flex !important; }

/* ── Карточки тренеров ── */
.trainer-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 0;
}

.trainer-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border-active);
  flex-shrink: 0;
  background: var(--bg-bubble-bot);
}

.trainer-card-large .trainer-avatar-large {
  width: 76px;
  height: 76px;
  border-width: 2px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.25);
}

.trainer-info {
  flex: 1;
  min-width: 0;
}

.trainer-name {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 3px;
}

.trainer-spec {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.35;
  margin-bottom: 3px;
}

.trainer-meta {
  font-size: 12.5px;
  color: var(--text-muted);
  font-weight: 600;
}

.trainer-bio {
  margin-top: 10px;
  font-size: 13.5px;
  color: var(--text-primary);
  line-height: 1.5;
  padding-left: 2px;
}

.trainer-price {
  margin-top: 10px;
  font-size: 13.5px;
  color: var(--text-muted);
}

.trainer-price strong {
  color: var(--accent-red);
  font-size: 15px;
  font-weight: 800;
}

/* ═══════════════════════════════════════════════════
   v14: новые иконки соцсетей и карт
   ═══════════════════════════════════════════════════ */

/* Контейнер по центру колонки */
.icon-square-grid-centered {
  display: flex;
  justify-content: center;
  gap: 18px;
  flex-wrap: wrap;
  padding: 4px 0;
}

/* Заголовок секций тоже центрируем */
.side-link-section {
  text-align: center;
}

.side-link-heading {
  text-align: center;
}

/* Иконка без обводки */
.icon-square.icon-bare {
  width: 56px;
  height: 56px;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  transition: transform 0.18s ease;
  -webkit-tap-highlight-color: transparent;
}

.icon-square.icon-bare:hover {
  transform: translateY(-2px) scale(1.06);
  background: transparent !important;
}

.icon-square.icon-bare svg { display: none; }

.icon-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 4px 14px rgba(232, 37, 58, 0.22));
}

[data-theme="light"] .icon-img {
  filter: drop-shadow(0 4px 12px rgba(232, 37, 58, 0.18));
}

/* ═══════════════════════════════════════════════════
   v19: Dual logo (white for dark theme, black for light)
        + равные карточки тренеров
   ═══════════════════════════════════════════════════ */

/* Контейнеры лого — прозрачные, без коробки */
.side-brand-logo {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

.auth-logo {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

/* Переключение версий по теме */
.logo-image-dark,
.logo-image-light {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.logo-image-light { display: none; }

[data-theme="light"] .logo-image-dark  { display: none; }
[data-theme="light"] .logo-image-light { display: block; }

/* ── Карточки тренеров: одинаковая высота ── */
.trainer-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 0;
  min-height: 76px; /* фиксируем нижнюю границу */
}

.trainer-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.trainer-name {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
}

.trainer-spec {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.35;
  /* обрезаем слишком длинную специализацию в одну строку */
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
}

.trainer-meta {
  font-size: 12.5px;
  color: var(--text-muted);
  font-weight: 600;
  line-height: 1.2;
}

/* Фиксируем ширину карточек тренеров — чтобы пузырёк всегда был одного размера
   и кнопки под ним помещались в один ряд */
.trainer-card {
  width: 100%;
  max-width: 320px;
}

.message:has(.trainer-card) .message-bubble {
  width: 100%;
  max-width: 360px;
  min-width: 300px;
}

/* и кнопки под такой карточкой тоже не должны переноситься */
.message:has(.trainer-card) + .inline-buttons,
.message:has(.trainer-card) .inline-buttons {
  flex-wrap: nowrap;
  max-width: 360px;
}

/* Имя тренера — обрезаем если слишком длинное */
.trainer-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ═══════════════════════════════════════════════════
   v20: Иконки в сообщениях и кнопках
   ═══════════════════════════════════════════════════ */

/* Иконка внутри текста сообщения (заголовки тренеров, дверь, чат и т.д.) */
.msg-icon {
  display: inline-block;
  width: 22px;
  height: 22px;
  vertical-align: -5px;
  margin-right: 4px;
  object-fit: contain;
  /* белые на тёмной теме — оставляем как есть */
}

/* На светлой теме инвертируем (белая → чёрная) */
[data-theme="light"] .msg-icon {
  filter: invert(1);
}

/* Иконка в начале inline-кнопки */
.btn-icon-img {
  width: 18px;
  height: 18px;
  object-fit: contain;
  margin-right: 6px;
  vertical-align: -3px;
  /* белые иконки хорошо читаются на красной кнопке */
}

/* На прозрачной серой кнопке (btn-back) фильтр не нужен — там и так темный фон */


/* ═══════════════════════════════════════════════════
   v21: Звезда рейтинга
   ═══════════════════════════════════════════════════ */
.star-icon {
  width: 14px;
  height: 14px;
  vertical-align: -2px;
  margin-right: 3px;
  object-fit: contain;
}
[data-theme="light"] .star-icon {
  filter: invert(1);
}

/* Иконка-PNG в нижней навигации */
.nav-icon-img {
  object-fit: contain;
  width: 24px;
  height: 24px;
}
[data-theme="light"] .nav-icon-img {
  filter: invert(1);
}

/* ═══════════════════════════════════════════════════
   SUPPORT INPUT BAR
   ═══════════════════════════════════════════════════ */

.support-input-bar {
  min-height: 58px;
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  background: var(--bg-surface);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.support-input-bar[hidden] {
  display: none !important;
}

.support-message-input {
  flex: 1;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-bubble-bot);
  color: var(--text-primary);
  padding: 0 16px;
  outline: none;
  font-size: 16px;
  font-weight: 600;
}

.support-message-input::placeholder {
  color: var(--text-muted);
}

.support-message-input:focus {
  border-color: var(--border-active);
}

.support-attach-btn,
.support-send-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border-active);
  background: transparent;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  font-weight: 800;
}

.support-file-input {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
}

.support-attach-btn {
  font-size: 22px;
  line-height: 1;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  cursor: pointer;
  user-select: none;
}

.support-attach-btn.has-file {
  background: rgba(255, 47, 91, 0.12);
  border-color: rgba(255, 47, 91, 0.5);
  color: #ff2f5b;
}

/* ── Support file preview (above input) ── */
.support-file-preview {
  position: relative;
  padding: 10px 44px 8px 14px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.support-file-preview[hidden] { display: none !important; }

.support-file-preview__remove {
  position: absolute;
  top: 6px;
  right: 10px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: rgba(128,128,128,0.6);
  color: #fff;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.support-file-preview__remove:hover { background: #ff2f5b; }

/* preview image grid */
.sp-images {
  display: grid;
  gap: 4px;
  width: min(100%, 292px);
  max-width: 292px;
}
.sp-grid-1 { grid-template-columns: 80px; }
.sp-grid-2 { grid-template-columns: repeat(2, 80px); }
.sp-grid-3 { grid-template-columns: 164px 80px; grid-template-rows: repeat(2, 80px); }
.sp-grid-4 { grid-template-columns: repeat(4, 68px); }
.sp-img-item { position: relative; overflow: hidden; border-radius: 8px; aspect-ratio: 1; min-width: 0; min-height: 0; }
.sp-img-item .sp-thumb { width: 100%; height: 100%; object-fit: cover; display: block; }
.sp-more { position: absolute; inset: 0; background: rgba(0,0,0,0.5); color: #fff; font-size: 16px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.sp-grid-3 .sp-img-item:first-child { grid-row: 1 / 3; aspect-ratio: auto; }

/* preview doc list */
.sp-docs { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.sp-doc-item { display: flex; align-items: center; gap: 8px; background: var(--bg-bubble-bot); border-radius: 8px; padding: 6px 8px; max-width: 260px; }
.sp-doc-item svg { flex-shrink: 0; color: var(--text-muted); }
.sp-doc-info { display: flex; flex-direction: column; min-width: 0; }
.sp-doc-name { font-size: 12px; font-weight: 600; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 180px; }
.sp-doc-size { font-size: 11px; color: var(--text-muted); }

/* ── Chat message: image grid ── */
.message-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: zoom-in;
  position: relative;
  z-index: 1;
}

.user-bubble.has-image,
.user-bubble.has-files,
.support-reply-bubble.has-image,
.support-reply-bubble.has-files {
  padding: 0;
  overflow: hidden;
  min-width: 120px;
  max-width: 100%;
  width: min(320px, calc(100vw - 72px));
  text-align: left;
}

.msg-media-grid {
  display: grid;
  gap: 2px;
  width: 100%;
  max-width: none;
  overflow: hidden;
}
.msg-grid-1 { grid-template-columns: 1fr; aspect-ratio: 4 / 3; }
.msg-grid-2 { grid-template-columns: 1fr 1fr; aspect-ratio: 2 / 1; }
.msg-grid-3 { grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; aspect-ratio: 4 / 3; }
.msg-grid-3 .msg-media-item:first-child { grid-row: 1 / 3; }
.msg-grid-4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; aspect-ratio: 1 / 1; }

.msg-media-item {
  position: relative;
  overflow: hidden;
  background: rgba(0,0,0,0.15);
  min-width: 0;
  min-height: 0;
}
.msg-media-item,
.msg-media-item .message-img {
  width: 100%;
  height: 100%;
}

.msg-media-blur { display: none; }

.msg-media-more {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: rgba(0,0,0,0.5);
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Chat message: file list ── */
.msg-file-list { display: flex; flex-direction: column; gap: 2px; padding: 6px 6px 0; width: 100%; }
.msg-media-grid + .msg-file-list { border-top: 1px solid rgba(255,255,255,0.07); }
.msg-file-item { display: flex; align-items: center; gap: 10px; padding: 8px 6px; text-decoration: none; color: inherit; }
a.msg-file-item:hover .msg-file-name { text-decoration: underline; }
.msg-file-item + .msg-file-item { border-top: 1px solid rgba(255,255,255,0.06); }
.msg-file-icon { width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,255,0.1); display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: var(--text-primary); }
.msg-file-info { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; flex: 1; }
.msg-file-name { font-size: 13px; font-weight: 600; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.msg-file-size { font-size: 11px; color: var(--text-muted); white-space: nowrap; flex-shrink: 0; }

/* bottom row: text left, time right */
.msg-bottom-row {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 8px;
  padding: 7px 10px 8px 12px;
  border-top: 1px solid rgba(255,255,255,0.07);
}
.msg-caption-text {
  flex: 1;
  font-family: var(--font-body);
  font-size: inherit;
  line-height: 1.46;
  letter-spacing: inherit;
  color: var(--text-primary);
  text-align: left;
  word-break: break-word;
  margin-right: auto;
}
.msg-bottom-row .message-time {
  flex-shrink: 0;
  margin: 0;
  padding: 0;
  align-self: flex-end;
}

.trainer-avatar { cursor: zoom-in; }
.trainer-avatar-large { cursor: zoom-in; }

/* ── Lightbox ── */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox[hidden] { display: none !important; }

.lightbox__img {
  max-width: calc(100vw - 32px);
  max-height: calc(100dvh - 80px);
  border-radius: 12px;
  object-fit: contain;
  user-select: none;
}

.lightbox__close {
  position: fixed;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.15);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  z-index: 1;
}

.lightbox__arrow {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.15);
  color: #fff;
  font-size: 32px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  z-index: 1;
  transition: background 0.15s;
}
.lightbox__arrow:hover { background: rgba(255,255,255,0.28); }
.lightbox__prev { left: 12px; }
.lightbox__next { right: 12px; }
.lightbox__arrow[hidden] { display: none !important; }

/* per-file remove button in preview */
.sp-img-item .sp-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: none;
  background: rgba(20,20,20,0.75);
  color: #fff;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  z-index: 2;
}
.sp-doc-item .sp-remove {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: none;
  background: rgba(80,80,80,0.9);
  color: #fff;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  z-index: 2;
}
.sp-img-item .sp-remove:hover,
.sp-doc-item .sp-remove:hover { background: #ff2f5b; }
.sp-img-item { position: relative; }
.sp-doc-item { position: relative; padding-right: 30px; }

.support-send-btn {
    width: 52px;
    height: 52px;

    border-radius: 16px;

    border: 1px solid rgba(255,255,255,0.12);

    background: rgba(255,255,255,0.04);

    color: #ff2f5b;

    display: flex;
    align-items: center;
    justify-content: center;

    cursor: pointer;

    transition: all 0.2s ease;
}

.support-send-btn:hover {
    background: rgba(255,47,91,0.12);
    border-color: rgba(255,47,91,0.35);

    transform: translateY(-1px);
}

.support-attach-btn:hover {
  background: rgba(255,255,255,0.08);
  border-color: var(--text-primary);
}

.support-attach-btn.has-file:hover {
  background: rgba(255, 47, 91, 0.22);
  border-color: #ff2f5b;
}

.support-send-btn:hover {
  filter: brightness(1.08);
}

[data-theme="light"] .support-input-bar {
  background: var(--bg-surface);
}
/* Subscription checkout modal */
.checkout-modal-card {
  max-width: 560px;
  max-height: calc(100dvh - 28px);
  overflow-y: auto;
}

.checkout-lead {
  margin: -10px 0 18px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
}

.checkout-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.checkout-step {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.checkout-step-title {
  margin: 2px 0 4px;
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 900;
}

.checkout-label {
  font-size: 11px;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 4px;
}

.checkout-input,
.checkout-file {
  width: 100%;
  min-height: 48px;
  border-radius: 14px;
  border: 1px solid var(--border-active);
  background: var(--bg-bubble-bot);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 650;
  outline: none;
  padding: 0 14px;
}

.checkout-file {
  display: block;
  padding: 12px 14px;
  height: auto;
  min-height: 52px;
}

.checkout-input:focus,
.checkout-file:focus {
  border-color: var(--accent-red);
  box-shadow: 0 0 0 4px rgba(228,0,43,0.12);
}

.checkout-photo-block {
  margin-top: 4px;
  padding: 14px;
  border: 1px solid var(--border);
  background: rgba(228, 0, 43, 0.08);
  border-radius: 18px;
}

.checkout-photo-warning {
  margin: 7px 0 10px;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.45;
}

.checkout-help {
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.4;
}

.checkout-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 13px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--bg-bubble-bot);
  color: var(--text-primary);
  font-size: 13px;
  line-height: 1.35;
  cursor: pointer;
}

.checkout-check input {
  width: 18px;
  height: 18px;
  margin-top: 0;
  accent-color: var(--accent-red);
  flex: 0 0 auto;
}

.checkout-check a {
  color: var(--accent-red);
  font-weight: 800;
  text-decoration: none;
}

.checkout-check a:hover { text-decoration: underline; }

.checkout-actions {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
  margin-top: 6px;
}

.checkout-submit,
.checkout-back {
  margin-top: 6px;
  min-height: 52px;
  border: none;
  border-radius: 16px;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 900;
  cursor: pointer;
}

.checkout-submit {
  background: linear-gradient(135deg, var(--accent-red), var(--accent-red-2));
  color: #fff;
  box-shadow: 0 16px 36px rgba(228,0,43,0.28);
}

.checkout-back {
  min-width: 104px;
  padding: 0 16px;
  background: var(--bg-bubble-bot);
  border: 1px solid var(--border);
  color: var(--text-primary);
}

.checkout-submit:disabled {
  cursor: wait;
  opacity: 0.72;
}

@media (max-width: 520px) {
  .checkout-actions {
    grid-template-columns: 1fr;
  }

  .checkout-back {
    width: 100%;
  }
}

.checkout-errors {
  border-radius: 14px;
  border: 1px solid rgba(228,0,43,0.42);
  background: rgba(228,0,43,0.12);
  color: var(--text-primary);
  font-size: 13px;
  line-height: 1.45;
  padding: 12px 14px;
}

.checkout-errors ul {
  margin: 6px 0 0;
  padding-left: 18px;
}

.payment-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent-red), var(--accent-red-2));
  color: #fff !important;
  font-weight: 900;
  text-decoration: none;
  box-shadow: 0 12px 28px rgba(228,0,43,0.22);
}

.payment-qr-title {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.payment-qr {
  width: min(220px, 100%);
  height: auto;
  display: block;
  border-radius: 18px;
  background: #fff;
  padding: 10px;
}

[data-theme="light"] .checkout-photo-block {
  background: rgba(228,0,43,0.07);
}

.payment-url-copy {
  margin-top: 8px;
  max-width: 100%;
  overflow-wrap: anywhere;
  font-size: 12px;
  color: var(--text-muted);
  opacity: 0.85;
}

.payment-missing {
  display: block;
  padding: 12px 14px;
  border: 1px solid rgba(240,191,76,0.35);
  border-radius: 14px;
  background: rgba(240,191,76,0.10);
  color: var(--text-primary);
  line-height: 1.45;
}

.payment-missing code {
  font-size: 0.92em;
  color: inherit;
}

/* Generated training cards */
.exercise-card {
  margin-top: 14px;
  padding: 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.exercise-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding-bottom: 12px;
  margin-bottom: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.exercise-number {
  min-width: 34px;
  height: 34px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 35, 72, 0.18);
  color: var(--accent-red-2);
  font-weight: 800;
}

.exercise-name {
  color: var(--text-primary);
  font-weight: 800;
  font-size: 17px;
  line-height: 1.25;
}

.exercise-group {
  margin-top: 2px;
  color: var(--accent-red-2);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.exercise-description {
  color: var(--text-muted);
  line-height: 1.55;
  font-size: 14px;
}

.exercise-meta {
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(255, 35, 72, 0.12);
  color: var(--accent-red-2);
  font-weight: 800;
}

/* Workout history in chat */
.workout-limit-note {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
}

.workout-history-list {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.workout-history-item {
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

.workout-history-item summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  user-select: none;
}

.workout-history-item summary::-webkit-details-marker {
  display: none;
}

.workout-history-title {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.workout-history-title strong {
  color: var(--text-primary);
  font-size: 20px;
  line-height: 1.2;
}

.workout-history-title span {
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.25;
}

.workout-history-chevron {
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: transform .18s ease;
}

.workout-history-item[open] .workout-history-chevron {
  transform: rotate(180deg);
}

.workout-history-body {
  padding: 0 16px 18px;
}

.workout-history-empty {
  color: var(--text-muted);
  padding: 0 4px 12px;
}

[data-theme="light"] .workout-history-item,
[data-theme="light"] .workout-limit-note {
  background: rgba(10, 16, 27, 0.045);
  border-color: rgba(10, 16, 27, 0.1);
}

@media (max-width: 560px) {
  .workout-history-item summary {
    padding: 16px;
  }

  .workout-history-title strong {
    font-size: 18px;
  }
}

/* ===== Trainer Tinder overlay ===== */
body.tinder-locked { overflow: hidden; }

.trainer-tinder-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: ttc-fade-in 0.2s ease;
  color: #f5f7fb;
}

/* HTML `hidden` attribute must win over display:flex */
.trainer-tinder-overlay[hidden] {
  display: none !important;
}

@keyframes ttc-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.trainer-tinder-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  flex-shrink: 0;
}

.trainer-tinder-title {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.01em;
}

.trainer-tinder-close {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.trainer-tinder-close:hover { background: rgba(255, 255, 255, 0.18); }

.trainer-tinder-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 20px 20px;
  min-height: 0;
}

.trainer-tinder-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  color: #0f1729;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  position: relative;
  touch-action: pan-y;
  will-change: transform;
  animation: ttc-slide-in 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
  /* Don't let drags create text selection / image drag ghosts */
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
  cursor: grab;
}

.trainer-tinder-card:active { cursor: grabbing; }

.trainer-tinder-card img,
.trainer-tinder-card * {
  -webkit-user-drag: none;
  user-select: none;
  -webkit-user-select: none;
}

@keyframes ttc-slide-in {
  from { opacity: 0; transform: translateY(20px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.ttc-photo {
  position: relative;
  aspect-ratio: 4 / 5;
  background: #1f1f55;
  overflow: hidden;
}

.ttc-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
  user-select: none;
}

.ttc-photo-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 40%, rgba(0, 0, 0, 0.65) 90%, rgba(0, 0, 0, 0.85) 100%);
  pointer-events: none;
}

.ttc-photo-overlay {
  position: absolute;
  inset: auto 0 0 0;
  padding: 20px 22px 18px;
  color: #fff;
  pointer-events: none;
}

.ttc-name {
  margin: 0;
  font-size: 26px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.ttc-specialty {
  margin: 4px 0 0;
  font-size: 14px;
  opacity: 0.9;
}

.ttc-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.ttc-meta-chip {
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  backdrop-filter: blur(8px);
}

.ttc-swipe-glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
  z-index: 2;
}

.ttc-swipe-glow-dismiss {
  background: linear-gradient(to right, rgba(255, 48, 79, 0.7) 0%, rgba(255, 48, 79, 0.2) 25%, transparent 60%);
  box-shadow: inset 14px 0 40px -4px rgba(255, 48, 79, 0.9);
}

.ttc-swipe-glow-like {
  background: linear-gradient(to left, rgba(29, 185, 84, 0.7) 0%, rgba(29, 185, 84, 0.2) 25%, transparent 60%);
  box-shadow: inset -14px 0 40px -4px rgba(29, 185, 84, 0.9);
}

.trainer-tinder-card.is-dragging-left .ttc-swipe-glow-dismiss { opacity: 1; }
.trainer-tinder-card.is-dragging-right .ttc-swipe-glow-like { opacity: 1; }

.ttc-bio {
  padding: 14px 22px 6px;
  font-size: 14px;
  line-height: 1.5;
  color: #475569;
}

.ttc-price {
  padding: 0 22px;
  margin-top: 8px;
  font-size: 14px;
  font-weight: 700;
  color: #e4002b;
}

.ttc-actions {
  display: flex;
  gap: 10px;
  padding: 14px 18px 18px;
}

.ttc-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 700;
  border-radius: 14px;
  border: none;
  cursor: pointer;
  transition: transform 0.1s, filter 0.15s;
}

.ttc-btn:active { transform: scale(0.96); }

.ttc-btn-dismiss {
  background: #f1f3f8;
  color: #475569;
}
.ttc-btn-dismiss:hover { background: #e5e8ee; }

.ttc-btn-like {
  background: linear-gradient(135deg, #e4002b, #ff304f);
  color: #fff;
  box-shadow: 0 8px 20px rgba(228, 0, 43, 0.35);
}
.ttc-btn-like:hover { filter: brightness(1.06); }

.ttc-btn-icon {
  font-size: 18px;
  line-height: 1;
}

.ttc-hint {
  text-align: center;
  font-size: 12px;
  color: rgba(15, 23, 41, 0.5);
  padding: 0 22px 16px;
  margin: 0;
}

@media (max-width: 480px) {
  .trainer-tinder-body { padding: 0 14px 14px; }
  .trainer-tinder-card { max-width: 100%; border-radius: 20px; }
  .ttc-name { font-size: 22px; }
  .ttc-actions { padding: 12px 14px 16px; }
}

/* ===== Tinder empty state card ===== */
.trainer-tinder-empty {
  padding: 36px 24px 24px;
  text-align: center;
  align-items: center;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.ttc-empty-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f1f3f8, #e5e8ee);
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
}

.ttc-empty-title {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #0f1729;
}

.ttc-empty-text {
  margin: 0;
  font-size: 14px;
  color: #64748b;
  line-height: 1.5;
  max-width: 320px;
}

.ttc-empty-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  margin-top: 8px;
}

.ttc-empty-actions .ttc-btn {
  width: 100%;
}

/* Stacked empty-state buttons: tone down the heavy red shadow so it doesn't
   bleed onto the gray button below. */
.ttc-empty-actions .ttc-btn-like {
  box-shadow: 0 4px 12px rgba(228, 0, 43, 0.22);
}

.ttc-empty-actions .ttc-btn-dismiss {
  position: relative;
  z-index: 1; /* sit above the like-button shadow */
  background: #f1f3f8;
  color: #334155;
  box-shadow: 0 2px 8px rgba(15, 23, 41, 0.06);
}

/* ===== Drag targets (cross + check) ===== */
.trainer-tinder-stage {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 20px 20px;
  min-height: 0;
}

.ttc-target {
  position: absolute;
  top: 50%;
  /* Centered around its anchor point: translateX(-50%) horizontally + Y center */
  transform: translate(-50%, -50%) scale(0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease, filter 0.2s ease;
  z-index: 5;
  user-select: none;
}

/* Anchor each icon at the midpoint of the empty dark area beside the card.
   Card has max-width 420px → its edges are at calc(50% ± 210px).
   Midpoint of LEFT gap: (0 + (50% - 210px)) / 2 = 25% - 105px
   Midpoint of RIGHT gap: 50% + 210px + (50% - 210px)/2 = 75% + 105px */
.ttc-target-left {
  left: calc(25% - 105px);
  color: #ff304f;
}

.ttc-target-right {
  left: calc(75% + 105px);
  color: #1db954;
}

.ttc-target.is-visible {
  opacity: 0.7;
  filter: drop-shadow(0 0 14px currentColor);
}

.ttc-target.is-active {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1.18);
  filter: drop-shadow(0 0 24px currentColor);
}

/* On screens where the card stretches close to the edges, fall back to edges */
@media (max-width: 720px) {
  .ttc-target-left  { left: 30px; transform: translateY(-50%) scale(0.9); }
  .ttc-target-right { left: auto; right: 30px; transform: translateY(-50%) scale(0.9); }
  .ttc-target.is-active { transform: translateY(-50%) scale(1.18); }
}

@media (max-width: 480px) {
  .ttc-target svg { width: 44px; height: 44px; }
  .ttc-target-left  { left: 12px; }
  .ttc-target-right { left: auto; right: 12px; }
  .trainer-tinder-stage { padding: 0 14px 14px; }
}

/* trainer-tinder-body keeps the card centered inside the stage */
.trainer-tinder-stage .trainer-tinder-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

/* Collapsed timestamps: only the last message in a same-minute run keeps the time visible */
.message.time-hidden > .message-time,
.message.time-hidden .msg-bottom-row .message-time {
  display: none;
}
.message.time-hidden { margin-bottom: 2px; }

/* Mobile drawer without header block: occupy full height */
.mobile-drawer .side-panel-inner {
  height: 100dvh;
  padding-top: 20px;
}

/* History lazy-load: spinner shown at top of chat while older messages fetch */
.history-loader {
  display: flex;
  justify-content: center;
  padding: 8px 0 12px;
}
.history-loader-dots {
  display: inline-flex;
  gap: 5px;
}
.history-loader-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  opacity: 0.6;
  animation: history-loader-pulse 1.1s infinite ease-in-out;
}
.history-loader-dots span:nth-child(2) { animation-delay: 0.18s; }
.history-loader-dots span:nth-child(3) { animation-delay: 0.36s; }
@keyframes history-loader-pulse {
  0%, 80%, 100% { transform: scale(0.7); opacity: 0.3; }
  40% { transform: scale(1); opacity: 0.9; }
}


/* ════════════════════════════
   Campaign notices — chat-style cards
   ════════════════════════════ */

:root {
  --notice-accent: #d8dce8;
  --notice-action-text: #151723;
}

[data-theme="light"] {
  --notice-accent: #4b5563;
  --notice-action-text: #ffffff;
}

/* Пост в ленте: как обычное сообщение бота, фото сверху — текст снизу */
.notice-message {
  align-self: flex-start;
  width: 86%;
  max-width: 440px;
  margin: 2px 0;
}
.notice-message .message-time { display: block; }

.notice-bubble {
  box-sizing: border-box; width: 100%; overflow: hidden;
  padding: 12px 12px 12px 14px;
  background: linear-gradient(180deg, var(--bubble-bot-tint), transparent 60%), var(--bg-bubble-bot);
  border: 1px solid var(--border);
  border-left: 3px solid var(--notice-accent);
  border-radius: var(--radius-bubble) var(--radius-bubble) var(--radius-bubble) 6px;
  box-shadow: 0 10px 28px rgba(0,0,0,0.14);
  color: var(--text-primary);
  -webkit-text-fill-color: var(--text-primary);
}

.notice-content {
  display: block;
  min-width: 0;
  color: var(--text-primary);
  -webkit-text-fill-color: var(--text-primary);
}

/* фото сверху */
.notice-media {
  display: block; width: 100%; height: auto; max-height: 300px; object-fit: cover;
  border-radius: 12px; margin: 0 0 10px; background: rgba(127,127,127,.10);
}

/* label is rendered with CSS to avoid content blockers hiding text nodes. */
.notice-label {
  color: var(--notice-accent); font-size: 11px; font-weight: 800;
  -webkit-text-fill-color: var(--notice-accent);
  text-transform: uppercase; letter-spacing: 0; margin: 0 0 4px;
}
.notice-label::before { content: "Рек" "лама"; }

/* заголовок и текст снизу */
.notice-title { margin: 0 0 6px; font-size: 16px; line-height: 1.2; font-weight: 800; color: var(--text-primary); -webkit-text-fill-color: var(--text-primary); }
.notice-body { color: var(--text-primary); -webkit-text-fill-color: var(--text-primary); font-size: 15px; line-height: 1.45; overflow-wrap: anywhere; word-break: break-word; }
.notice-body p { margin: 0; }
.notice-body p + p { margin-top: .6em; }
.notice-body a { color: var(--link-color); -webkit-text-fill-color: var(--link-color); }

.notice-action-link {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; margin-top: 12px; min-height: 42px; padding: 0 16px;
  border-radius: 12px; text-decoration: none; text-transform: uppercase;
  background: var(--notice-accent); color: var(--notice-action-text);
  -webkit-text-fill-color: var(--notice-action-text) !important;
  font-weight: 800; font-size: 14px; letter-spacing: 0;
}
.notice-action-link:active { transform: translateY(1px); }

/* Sponsored block: ordinary left-side chat item, kept as the last DOM item. */
.notice-slot {
  flex-shrink: 0;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 8px;
  align-self: flex-start;
  width: 94%;
  max-width: 520px;
  margin: 2px 0;
  padding: 0;
  background: transparent;
}
.notice-slot[hidden] { display: none !important; }

.notice-card {
  position: relative; box-sizing: border-box;
  flex: 1 1 auto;
  width: 100%;
  max-width: none;
  min-width: 0;
  padding: 12px 12px 12px 14px;
  background: linear-gradient(180deg, var(--bubble-bot-tint), transparent 60%), var(--bg-bubble-bot);
  border: 1px solid var(--border);
  border-left: 3px solid var(--notice-accent);
  border-radius: var(--radius-bubble) var(--radius-bubble) var(--radius-bubble) 6px;
  box-shadow: 0 10px 28px rgba(0,0,0,0.14);
  color: var(--text-primary);
  -webkit-text-fill-color: var(--text-primary);
}
.notice-card .notice-media { max-height: 150px; margin: 0 0 8px; }
.notice-card .notice-action-link { margin-top: 10px; min-height: 40px; }
.notice-card .notice-label { color: var(--notice-accent); -webkit-text-fill-color: var(--notice-accent) !important; }
.notice-card .notice-title,
.notice-card .notice-body,
.notice-card .notice-body p {
  color: var(--text-primary);
  -webkit-text-fill-color: var(--text-primary) !important;
}
.notice-card .notice-body a {
  color: var(--link-color);
  -webkit-text-fill-color: var(--link-color) !important;
}

.notice-close {
  flex: 0 0 30px; width: 30px; height: 30px; margin-top: 2px;
  border: 1px solid var(--border); border-radius: 50%;
  background: var(--bg-surface); color: var(--text-muted);
  font-size: 19px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.notice-close:hover { color: var(--text-primary); }

@media (max-width: 640px) {
  .notice-bubble, .notice-card { border-radius: 16px 16px 16px 5px; }
  .notice-slot { width: 100%; max-width: 100%; }
  .notice-media { max-height: 260px; }
  .notice-content,
  .notice-card {
    min-width: 0;
  }
}
