/* ===== STYLE-V2: Chat-First Mobile-First ===== */
/* Версия: v1 */
/* Базовые стили = мобайл (375px) */
/* @media (min-width: 768px) = планшет */
/* @media (min-width: 1024px) = desktop */

/* ===== CSS VARIABLES ===== */

:root {
  /* Layout */
  --app-height: 100dvh;
  --input-bar-height: 56px;
  --quick-actions-height: auto;
  --swipe-dots-height: 32px;
  --sheet-peek-h: 56px;

  /* Nebula — звёзды и синеватый glow для бодиграфа */
  --nebula-star:   #EDEDE8;
  --nebula-glow:   rgba(91, 163, 190, 0.22);
  --nebula-accent: rgba(167, 139, 200, 0.15);

  /* Colors: Dark theme (default) — Original */
  --bg-body: #030712;
  /* --bg-header removed (no header) */
  --bg-input-bar: rgba(3, 7, 18, 0.95);
  --bg-card: rgba(255, 255, 255, 0.05);
  --bg-card-hover: rgba(255, 255, 255, 0.08);
  --bg-input: rgba(255, 255, 255, 0.08);
  --bg-message-user: #EDEDE8;
  --ink-message-user: #0B0E14;
  --bg-message-ai: rgba(255, 255, 255, 0.05);
  --ink-message-ai: var(--text-primary);
  --border-message-ai: rgba(255, 255, 255, 0.08);
  --bg-form-card: rgba(255, 255, 255, 0.06);

  /* Borders */
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-input: rgba(255, 255, 255, 0.12);
  --border-card: rgba(255, 255, 255, 0.1);
  --border-form: rgba(147, 51, 234, 0.2);

  /* Text */
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-dim: #6b7280;
  --text-muted: #4b5563;
  --text-heading: #e5e7eb;

  /* Accent */
  --accent: #EDEDE8;
  --accent-ink: #0B0E14;
  --accent-hover: #FFFFFF;
  --accent-light: rgba(237, 237, 232, 0.12);
  --accent-glow: rgba(237, 237, 232, 0.28);

  /* PRO accent */
  --pro-accent: #A78BFA;
  --pro-accent-ink: #1a0b3d;

  /* Signal / focus */
  --signal: #C44D4D;
  --focus-ring: #B8C4D3;

  /* Semantic */
  --color-success: #22c55e;
  --color-danger: #ef4444;
  --color-warning: #f59e0b;

  /* Shadows */
  /* --shadow-header removed (no header) */
  --shadow-input-bar: 0 -1px 0 rgba(255, 255, 255, 0.05);
  --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-glow: 0 0 20px rgba(147, 51, 234, 0.15);

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-base: 0.3s ease;
  --transition-slow: 0.5s ease;
  --transition-blur: 1.5s ease;

  /* Modals (dark theme) */
  --modal-bg: #1e1e2e;
  --modal-text: #e5e7eb;
  --modal-text-secondary: #9ca3af;
  --modal-text-dim: #6b7280;
  --modal-text-muted: #4b5563;
  --modal-input-bg: rgba(255, 255, 255, 0.06);
  --modal-input-border: rgba(255, 255, 255, 0.12);
  --modal-border-divider: rgba(255, 255, 255, 0.08);
  --modal-accent: #9333ea;
  --modal-shadow: rgba(0, 0, 0, 0.5);

  /* Bodygraph */
  --gate-personality: #39ff94;
  --gate-design: #f97316;

  /* Buttons */
  --btn-text: var(--accent-ink);

  /* Popup / Toast */
  --bg-popup: rgba(20, 20, 35, 0.95);
  --bg-toast: rgba(0, 0, 0, 0.8);

  /* Glassmorphism (dark) — единые токены для стеклянных поверхностей */
  --glass-bg-sidebar: rgba(15, 20, 33, 0.7);    /* сайдбар */
  --glass-bg-sheet:   rgba(15, 20, 33, 0.85);   /* mobile sheet-chat */
  --glass-bg-modal:   rgba(20, 25, 38, 0.85);   /* модалка, confirm-popup */
  --glass-bg-popup:   rgba(20, 25, 38, 0.92);   /* мелкие поверх-плашки (bodygraph-popup) */
  --glass-bg-fab:     rgba(15, 20, 30, 0.7);    /* fab-кнопки */
  --glass-border:     rgba(255, 255, 255, 0.08); /* border мягкий */
  --glass-border-strong: rgba(255, 255, 255, 0.12); /* border заметный (confirm, fabs) */
  --glass-border-accent: rgba(255, 255, 255, 0.14); /* border с контрастом (popup) */
  --blur-sm: blur(10px);
  --blur-md: blur(20px);
  --blur-lg: blur(24px);
  --blur-xl: blur(30px);
  --blur-xxl: blur(32px);
}

/* ===== LIGHT THEME — Black + Moon White ===== */
[data-theme="light"] {
  --bg-body: #eee9f0;
  --bg-input-bar: rgba(238, 233, 240, 0.9);
  --bg-card: rgba(255, 255, 255, 0.55);
  --bg-card-hover: rgba(255, 255, 255, 0.7);
  --bg-input: rgba(255, 255, 255, 0.6);
  --bg-message-user: rgba(0, 0, 0, 0.06);
  --bg-message-ai: rgba(255, 255, 255, 0.6);
  --bg-form-card: rgba(255, 255, 255, 0.3);

  --border-subtle: rgba(0, 0, 0, 0.06);
  --border-input: rgba(0, 0, 0, 0.1);
  --border-card: rgba(0, 0, 0, 0.06);
  --border-form: rgba(0, 0, 0, 0.15);

  --text-primary: #1a1a2e;
  --text-secondary: #3d3d5c;
  --text-dim: #5a5a7a;
  --text-muted: #8888a8;
  --text-heading: #1a1a2e;

  --accent: #1a1a2e;
  --accent-ink: #ffffff;
  --accent-hover: #0f0f1a;
  --accent-light: rgba(26, 26, 46, 0.06);
  --accent-glow: rgba(26, 26, 46, 0.15);

  --pro-accent: #7c3aed;
  --pro-accent-ink: #ffffff;

  --signal: #B91C1C;
  --focus-ring: #1a1a2e;

  --color-success: #16a34a;
  --color-danger: #1a1a2e;
  --color-warning: #d97706;

  --shadow-input-bar: 0 -1px 0 rgba(0, 0, 0, 0.04);
  --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.04);
  --shadow-glow: 0 0 20px rgba(0, 0, 0, 0.06);

  --modal-bg: rgba(250, 248, 253, 0.95);
  --modal-text: #1a1a2e;
  --modal-text-secondary: #3d3d5c;
  --modal-text-dim: #5a5a7a;
  --modal-text-muted: #8888a8;
  --modal-input-bg: rgba(255, 255, 255, 0.7);
  --modal-input-border: rgba(0, 0, 0, 0.1);
  --modal-border-divider: rgba(0, 0, 0, 0.06);
  --modal-accent: #1a1a2e;
  --modal-shadow: rgba(0, 0, 0, 0.08);

  --gate-personality: #1a1a2e;
  --gate-design: #dc2626;

  --btn-text: #ffffff;

  --bg-popup: rgba(230, 226, 238, 0.92);
  --bg-toast: rgba(230, 226, 238, 0.9);
}

/* Light overrides for hardcoded colors */
[data-theme="light"] .chat-chip-paid {
  border-color: #b45309;
  background: linear-gradient(135deg, rgba(245,158,11,0.12), rgba(180,83,9,0.12));
  color: #1a1a1a;
  font-weight: 600;
}
[data-theme="light"] .chat-chip-paid:active {
  background: #b45309;
  color: #fff;
  border-color: #b45309;
}
[data-theme="light"] .info-chip-defined {
  border-color: rgba(26, 26, 46, 0.25);
  background: rgba(26, 26, 46, 0.1);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #2d2d44;
  box-shadow: 0 2px 8px rgba(26, 26, 46, 0.08);
}
[data-theme="light"] .info-chip-defined:active {
  background: rgba(26, 26, 46, 0.75);
  color: #fff;
  border-color: rgba(26, 26, 46, 0.5);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
[data-theme="light"] .info-chip-open {
  border-color: rgba(26, 26, 46, 0.35);
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #4a4a6a;
  box-shadow: 0 2px 8px rgba(26, 26, 46, 0.06);
}
[data-theme="light"] .info-link {
  text-decoration-color: rgba(0,0,0,0.15);
}
[data-theme="light"] .info-chip-channel {
  border-color: rgba(26, 26, 46, 0.35);
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #1a1a2e;
  box-shadow: 0 2px 8px rgba(26, 26, 46, 0.06);
}
[data-theme="light"] .info-chip-trauma {
  border-color: rgba(244, 63, 94, 0.3);
  background: rgba(244, 63, 94, 0.08);
  color: #9f1239;
}
[data-theme="light"] .info-chip-trauma:active {
  background: rgba(244, 63, 94, 0.2);
  color: #fff;
}
/* Light: personality gates — dark */
[data-theme="light"] .info-chip-gate.gate-personality {
  border-color: rgba(26, 26, 46, 0.25);
  background: rgba(26, 26, 46, 0.08);
  color: #1a1a2e;
}
[data-theme="light"] .info-chip-gate.gate-personality:active {
  background: rgba(26, 26, 46, 0.7);
  color: #fff;
}
/* Light: design gates — red */
[data-theme="light"] .info-chip-gate.gate-design {
  border-color: rgba(220, 38, 38, 0.3);
  background: rgba(220, 38, 38, 0.08);
  color: #dc2626;
}
[data-theme="light"] .info-chip-gate.gate-design:active {
  background: #dc2626;
  color: #fff;
  border-color: #dc2626;
}
/* Light: both — split background (dark | red) */
[data-theme="light"] .info-chip-gate.gate-both {
  background: linear-gradient(
    90deg,
    rgba(26, 26, 46, 0.1) 0%,
    rgba(26, 26, 46, 0.1) 50%,
    rgba(220, 38, 38, 0.1) 50%,
    rgba(220, 38, 38, 0.1) 100%
  );
  border: 1px solid rgba(220, 38, 38, 0.3);
  color: #1a1a2e;
}
[data-theme="light"] .info-chip-gate.gate-both:active {
  background: rgba(26, 26, 46, 0.7);
  color: #fff;
  border-color: rgba(26, 26, 46, 0.8);
}

/* Light theme: Variables cards */
[data-theme="light"] .info-var-card {
  background: rgba(255, 255, 255, 0.55);
  border-color: rgba(26, 26, 46, 0.35);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 2px 8px rgba(26, 26, 46, 0.06);
}
[data-theme="light"] .info-var-arrow.var-left {
  background: rgba(59, 130, 246, 0.1);
  color: #2563eb;
}
[data-theme="light"] .info-var-arrow.var-right {
  background: rgba(249, 115, 22, 0.1);
  color: #ea580c;
}
[data-theme="light"] .info-var-ask {
  background: rgba(26, 26, 46, 0.06);
}
[data-theme="light"] .info-var-ask:active {
  background: rgba(26, 26, 46, 0.75);
  color: #fff;
}

/* Light theme: Gene Keys cards */
[data-theme="light"] .info-gk-card {
  background: rgba(255, 255, 255, 0.55);
  border-color: rgba(26, 26, 46, 0.35);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 2px 8px rgba(26, 26, 46, 0.06);
}
[data-theme="light"] .info-gk-card:active {
  background: rgba(26, 26, 46, 0.08);
  border-color: var(--accent);
}
[data-theme="light"] .info-gk-gate {
  background: rgba(147, 51, 234, 0.1);
}


/* neutrino pattern removed */

/* ===== RESET & BASE ===== */

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

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-x: none;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text-primary);
  background-color: var(--bg-body);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-x: none;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

input {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  outline: none;
}

a {
  color: var(--accent);
  text-decoration: none;
}

/* Global focus ring (keyboard a11y) */
input:focus,
button:focus-visible,
[role="button"]:focus-visible,
a:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}
input:focus:not(:focus-visible),
button:focus:not(:focus-visible) {
  outline: none;
}

/* Form errors */
.error-text,
.input-error {
  color: var(--signal);
  font-size: 12px;
  line-height: 1.4;
}

.hidden {
  display: none !important;
}

/* ===== APP SHELL ===== */

#app {
  display: flex;
  flex-direction: column;
  height: var(--app-height);
  overflow: hidden;
  position: relative;
}

/* ===== FLOATING SIDEBAR BUTTON (DeepSeek style) ===== */

.fab-sidebar {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: background var(--transition-fast), opacity var(--transition-fast);
  cursor: pointer;
}

.fab-sidebar:active {
  background: var(--bg-card-hover);
}

/* Hide FAB when sidebar is open */
.fab-sidebar.hidden-by-sidebar {
  opacity: 0;
  pointer-events: none;
}

/* ===== LOGIN FAB (top-right) ===== */

.fab-login {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 1200;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 12px;
  background: var(--accent);
  color: var(--btn-text);
  font-size: 13px;
  font-weight: 600;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: background var(--transition-fast), opacity var(--transition-fast);
  cursor: pointer;
}

.fab-login:active {
  background: var(--accent-hover);
}

.fab-login.hidden {
  display: none !important;
}

/* Top gradient fade for chat panel — hides text under burger/login */
.chat-top-fade {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 72px;
  background: linear-gradient(to bottom, var(--bg-body) 60%, transparent);
  z-index: 45;
  pointer-events: none;
  transition: opacity 0.2s;
}
.chat-top-fade.hidden {
  opacity: 0;
}

/* Login button visible on all pages (hidden via .hidden class when logged in) */

/* ===== AUTH MODAL extras ===== */

.auth-error {
  padding: 8px 12px;
  margin-bottom: 12px;
  border-radius: 8px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--color-danger);
  font-size: 13px;
}

.auth-switch {
  text-align: center;
  margin-top: 16px;
  font-size: 13px;
  color: var(--modal-text-secondary);
}

.auth-oauth-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.oauth-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid var(--modal-border, rgba(255, 255, 255, 0.12));
  background: var(--modal-input-bg, rgba(255, 255, 255, 0.04));
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.oauth-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.25);
}

[data-theme="light"] .oauth-btn:hover {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.2);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px 0 14px;
  color: var(--modal-text-secondary);
  font-size: 12px;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--modal-border, rgba(255, 255, 255, 0.12));
}

/* ===== CHAT STYLES ===== */

/* Chat messages */
.chat-message {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  animation: msg-appear 0.2s ease;
}

@keyframes msg-appear {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.chat-message.user {
  align-self: flex-end;
  background: var(--bg-message-user);
  border: 1px solid rgba(57, 255, 148, 0.2);
  border-bottom-right-radius: 4px;
}

.chat-message.assistant {
  align-self: flex-start;
  background: var(--bg-message-ai);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom-left-radius: 4px;
}

.chat-copy-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--accent);
  opacity: 0.5;
  padding: 2px;
  line-height: 1;
  transition: opacity 0.2s;
  padding: 2px 4px;
  line-height: 1;
}
.chat-message.assistant:hover .chat-copy-btn,
.chat-copy-btn:active {
  opacity: 1;
}

/* ===== CHAT CHIPS (AI buttons) ===== */

.chat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

/* Stacked layout for AI-answer chips — full-width rows edge to edge,
   чтобы не висели обрывками справа. Confirm Yes/Нет и composite-picker
   используют базовый `.chat-chips` (pills), без модификатора. */
.chat-chips.chat-chips--stacked {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

.chat-chips.chat-chips--stacked .chat-chip {
  padding: 8px 14px;
  font-size: 13px;
  line-height: 1.3;
  border-radius: 14px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.chat-chip {
  padding: 6px 14px;
  border-radius: 16px;
  border: 1px solid var(--border-form);
  background: var(--accent-light);
  color: #e5e7eb;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: left;
}

.chat-chip:active {
  background: var(--accent);
  color: var(--btn-text);
  border-color: var(--accent);
}

/* Paid chip (deep analysis button) */
.chat-chip-paid {
  border-color: rgba(245, 158, 11, 0.4);
  background: rgba(245, 158, 11, 0.1);
  color: #fbbf24;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-align: left;
}

.chat-chip-paid:active {
  background: rgba(245, 158, 11, 0.3);
  border-color: #f59e0b;
  color: #fff;
}

.chip-cost {
  font-size: 12px;
  opacity: 0.85;
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

/* ===== COMPOSITE PICKER (inline in chat) ===== */

.composite-picker-card {
  border: 1px solid rgba(139, 92, 246, 0.3);
  background: rgba(139, 92, 246, 0.08);
  border-radius: 16px;
  padding: 14px;
}

.composite-picker-title {
  font-size: 14px;
  font-weight: 600;
  color: #e5e7eb;
  margin-bottom: 10px;
}

.composite-pick-new {
  margin-top: 8px;
  padding: 6px 14px;
  border-radius: 16px;
  border: 1px dashed rgba(139, 92, 246, 0.4);
  background: transparent;
  color: #a78bfa;
  font-size: 13px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.composite-pick-new:active {
  background: rgba(139, 92, 246, 0.2);
}
.composite-pick-back {
  display: block;
  margin-top: 10px;
  padding: 8px 0;
  background: none;
  border: none;
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s;
}
.composite-pick-back:hover {
  text-decoration: underline;
}

.composite-picker-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.composite-picker-form .form-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.composite-picker-form .form-field label {
  font-size: 12px;
  color: #fff;
  font-weight: 600;
}

.composite-picker-input {
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-form);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 14px;
}

.composite-picker-btn {
  padding: 10px 16px;
  border-radius: 12px;
  border: none;
  background: #111;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.composite-picker-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

[data-theme="light"] .composite-picker-title { color: #1f2937; }
[data-theme="light"] .composite-picker-card { background: rgba(139, 92, 246, 0.05); }

/* ===== FORM CARD (inside chat) ===== */

.form-card {
  background: var(--bg-form-card);
  border: 1px solid var(--border-form);
  border-radius: 16px;
  padding: 18px 14px;
}
/* Форма — это AI-сообщение в чате (align-self: flex-start от .assistant), но шире обычного:
   ~95% контейнера на мобиле, фикс. ширина на десктопе. width нужен, чтобы контент не сжимал
   карточку до своих размеров (как делает flex-start по умолчанию). */
.chat-message.form-card {
  width: 95%;
  max-width: 95%;
}

.form-card-title {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.form-field {
  margin-bottom: 14px;
}

.form-field:last-of-type {
  margin-bottom: 0;
}

.form-field label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-dim);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-field input {
  width: 100%;
  max-width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-input);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 16px;
  transition: border-color var(--transition-fast);
  -webkit-appearance: none;
  appearance: none;
}

.form-field input:focus {
  border-color: var(--focus-ring);
}

.form-field input::placeholder {
  color: var(--text-muted);
}

.form-field .form-hint {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.btn-calculate {
  display: block;
  width: 100%;
  padding: 12px;
  margin-top: 16px;
  border-radius: 12px;
  border: none;
  background: var(--accent);
  color: var(--btn-text);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition-fast), transform var(--transition-fast);
}

.btn-primary,
.auth-submit,
.send-btn {
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}

.btn-calculate:active {
  background: var(--accent-hover);
  transform: scale(0.98);
}

.btn-calculate:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

/* ===== SWIPE CONTAINER ===== */

#swipe-container {
  position: relative;
  overflow: hidden;
  flex: 1;
  overscroll-behavior-x: contain;
  touch-action: pan-y;
}

.swipe-panel {
  position: absolute;
  inset: 0;
  /* Компенсация fixed sheet-chat peek: бодиграф не прячется за инпутом */
  bottom: var(--sheet-peek-h);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  /* Transition управляется JS (snapTo) — здесь fallback */
  transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  will-change: transform;
  /* Неактивные панели скрыты — предотвращает «просвечивание» на iOS */
  visibility: hidden;
  touch-action: pan-y;
  overscroll-behavior: contain;
}

/* Default positions: graph = home (index 1) */
.swipe-panel[data-panel="cards"] { transform: translate3d(-100%, 0, 0); }
.swipe-panel[data-panel="graph"] { transform: translate3d(0, 0, 0); }
.swipe-panel[data-panel="info"]  { transform: translate3d(100%, 0, 0); }

/* Cards panel */
.swipe-panel[data-panel="cards"] {
  display: flex;
  flex-direction: column;
  padding: 0;
  background: var(--bg-body);
}

/* Active panel + соседние видимы для анимации свайпа */
.swipe-panel.active {
  z-index: 1;
  visibility: visible;
}
.swipe-panel.swipe-visible {
  visibility: visible;
}


.cards-panel-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  padding-top: calc(env(safe-area-inset-top, 0px) + 56px); /* space for FAB */
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.cards-panel-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  text-align: center;
}

.cards-panel-content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 8px 0;
}

/* Chart cards in swipe panel */
.chart-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 12px;
}

.chart-card {
  padding: 14px 16px;
  cursor: pointer;
  transition: background var(--transition-fast);
  position: relative;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

[data-theme="light"] .chart-card {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.chart-card-delete {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.4;
  transition: opacity 0.15s, background 0.15s, color 0.15s;
}
.chart-card-delete:hover {
  opacity: 1;
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}
.chart-card-delete:active {
  background: rgba(239, 68, 68, 0.3);
}

.chart-card:hover,
.chart-card:active {
  background: var(--bg-card-hover);
}

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

.chart-card-type {
  font-size: 13px;
  color: var(--accent);
  margin-bottom: 2px;
}

.chart-card-date {
  font-size: 12px;
  color: var(--text-dim);
}

/* Graph panel: bodygraph fullscreen */
.swipe-panel[data-panel="graph"] {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  background: var(--bg-body);
}

.swipe-panel[data-panel="info"] {
  background: var(--bg-body);
}

/* Graph header: name + type */
.graph-header {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 10px;
  padding: 36px 12px 6px;
  flex-shrink: 0;
  line-height: 1.2;
}

.graph-header-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.graph-header-type {
  font-size: 18px;
  font-weight: 500;
  color: var(--accent-hover);
  line-height: 1.2;
}

/* Graph toast (chart switch feedback) */
.graph-toast {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 16px;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  color: #fff;
  font-size: 13px;
  border-radius: 20px;
  z-index: 200;
  pointer-events: none;
  animation: toast-fade 1.5s ease-out forwards;
}
@keyframes toast-fade {
  0%, 60% { opacity: 1; }
  100% { opacity: 0; }
}

/* ===== CONFIRM POPUP ===== */
.confirm-overlay {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0);
  transition: background 0.2s ease;
}
.confirm-overlay.active {
  background: rgba(0, 0, 0, 0.5);
}
.confirm-box {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 20px 24px;
  max-width: 280px;
  width: 90%;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transform: scale(0.9);
  opacity: 0;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.confirm-overlay.active .confirm-box {
  transform: scale(1);
  opacity: 1;
}
.confirm-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.confirm-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 18px;
  line-height: 1.4;
}
.confirm-actions {
  display: flex; gap: 10px;
}
.confirm-btn {
  flex: 1;
  padding: 10px 0;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: background 0.15s ease;
}
.confirm-btn-cancel {
  background: var(--bg-input);
  color: var(--text-secondary);
}
.confirm-btn-cancel:active {
  background: var(--border-subtle);
}
.confirm-btn-ok {
  background: #1a1a2e;
  color: #fff;
}
.confirm-btn-ok:active {
  background: #1a1a2e;
}

/* SVG wrapper: fills remaining space */
.bodygraph-svg-wrap {
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: hidden;
}

/* Light theme: bodygraph SVG opaque background so glow doesn't bleed through */

.bodygraph-svg-wrap svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

.bodygraph-svg-wrap svg text,
.bodygraph-svg-wrap svg * {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

/* Side buttons on graph (Transit / Composite) */
.graph-side-btn {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 6px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: rgba(255, 255, 255, 0.85);
  font-size: 11px;
  font-weight: 500;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: all var(--transition-fast);
  z-index: 5;
  cursor: pointer;
  writing-mode: horizontal-tb;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.graph-side-btn:active {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

.graph-side-btn svg {
  flex-shrink: 0;
}

.graph-side-btn span {
  line-height: 1.2;
  text-align: center;
  max-width: 56px;
}

.graph-side-btn-left {
  left: 12px;
  top: 25%;
}

.graph-side-btn-right {
  right: 12px;
  top: 25%;
}

/* Chat mode banner (transit/composite indicator) */
.chat-mode-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  margin: -12px -16px 8px;
  background: var(--accent-light);
  border-bottom: 1px solid var(--border-form);
  flex-shrink: 0;
}

.chat-mode-banner-text {
  font-size: 13px;
  font-weight: 500;
  color: var(--accent-hover);
}

.chat-mode-banner-close {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: none;
  border: 1px solid var(--border-form);
  color: var(--accent-hover);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-mode-banner-close:active {
  background: var(--accent);
  color: var(--btn-text);
}

/* Graph mode reset button (exit transit/composite) */
.graph-mode-reset {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.graph-mode-reset:active {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

/* Composite partner picker (overlay on graph panel) */
.composite-picker {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px;
  background: var(--bg-popup, rgba(20, 20, 35, 0.95));
  border: 1px solid var(--border-form);
  border-radius: 16px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  z-index: 10;
  min-width: 200px;
  max-width: 280px;
  animation: popup-appear 0.2s ease-out;
}

.composite-picker-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-heading);
  text-align: center;
  margin-bottom: 4px;
}

/* duplicate .composite-picker-btn removed — defined above */

/* Hide legacy touch-preview from bodygraph.js (v2 uses its own popup) */
.touch-preview {
  display: none !important;
}

/* Popup on bodygraph element tap */
.bodygraph-popup {
  position: fixed;
  z-index: 100;
  left: 50%;
  bottom: 76px;
  transform: translateX(-50%);
  max-width: calc(100vw - 16px);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px 10px 16px;
  background: var(--bg-popup, rgba(20, 20, 35, 0.95));
  border: 1px solid var(--border-form);
  border-radius: 14px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  white-space: nowrap;
  animation: popup-appear 0.2s ease-out;
}

@keyframes popup-appear {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.bodygraph-popup-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

.bodygraph-popup-ask {
  padding: 4px 10px;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.bodygraph-popup-ask:active {
  background: var(--accent-hover);
}

/* Info panel */
.swipe-panel[data-panel="info"] {
  padding: 58px 0 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}




/* New chat button (fixed overlay, above input bar) */
.chat-new-btn {
  position: fixed;
  bottom: 120px;
  right: 12px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--text-secondary);
  color: var(--text-primary);
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 30;
  font-size: 22px;
  line-height: 1;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  transition: transform 0.15s, box-shadow 0.15s;
}
.chat-new-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}
.chat-new-btn:active {
  transform: scale(0.95);
}
/* Show in any active chat state */
.state-chatting .chat-new-btn,
.state-calculated .chat-new-btn,
.state-composite .chat-new-btn,
.state-transit .chat-new-btn {
  display: flex;
}

/* ===== SWIPE INDICATORS ===== */

/* Dots with labels */
.swipe-dots {
  display: none;
}

.swipe-dot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.swipe-dot-circle {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  transition: all 0.2s ease;
}

.swipe-dot.active .swipe-dot-circle {
  width: 8px;
  height: 8px;
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent-glow);
}

.swipe-dot-label {
  font-size: 9px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.3);
  transition: color 0.2s ease;
  user-select: none;
}

.swipe-dot.active .swipe-dot-label {
  color: var(--accent-hover);
}

.swipe-dot.disabled {
  opacity: 0.3;
  pointer-events: none;
}

/* Edge labels — hidden */
.swipe-edge-label { display: none; }

/* Edge glow (overscroll) */
.swipe-edge-glow {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 40px;
  pointer-events: none;
  z-index: 4;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.swipe-edge-glow-left {
  left: 0;
  background: linear-gradient(to right, var(--accent-glow), transparent);
}

.swipe-edge-glow-right {
  right: 0;
  background: linear-gradient(to left, var(--accent-glow), transparent);
}

.swipe-edge-glow.visible {
  opacity: 1;
}

/* ===== QUICK ACTIONS ===== */

#quick-actions {
  display: flex;
  gap: 8px;
  padding: 8px 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  flex-shrink: 0;
  z-index: 10;
}

#quick-actions::-webkit-scrollbar {
  display: none;
}

.quick-action-btn {
  flex-shrink: 0;
  padding: 8px 14px;
  border-radius: 20px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.quick-action-btn:active {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent-hover);
}

/* ===== INPUT BAR ===== */

.input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

#chat-input {
  flex: 1;
  padding: 10px 14px;
  border-radius: 22px;
  border: 1px solid var(--border-input);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 16px;
  transition: border-color var(--transition-fast);
}

#chat-input:focus {
  border-color: var(--focus-ring);
}

#chat-input::placeholder {
  color: var(--text-muted);
}

.input-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.input-btn-send {
  background: var(--accent);
  color: var(--btn-text);
  font-weight: 600;
}

/* Stop-режим: когда идёт отправка, кнопка превращается в «Остановить».
   SVG-«paper plane» скрываем, показываем квадратик. */
.input-btn-send.is-stop,
#sheet-chat-send.is-stop {
  background: var(--signal);
  color: #fff;
}
.input-btn-send.is-stop > *,
#sheet-chat-send.is-stop > * {
  opacity: 0;
}
.input-btn-send.is-stop::after,
#sheet-chat-send.is-stop::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 12px;
  height: 12px;
  border-radius: 2px;
  background: currentColor;
  transform: translate(-50%, -50%);
}
.input-btn-send,
#sheet-chat-send {
  position: relative;
}

.input-btn-send:active {
  background: var(--accent-hover);
  transform: scale(0.92);
}

/* voice btn removed */

/* Input hints (landing quick actions) */
.input-hints {
  display: none;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 0 0;
  justify-content: center;
}

.state-landing .input-hints {
  display: flex;
}

.landing-logo-sub {
  display: none;
  text-align: center;
  margin-top: -4px;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 4px;
  text-transform: lowercase;
  color: var(--text-secondary, rgba(107,114,128,0.8));
}
.state-landing .landing-logo-sub {
  display: block;
}

.input-hint {
  padding: 8px 16px;
  border-radius: 18px;
  border: 1px solid var(--border-form);
  background: rgba(255, 255, 255, 0.06);
  color: #e5e7eb;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
}

.input-hint:active {
  background: var(--accent-light);
  border-color: var(--accent);
  color: #e5e7eb;
}

/* Dark · landing dynamic hints — белая обводка, прозрачный фон */
[data-theme="dark"] .input-hint {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.5);
  color: #ffffff;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
[data-theme="dark"] .input-hint:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.8);
}
[data-theme="dark"] .input-hint:active {
  background: rgba(255, 255, 255, 0.12);
  border-color: #ffffff;
  color: #ffffff;
}

/* Акцентная кнопка-подсказка (главное действие) */
.input-hint--accent {
  border-color: var(--accent);
  background: var(--accent-light);
  color: #e5e7eb;
  font-weight: 600;
}
.input-hint--accent:active {
  background: rgba(147, 51, 234, 0.3);
}
[data-theme="light"] .input-hint--accent {
  background: rgba(26, 26, 46, 0.1);
}
[data-theme="light"] .input-hint--accent:active {
  background: rgba(26, 26, 46, 0.2);
}

/* ===== STATE CLASSES ===== */

/* Свайп всегда виден */
#swipe-container {
  display: flex;
  flex: 1;
}

/* --- LANDING: DeepSeek-style centered layout --- */

.landing-hero {
  display: none;
}

.state-landing .landing-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  padding: 20px 20px 24px;
  position: relative;
  z-index: 2;
}

.landing-hero-logo {
  color: var(--text-primary);
  margin-bottom: 4px;
}

.logo-rays {
  stroke: #EDEDE8;
  opacity: 0.85;
}

[data-theme="light"] .logo-rays {
  stroke: #dc2626;
  opacity: 1;
}

.landing-hero-title {
  font-size: 28px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.landing-hero-sub {
  font-size: 15px;
  color: var(--text-secondary);
  max-width: 280px;
}

/* Landing: entire app becomes centered flex */
.state-landing {
  justify-content: center;
  align-items: center;
}

.state-landing #swipe-container {
  flex: none;
  overflow: visible;
}
.state-landing .swipe-panel {
  bottom: 0;
}

/* --- CALCULATING --- */
.state-calculating .landing-input-bar { opacity: 0.3; pointer-events: none; }

/* ===== CALCULATING SPINNER ===== */

.calculating-spinner {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 40px 20px;
}

.calculating-spinner::before {
  content: '';
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-subtle);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.calculating-spinner-text {
  font-size: 14px;
  color: var(--text-secondary);
}

/* ===== TYPING INDICATOR ===== */

.typing-indicator {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 12px 16px;
  align-self: flex-start;
  background: var(--bg-message-ai);
  border-radius: 16px;
  border-bottom-left-radius: 4px;
}

.typing-indicator span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-dim);
  animation: typing-bounce 1.4s ease-in-out infinite;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30%           { transform: translateY(-4px); opacity: 1; }
}

/* ===== MODALS (shared pattern) ===== */

.ooc-overlay {
  position: fixed;
  inset: 0;
  z-index: 1300;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  padding: 16px;
}

/* Мобильная клавиатура открыта: прижимаем модалку к верху видимой области
   и ужимаем по высоте visualViewport, чтобы кнопки (OAuth, submit) не прятались. */
body.kb-open .ooc-overlay {
  align-items: flex-start;
  padding-top: 8px;
  padding-bottom: 8px;
  height: var(--vvh, 100vh);
}
body.kb-open .ooc-overlay .modal-container {
  max-height: calc(var(--vvh, 100vh) - 16px);
  padding: 16px 20px;
}
body.kb-open .ooc-overlay .modal-title {
  margin-bottom: 10px;
  font-size: 16px;
}

.modal-container {
  background: var(--modal-bg);
  color: var(--modal-text);
  border-radius: 16px;
  padding: 24px;
  width: 100%;
  max-width: 420px;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 8px 32px var(--modal-shadow);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  color: var(--modal-text-dim);
  font-size: 18px;
  transition: background var(--transition-fast);
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.08);
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--modal-text);
  margin-bottom: 16px;
}

.modal-icon {
  font-size: 32px;
  text-align: center;
  margin-bottom: 12px;
}

/* ===== MODAL CONTENT ===== */

.modal-body {
  font-size: 13px;
  color: var(--modal-text-secondary);
  line-height: 1.6;
  margin-bottom: 16px;
}

.modal-body p + p {
  margin-top: 8px;
}

.modal-body-scroll {
  font-size: 13px;
  color: var(--modal-text-secondary);
  line-height: 1.7;
  max-height: 65vh;
  overflow-y: auto;
}

.modal-body-scroll p + p {
  margin-top: 8px;
}

.modal-body-scroll p:first-child + p {
  margin-top: 12px;
}

.modal-container-tall {
  max-height: 85vh;
}

/* Просмотрщик юридических документов (privacy/disclaimer/oferta).
   iframe вытягивает полный текст с /privacy.html → пользователь видит
   «вордовский белый лист» с полной юридической формулировкой внутри модалки,
   а не короткую выжимку из i18n. docs.css внутри iframe уже стилизует документ. */
.policy-viewer-container {
  max-width: 760px;
  width: 94vw;
  padding: 18px 18px 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.policy-viewer-title {
  margin: 0 0 12px;
  flex-shrink: 0;
}
.policy-viewer-iframe {
  flex: 1;
  min-height: 60vh;
  width: 100%;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 10px;
  background: #fff;
}
@media (max-width: 720px) {
  .policy-viewer-container {
    max-width: 100%;
    padding: 14px 12px 12px;
    max-height: 92vh;
  }
  .policy-viewer-iframe {
    min-height: 70vh;
  }
}
[data-theme="dark"] .policy-viewer-iframe {
  border-color: rgba(255, 255, 255, 0.14);
}

.modal-container-center {
  text-align: center;
}

.modal-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 13px;
  color: var(--modal-text-secondary);
  cursor: pointer;
}

.modal-checkbox:last-of-type {
  margin-bottom: 16px;
}

.modal-checkbox input[type="checkbox"] {
  margin-top: 3px;
}

.modal-link {
  color: var(--text-secondary);
  text-decoration: underline;
  text-underline-offset: 2px;
  background: none;
  border: none;
  font: inherit;
  cursor: pointer;
  padding: 0;
}
.modal-link:hover { color: var(--text-primary); }

.modal-input,
.modal-select,
.modal-textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--modal-input-border);
  background: var(--modal-input-bg) !important;
  color: var(--modal-text) !important;
  font-size: 16px;
  -webkit-text-fill-color: var(--modal-text);
}

.modal-input::placeholder,
.modal-textarea::placeholder {
  color: var(--modal-text-muted);
  -webkit-text-fill-color: var(--modal-text-muted);
  opacity: 1;
  font-weight: 300;
  font-size: 14px;
}

.modal-input:focus,
.modal-select:focus,
.modal-textarea:focus {
  border-color: var(--modal-accent);
  outline: none;
}

/* Override browser autofill styles */
.modal-input:-webkit-autofill,
.modal-input:-webkit-autofill:hover,
.modal-input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 40px var(--modal-bg) inset;
  -webkit-text-fill-color: var(--modal-text);
  border-color: var(--modal-input-border);
}

.modal-textarea {
  resize: vertical;
  font-family: inherit;
}

.modal-text {
  font-size: 14px;
  color: var(--modal-text-secondary);
  margin-bottom: 20px;
}

.modal-btn-secondary {
  display: block;
  width: 100%;
  padding: 10px;
  color: var(--modal-text-muted);
  font-size: 14px;
}

.btn-calculate + .btn-calculate,
.btn-calculate + .modal-btn-secondary {
  margin-top: 10px;
}

/* Conversations panel (inside swipe) */
.cards-panel-inner {
  padding: 16px;
  overflow-y: auto;
  height: 100%;
  background: var(--bg-body);
}

.cards-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-heading);
  margin-bottom: 12px;
}

.conv-new-btn {
  width: 100%;
  padding: 12px 16px;
  margin-bottom: 16px;
  border: 1px solid var(--border-form);
  border-radius: 12px;
  background: var(--accent-light);
  color: #e5e7eb;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.conv-new-btn:active {
  background: var(--bg-card);
}

[data-theme="light"] .conv-new-btn {
  border-color: rgba(220, 38, 38, 0.35);
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #1a1a1a;
}
[data-theme="light"] .conv-new-btn:active {
  background: rgba(220, 38, 38, 0.08);
  border-color: rgba(220, 38, 38, 0.5);
}

.conv-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.conv-section-header {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 14px 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-top: 8px;
}

.conv-section-count {
  font-size: 10px;
  font-weight: 400;
  color: var(--text-muted);
  opacity: 0.6;
  margin-left: 6px;
  text-transform: none;
}

.conv-section-add {
  margin-left: auto;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--border-form);
  background: transparent;
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.conv-section-add:active {
  background: var(--accent);
  color: var(--btn-text);
  border-color: var(--accent);
}

.conv-section-header:first-child {
  margin-top: 0;
}

.conv-item {
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.12);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.conv-item-inner {
  padding: 12px 14px;
  transition: background 0.15s;
}
.conv-item:active .conv-item-inner {
  background: var(--bg-card-hover);
}
.conv-item-delete-bg {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 0;
  overflow: hidden;
  display: none;
  align-items: center;
  justify-content: center;
  background: #ef4444;
  color: white;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  border-radius: 0 10px 10px 0;
}
.conv-item-delete-bg.animating {
  transition: width 0.25s ease-out;
}

/* Desktop delete button (cross) — only on devices with real hover (not touch) */
.conv-item-delete-x {
  display: none;
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
  z-index: 2;
}
@media (hover: hover) and (pointer: fine) {
  .conv-item:hover .conv-item-delete-x {
    display: flex;
  }
  .conv-item-delete-x:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
  }
}

.conv-item-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conv-item-meta {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-dim);
}

.conv-item--composite .conv-item-inner {
  border-left: 3px solid #16a34a;
  padding-left: 9px;
}
.conv-item--composite .conv-item-meta {
  color: #16a34a;
}

.cards-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-secondary);
  font-size: 14px;
}

.cards-empty p + p {
  margin-top: 8px;
  color: var(--text-dim);
  font-size: 13px;
}

/* Swipe panel placeholders */
.panel-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 200px;
  color: var(--text-secondary);
  font-size: 14px;
  text-align: center;
  padding: 20px;
  gap: 8px;
}

.placeholder-icon {
  font-size: 48px;
  color: var(--accent);
  opacity: 0.6;
}

.placeholder-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.placeholder-subtitle {
  font-size: 14px;
  color: var(--accent-hover);
}

.placeholder-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 8px;
}

/* ===== Swipe hint arrows (subtle, thin) ===== */
.swipe-hint-arrow {
  position: absolute;
  z-index: 20;
  pointer-events: none;
  color: rgba(255, 255, 255, 0.85);
  font-size: 90px;
  font-weight: 100;
  line-height: 1;
  transition: opacity 0.6s ease;
  -webkit-text-stroke: 0;
}

[data-theme="light"] .swipe-hint-arrow {
  color: rgba(0, 0, 0, 0.4);
}

[data-theme="light"] .swipe-panel[data-panel="graph"] {
  background:
    radial-gradient(ellipse 220% 120% at 50% 15%, rgba(135, 180, 230, 0.55) 0%, transparent 70%),
    linear-gradient(to top, rgba(185, 180, 195, 0.6) 0%, transparent 60%),
    #f0f0f5;
}

[data-theme="light"] .graph-side-btn {
  border-color: #1a1a2e;
  color: #1a1a2e;
  background: rgba(255, 255, 255, 0.9);
}
[data-theme="light"] .graph-side-btn:active {
  background: rgba(26, 26, 46, 0.08);
  color: #2d2d44;
}

.swipe-hint-arrow.fade-out {
  opacity: 0 !important;
}

/* Left/right on chat */
.swipe-hint-arrow-left {
  left: 1px;
  top: 50%;
  animation: arrowLeft 1.5s ease-in-out 2;
}

.swipe-hint-arrow-right {
  right: 1px;
  top: 50%;
  animation: arrowRight 1.5s ease-in-out 2;
}

/* Подписи под стрелками свайпов: куда ведёт жест (карты/инфо).
   Позиционируем чуть ниже центра стрелки, стиль — как у tap-label. */
.swipe-hint-label {
  position: absolute;
  top: calc(50% + 55px);
  z-index: 20;
  pointer-events: none;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.85);
  text-transform: lowercase;
  transition: opacity 0.6s ease;
  animation: swipeLabelPulse 1.5s ease-in-out 2;
}
.swipe-hint-label.fade-out {
  opacity: 0 !important;
}
.swipe-hint-label-left  { left: 2px; }
.swipe-hint-label-right { right: 2px; }
[data-theme="light"] .swipe-hint-label {
  color: rgba(0, 0, 0, 0.75);
}
@keyframes swipeLabelPulse {
  0%, 100% { opacity: 0.5; }
  50%      { opacity: 1; }
}

@keyframes arrowLeft {
  0%, 100% { opacity: 0.3; transform: scale(0.6, 1.8) translateY(-28%); }
  50%      { opacity: 0.6; transform: scale(0.6, 1.8) translateY(-28%) translateX(-16px); }
}

@keyframes arrowRight {
  0%, 100% { opacity: 0.3; transform: scale(0.6, 1.8) translateY(-28%); }
  50%      { opacity: 0.6; transform: scale(0.6, 1.8) translateY(-28%) translateX(16px); }
}

/* Info panel tabs */
.info-tabs {
  display: flex;
  gap: 0;
  padding: 0 4px env(safe-area-inset-bottom, 8px);
  border-top: 1px solid var(--border-subtle);
  flex-shrink: 0;
  background: var(--bg-body);
  z-index: 2;
}

.info-tab {
  flex: 1 1 0;
  padding: 12px 4px;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  text-align: center;
  transition: color var(--transition-fast), border-color var(--transition-fast);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.info-tab.active {
  color: #ef4444;
  border-bottom-color: #ef4444;
}

/* Info pages (switchable) */
.info-page {
  display: none;
  padding: 6px 14px 8px;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.4;
  animation: infoPageIn 0.25s ease;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.info-page.active {
  display: flex;
  flex-direction: column;
}

/* Main info page */
.info-page[data-info-page="main"] {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Planets page: scrollable */
.info-page[data-info-page="planets"] {
  overflow-y: auto;
  padding-bottom: 80px;
}

/* Variables page: scrollable */
.info-page[data-info-page="variables"] {
  overflow-y: auto;
  padding-bottom: 80px;
}

/* Gene Keys page: scrollable */
.info-page[data-info-page="genekeys"] {
  overflow-y: auto;
  padding-bottom: 80px;
}

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

/* Arrow hint inside info page (relative position, not absolute) */
.info-hint-up {
  position: relative;
  left: auto;
  bottom: auto;
  align-self: center;
  margin-top: auto;
  flex-shrink: 0;
}

.panel-info {
  padding: 16px;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.6;
}

.panel-info h3,
.info-page h3 {
  color: var(--text-heading);
  margin-bottom: 6px;
  font-size: 15px;
}

.panel-info p + p,
.info-page p + p {
  margin-top: 2px;
}

/* Compact props list on info page */
.info-page .info-props-grid {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.info-page .info-props-grid p {
  font-size: 16px;
  line-height: 1.5;
  margin: 0;
  color: var(--text-primary);
}

.info-page .info-props-grid strong {
  color: var(--accent);
  font-weight: 500;
}

/* Info sections (centers, channels, gates, planets) */
.info-section {
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px solid var(--border-subtle);
}

.info-section h4 {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--accent);
  margin-bottom: 4px;
}

.info-heading-open {
  color: var(--text-muted) !important;
}

.info-heading-channels {
  color: var(--text-primary) !important;
}

.info-heading-trauma {
  color: #fda4af !important;
}
[data-theme="light"] .info-heading-trauma {
  color: #e11d48 !important;
}

/* Clickable links in info panel */
.info-link {
  color: var(--text-primary);
  cursor: pointer;
  transition: color var(--transition-fast);
  text-decoration: underline;
  text-decoration-color: rgba(255,255,255,0.2);
  text-underline-offset: 2px;
}

.info-link:active {
  color: var(--accent);
}

/* Chip grid for centers, channels, gates.
   Grid с auto-fill — чипы равномерно растягиваются на всю ширину от левого
   края до правого, без рваных обрывков справа. minmax для разных типов
   переопределён через :has() ниже (центры шире, ворота уже, травма — full). */
.info-chips {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px;
  padding-bottom: 4px;
}

/* Ворота — короткие (1-2 цифры), плотнее сетка */
.info-chips:has(.info-chip-gate) {
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
}

/* Каналы — формат "N-M", средняя плотность */
.info-chips:has(.info-chip-channel) {
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
}

/* Генетическая рана — длинный текст «Линия N: Тень → Дар», одна колонка
   на всю ширину, текст слева, увеличенный паддинг. */
.info-chips:has(.info-chip-trauma) {
  grid-template-columns: 1fr;
  gap: 6px;
}

.info-chip {
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid var(--border-form);
  background: var(--accent-light);
  color: var(--accent-hover);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: all var(--transition-fast);
  white-space: normal;
  word-break: break-word;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1.25;
}

/* Травма — длинный текст, выровнять слева, увеличить паддинг */
.info-chip.info-chip-trauma {
  justify-content: flex-start;
  text-align: left;
  padding: 14px 18px;
}

.info-chip:active {
  background: var(--accent);
  color: var(--btn-text);
  border-color: var(--accent);
}

.info-chip-defined {
  border-color: rgba(147, 51, 234, 0.5);
  background: rgba(147, 51, 234, 0.22);
  color: #ffffff;
}

.info-chip-defined:active {
  background: #9333ea;
  color: #fff;
  border-color: #9333ea;
}

.info-chip-trauma {
  border-color: rgba(244, 63, 94, 0.45);
  background: rgba(244, 63, 94, 0.15);
  color: #fda4af;
}

.info-chip-trauma:active {
  background: rgba(244, 63, 94, 0.4);
  color: #fff;
  border-color: rgba(244, 63, 94, 0.7);
}

.info-chip-open {
  border-color: rgba(26, 26, 46, 0.4);
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
}

.info-chip-open:active {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.info-chip-channel {
  border-color: rgba(26, 26, 46, 0.4);
  background: rgba(255, 255, 255, 0.1);
  color: #e5e7eb;
}

.info-chip-channel:active {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.4);
}

/* Personality gates (conscious) — neon green in dark */
.info-chip-gate.gate-personality {
  border-color: rgba(57, 255, 148, 0.3);
  background: rgba(57, 255, 148, 0.1);
  color: #39ff94;
}
.info-chip-gate.gate-personality:active {
  background: rgba(57, 255, 148, 0.25);
  border-color: rgba(57, 255, 148, 0.5);
  color: #fff;
}

/* Design gates (unconscious) — orange in dark */
.info-chip-gate.gate-design {
  border-color: rgba(249, 115, 22, 0.4);
  background: rgba(249, 115, 22, 0.12);
  color: #f97316;
}
.info-chip-gate.gate-design:active {
  background: #f97316;
  color: #fff;
  border-color: #f97316;
}

/* Both — split background: левая половина personality, правая design */
.info-chip-gate.gate-both {
  background: linear-gradient(
    90deg,
    rgba(57, 255, 148, 0.14) 0%,
    rgba(57, 255, 148, 0.14) 50%,
    rgba(249, 115, 22, 0.14) 50%,
    rgba(249, 115, 22, 0.14) 100%
  );
  border: 1px solid rgba(249, 115, 22, 0.35);
  color: #f3f4f6;
}
.info-chip-gate.gate-both:active {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.4);
}

/* Planets table */
.info-planets {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.planet-row {
  display: grid;
  grid-template-columns: 120px 1fr 1fr;
  gap: 4px;
  padding: 5px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  align-items: center;
}

.planet-row:last-child {
  border-bottom: none;
}

.planet-header {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 6px;
}

.planet-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.planet-icon {
  font-size: 18px;
  opacity: 0.7;
  width: 22px;
  text-align: center;
  flex-shrink: 0;
}

.planet-col {
  font-size: 13px;
  color: var(--gate-personality);
  text-align: center;
}

.planet-design {
  color: var(--gate-design);
}

/* ===== VARIABLES CARDS ===== */

.info-var-card {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(26, 26, 46, 0.4);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 10px;
}

.info-var-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.info-var-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.info-var-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
}

.info-var-arrow {
  font-size: 22px;
  font-weight: 700;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  flex-shrink: 0;
}

.info-var-arrow.var-left {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
}

.info-var-arrow.var-right {
  background: rgba(249, 115, 22, 0.15);
  color: #fb923c;
}

.info-var-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.info-var-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--accent);
}

.info-var-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.info-var-cognition {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
  margin-top: 2px;
}

.info-var-cognition strong {
  color: var(--text-secondary);
}

.info-var-ask {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 8px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: rgba(147, 51, 234, 0.1);
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.info-var-ask:active {
  background: var(--accent);
  color: var(--accent-ink);
}

/* ===== GENE KEYS CARDS ===== */

.info-gk-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 10px;
  padding: 0 2px;
}

.info-gk-card {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(26, 26, 46, 0.4);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.info-gk-card:active {
  background: var(--accent-light);
  border-color: var(--accent);
}

.info-gk-header {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.info-gk-gate {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: rgba(147, 51, 234, 0.15);
  color: var(--accent);
  font-size: 18px;
  font-weight: 700;
  flex-shrink: 0;
}

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

.info-gk-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.info-gk-sublabel {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.info-gk-arrow {
  font-size: 20px;
  color: var(--text-muted);
  flex-shrink: 0;
  opacity: 0.5;
}

/* ===== ONBOARDING: Breathing bodygraph ===== */

@keyframes bg-breathe {
  0%, 100% { opacity: 0.12; }
  50%      { opacity: 0.18; }
}

.state-landing .layer-bg {
  animation: bg-breathe 4s ease-in-out infinite;
}

/* ===== UTILITY ===== */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* ===== TABLET (≥768px) ===== */

@media (min-width: 768px) {
  :root {
    --input-bar-height: 60px;
  }


  .chat-message {
    max-width: 70%;
  }

  .chat-message.form-card {
    width: 460px;
    max-width: 90%;
  }

}

/* Hide desktop-only elements on mobile (must be BEFORE desktop @media) */
.desktop-tabs,
.desktop-empty-graph {
  display: none;
}

/* ===== SIDEBAR (mobile + desktop) ===== */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1199;
}
.sidebar-backdrop.open {
  display: block;
}

.sidebar {
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  width: 280px;
  height: 100vh;
  height: 100dvh;
  max-width: 85vw;
  background: var(--bg-body);
  border-right: 1px solid var(--border-subtle);
  z-index: 1200;
  transform: translateX(-100%);
  transition: transform var(--transition-base);
}
.sidebar.open {
  transform: translateX(0);
}

/* Dark · glassmorphism сайдбар (зеркалит light) */
[data-theme="dark"] .sidebar {
  background: var(--glass-bg-sidebar);
  backdrop-filter: var(--blur-xxl);
  -webkit-backdrop-filter: var(--blur-xxl);
  border-right: 1px solid var(--glass-border);
  border-radius: 0 20px 20px 0;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.4);
}
[data-theme="dark"] .sidebar-footer {
  border-top-color: rgba(255, 255, 255, 0.06);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  flex-shrink: 0;
}

.sidebar-new-chat {
  color: var(--text-dim);
  padding: 6px;
  border-radius: 8px;
  cursor: pointer;
  transition: color var(--transition-fast), background var(--transition-fast);
}
.sidebar-new-chat:hover {
  color: var(--text-primary);
  background: var(--accent-light);
}

.sidebar-close {
  color: var(--text-dim);
  padding: 6px;
  border-radius: 8px;
  transition: color var(--transition-fast);
  cursor: pointer;
}
.sidebar-close:hover {
  color: var(--text-primary);
}

.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 0 12px 12px;
}

.sidebar-footer {
  border-top: 1px solid var(--border-subtle);
  padding: 12px;
  flex-shrink: 0;
}

.sidebar-user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 4px 8px;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.15s;
}
.sidebar-user-row:hover {
  background: rgba(255, 255, 255, 0.06);
}
[data-theme="light"] .sidebar-user-row:hover {
  background: rgba(0, 0, 0, 0.04);
}
.sidebar-user-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.sidebar-accordion-arrow {
  color: var(--text-secondary);
  transition: transform 0.25s ease;
  flex-shrink: 0;
}
.sidebar-footer.open .sidebar-accordion-arrow {
  transform: rotate(180deg);
}

/* Accordion menu */
.sidebar-accordion {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.25s ease;
  opacity: 0;
  padding-top: 0;
}
.sidebar-footer.open .sidebar-accordion {
  max-height: 300px;
  opacity: 1;
  padding-top: 8px;
}

.sidebar-user {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

/* ===== SIDEBAR PLAN BADGE (рядом с именем) ===== */
.sidebar-plan-badge {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .03em;
}

.sidebar-balance-btn {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.35);
  background: rgba(255,255,255,.12);
  color: #fff;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.sidebar-balance-btn:hover {
  background: rgba(255,255,255,.18);
  border-color: rgba(255,255,255,.45);
}

.sidebar-balance--pro {
  border-color: rgba(255,255,255,.3) !important;
  background: rgba(255,255,255,.1) !important;
  color: #fff !important;
}

.sidebar-balance--pro:hover {
  background: rgba(255,255,255,.15) !important;
}

[data-theme="light"] .sidebar-balance-btn {
  border-color: rgba(0,0,0,.25);
  background: rgba(0,0,0,.08);
  color: #111;
}
[data-theme="light"] .sidebar-balance-btn:hover {
  background: rgba(0,0,0,.12);
}
[data-theme="light"] .sidebar-balance--pro {
  border-color: rgba(0,0,0,.3) !important;
  background: rgba(0,0,0,.1) !important;
  color: #111 !important;
}


/* ===== COINS MODAL ===== */

.ooc-overlay .modal-container.coins-modal-container {
  text-align: center;
  padding: 20px 18px 16px;
  max-width: 380px;
  background:
    radial-gradient(ellipse 180% 100% at 50% 0%, rgba(135, 180, 230, 0.55) 0%, transparent 60%),
    linear-gradient(to bottom, rgba(135, 180, 230, 0.18) 0%, rgba(185, 180, 195, 0.35) 100%),
    #f4f4f7;
  color: #1a1a2e;
}

.ooc-overlay .modal-container.coins-modal-container .modal-title {
  margin-bottom: 6px;
  font-size: 17px;
}

.ooc-overlay .modal-container.coins-modal-container .modal-close {
  color: #1a1a2e;
}
.ooc-overlay .modal-container.coins-modal-container .modal-close:hover {
  background: rgba(0, 0, 0, 0.08);
}

.coins-balance-row {
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: 8px;
  margin: 0 0 14px;
}
.coins-balance-row__label {
  opacity: 0.65;
  font-size: 13px;
}
.coins-balance-row__value {
  font-size: 26px;
  font-weight: 800;
  color: #1a1a2e;
}

.coins-guest-block {
  text-align: left;
  padding: 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  margin-bottom: 14px;
}
.coins-guest-block__title {
  margin: 0 0 8px;
  font-weight: 600;
  font-size: 14px;
}
.coins-guest-block__list {
  margin: 0 0 12px;
  padding-left: 18px;
  line-height: 1.6;
  font-size: 13px;
}

.coins-packages {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
  /* Резервируем высоту ~3 пакетов, чтобы модалка не "отщёлкивала" после loadPackages() */
  min-height: 204px;
}

.coin-pack {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(220, 38, 38, 0.35);
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: #1a1a2e;
  transition: transform 0.1s, box-shadow 0.15s, border-color 0.15s;
}
.coin-pack:hover {
  border-color: rgba(220, 38, 38, 0.55);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}
.coin-pack:active {
  transform: scale(0.985);
}

.coin-pack__coins {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.1;
}
.coin-pack__coins-label {
  font-size: 12px;
  font-weight: 500;
  opacity: 0.6;
}
.coin-pack__per-coin {
  font-size: 11px;
  opacity: 0.55;
  margin-top: 2px;
}
.coin-pack__price-wrap {
  text-align: right;
}
.coin-pack__price {
  font-size: 17px;
  font-weight: 800;
  color: #1a1a2e;
}
.coin-pack__savings {
  font-size: 11px;
  color: #16a34a;
  font-weight: 700;
  margin-top: 2px;
}

.coins-referral {
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(0, 0, 0, 0.08);
  margin-bottom: 12px;
  text-align: left;
}
.coins-referral__title {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 600;
}
.coins-referral__row {
  display: flex;
  gap: 6px;
}
.coins-referral__input {
  flex: 1;
  font-size: 12px;
  padding: 6px 10px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 8px;
  background: #fff;
  color: #1a1a2e;
}
.coins-referral__copy {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: #fff;
  color: #1a1a2e;
  cursor: pointer;
}

.coins-packages__empty,
.coins-packages__loading {
  text-align: center;
  padding: 12px;
  font-size: 13px;
  opacity: 0.6;
}

.ooc-overlay .modal-container.coins-modal-container .btn-calculate {
  width: 100%;
  padding: 11px 16px;
  font-size: 14px;
}
.ooc-overlay .modal-container.coins-modal-container .modal-btn-secondary {
  width: 100%;
  padding: 10px 16px;
  font-size: 13px;
  background: transparent;
  color: #1a1a2e;
  border: 1px solid rgba(0, 0, 0, 0.15);
}
.ooc-overlay .modal-container.coins-modal-container .modal-btn-secondary:hover {
  background: rgba(0, 0, 0, 0.05);
}

/* Dark theme tweaks — чуть затемняем градиент и фон карточек */
[data-theme="dark"] .ooc-overlay .modal-container.coins-modal-container {
  background:
    radial-gradient(ellipse 180% 100% at 50% 0%, rgba(96, 140, 200, 0.35) 0%, transparent 60%),
    linear-gradient(to bottom, rgba(60, 70, 90, 0.9) 0%, rgba(35, 35, 45, 0.95) 100%),
    #1a1a2e;
  color: #e8e8ee;
}
[data-theme="dark"] .ooc-overlay .modal-container.coins-modal-container .modal-title,
[data-theme="dark"] .ooc-overlay .modal-container.coins-modal-container .modal-close,
[data-theme="dark"] .coins-balance-row__value,
[data-theme="dark"] .coin-pack,
[data-theme="dark"] .coin-pack__price,
[data-theme="dark"] .ooc-overlay .modal-container.coins-modal-container .modal-btn-secondary {
  color: #e8e8ee;
}
[data-theme="dark"] .coin-pack {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(248, 113, 113, 0.45);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}
[data-theme="dark"] .coin-pack:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(248, 113, 113, 0.7);
}
[data-theme="dark"] .coins-guest-block,
[data-theme="dark"] .coins-referral {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
}
[data-theme="dark"] .coins-referral__input {
  background: rgba(255, 255, 255, 0.05);
  color: #e8e8ee;
  border-color: rgba(255, 255, 255, 0.15);
}
[data-theme="dark"] .coins-referral__copy {
  background: rgba(255, 255, 255, 0.08);
  color: #e8e8ee;
  border-color: rgba(255, 255, 255, 0.15);
}
[data-theme="dark"] .ooc-overlay .modal-container.coins-modal-container .modal-btn-secondary {
  border-color: rgba(255, 255, 255, 0.18);
}
[data-theme="dark"] .ooc-overlay .modal-container.coins-modal-container .modal-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
}

/* ===== SUBSCRIPTION STATUS ===== */

.sub-status { text-align: center; }
.sub-status--active .sub-status__badge {
  display: inline-block;
  padding: 6px 16px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(168,85,247,.18), rgba(99,102,241,.18));
  color: #c084fc;
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 8px;
}
.sub-status__until { font-size: 13px; opacity: .7; margin-bottom: 12px; }
.sub-status__features { font-size: 13px; line-height: 1.8; opacity: .8; }
.sub-status__canceled { font-size: 12px; color: #f59e0b; margin-top: 8px; }
.sub-cancel-btn { margin-top: 8px; font-size: 12px; opacity: .6; }

.sub-promo { text-align: center; }
.sub-trial-info {
  font-size: 14px;
  margin-bottom: 14px;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(255,255,255,.08);
  color: #fff;
  font-weight: 500;
}
.sub-trial-info strong {
  font-size: 18px;
  font-weight: 700;
}
[data-theme="light"] .sub-trial-info {
  background: rgba(0,0,0,.05);
  color: #1a1a2e;
}
.sub-features { margin-bottom: 16px; text-align: left; }
.sub-feature {
  font-size: 13px;
  line-height: 1.6;
  padding: 4px 0;
  padding-left: 20px;
  position: relative;
}
.sub-feature::before {
  content: "—";
  position: absolute;
  left: 0;
  opacity: .4;
  font-weight: 400;
}
.sub-subscribe-btn {
  width: 100%;
  font-size: 15px;
  font-weight: 600;
  padding: 13px 24px;
  border-radius: 12px;
  background: #fff;
  color: #111;
  border: none;
  cursor: pointer;
  transition: opacity .15s;
}
[data-theme="light"] .sub-subscribe-btn {
  background: #1a1a2e;
  color: #fff;
}
.sub-subscribe-btn:hover { opacity: .9; }
.sub-subscribe-btn:disabled { opacity: .5; cursor: default; }

.sidebar-action-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  font-size: 14px;
  cursor: pointer;
  transition: background var(--transition-fast);
  margin-bottom: 6px;
}
.sidebar-action-btn:active {
  background: var(--bg-card-hover);
}

.sidebar-footer-item {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  box-sizing: border-box;
  text-align: left;
  padding: 10px 10px 10px 32px;
  font-size: 14px;
  color: var(--text-secondary);
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-footer-item > svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  margin: 0 !important;
  flex-shrink: 0;
}
.sidebar-footer-item:hover {
  color: var(--text-primary);
  background: var(--accent-light);
}
.sidebar-footer-danger {
  color: var(--color-danger);
  opacity: 0.8;
}
.sidebar-footer-danger:hover {
  opacity: 1;
  background: rgba(239, 68, 68, 0.08);
}

[data-theme="light"] .sidebar-footer-item {
  color: #374151;
}
[data-theme="light"] .sidebar-footer-item:hover {
  color: #1a1a1a;
  background: rgba(0, 0, 0, 0.04);
}
[data-theme="light"] .sidebar-balance {
  color: #b45309;
}

/* ===== LIGHT THEME: GLASSMORPHISM ===== */

/* Sidebar: frosted glass panel */
[data-theme="light"] .sidebar {
  background: rgba(230, 225, 235, 0.8);
  backdrop-filter: blur(32px);
  -webkit-backdrop-filter: blur(32px);
  border-right: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 0 20px 20px 0;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.06);
}
[data-theme="light"] .sidebar-footer {
  border-top-color: rgba(255, 255, 255, 0.25);
}
[data-theme="light"] .sidebar-action-btn {
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
[data-theme="light"] .sidebar-action-btn:active {
  background: rgba(255, 255, 255, 0.3);
}
[data-theme="light"] .sidebar-backdrop.open {
  background: rgba(0, 0, 0, 0.2);
}

/* FAB buttons: frosted glass */
[data-theme="light"] .fab-sidebar {
  background: rgba(245, 242, 250, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.45);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
}
[data-theme="light"] .fab-sidebar:active {
  background: rgba(240, 237, 248, 0.85);
}
[data-theme="light"] .fab-login {
  background: #1a1a2e;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 2px 14px rgba(26, 26, 46, 0.35);
}
[data-theme="light"] .fab-login:active {
  background: #0f0f1a;
}

/* Input bar: glass input + red glass send button */
[data-theme="light"] #chat-input {
  background: rgba(255, 255, 255, 0.55);
  border-color: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
[data-theme="light"] #chat-input:focus {
  background: rgba(255, 255, 255, 0.65);
  border-color: rgba(26, 26, 46, 0.3);
  box-shadow: 0 0 0 3px rgba(26, 26, 46, 0.06);
}
[data-theme="light"] .input-btn-send {
  background: #1a1a2e;
  box-shadow: 0 2px 12px rgba(26, 26, 46, 0.35);
}
[data-theme="light"] .input-btn-send:active {
  background: #0f0f1a;
}

/* Input hints: glass pills with ruby border */
[data-theme="light"] .input-hint {
  border-color: rgba(220, 38, 38, 0.35);
  background: rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #1a1a1a;
}
[data-theme="light"] .input-hint:active {
  background: rgba(220, 38, 38, 0.08);
  border-color: rgba(220, 38, 38, 0.5);
  color: #1a1a1a;
}

/* Quick action buttons: glass */
[data-theme="light"] .quick-action-btn {
  border-color: rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
[data-theme="light"] .quick-action-btn:active {
  background: rgba(26, 26, 46, 0.1);
  border-color: rgba(26, 26, 46, 0.25);
  color: #2d2d44;
}

/* Chat messages: glass cards */
[data-theme="light"] .chat-message.user {
  background: rgba(220, 38, 38, 0.1);
  border: 1px solid rgba(220, 38, 38, 0.15);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
[data-theme="light"] .chat-message.assistant {
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

/* Chat chips: glass pills */
[data-theme="light"] .chat-chip,
[data-theme="light"] .sheet-chat-body .chat-chip {
  border-color: rgba(220, 38, 38, 0.4);
  background: rgba(255, 255, 255, 0.25);
  color: #1a1a1a;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
[data-theme="light"] .chat-chip:active,
[data-theme="light"] .sheet-chat-body .chat-chip:active {
  background: rgba(220, 38, 38, 0.12);
  border-color: rgba(220, 38, 38, 0.6);
  color: #1a1a1a;
}
[data-theme="light"] .chat-chip-paid,
[data-theme="light"] .sheet-chat-body .chat-chip-paid {
  border-color: #b45309;
  color: #1a1a1a;
}

/* Landing overlay */
[data-theme="light"] .landing-overlay {
  background:
    radial-gradient(ellipse 220% 120% at 50% 10%, rgba(135, 180, 230, 0.55) 0%, transparent 65%),
    linear-gradient(to top, rgba(185, 180, 195, 0.6) 0%, transparent 45%),
    var(--bg-body);
}

/* Modals: frosted glass */
[data-theme="light"] .modal-container {
  background: rgba(225, 220, 235, 0.88);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
}

/* Sidebar chat items */
[data-theme="light"] .sidebar-chat-item.active {
  background: rgba(26, 26, 46, 0.08);
}
[data-theme="light"] .sidebar-footer-item {
  color: #2a2a44;
}
[data-theme="light"] .sidebar-footer-item:hover {
  background: rgba(255, 255, 255, 0.35);
}

/* Conv items (диалоги) — светлее и с тенью */
[data-theme="light"] .conv-item {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.07);
}
[data-theme="light"] .conv-item:active .conv-item-inner {
  background: rgba(255, 255, 255, 0.55);
}
[data-theme="light"] .conv-section-header {
  color: #3d3d5c;
}
[data-theme="light"] .sidebar-action-btn {
  background: rgba(255, 255, 255, 0.35);
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

/* ===== TRANSIT LABEL (надпись + кнопка закрытия над колёсиком) ===== */
.transit-label {
  position: absolute;
  left: 6px;
  top: calc(42% - 170px);
  z-index: 9;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 48px;
}
.transit-label-text {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-warning, #f59e0b);
  text-align: center;
  line-height: 1.2;
}
.transit-label-date {
  font-size: 10px;
  color: var(--text-secondary);
  text-align: center;
  line-height: 1.2;
}
.transit-label-close {
  margin-top: 4px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.12);
  color: #f87171;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: transit-close-pulse 2s ease-in-out infinite;
}
.transit-label-close:active {
  background: rgba(239, 68, 68, 0.3);
  transform: scale(0.9);
}
@keyframes transit-close-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  50% { box-shadow: 0 0 8px 3px rgba(239, 68, 68, 0.25); }
}

[data-theme="light"] .transit-label-close {
  border-color: rgba(220, 38, 38, 0.3);
  background: rgba(220, 38, 38, 0.08);
  color: #dc2626;
}

/* ===== COMPOSITE LABEL (аналог transit-label) ===== */
.composite-label {
  position: absolute;
  left: 6px;
  top: calc(42% - 170px);
  z-index: 9;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 56px;
}
.composite-label-text {
  font-size: 8px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--color-success, #22c55e);
  text-align: center;
  line-height: 1.2;
}
.composite-label-names {
  font-size: 9px;
  color: var(--text-secondary);
  text-align: center;
  line-height: 1.3;
  word-break: break-word;
}
.composite-label-close {
  margin-top: 4px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.12);
  color: #f87171;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: transit-close-pulse 2s ease-in-out infinite;
}
.composite-label-close:active {
  background: rgba(239, 68, 68, 0.3);
  transform: scale(0.9);
}
[data-theme="light"] .composite-label-close {
  border-color: rgba(220, 38, 38, 0.3);
  background: rgba(220, 38, 38, 0.08);
  color: #dc2626;
}

/* ===== COMPOSITE INFO (статистика + чипы каналов) ===== */
.composite-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 12px 0;
}
.composite-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 6px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
}
.composite-stat-num {
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
}
.composite-stat-label {
  font-size: 10px;
  color: var(--text-dim);
  text-align: center;
  margin-top: 4px;
  line-height: 1.2;
}
.composite-stat-em { border-color: rgba(168,85,247,0.3); }
.composite-stat-em .composite-stat-num { color: #a855f7; }
.composite-stat-dom { border-color: rgba(59,130,246,0.3); }
.composite-stat-dom .composite-stat-num { color: #3b82f6; }
.composite-stat-a { border-color: rgba(244,63,94,0.3); }
.composite-stat-a .composite-stat-num { color: #f43f5e; }
.composite-stat-b { border-color: rgba(34,197,94,0.3); }
.composite-stat-b .composite-stat-num { color: #22c55e; }
.composite-stat-both { border-color: rgba(245,158,11,0.3); }
.composite-stat-both .composite-stat-num { color: #f59e0b; }

.composite-total {
  text-align: center;
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 4px;
}
.composite-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  justify-content: center;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
}
.composite-legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-secondary);
}
.composite-legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}

.info-chip-composite-em {
  background: rgba(168,85,247,0.15);
  color: #c084fc;
  border: 1px solid rgba(168,85,247,0.3);
}
.info-chip-composite-dom {
  background: rgba(59,130,246,0.15);
  color: #60a5fa;
  border: 1px solid rgba(59,130,246,0.3);
}
.info-chip-composite-a {
  background: rgba(244,63,94,0.15);
  color: #fb7185;
  border: 1px solid rgba(244,63,94,0.3);
}
.info-chip-composite-b {
  background: rgba(34,197,94,0.15);
  color: #4ade80;
  border: 1px solid rgba(34,197,94,0.3);
}

[data-theme="light"] .info-chip-composite-em {
  background: rgba(168,85,247,0.1);
  color: #7c3aed;
}
[data-theme="light"] .info-chip-composite-dom {
  background: rgba(59,130,246,0.1);
  color: #2563eb;
}
[data-theme="light"] .info-chip-composite-a {
  background: rgba(244,63,94,0.1);
  color: #e11d48;
}
[data-theme="light"] .info-chip-composite-b {
  background: rgba(34,197,94,0.1);
  color: #16a34a;
}

/* ===== TRANSIT DATE WHEEL (вертикальное колёсико дат) ===== */
.transit-date-wheel {
  position: absolute;
  left: 6px;
  top: 42%;
  transform: translateY(-50%);
  height: 220px;
  width: 48px;
  z-index: 8;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* Fade-gradient сверху и снизу */
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 20%, black 80%, transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0%, black 20%, black 80%, transparent 100%);
}

.transit-wheel-list {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  overflow-y: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: y mandatory;
  padding: 40px 0;
}
.transit-wheel-list::-webkit-scrollbar { display: none; }

.transit-wheel-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 42px;
  min-height: 40px;
  padding: 4px 2px;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-dim);
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s ease;
  scroll-snap-align: center;
  position: relative;
  flex-shrink: 0;
}

.transit-wheel-item .tw-day {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.1;
}
.transit-wheel-item .tw-month {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.7;
}

.transit-wheel-item.today {
  border: 1px solid var(--accent);
}

.transit-wheel-item.active {
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  transform: scale(1.1);
  box-shadow: 0 2px 8px rgba(237, 237, 232, 0.25);
}
.transit-wheel-item.active .tw-month { opacity: 1; }

/* Точка-индикатор (новые каналы в этот день) */
.tw-dot {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--color-warning, #f59e0b);
}
.transit-wheel-item.active .tw-dot { background: #fff; }

[data-theme="light"] .transit-wheel-item {
  background: rgba(0, 0, 0, 0.04);
}
[data-theme="light"] .transit-wheel-item.active {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

/* ===== TRANSIT INFO PAGE ===== */
.transit-info-heading h3 {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}
.transit-info-date {
  font-size: 13px;
  color: var(--color-warning, #f59e0b);
  margin-top: 2px;
}

.transit-strategy-btn {
  width: 100%;
  padding: 12px 16px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  color: var(--accent-ink);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.transit-strategy-btn:active { opacity: 0.8; }
.transit-strategy-cost {
  font-size: 12px;
  opacity: 0.85;
  background: rgba(255,255,255,0.15);
  padding: 2px 8px;
  border-radius: 12px;
}

/* Транзитные чипы */
.info-chip-transit {
  background: rgba(2, 132, 199, 0.2) !important;
  color: #38bdf8 !important;
  border-color: rgba(56, 189, 248, 0.3) !important;
}
.info-chip-transit-bridged {
  background: rgba(2, 132, 199, 0.12) !important;
  color: #7dd3fc !important;
  border-color: rgba(125, 211, 252, 0.2) !important;
}
.info-chip-transit-gate {
  background: rgba(2, 132, 199, 0.15) !important;
  color: #38bdf8 !important;
}

[data-theme="light"] .info-chip-transit {
  background: rgba(2, 132, 199, 0.12) !important;
  color: #0369a1 !important;
  border-color: rgba(3, 105, 161, 0.25) !important;
}
[data-theme="light"] .info-chip-transit-bridged {
  background: rgba(2, 132, 199, 0.08) !important;
  color: #0284c7 !important;
}
[data-theme="light"] .info-chip-transit-gate {
  background: rgba(2, 132, 199, 0.1) !important;
  color: #0369a1 !important;
}

/* ===== TRANSIT EVENTS (лента) ===== */
.transit-events-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.transit-event-date {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  padding: 12px 0 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  margin-bottom: 2px;
}
.transit-event-date:first-child { padding-top: 0; }
.transit-event-item {
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
}
.transit-event-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.transit-event-text {
  font-size: 13px;
  color: var(--text-primary);
  flex: 1;
  min-width: 0;
}
.transit-event-ask {
  flex-shrink: 0;
  padding: 3px 10px;
  border: 1px solid rgba(147, 51, 234, 0.3);
  border-radius: 12px;
  background: rgba(147, 51, 234, 0.12);
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.transit-event-ask:active {
  background: rgba(147, 51, 234, 0.25);
  transform: scale(0.95);
}
.transit-event-effects {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}
.transit-fx-formed {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
}
.transit-fx-lost {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

[data-theme="light"] .transit-event-date {
  border-bottom-color: rgba(0, 0, 0, 0.08);
}
[data-theme="light"] .transit-event-item {
  background: #fff;
  border-color: rgba(0, 0, 0, 0.08);
}
[data-theme="light"] .transit-event-ask {
  background: rgba(147, 51, 234, 0.08);
  border-color: rgba(147, 51, 234, 0.2);
}
[data-theme="light"] .transit-fx-formed {
  background: rgba(34, 197, 94, 0.1);
  color: #16a34a;
}
[data-theme="light"] .transit-fx-lost {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
}

.info-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-dim);
  font-size: 14px;
}

/* ===== DESKTOP (≥1024px) ===== */

@media (min-width: 1024px) {

  /* --- Split layout: left = content, right = chat --- */
  #app {
    flex-direction: row;
  }

  /* Swipe container becomes the left column with tabs */
  #swipe-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    overflow: visible;
  }

  /* All panels: static, no transform, no absolute */
  .swipe-panel {
    position: static;
    transform: none !important;
    transition: none;
    will-change: auto;
    overflow-y: auto;
    bottom: 0; /* override mobile --sheet-peek-h */
    flex: 1;
    visibility: visible;
  }

  /* Default: only graph visible */
  .swipe-panel[data-panel="info"] { display: none; }
  .swipe-panel[data-panel="cards"] { display: none; }

  /* Show info, hide graph when info tab is active */
  #swipe-container.desktop-show-info .swipe-panel[data-panel="info"] {
    display: block;
    overflow-y: auto;
  }
  #swipe-container.desktop-show-info .swipe-panel[data-panel="graph"] {
    display: none;
  }
  /* Show cards, hide graph when cards tab is active */
  #swipe-container.desktop-show-cards .swipe-panel[data-panel="cards"] {
    display: flex;
  }
  #swipe-container.desktop-show-cards .swipe-panel[data-panel="graph"] {
    display: none;
  }

  /* Desktop tabs: top of left column (order -1 to be above panels) */
  .desktop-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
    order: -1;
  }

  .desktop-tab {
    flex: 1;
    padding: 10px;
    text-align: center;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-dim);
    border-bottom: 2px solid transparent;
    transition: all var(--transition-fast);
    cursor: pointer;
  }

  .desktop-tab:hover {
    color: var(--text-secondary);
  }

  .desktop-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
  }

  /* Hide mobile-only swipe elements */
  .swipe-dots,
  .swipe-edge-label,
  .swipe-edge-glow,
  .swipe-peek {
    display: none;
  }

  /* Empty graph placeholder: shown when no bodygraph rendered */
  .desktop-empty-graph {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 5;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: 16px;
    padding: 32px 40px;
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s;
  }
  .desktop-empty-graph:hover {
    transform: translate(-50%, -50%) scale(1.04);
    border-color: var(--accent);
  }
  .desktop-empty-graph-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--bg-body);
    border: 2px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: var(--text-muted);
    font-weight: 300;
  }
  .desktop-empty-graph-label {
    font-size: 0.85rem;
    color: var(--text-muted);
  }
  /* Show when swipe-container has .graph-empty */
  #swipe-container.graph-empty .desktop-empty-graph {
    display: flex;
  }

  /* Graph side buttons: absolute inside graph panel */
  .swipe-panel[data-panel="graph"] {
    position: relative;
  }
  .graph-side-btn {
    position: absolute;
    top: 50%;
    bottom: auto;
    z-index: 10;
  }
  .graph-side-btn-left {
    left: 4px;
  }
  .graph-side-btn-right {
    right: 4px;
  }

  /* Transit label: bigger on desktop */
  .transit-label {
    left: 12px;
    top: calc(55% - 210px);
    width: 54px;
  }
  .transit-label-text { font-size: 10px; }
  .transit-label-date { font-size: 11px; }
  .transit-label-close { width: 30px; height: 30px; }

  .composite-label {
    left: 12px;
    top: calc(55% - 210px);
    width: 62px;
  }
  .composite-label-text { font-size: 9px; }
  .composite-label-names { font-size: 10px; }
  .composite-label-close { width: 30px; height: 30px; }

  /* Transit date wheel: bigger on desktop */
  .transit-date-wheel {
    left: 12px;
    top: 55%;
    height: 280px;
    width: 54px;
  }

  /* Chat messages: wider on desktop */
  .chat-message {
    max-width: 80%;
  }

  .chat-message.form-card {
    width: 500px;
    max-width: 90%;
  }

  /* Bigger input on desktop */
  #chat-input {
    font-size: 15px;
    padding: 12px 16px;
  }

  /* Bodygraph popup: position relative to left column */
  .bodygraph-popup {
    left: 25%;
    bottom: 24px;
  }

  /* --- Sheet chat: static right column on desktop (50% width) --- */
  .sheet-chat {
    position: static !important;
    transform: none !important;
    width: 50%;
    min-width: 400px;
    max-width: none;
    height: auto !important;
    max-height: none !important;
    align-self: stretch;
    flex-shrink: 0;
    pointer-events: auto !important;
    border-radius: 0 !important;
    border-left: 1px solid var(--border-subtle);
    box-shadow: none !important;
    border-top: none !important;
    display: flex !important;
    flex-direction: column;
    backdrop-filter: none;
    background: var(--bg-body);
    transition: none !important;
    top: auto !important;
    bottom: auto !important;
    left: auto !important;
    right: auto !important;
    z-index: auto !important;
  }

  /* On desktop: always show all parts regardless of peek/open/expanded class */
  .sheet-chat .sheet-chat-handle { display: none; }
  .sheet-chat .sheet-chat-header {
    display: flex;
    border-bottom: 1px solid var(--border-subtle);
  }
  .sheet-chat .sheet-chat-body {
    display: flex;
    flex: 1;
    min-height: 0;
  }
  .sheet-chat .sheet-chat-input {
    padding: 12px 16px;
  }
  .sheet-chat .sheet-chat-collapse { display: none; }

  /* Override peek hiding on desktop */
  .sheet-chat.peek .sheet-chat-header,
  .sheet-chat.peek .sheet-chat-body {
    display: flex !important;
  }
  .sheet-chat.peek {
    height: auto !important;
    max-height: none !important;
  }

  /* No overlay on desktop */
  .sheet-chat-overlay { display: none !important; }

  /* Light theme desktop adjustments */
  [data-theme="light"] .sheet-chat {
    background: rgba(230, 225, 235, 0.8);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  /* Landing: hide chat column, full-width landing */
  .state-landing .sheet-chat { display: none !important; }
  .state-landing #swipe-container { display: none !important; }
  .state-landing .desktop-tabs { display: none !important; }
  .state-landing {
    flex-direction: column;
  }

  /* Prevent FOUC: hide app content until JS removes app-loading */
  .app-loading .sheet-chat { display: none !important; }
  .app-loading #swipe-container { display: none !important; }
  .app-loading .desktop-tabs { display: none !important; }

  /* Landing sidebar rules moved below .sidebar block */

  /* Landing overlay: full width on desktop */
  .landing-overlay {
    right: 0;
  }

  /* --- Sidebar: always visible on desktop (except landing) --- */
  .fab-sidebar { display: none !important; }
  .state-landing .fab-sidebar { display: flex !important; }
  .sidebar-backdrop { display: none !important; }

  body {
    display: flex;
    flex-direction: row;
    height: var(--app-height);
    overflow: hidden;
  }

  .sidebar {
    position: static;
    transform: none;
    width: 260px;
    min-width: 260px;
    max-width: 260px;
    height: 100%;
    z-index: auto;
    flex-shrink: 0;
    order: -1; /* sidebar before #app in visual order */
    border-right: 1px solid var(--border-subtle);
  }
  .sidebar-close { display: none; }

  /* Landing: sidebar reverts to fixed overlay mode */
  #app.state-landing ~ .sidebar {
    position: fixed;
    transform: translateX(-100%);
    z-index: 1200;
    height: 100vh;
    height: 100dvh;
    width: 280px;
    min-width: auto;
    max-width: 85vw;
    order: 0;
  }
  #app.state-landing ~ .sidebar.open {
    transform: translateX(0);
  }
  #app.state-landing ~ .sidebar .sidebar-close { display: block; }
  #app.state-landing ~ .sidebar-backdrop { display: none; }
  #app.state-landing ~ .sidebar-backdrop.open { display: block; }

  #app {
    flex: 1;
    min-width: 0;
    height: 100%;
  }

  /* Quick actions: no need to constrain */
  .state-calculated #quick-actions,
  .state-composite #quick-actions,
  .state-transit #quick-actions {
    justify-content: center;
  }

  /* Cards panel header: no need for safe-area padding on desktop */
  .cards-panel-header {
    padding-top: 14px;
  }

  /* Info panel: show all pages at once, hide tabs on desktop */
  .info-tabs {
    display: none !important;
  }
  .info-page {
    display: flex !important;
    flex-direction: column;
    animation: none;
    overflow-y: visible;
    flex: none;
  }
  .info-page[data-info-page="planets"],
  .info-page[data-info-page="variables"],
  .info-page[data-info-page="genekeys"] {
    padding-bottom: 8px;
  }
  /* Info panel itself: single scroll */
  .swipe-panel[data-panel="info"] {
    overflow-y: auto;
    padding-bottom: 24px;
  }

}

/* ===== REDUCED MOTION ===== */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ===== ELEMENT POPUP (desktop) ===== */
.element-popup {
  position: fixed;
  z-index: 1000;
  width: 276px;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 14px;
  padding: 14px 16px 16px;
  backdrop-filter: blur(24px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3), 0 0 0 1px var(--border-card);
  animation: ep-appear 0.14s ease;
  pointer-events: all;
}
@keyframes ep-appear {
  from { opacity: 0; transform: translateY(-6px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.ep-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.ep-title-group { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ep-type-tag { font-size: 0.58rem; font-weight: 700; letter-spacing: 0.1em; color: var(--accent); text-transform: uppercase; }
.ep-title { font-size: 0.98rem; font-weight: 600; color: var(--text-primary); line-height: 1.25; word-break: break-word; }
.ep-close { background: none; border: none; color: var(--text-muted); font-size: 1rem; line-height: 1; cursor: pointer; padding: 2px 4px; border-radius: 4px; flex-shrink: 0; }
.ep-close:hover { color: var(--text-primary); }

.ep-status { display: inline-flex; align-items: center; gap: 4px; font-size: 0.7rem; font-weight: 500; padding: 3px 9px; border-radius: 20px; margin-bottom: 10px; }
.ep-status-defined     { background: rgba(124,58,237,0.12); color: #a78bfa; border: 1px solid rgba(124,58,237,0.25); }
.ep-status-open        { background: rgba(107,114,128,0.12); color: var(--text-muted); border: 1px solid rgba(107,114,128,0.2); }
.ep-status-personality { background: rgba(125,211,252,0.08); color: var(--gate-personality); border: 1px solid rgba(125,211,252,0.2); }
.ep-status-design      { background: rgba(249,115,22,0.1);  color: #f97316; border: 1px solid rgba(249,115,22,0.25); }
.ep-status-both        { background: rgba(255,255,255,0.06); color: #d1d5db; border: 1px solid rgba(255,255,255,0.15); }
.ep-status-transit     { background: rgba(56,189,248,0.1);  color: #38bdf8; border: 1px solid rgba(56,189,248,0.25); }
.ep-status-em          { background: rgba(16,185,129,0.12); color: #34d399; border: 1px solid rgba(16,185,129,0.25); }

.ep-theme { font-size: 0.67rem; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 4px; }
.ep-desc { font-size: 0.78rem; color: var(--text-muted); line-height: 1.5; margin-bottom: 10px; }

.ep-meta { display: flex; flex-direction: column; gap: 5px; margin-bottom: 10px; padding: 8px 0 0; border-top: 1px solid var(--border-card); }
.ep-meta-row { display: flex; align-items: baseline; gap: 6px; font-size: 0.72rem; }
.ep-meta-label { color: var(--text-muted); flex-shrink: 0; }
.ep-meta-value { color: var(--text-primary); }

.ep-section-label { font-size: 0.62rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.07em; margin: 8px 0 5px; }
.ep-channels { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 12px; }
.ep-ch-tag { font-size: 0.65rem; padding: 2px 7px; border-radius: 5px; font-weight: 500; white-space: nowrap; }
.ep-ch-def  { background: rgba(124,58,237,0.15); color: #a78bfa; }
.ep-ch-open { background: var(--bg-card); color: var(--text-muted); }

.ep-ask-btn {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  width: 100%; margin-top: 4px; background: var(--accent); border: none;
  color: var(--accent-ink); font-size: 0.82rem; font-weight: 600; padding: 9px 16px;
  border-radius: 10px; cursor: pointer; transition: opacity 0.15s, transform 0.1s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.ep-ask-btn:hover  { opacity: 0.88; }
.ep-ask-btn:active { transform: scale(0.97); }

/* ===== ELEMENT POPUP BOTTOM SHEET (mobile) ===== */
/* ===== TOUCH PREVIEW BUBBLE ===== */
.touch-preview {
  position: fixed; z-index: 950; pointer-events: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 52px; min-height: 44px;
  padding: 6px 12px; border-radius: 14px;
  background: var(--bg-card); border: 2px solid var(--accent, #7c3aed);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 6px 24px rgba(0,0,0,0.4);
  transform: translate(-50%, -100%);
  animation: tp-in 0.12s ease;
}
@keyframes tp-in {
  from { opacity: 0; transform: translate(-50%, -90%) scale(0.7); }
  to   { opacity: 1; transform: translate(-50%, -100%) scale(1); }
}
.tp-num {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; font-weight: 700; color: #fff;
  background: var(--accent, #7c3aed); border: 2px solid rgba(255,255,255,0.2);
}
.tp-ch { font-size: 1.1rem; font-weight: 700; color: var(--accent, #7c3aed); font-family: monospace; }
.tp-sym { font-size: 1.4rem; line-height: 1; }
.tp-text { font-size: 0.85rem; font-weight: 600; color: var(--text-heading); text-align: center; line-height: 1.2; }
.tp-label { font-size: 0.6rem; color: var(--text-dim); white-space: nowrap; margin-top: 2px; text-transform: uppercase; letter-spacing: 0.5px; }
[data-theme="light"] .tp-num { color: #fff; }

.element-popup-sheet-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.3); z-index: 999; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.element-popup-sheet-overlay.active { display: block; }

.element-popup-sheet {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 1000;
  background: var(--bg-card); border-top-left-radius: 20px; border-top-right-radius: 20px;
  border-top: 1px solid var(--border-card); box-shadow: 0 -8px 40px rgba(0,0,0,0.4);
  padding: 0 16px 16px; max-height: 70vh; overflow-y: auto;
  transform: translateY(100%); transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  backdrop-filter: blur(24px);
}
.element-popup-sheet.open { transform: translateY(0); }
.element-popup-sheet .ep-sheet-handle { width: 36px; height: 4px; border-radius: 2px; background: var(--text-muted); margin: 8px auto 12px; }
.element-popup-sheet .ep-ask-btn { padding: 12px 16px; font-size: 0.9rem; min-height: 44px; }

/* ===== MINI-CHAT BOTTOM SHEET ===== */
/* ===== LANDING OVERLAY ===== */
/* Landing: DeepSeek-style centered, transitions to chat when messages appear */
.landing-overlay {
  display: none; position: fixed; inset: 0; z-index: 500;
  background: var(--bg-body);
  flex-direction: column; align-items: center;
  justify-content: center;
  overflow: hidden;
}
.landing-overlay.active { display: flex; pointer-events: none; }
.landing-overlay.active > * { pointer-events: auto; }

.landing-input-bar {
  width: 100%; max-width: 720px;
  padding: 8px 16px calc(env(safe-area-inset-bottom, 0px) + 12px);
  position: relative;
  z-index: 2;
}

/* ===== SHEET CHAT (always fixed — no layout reflow) ===== */
.sheet-chat-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.4); z-index: 1100;
}
.sheet-chat-overlay.active { display: block; }

.sheet-chat {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 1101;
  background: var(--bg-body);
  display: flex; flex-direction: column;
  transform: translateY(100%);
  pointer-events: none;
  backdrop-filter: blur(24px);
  /* Transition covers both peek→open and open→peek smoothly */
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1),
              max-height 0.3s cubic-bezier(0.32, 0.72, 0, 1),
              border-radius 0.3s ease;
}

/* Peek: only input bar visible at bottom (always fixed, no reflow) */
.sheet-chat.peek {
  transform: translateY(0);
  height: var(--sheet-peek-h);
  max-height: var(--sheet-peek-h);
  pointer-events: auto;
  box-shadow: none;
  border-top: none;
  border-radius: 0;
}
.sheet-chat.peek .sheet-chat-handle,
.sheet-chat.peek .sheet-chat-header,
.sheet-chat.peek .sheet-chat-body { display: none; }

/* Keyboard open: only applies on mobile (desktop has static layout) */
@media (max-width: 1023px) {

/* Keyboard open: скрыть свайп-индикаторы и боковые кнопки */
#app.keyboard-open .swipe-dots,
#app.keyboard-open .swipe-edge-label,
#app.keyboard-open .swipe-hint-arrow,
#app.keyboard-open .graph-side-btn,
#app.keyboard-open .transit-date-wheel,
#app.keyboard-open .transit-label,
#app.keyboard-open .composite-label {
  display: none !important;
}
/* Keyboard open: компактный бодиграф с именем */
#app.keyboard-open .graph-header {
  padding: 4px 12px 0;
}
#app.keyboard-open .swipe-panel {
  bottom: var(--sheet-peek-h) !important;
}
#app.keyboard-open .bodygraph-svg-wrap {
  padding: 0 12%;
}
/* Keyboard open: sheet-chat привязан к #app, а не к viewport */
#app.keyboard-open .sheet-chat.peek {
  position: absolute;
}

} /* end @media max-width: 1023px (keyboard-open mobile only) */

/* Open: ниже центра экрана — чтобы шторка не закрывала свайп-стрелки
   и подсказки элементов бодиграфа при первом открытии карты. */
.sheet-chat.open {
  transform: translateY(0);
  pointer-events: auto;
  height: auto;
  max-height: 45vh;
  box-shadow: 0 -8px 40px rgba(0,0,0,0.5);
  border-top: 1px solid var(--border-subtle);
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
}

/* Expanded: fullscreen */
.sheet-chat.expanded {
  transform: translateY(0);
  pointer-events: auto;
  top: 0;
  height: 100%;
  max-height: none;
  border-radius: 0;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
/* Fullscreen чат без карты — отступ под FAB */
.sheet-chat.expanded.no-chart .sheet-chat-body {
  padding-top: 56px;
}

.sheet-chat-handle {
  width: 40px; height: 5px; border-radius: 3px;
  background: var(--text-dim); margin: 10px auto 0; flex-shrink: 0;
  touch-action: none; cursor: grab;
}

.sheet-chat-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px 8px; flex-shrink: 0;
  border-bottom: 1px solid var(--border-subtle);
  touch-action: none; cursor: grab;
}
.sheet-chat-title {
  font-size: 0.85rem; font-weight: 600; color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sheet-chat-collapse {
  background: none; border: none; color: var(--text-secondary);
  font-size: 1.2rem; cursor: pointer; padding: 4px 8px; line-height: 1;
}

.sheet-chat-body {
  flex: 1; overflow-y: auto; padding: 12px 16px;
  -webkit-overflow-scrolling: touch;
  display: flex; flex-direction: column; gap: 8px;
}
.sheet-chat-body .chat-message { font-size: 0.9rem; }
.sheet-chat-body .typing-indicator { align-self: flex-start; }

.sheet-chat-input {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px calc(env(safe-area-inset-bottom, 0px) + 12px); flex-shrink: 0;
  border-top: 1px solid var(--border-subtle);
}
.sheet-chat-input input {
  flex: 1; background: var(--bg-input); border: 1px solid var(--border-input);
  border-radius: 20px; padding: 8px 14px; color: var(--text-primary);
  font-size: 16px; outline: none;
}
.sheet-chat-input input::placeholder { color: var(--text-dim); }
.sheet-chat-input input:focus { border-color: var(--focus-ring); }
.sheet-chat-input button {
  background: var(--accent); border: none; border-radius: 50%;
  width: 36px; height: 36px; color: var(--accent-ink); font-size: 1rem;
  font-weight: 600;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sheet-chat-input button:disabled { opacity: 0.4; cursor: default; }

/* Light theme: glassmorphism for sheet-chat */
[data-theme="light"] .sheet-chat {
  background: rgba(230, 225, 235, 0.85);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
}
[data-theme="light"] .sheet-chat.open {
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.1);
  border-top: 1px solid rgba(255, 255, 255, 0.3);
}
[data-theme="light"] .sheet-chat-input {
  border-top-color: rgba(255, 255, 255, 0.25);
}
[data-theme="light"] .sheet-chat-input input {
  background: rgba(255, 255, 255, 0.55);
  border-color: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
[data-theme="light"] .sheet-chat-input button {
  background: #1a1a2e;
  box-shadow: 0 2px 10px rgba(26, 26, 46, 0.35);
}

.sheet-chat-body .chat-chips {
  display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px;
}
.sheet-chat-body .chat-chips.chat-chips--stacked {
  flex-direction: column; align-items: stretch; gap: 8px;
}
.sheet-chat-body .chat-chips.chat-chips--stacked .chat-chip {
  padding: 8px 12px; font-size: 0.8rem; line-height: 1.3;
  border-radius: 14px; width: 100%;
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
}
.sheet-chat-body .chat-chip {
  padding: 6px 12px; font-size: 0.8rem; border-radius: 16px;
  background: transparent; border: 1px solid var(--accent);
  color: #e5e7eb; cursor: pointer; transition: background 0.15s;
}
.sheet-chat-body .chat-chip:active {
  background: var(--accent); color: var(--accent-ink);
}
.sheet-chat-body .chat-chip-paid {
  border-color: rgba(245, 158, 11, 0.4); color: #f59e0b;
}
.sheet-chat-body .chat-chip-paid:active {
  background: rgba(245, 158, 11, 0.3);
}
.sheet-chat-body .chip-cost {
  font-size: 0.7rem; opacity: 0.7; margin-left: 4px;
}

/* ===== SETTINGS MODAL ===== */
/* Голубой градиент, как у модалки монет — делаем UX единым */
#settings-modal .modal-container.modal-container-tall {
  max-width: 500px;
  background:
    radial-gradient(ellipse 180% 100% at 50% 0%, rgba(135, 180, 230, 0.55) 0%, transparent 60%),
    linear-gradient(to bottom, rgba(135, 180, 230, 0.18) 0%, rgba(185, 180, 195, 0.35) 100%),
    #f4f4f7;
  color: #1a1a2e;
}
#settings-modal .modal-title,
#settings-modal .modal-close {
  color: #1a1a2e;
}
#settings-modal .modal-close:hover {
  background: rgba(0, 0, 0, 0.08);
}
[data-theme="dark"] #settings-modal .modal-container.modal-container-tall {
  background:
    radial-gradient(ellipse 180% 100% at 50% 0%, rgba(96, 140, 200, 0.35) 0%, transparent 60%),
    linear-gradient(to bottom, rgba(60, 70, 90, 0.9) 0%, rgba(35, 35, 45, 0.95) 100%),
    #1a1a2e;
  color: #e8e8ee;
}
[data-theme="dark"] #settings-modal .modal-title,
[data-theme="dark"] #settings-modal .modal-close {
  color: #e8e8ee;
}
/* Форсируем читаемые цвета внутри голубой модалки независимо от темы сайта */
#settings-modal .settings-section-title,
#settings-modal .settings-stat-value,
#settings-modal .form-field label {
  color: #1a1a2e;
}
#settings-modal .settings-readonly,
#settings-modal .settings-stat-label,
#settings-modal .settings-danger-text,
#settings-modal .settings-hint {
  color: rgba(26, 26, 46, 0.65);
}
#settings-modal .settings-readonly,
#settings-modal .settings-stat {
  background: rgba(255, 255, 255, 0.65);
}
#settings-modal .settings-section {
  border-bottom-color: rgba(26, 26, 46, 0.12);
}
#settings-modal .modal-input,
#settings-modal input[type="text"],
#settings-modal input[type="email"],
#settings-modal input[type="password"] {
  background: rgba(255, 255, 255, 0.85);
  color: #1a1a2e;
  border: 1px solid rgba(26, 26, 46, 0.18);
}
[data-theme="dark"] #settings-modal .settings-section-title,
[data-theme="dark"] #settings-modal .settings-stat-value,
[data-theme="dark"] #settings-modal .form-field label {
  color: #e8e8ee;
}
[data-theme="dark"] #settings-modal .settings-readonly,
[data-theme="dark"] #settings-modal .settings-stat-label,
[data-theme="dark"] #settings-modal .settings-danger-text,
[data-theme="dark"] #settings-modal .settings-hint {
  color: rgba(232, 232, 238, 0.65);
}
[data-theme="dark"] #settings-modal .settings-readonly,
[data-theme="dark"] #settings-modal .settings-stat {
  background: rgba(255, 255, 255, 0.06);
}
[data-theme="dark"] #settings-modal .settings-section {
  border-bottom-color: rgba(255, 255, 255, 0.12);
}
[data-theme="dark"] #settings-modal .modal-input,
[data-theme="dark"] #settings-modal input[type="text"],
[data-theme="dark"] #settings-modal input[type="email"],
[data-theme="dark"] #settings-modal input[type="password"] {
  background: rgba(255, 255, 255, 0.08);
  color: #e8e8ee;
  border-color: rgba(255, 255, 255, 0.18);
}
.settings-section {
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.15);
}
.settings-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}
.settings-section-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0 0 12px;
  color: var(--text-primary, #e5e7eb);
}
.settings-readonly {
  padding: 8px 12px;
  background: rgba(148, 163, 184, 0.08);
  border-radius: 6px;
  font-size: 0.9rem;
  color: var(--text-secondary, #9ca3af);
}
.settings-hint {
  font-size: 0.8rem;
  opacity: 0.7;
  margin-left: 4px;
}
.settings-save-btn {
  padding: 9px 16px;
  font-size: 0.88rem;
  margin-top: 4px;
  width: auto;
}
.settings-msg {
  min-height: 18px;
  font-size: 0.82rem;
  margin-top: 6px;
}
.settings-msg-ok {
  color: #22c55e;
}
.settings-msg-error {
  color: var(--signal);
}
[data-theme="light"] .settings-msg-ok {
  color: #15803d;
}
[data-theme="light"] .settings-msg-error {
  color: #b91c1c;
}
.settings-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}
.settings-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 8px;
  background: rgba(148, 163, 184, 0.08);
  border-radius: 8px;
  text-align: center;
}
.settings-stat-label {
  font-size: 0.72rem;
  color: var(--text-secondary, #9ca3af);
  margin-bottom: 4px;
}
.settings-stat-value {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary, #e5e7eb);
}
.settings-section-danger {
  background: rgba(239, 68, 68, 0.06);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 8px;
  padding: 14px 14px 12px;
  margin-top: 20px;
}
.settings-section-danger .settings-section-title {
  color: #ef4444;
}
.settings-danger-text {
  font-size: 0.85rem;
  color: var(--text-secondary, #9ca3af);
  margin: 0 0 12px;
}
.settings-delete-trigger {
  border-color: rgba(239, 68, 68, 0.4);
  color: #ef4444;
}
.settings-delete-trigger:hover {
  background: rgba(239, 68, 68, 0.1);
}

/* Delete account confirm modal */
.settings-delete-list {
  margin: 8px 0 10px;
  padding-left: 20px;
  font-size: 0.88rem;
  color: var(--text-secondary, #9ca3af);
}
.settings-delete-list li {
  margin-bottom: 4px;
}
.settings-delete-warn {
  font-size: 0.8rem;
  color: var(--text-secondary, #9ca3af);
  opacity: 0.8;
  margin: 10px 0;
}
.settings-delete-btn {
  background: #ef4444;
  border: none;
}
.settings-delete-btn:hover {
  background: #dc2626;
}

/* Light theme */
[data-theme="light"] .settings-readonly {
  background: rgba(0, 0, 0, 0.05);
  color: #4b5563;
}
[data-theme="light"] .settings-stat {
  background: rgba(0, 0, 0, 0.05);
}
[data-theme="light"] .settings-section-danger {
  background: rgba(239, 68, 68, 0.05);
}

@media (max-width: 480px) {
  .settings-stats-grid { grid-template-columns: 1fr 1fr; }
  .settings-stats-grid .settings-stat:nth-child(3) { grid-column: 1 / -1; }
}

/* ===== SEO CONTENT (text layer for search bots) ===== */
/* Visually hidden but accessible to crawlers (not display:none) */
#seo-content {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
  padding: 2rem 1rem;
  max-width: 800px;
  margin: 0 auto;
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.7;
}
#seo-content h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-heading);
  margin-bottom: 1rem;
}
#seo-content h2 {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-heading);
  margin: 1.5rem 0 0.5rem;
}
#seo-content h3 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 1rem 0 0.3rem;
}
#seo-content p, #seo-content dd {
  margin-bottom: 0.6rem;
}
#seo-content ol, #seo-content dl {
  margin: 0.5rem 0;
  padding-left: 1.2rem;
}
#seo-content dt {
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 0.8rem;
}
#seo-content dd {
  margin-left: 0;
  padding-left: 0;
}
#seo-content footer {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.85rem;
  color: var(--text-dim);
}
#seo-content footer a {
  color: var(--text-secondary);
  text-decoration: none;
}
#seo-content footer a:hover {
  color: var(--accent);
}
#seo-content a {
  color: var(--accent);
  text-decoration: none;
}
#seo-content a:hover {
  text-decoration: underline;
}
#seo-content ul {
  margin: 0.5rem 0;
  padding-left: 1.2rem;
}
#seo-content li {
  margin-bottom: 0.4rem;
}

/* SEO content always visually hidden (position: absolute off-screen) — no toggle needed */

/* ===== REGISTER CTA (в пузыре чата для гостей) ===== */
.chat-register-cta {
  text-align: center;
  padding: 16px 14px !important;
}
.register-cta-text {
  font-size: 15px;
  line-height: 1.45;
  margin-bottom: 6px;
}
.register-cta-perks {
  font-size: 12px;
  opacity: 0.55;
  margin-bottom: 14px;
}
.register-cta-btn {
  display: inline-block;
  width: 100%;
  padding: 11px 0;
  background: #fff;
  color: #111;
  font-size: 14px;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: opacity .15s;
}
.register-cta-btn:hover {
  opacity: 0.85;
}
[data-theme="light"] .register-cta-btn {
  background: #1a1a2e;
  color: #fff;
}

/* Trial counter under deep answer */
.chat-trial-counter {
  text-align: center;
  font-size: 12px;
  color: rgba(255,255,255,0.45);
  padding: 6px 0 2px;
  letter-spacing: 0.02em;
}
.chat-trial-sub-hint {
  color: rgba(255,255,255,0.6);
  cursor: pointer;
  border-bottom: 1px dotted rgba(255,255,255,0.3);
  transition: color 0.2s;
}
.chat-trial-sub-hint:hover {
  color: #fff;
}
[data-theme="light"] .chat-trial-counter {
  color: rgba(0,0,0,0.4);
}
[data-theme="light"] .chat-trial-sub-hint {
  color: rgba(0,0,0,0.55);
  border-bottom-color: rgba(0,0,0,0.25);
}
[data-theme="light"] .chat-trial-sub-hint:hover {
  color: #000;
}

/* PRO CTA block in free chat */
/* PRO-CTA бабл: наследует размер/стиль обычного chat-message.assistant
   (max-width:85%, align-self:flex-start, стандартные padding/bg). Здесь только
   сбрасываем прежний полноразмерный градиент и добавляем внутренний layout. */
.chat-pro-cta {
  /* background/border/padding приходят от .chat-message.assistant — не переопределяем */
  text-align: left;
}
.pro-cta-text {
  font-size: 14px;
  color: var(--text-primary);
  margin-bottom: 10px;
  line-height: 1.5;
}
.pro-cta-btn {
  background: #000;
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 9px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
}
.pro-cta-btn:hover { opacity: 0.9; }
.pro-cta-btn:active { opacity: 0.8; transform: scale(0.98); }
[data-theme="light"] .pro-cta-btn {
  background: #000;
  color: #fff;
}

/* PRO badge at top of PRO chat */
.chat-pro-badge {
  text-align: center;
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--pro-accent);
  border-bottom: 1px solid rgba(167, 139, 250, 0.18);
  margin-bottom: 8px;
  position: relative;
}
/* В dark — зелёный акцент для PRO-бейджа (соответствует «Вы здесь» в free) */
[data-theme="dark"] .chat-pro-badge {
  color: #10b981;
  border-bottom-color: rgba(16, 185, 129, 0.18);
}
.pro-badge-back {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  color: rgba(255,255,255,0.5);
  cursor: pointer;
  transition: color 0.2s;
}
.pro-badge-back:active {
  color: #fff;
}
[data-theme="light"] .pro-badge-back {
  color: rgba(0,0,0,0.4);
}
[data-theme="light"] .pro-badge-back:active {
  color: #000;
}

/* PRO label in sidebar */
.conv-item--pro .conv-item-meta {
  color: var(--pro-accent);
}

/* PRO inline input form in chat */
.chat-pro-input-form {
  margin: 8px 0 4px;
  padding: 12px 14px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
}
.chat-pro-input-label {
  font-size: 13px;
  color: rgba(255,255,255,0.6);
  margin-bottom: 8px;
}
.chat-pro-input-row {
  display: flex;
  gap: 8px;
}
.chat-pro-input {
  flex: 1;
  padding: 10px 12px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  color: #fff;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}
.chat-pro-input:focus {
  border-color: rgba(255,255,255,0.35);
}
.chat-pro-input::placeholder {
  color: rgba(255,255,255,0.3);
}
.chat-pro-input-send {
  width: 40px;
  background: #fff;
  color: #111;
  border: none;
  border-radius: 8px;
  font-size: 18px;
  cursor: pointer;
  transition: opacity 0.2s;
  flex-shrink: 0;
}
.chat-pro-input-send:hover { opacity: 0.8; }
[data-theme="light"] .chat-pro-input-form {
  background: rgba(0,0,0,0.03);
  border-color: rgba(0,0,0,0.1);
}
[data-theme="light"] .chat-pro-input-label { color: rgba(0,0,0,0.5); }
[data-theme="light"] .chat-pro-input {
  background: rgba(0,0,0,0.05);
  border-color: rgba(0,0,0,0.12);
  color: #111;
}
[data-theme="light"] .chat-pro-input:focus { border-color: rgba(0,0,0,0.3); }
[data-theme="light"] .chat-pro-input::placeholder { color: rgba(0,0,0,0.3); }
[data-theme="light"] .chat-pro-input-send {
  background: #1a1a2e;
  color: #fff;
}

/* Subscription popup overlay */
.sub-popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  animation: fadeIn 0.2s ease;
}
.sub-popup {
  background: #1a1a2e;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  padding: 32px 28px;
  max-width: 340px;
  width: 90%;
  text-align: center;
}
.sub-popup__icon {
  font-size: 32px;
  color: #fff;
  margin-bottom: 12px;
  letter-spacing: -2px;
}
.sub-popup__title {
  font-size: 18px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 8px;
}
.sub-popup__subtitle {
  font-size: 13px;
  color: rgba(255,255,255,0.55);
  margin-bottom: 24px;
  line-height: 1.4;
}
.sub-popup__btn-primary {
  display: block;
  width: 100%;
  padding: 12px 0;
  background: var(--pro-accent);
  color: var(--pro-accent-ink);
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
  margin-bottom: 10px;
}
.sub-popup__btn-primary:hover { opacity: 0.85; }
.sub-popup__btn-secondary {
  display: block;
  width: 100%;
  padding: 10px 0;
  background: transparent;
  color: rgba(255,255,255,0.5);
  border: none;
  font-size: 13px;
  cursor: pointer;
  transition: color 0.2s;
}
.sub-popup__btn-secondary:hover { color: #fff; }

[data-theme="light"] .sub-popup {
  background: #fff;
  border-color: rgba(0,0,0,0.1);
}
[data-theme="light"] .sub-popup__icon { color: #111; }
[data-theme="light"] .sub-popup__title { color: #111; }
[data-theme="light"] .sub-popup__subtitle { color: rgba(0,0,0,0.5); }
[data-theme="light"] .sub-popup__btn-primary {
  background: #1a1a2e;
  color: #fff;
}
[data-theme="light"] .sub-popup__btn-secondary { color: rgba(0,0,0,0.4); }
[data-theme="light"] .sub-popup__btn-secondary:hover { color: #111; }

/* ─── Sidebar inbox кнопка (🔔 + badge) ───────────────────────── */

.sidebar-inbox-btn {
  position: relative;
  color: var(--text-dim);
  padding: 6px;
  border-radius: 8px;
  cursor: pointer;
  transition: color var(--transition-fast), background var(--transition-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  margin-right: 8px;
}
.sidebar-inbox-btn:hover {
  color: var(--text-primary);
  background: var(--accent-light);
}
.sidebar-inbox-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  color: #fff;
  background: #ef4444;
  border-radius: 8px;
  pointer-events: none;
}

/* ─── Modal с градиентом в стиле лендинга ─────────────────────── */
/* Голубой радиальный сверху → серый к низу на #f4f4f7, как coins-modal */

.ooc-overlay .modal-container.modal-with-hero {
  padding: 0;
  overflow: hidden;
  background:
    radial-gradient(ellipse 180% 100% at 50% 0%, rgba(135, 180, 230, 0.55) 0%, transparent 60%),
    linear-gradient(to bottom, rgba(135, 180, 230, 0.18) 0%, rgba(185, 180, 195, 0.35) 100%),
    #f4f4f7;
  color: #1a1a2e;
}
.modal-with-hero .modal-body-scroll,
.modal-with-hero .modal-body {
  padding: 12px 22px 18px;
}
.modal-with-hero > .btn-calculate,
.modal-with-hero > .modal-btn-secondary {
  margin: 8px 22px 0;
}
.modal-with-hero > .modal-btn-secondary:last-child { margin-bottom: 18px; }

.modal-hero {
  position: relative;
  padding: 26px 52px 14px 22px;
  text-align: left;
  background: transparent;
}
.modal-hero-compact {
  padding: 22px 52px 12px;
  text-align: center;
}
.modal-hero-compact .modal-hero-icon {
  font-size: 40px;
  line-height: 1;
  margin-bottom: 6px;
  filter: drop-shadow(0 2px 4px rgba(26, 26, 46, 0.15));
}
.modal-hero-title {
  font-size: 19px;
  font-weight: 700;
  color: #1a1a2e;
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}
.modal-hero-sub {
  font-size: 13px;
  color: rgba(26, 26, 46, 0.6);
  margin: 0;
  line-height: 1.4;
}
.modal-hero-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(26, 26, 46, 0.08);
  color: #1a1a2e;
  border: none;
  border-radius: 50%;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s;
}
.modal-hero-close:hover { background: rgba(26, 26, 46, 0.18); }

/* ─── Inbox toolbar (на светлом фоне лендинг-стиля) ──────────── */

.modal-with-hero .inbox-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 16px;
  border-top: 1px solid rgba(26, 26, 46, 0.08);
  border-bottom: 1px solid rgba(26, 26, 46, 0.08);
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.modal-with-hero .inbox-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(26, 26, 46, 0.1);
  color: #1a1a2e;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.modal-with-hero .inbox-action-btn:hover {
  background: #fff;
  border-color: rgba(26, 26, 46, 0.3);
}
.modal-with-hero .inbox-action-btn svg { flex-shrink: 0; }
.modal-with-hero .inbox-action-icon {
  padding: 6px;
  width: 32px;
  height: 32px;
  justify-content: center;
}

/* ─── Inbox карточки (белые на голубо-сером фоне) ──────────── */

.modal-with-hero .inbox-feed { padding: 12px 16px 16px; }
.modal-with-hero .inbox-card {
  position: relative;
  padding: 12px 14px;
  margin-bottom: 10px;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(26, 26, 46, 0.08);
  border-radius: 12px;
  cursor: pointer;
  transition: all var(--transition-fast);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.modal-with-hero .inbox-card:hover {
  background: #fff;
  border-color: rgba(26, 26, 46, 0.2);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(26, 26, 46, 0.08);
}
.modal-with-hero .inbox-card.unread { padding-left: 22px; }
.modal-with-hero .inbox-card.unread::before {
  content: '';
  position: absolute;
  top: 16px;
  left: 8px;
  width: 6px;
  height: 6px;
  background: #3b82f6;
  border-radius: 50%;
}

.modal-with-hero .inbox-card-body-wrap { padding-right: 68px; }
.modal-with-hero .inbox-card-title {
  font-size: 14px;
  font-weight: 600;
  color: #1a1a2e;
  margin-bottom: 4px;
  line-height: 1.35;
}
.modal-with-hero .inbox-card-body {
  font-size: 13px;
  color: rgba(26, 26, 46, 0.7);
  line-height: 1.45;
  margin-bottom: 6px;
}
.modal-with-hero .inbox-card-meta {
  font-size: 11px;
  color: rgba(26, 26, 46, 0.4);
}

.modal-with-hero .inbox-card-actions {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.15s;
}
.modal-with-hero .inbox-card:hover .inbox-card-actions { opacity: 1; }
@media (hover: none) {
  .modal-with-hero .inbox-card-actions { opacity: 1; }
}
.modal-with-hero .inbox-card-action {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 1px solid rgba(26, 26, 46, 0.12);
  color: rgba(26, 26, 46, 0.6);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}
.modal-with-hero .inbox-card-action:hover {
  color: #1a1a2e;
  border-color: rgba(26, 26, 46, 0.35);
}
.modal-with-hero .inbox-card-action.delete:hover {
  color: #ef4444;
  border-color: #ef4444;
}

.modal-with-hero .inbox-empty {
  text-align: center;
  color: rgba(26, 26, 46, 0.55);
  padding: 60px 20px;
  font-size: 13px;
}

/* ─── Notif settings (select, чекбоксы, iOS-hint) ─────────── */

.modal-with-hero .notif-hint {
  margin: 0 22px 16px;
  padding: 12px 14px;
  background: rgba(135, 180, 230, 0.35);
  border: 1px solid rgba(59, 130, 246, 0.4);
  border-radius: 10px;
  font-size: 13px;
  color: #1a1a2e;
  line-height: 1.5;
}
.modal-with-hero .notif-hint em {
  font-style: normal;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.5);
  padding: 1px 6px;
  border-radius: 4px;
}
.modal-with-hero .settings-section-title {
  color: rgba(26, 26, 46, 0.55);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 16px 0 8px;
}
.modal-with-hero .notif-radio,
.modal-with-hero .notif-checkbox {
  display: block;
  padding: 10px 0;
  cursor: pointer;
  color: #1a1a2e;
  font-size: 14px;
}
.modal-with-hero .notif-radio input,
.modal-with-hero .notif-checkbox input {
  margin-right: 8px;
  accent-color: #1a1a2e;
}
.modal-with-hero .notif-radio-hint {
  display: block;
  margin-left: 24px;
  margin-top: 2px;
  font-size: 12px;
  color: rgba(26, 26, 46, 0.55);
}
.modal-with-hero .notif-select-wrap { position: relative; }
.modal-with-hero .notif-select {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  padding: 10px 40px 10px 12px;
  background-color: rgba(255, 255, 255, 0.8);
  color: #1a1a2e;
  border: 1px solid rgba(26, 26, 46, 0.12);
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%231a1a2e' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 12px;
}
.modal-with-hero .notif-push-status {
  padding: 10px 12px;
  margin-bottom: 10px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(26, 26, 46, 0.08);
  border-radius: 8px;
  font-size: 13px;
  color: rgba(26, 26, 46, 0.75);
}

/* Кнопки внутри — совместимо с лендинг-стилем */
.modal-with-hero .btn-calculate {
  background: #1a1a2e;
  color: #fff;
  border: none;
}
.modal-with-hero .btn-calculate:hover { background: #2d2d44; }
.modal-with-hero .modal-btn-secondary {
  background: transparent;
  color: rgba(26, 26, 46, 0.55);
}
.modal-with-hero .modal-btn-secondary:hover { color: #1a1a2e; }

/* ─── Welcome-модалка список ──────────────────────────────── */

.modal-with-hero .notif-welcome-list {
  list-style: none;
  padding: 0;
  margin: 0 0 12px;
}
.modal-with-hero .notif-welcome-list li {
  padding: 6px 0 6px 24px;
  position: relative;
  color: #1a1a2e;
  font-size: 14px;
}
.modal-with-hero .notif-welcome-list li::before {
  content: '✓';
  position: absolute;
  left: 4px;
  color: #3b82f6;
  font-weight: 700;
}
.modal-with-hero .notif-welcome-hint {
  font-size: 13px;
  color: rgba(26, 26, 46, 0.6);
  margin: 0;
}

/* ═══════════════════════════════════════════════════════════════════════
   Тарифные карточки (Free / PRO / PDF-разбор) в coins-modal
   ═══════════════════════════════════════════════════════════════════════ */

.ooc-overlay .modal-container.coins-modal-container--wide {
  max-width: 820px;
  padding: 22px 22px 18px;
}

.tier-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 14px 0;
  text-align: left;
}

.tier-cards__note {
  margin: 8px auto 4px;
  font-size: 13px;
  color: #4a3c66;
  opacity: 0.85;
  text-align: center;
  max-width: 540px;
  line-height: 1.45;
}

.tier-cards__loading,
.tier-cards__error {
  grid-column: 1 / -1;
  text-align: center;
  padding: 22px;
  opacity: 0.7;
  font-size: 14px;
}

.tier-card {
  position: relative;
  padding: 18px 16px 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
  display: flex;
  flex-direction: column;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.tier-card--featured {
  border-color: #5b3db3;
  box-shadow: 0 6px 20px rgba(91, 61, 179, 0.18);
  transform: translateY(-2px);
}

.tier-card--current {
  background: rgba(255, 255, 255, 0.65);
  border-color: rgba(91, 61, 179, 0.25);
}

.tier-card--dimmed {
  opacity: 0.65;
}

.tier-card__ribbon {
  position: absolute;
  top: -9px;
  right: 12px;
  background: #5b3db3;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 100px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

.tier-card__header {
  font-size: 15px;
  font-weight: 700;
  color: #1a1a2e;
  margin-bottom: 4px;
}

.tier-card__price {
  font-size: 13px;
  color: #5b3db3;
  font-weight: 600;
  margin-bottom: 12px;
}

.tier-card__features {
  list-style: none;
  padding: 0;
  margin: 0 0 14px;
  flex: 1;
  font-size: 12.5px;
  color: #2a2142;
  line-height: 1.5;
}

.tier-card__features li {
  position: relative;
  padding: 3px 0 3px 18px;
}

.tier-card__features li::before {
  content: '✓';
  position: absolute;
  left: 2px;
  top: 3px;
  color: #5b3db3;
  font-weight: 700;
}

.tier-card__badge {
  display: inline-block;
  align-self: flex-start;
  font-size: 11px;
  color: #5b3db3;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 100px;
  background: rgba(91, 61, 179, 0.1);
}

.tier-card__note {
  font-size: 12px;
  color: #6a5d85;
  margin: 0;
  font-style: italic;
}

/* Консент-чекбокс под features, перед CTA «Подписаться». Требование ЮKassa
   для рекурентов: юзер явно соглашается на автосписание до клика на оплату. */
.tier-card__consent {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0 0 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(91, 61, 179, 0.06);
  font-size: 11.5px;
  line-height: 1.35;
  color: #4a3c66;
  cursor: pointer;
  user-select: none;
}
.tier-card__consent input[type="checkbox"] {
  flex-shrink: 0;
  margin-top: 2px;
  width: 14px;
  height: 14px;
  accent-color: #5b3db3;
}
.tier-card__cta:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
[data-theme="dark"] .tier-card__consent {
  background: rgba(183, 167, 224, 0.1);
  color: #d4c8ee;
}

.tier-card__cta,
.tier-card__cta-secondary {
  width: 100%;
  padding: 10px 14px;
  border: none;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
  font-family: inherit;
}

.tier-card__cta {
  background: #5b3db3;
  color: #fff;
}
.tier-card__cta:hover { background: #4a2f99; }

.tier-card__cta-secondary {
  background: transparent;
  color: #1a1a2e;
  border: 1px solid rgba(0, 0, 0, 0.2);
}
.tier-card__cta-secondary:hover { background: rgba(0, 0, 0, 0.05); }

/* Мобильная раскладка — 3 карточки в колонку, компактные чтобы все 3 влезли
   в мобильный viewport без скролла. Сокращаем padding, шрифты, gap'ы. */
@media (max-width: 720px) {
  .ooc-overlay .modal-container.coins-modal-container--wide {
    max-width: 420px;
    padding: 14px 14px 12px;
    max-height: 92vh;
    overflow-y: auto;
  }
  .ooc-overlay .modal-container.coins-modal-container .modal-title {
    font-size: 17px;
    margin-bottom: 8px;
  }
  .tier-cards__note {
    margin: 4px auto;
    font-size: 12px;
    line-height: 1.35;
  }
  .tier-cards {
    grid-template-columns: 1fr;
    gap: 8px;
    margin: 8px 0;
  }
  .tier-card {
    padding: 10px 12px 12px;
    border-radius: 12px;
  }
  .tier-card--featured { transform: none; }
  .tier-card__header {
    font-size: 14px;
    margin-bottom: 2px;
  }
  .tier-card__price {
    font-size: 12px;
    margin-bottom: 6px;
  }
  .tier-card__features {
    font-size: 12px;
    line-height: 1.35;
    margin-bottom: 8px;
  }
  .tier-card__features li {
    padding: 1px 0 1px 16px;
  }
  .tier-card__features li::before { top: 1px; }
  .tier-card__cta,
  .tier-card__cta-secondary {
    padding: 8px 12px;
    font-size: 13px;
  }
  .tier-card__ribbon {
    font-size: 9px;
    padding: 2px 8px;
    top: -7px;
  }
  .tier-card__badge {
    font-size: 10px;
    padding: 2px 7px;
  }
  .tier-card__note {
    font-size: 11px;
  }
}

[data-theme="dark"] .tier-card {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
}
[data-theme="dark"] .tier-card__header,
[data-theme="dark"] .tier-card__features,
[data-theme="dark"] .tier-card__cta-secondary { color: #e8e8ee; }
[data-theme="dark"] .tier-card__price,
[data-theme="dark"] .tier-card__features li::before { color: #b7a7e0; }
/* «Вы здесь» бейдж в free — зелёный акцент (подсказка где юзер сейчас) */
[data-theme="dark"] .tier-card__badge {
  color: #10b981;
  background: rgba(16, 185, 129, 0.12);
}
[data-theme="dark"] .tier-card--featured { box-shadow: 0 6px 20px rgba(183, 167, 224, 0.25); border-color: #b7a7e0; }
/* CTA «Подписаться» / «Купить» в dark — белый контраст на фиолетовой модалке */
[data-theme="dark"] .tier-card__cta {
  background: #ffffff;
  color: #0f172a;
}
[data-theme="dark"] .tier-card__cta:hover { background: #e5e7eb; }
/* В light — чёрные CTA (белый текст), единый стиль primary */
[data-theme="light"] .tier-card__cta {
  background: #1a1a2e;
  color: #ffffff;
}
[data-theme="light"] .tier-card__cta:hover { background: #0f0f1a; }

/* ═══════════════════════════════════════════════════════════════════════
   Модалка покупки персонального разбора (report-buy-modal)
   ═══════════════════════════════════════════════════════════════════════ */

.report-buy-modal .modal-container {
  max-width: 500px;
  text-align: left;
  padding: 24px 22px 18px;
}

.report-buy__hero {
  text-align: center;
  margin-bottom: 14px;
}
.report-buy__hero h3 { margin: 0 0 6px; font-size: 20px; color: #1a1a2e; }
.report-buy__hero .report-buy__subtitle { font-size: 13px; color: #4a3c66; margin: 0; }

.report-buy__features {
  list-style: none;
  margin: 14px 0;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 12px;
  font-size: 13.5px;
  line-height: 1.7;
  color: #2a2142;
}
.report-buy__features li { padding-left: 22px; position: relative; }
.report-buy__features li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: #5b3db3;
  font-weight: 700;
}

.report-buy__mode-tabs {
  display: flex;
  gap: 8px;
  margin: 10px 0 12px;
}
.report-buy__mode-tab {
  flex: 1;
  padding: 10px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  background: #fff;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: #1a1a2e;
  font-family: inherit;
  transition: all 0.15s ease;
}
.report-buy__mode-tab.active {
  border-color: #5b3db3;
  background: rgba(91, 61, 179, 0.08);
  color: #5b3db3;
}

.report-buy__form-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}
.report-buy__form-field label {
  font-size: 12px;
  font-weight: 600;
  color: #4a3c66;
}
.report-buy__form-field input {
  padding: 10px 12px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 10px;
  font-size: 14px;
  background: #fff;
  color: #1a1a2e;
  font-family: inherit;
}
.report-buy__form-field input:focus {
  outline: none;
  border-color: #5b3db3;
  box-shadow: 0 0 0 3px rgba(91, 61, 179, 0.15);
}

.report-buy__gift-note {
  font-size: 12px;
  color: #6a5d85;
  margin: 6px 0 14px;
  padding: 8px 10px;
  background: rgba(91, 61, 179, 0.06);
  border-left: 3px solid #5b3db3;
  border-radius: 4px;
}

.report-buy__submit {
  width: 100%;
  padding: 13px 16px;
  background: #5b3db3;
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}
.report-buy__submit:hover:not(:disabled) { background: #4a2f99; }
.report-buy__submit:disabled { opacity: 0.6; cursor: wait; }

.report-buy__error {
  color: #d43a4a;
  font-size: 13px;
  margin: 8px 0 0;
  padding: 8px 10px;
  background: rgba(212, 58, 74, 0.08);
  border-radius: 6px;
  display: none;
}
.report-buy__error.active { display: block; }

.report-buy__success {
  text-align: center;
  padding: 20px 16px;
}
.report-buy__success-icon { font-size: 48px; margin-bottom: 10px; }
.report-buy__success h3 { margin: 0 0 10px; color: #1a1a2e; }
.report-buy__success p { color: #4a3c66; margin: 0 0 14px; line-height: 1.5; }

/* Кнопка в info-panel карты — «Персональный разбор в PDF» */
.info-report-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(91, 61, 179, 0.3);
  background: rgba(91, 61, 179, 0.06);
  border-radius: 12px;
  cursor: pointer;
  font-family: inherit;
  color: #1a1a2e;
  text-align: left;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.info-report-cta:hover {
  background: rgba(91, 61, 179, 0.12);
  border-color: #5b3db3;
}
.info-report-cta__body { display: flex; flex-direction: column; gap: 2px; }
.info-report-cta__title { font-size: 13.5px; font-weight: 700; }
.info-report-cta__hint { font-size: 11.5px; color: #4a3c66; }
.info-report-cta__price {
  font-size: 13.5px;
  font-weight: 700;
  color: #5b3db3;
  white-space: nowrap;
}

[data-theme="dark"] .info-report-cta {
  background: rgba(183, 167, 224, 0.08);
  border-color: rgba(183, 167, 224, 0.35);
  color: #e8e8ee;
}
[data-theme="dark"] .info-report-cta__hint { color: #b7a7e0; }
[data-theme="dark"] .info-report-cta__price { color: #b7a7e0; }
[data-theme="dark"] .report-buy-modal .modal-container { color: #e8e8ee; }
[data-theme="dark"] .report-buy__features { background: rgba(255, 255, 255, 0.05); }
[data-theme="dark"] .report-buy__form-field input,
[data-theme="dark"] .report-buy__mode-tab {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.15);
  color: #e8e8ee;
}

/* ==========================================================
   NEBULA — ночное небо (только dark)
   ========================================================== */

/* ===== NEBULA · LANDING (dark only) ===== */
/* NB: .landing-overlay уже position: fixed; inset: 0 + overflow: hidden — оставляем как есть */

/* Слой 1 — мягкий синий подсвет сверху + лавандовый снизу-слева */
[data-theme="dark"] .state-landing .landing-overlay::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% 15%, var(--nebula-glow) 0%, transparent 65%),
    radial-gradient(ellipse 60% 40% at 25% 85%, var(--nebula-accent) 0%, transparent 60%);
}

/* Слой 2 — звёздное небо: точки только по краям и в верхней/нижней зонах,
   центральная колонка (Y ≈ 30-75%, X ≈ 15-85%) свободна — там живёт hero/input/chips */
[data-theme="dark"] .state-landing .landing-overlay::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background-image:
    /* === Верхняя зона (Y < 28%) — полная ширина === */
    radial-gradient(circle 1.2px at 4% 5%,   var(--nebula-star) 100%, transparent 100%),
    radial-gradient(circle 1px   at 11% 13%, rgba(237,237,232,0.6) 100%, transparent 100%),
    radial-gradient(circle 1.4px at 17% 4%,  var(--nebula-star) 100%, transparent 100%),
    radial-gradient(circle 1px   at 24% 21%, rgba(237,237,232,0.5) 100%, transparent 100%),
    radial-gradient(circle 1.1px at 30% 9%,  var(--nebula-star) 100%, transparent 100%),
    radial-gradient(circle 1px   at 36% 17%, rgba(237,237,232,0.7) 100%, transparent 100%),
    radial-gradient(circle 1.3px at 43% 3%,  var(--nebula-star) 100%, transparent 100%),
    radial-gradient(circle 1px   at 50% 11%, rgba(237,237,232,0.6) 100%, transparent 100%),
    radial-gradient(circle 1.2px at 57% 23%, rgba(237,237,232,0.7) 100%, transparent 100%),
    radial-gradient(circle 1px   at 64% 6%,  rgba(237,237,232,0.5) 100%, transparent 100%),
    radial-gradient(circle 1.4px at 71% 15%, var(--nebula-star) 100%, transparent 100%),
    radial-gradient(circle 1px   at 78% 4%,  rgba(237,237,232,0.6) 100%, transparent 100%),
    radial-gradient(circle 1.2px at 85% 20%, var(--nebula-star) 100%, transparent 100%),
    radial-gradient(circle 1px   at 92% 10%, rgba(237,237,232,0.7) 100%, transparent 100%),
    radial-gradient(circle 1.3px at 97% 26%, var(--nebula-star) 100%, transparent 100%),
    /* === Левая полоса (X < 15%) на средней высоте === */
    radial-gradient(circle 1px   at 3% 36%,  rgba(237,237,232,0.5) 100%, transparent 100%),
    radial-gradient(circle 1.2px at 8% 44%,  rgba(237,237,232,0.6) 100%, transparent 100%),
    radial-gradient(circle 1px   at 4% 52%,  rgba(237,237,232,0.5) 100%, transparent 100%),
    radial-gradient(circle 1.3px at 11% 60%, var(--nebula-star)   100%, transparent 100%),
    radial-gradient(circle 1px   at 5% 68%,  rgba(237,237,232,0.6) 100%, transparent 100%),
    /* === Правая полоса (X > 85%) на средней высоте === */
    radial-gradient(circle 1.2px at 88% 38%, rgba(237,237,232,0.7) 100%, transparent 100%),
    radial-gradient(circle 1px   at 95% 46%, rgba(237,237,232,0.5) 100%, transparent 100%),
    radial-gradient(circle 1.4px at 91% 55%, var(--nebula-star)   100%, transparent 100%),
    radial-gradient(circle 1px   at 96% 63%, rgba(237,237,232,0.6) 100%, transparent 100%),
    radial-gradient(circle 1.2px at 89% 72%, rgba(237,237,232,0.7) 100%, transparent 100%),
    /* === Нижняя зона (Y > 78%) — полная ширина === */
    radial-gradient(circle 1.3px at 6% 82%,  var(--nebula-star)   100%, transparent 100%),
    radial-gradient(circle 1px   at 14% 88%, rgba(237,237,232,0.6) 100%, transparent 100%),
    radial-gradient(circle 1.2px at 22% 95%, rgba(237,237,232,0.7) 100%, transparent 100%),
    radial-gradient(circle 1px   at 30% 80%, rgba(237,237,232,0.5) 100%, transparent 100%),
    radial-gradient(circle 1.3px at 38% 92%, var(--nebula-star)   100%, transparent 100%),
    radial-gradient(circle 1px   at 47% 84%, rgba(237,237,232,0.6) 100%, transparent 100%),
    radial-gradient(circle 1.2px at 55% 97%, rgba(237,237,232,0.5) 100%, transparent 100%),
    radial-gradient(circle 1px   at 63% 81%, rgba(237,237,232,0.6) 100%, transparent 100%),
    radial-gradient(circle 1.3px at 71% 90%, var(--nebula-star)   100%, transparent 100%),
    radial-gradient(circle 1px   at 79% 83%, rgba(237,237,232,0.5) 100%, transparent 100%),
    radial-gradient(circle 1.2px at 87% 95%, rgba(237,237,232,0.7) 100%, transparent 100%),
    radial-gradient(circle 1px   at 94% 87%, rgba(237,237,232,0.6) 100%, transparent 100%);
  animation: twinkle 6s ease-in-out infinite;
}

@keyframes twinkle {
  0%, 100% { opacity: 0.7; }
  50%      { opacity: 1; }
}

/* Контент landing — над звёздами */
.state-landing .landing-hero,
.state-landing .landing-input-bar,
.state-landing .input-hints {
  position: relative;
  z-index: 2;
}

/* ===== BODYGRAPH PANEL · плавное свечение от шапки + звёзды по краям (dark only) ===== */
/* Glow и stars живут на ВСЕЙ панели — захватывают и шапку «Dima Проектор», поэтому никакой обрезки */
/* isolation: isolate + z-index: -1 → pseudo сидит ПОД содержимым (header, SVG), но НАД фоном панели */
[data-theme="dark"] .swipe-panel[data-panel="graph"] {
  isolation: isolate;
}

[data-theme="dark"] .swipe-panel[data-panel="graph"]::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background:
    radial-gradient(ellipse 110% 60% at 50% 0%,  var(--nebula-glow)   0%, transparent 70%),
    radial-gradient(ellipse 70% 40% at 20% -5%, var(--nebula-accent) 0%, transparent 70%);
}

/* Звёзды только по краям (≤8% или ≥92% по X), чтобы не светились через карту бодиграфа */
[data-theme="dark"] .swipe-panel[data-panel="graph"]::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  opacity: 0.7;
  background-image:
    /* Левая полоса */
    radial-gradient(circle 1.2px at 2% 8%,   var(--nebula-star)   100%, transparent 100%),
    radial-gradient(circle 1px   at 5% 16%,  rgba(237,237,232,0.6) 100%, transparent 100%),
    radial-gradient(circle 1.3px at 3% 26%,  var(--nebula-star)   100%, transparent 100%),
    radial-gradient(circle 1px   at 6% 35%,  rgba(237,237,232,0.5) 100%, transparent 100%),
    radial-gradient(circle 1.2px at 2% 44%,  var(--nebula-star)   100%, transparent 100%),
    radial-gradient(circle 1px   at 5% 53%,  rgba(237,237,232,0.6) 100%, transparent 100%),
    radial-gradient(circle 1.3px at 3% 62%,  rgba(237,237,232,0.7) 100%, transparent 100%),
    radial-gradient(circle 1px   at 6% 72%,  rgba(237,237,232,0.5) 100%, transparent 100%),
    radial-gradient(circle 1.2px at 2% 81%,  var(--nebula-star)   100%, transparent 100%),
    radial-gradient(circle 1px   at 5% 91%,  rgba(237,237,232,0.6) 100%, transparent 100%),
    /* Правая полоса */
    radial-gradient(circle 1.2px at 98% 9%,  var(--nebula-star)   100%, transparent 100%),
    radial-gradient(circle 1px   at 95% 17%, rgba(237,237,232,0.5) 100%, transparent 100%),
    radial-gradient(circle 1.3px at 97% 27%, var(--nebula-star)   100%, transparent 100%),
    radial-gradient(circle 1px   at 94% 37%, rgba(237,237,232,0.6) 100%, transparent 100%),
    radial-gradient(circle 1.2px at 98% 47%, rgba(237,237,232,0.7) 100%, transparent 100%),
    radial-gradient(circle 1px   at 95% 56%, rgba(237,237,232,0.5) 100%, transparent 100%),
    radial-gradient(circle 1.3px at 97% 66%, var(--nebula-star)   100%, transparent 100%),
    radial-gradient(circle 1px   at 94% 76%, rgba(237,237,232,0.6) 100%, transparent 100%),
    radial-gradient(circle 1.2px at 98% 85%, var(--nebula-star)   100%, transparent 100%),
    radial-gradient(circle 1px   at 95% 94%, rgba(237,237,232,0.5) 100%, transparent 100%);
  animation: twinkle 6s ease-in-out infinite;
}


/* ===== PROTECTED FABs (dark only) ===== */
/* z-index намеренно не трогаем — оставляем родной 1200, иначе landing-overlay (z-index 500) перекроет */
[data-theme="dark"] .fab-sidebar {
  background: var(--glass-bg-fab);
  border: 1px solid var(--glass-border-strong);
  backdrop-filter: var(--blur-sm);
  -webkit-backdrop-filter: var(--blur-sm);
  color: var(--text-primary);
  transition: background 0.2s ease, border-color 0.2s ease;
}
[data-theme="dark"] .fab-sidebar:hover {
  background: rgba(15, 20, 30, 0.9);
  border-color: rgba(255, 255, 255, 0.24);
}
[data-theme="dark"] .fab-sidebar:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

[data-theme="dark"] .fab-login {
  background: var(--glass-bg-fab);
  border: 1px solid var(--glass-border-strong);
  backdrop-filter: var(--blur-sm);
  -webkit-backdrop-filter: var(--blur-sm);
  color: var(--text-primary);
}
[data-theme="dark"] .fab-login:active {
  background: rgba(15, 20, 30, 0.9);
  border-color: rgba(255, 255, 255, 0.24);
}

/* ===== CHAT BUBBLES (dark) ===== */
.chat-message.user {
  background: var(--bg-message-user);
  color: var(--ink-message-user);
  font-weight: 500;
  border: none;
}
.chat-message.assistant {
  background: var(--bg-message-ai);
  color: var(--ink-message-ai);
  border: 1px solid var(--border-message-ai);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.chat-message.assistant .chat-copy-btn {
  color: var(--text-secondary);
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
  .state-landing .landing-overlay::after,
  .swipe-panel[data-panel="graph"]::after {
    animation: none !important;
  }
}

/* ===== DARK GLASSMORPHISM (зеркалит light) ===== */

/* Modal — стеклянный контейнер с мягкой обводкой */
[data-theme="dark"] .modal-container {
  background: var(--glass-bg-modal);
  backdrop-filter: var(--blur-lg);
  -webkit-backdrop-filter: var(--blur-lg);
  border: 1px solid var(--glass-border);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

/* Desktop: сдвигаем колонку «Дизайн» чуть правее — слева упиралась в край */
.desktop-planets-wrap > .desktop-planets:first-child {
  margin-left: 24px !important;
}

/* ===== LANG SWITCHER (sidebar footer item) =====
   Флажок позиционируется как SVG-иконки других пунктов (абсолютно при
   left:10px), чтобы текст «Русский · EN» стартовал с той же вертикали,
   что и «Сменить тему» / «Настройки». */
.sidebar-lang-emoji {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  display: inline-flex;
  justify-content: center;
  font-size: 15px;
  line-height: 1;
  margin: 0 !important;
}

/* ===== EN BETA DISCLAIMER ===== */
/* Баннер виден только при <html lang="en">. В ru-режиме — display:none. */
.beta-disclaimer-en {
  display: none;
}
html[lang="en"] .beta-disclaimer-en {
  display: block;
  position: absolute;
  top: 64px; /* ниже ряда fab-кнопок (бургер / Log in), чтобы не перекрывались */
  left: 50%;
  transform: translateX(-50%);
  max-width: min(480px, calc(100vw - 32px));
  padding: 6px 14px;
  font-size: 11px;
  line-height: 1.3;
  text-align: center;
  color: rgba(255, 255, 255, 0.65);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 3;
  pointer-events: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
[data-theme="light"] html[lang="en"] .beta-disclaimer-en,
html[lang="en"][data-theme="light"] .beta-disclaimer-en {
  color: rgba(26, 26, 46, 0.7);
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.1);
}

/* ===== GENDER RADIO в форме расчёта ===== */
.gender-radio-row {
  display: flex;
  gap: 8px;
}
.gender-radio {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-input);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  user-select: none;
  transition: border-color var(--transition-fast), background var(--transition-fast);
}
.gender-radio input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  min-width: 12px;
  min-height: 12px;
  aspect-ratio: 1 / 1;
  box-sizing: border-box;
  border-radius: 50%;
  border: 1.5px solid var(--text-muted);
  background: transparent;
  padding: 0;
  margin: 0;
  flex-shrink: 0;
  position: relative;
  top: 1px; /* Оптическое выравнивание по центру текста (визуально кружок «всплывает» на 1-2px выше baseline) */
  transition: border-color var(--transition-fast);
}
.gender-radio input[type="radio"]::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  transform: translate(-50%, -50%) scale(0);
  transition: transform 0.12s ease;
}
.gender-radio input[type="radio"]:checked {
  border-color: var(--accent);
}
.gender-radio input[type="radio"]:checked::before {
  transform: translate(-50%, -50%) scale(1);
}
.gender-radio:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-light);
}
.gender-radio span {
  line-height: 1;
}

/* ===== BODYGRAPH PULSE HINT =====
   Применяется одним классом .hd-pulse-hint на center/channel/gate.
   Два слоя glow (для iOS Safari 15 compat):
   — stroke + stroke-width: красная обводка, работает в любом WebKit,
     наследуется от <g> канала к детям-path'ам. stroke-width в пике 7px
     шире чёрного #stroke-контура (3px), перекрывает его.
   — filter: drop-shadow: ореол. Радиус константа 18px в обоих keyframes —
     WebKit ≤ Safari 15 «схлопывает» filter с нулевым радиусом и рвёт
     анимацию, при константе рендерит нормально.
   !important — bodygraph.js ставит inline `transition: filter 0.3s`,
   который иначе «съедает» CSS-анимацию. */
.hd-pulse-hint {
  animation: hd-pulse-hint-glow 1.5s ease-in-out 1 !important;
}
@keyframes hd-pulse-hint-glow {
  0%, 100% {
    stroke: rgba(220, 38, 38, 0);
    stroke-width: 0;
    filter: drop-shadow(0 0 18px rgba(220, 38, 38, 0));
  }
  50% {
    stroke: rgba(220, 38, 38, 0.9);
    stroke-width: 7;
    filter: drop-shadow(0 0 18px rgba(220, 38, 38, 1));
  }
}
/* <text> ворот — fill НЕ меняем (иначе цифра сливается с красным ореолом
   и «10» не читается). paint-order:stroke fill — stroke под fill, виден
   только по краям. */
text.hd-pulse-hint {
  paint-order: stroke fill;
  animation: hd-pulse-hint-text 1.5s ease-in-out 1 !important;
}
@keyframes hd-pulse-hint-text {
  0%, 100% {
    stroke: rgba(220, 38, 38, 0);
    stroke-width: 0;
    filter: drop-shadow(0 0 8px rgba(220, 38, 38, 0));
  }
  50% {
    stroke: rgba(220, 38, 38, 1);
    stroke-width: 2;
    filter: drop-shadow(0 0 8px rgba(220, 38, 38, 0.9));
  }
}
@media (prefers-reduced-motion: reduce) {
  .hd-pulse-hint,
  text.hd-pulse-hint {
    animation-duration: 1.2s !important;
  }
}

/* ===== «?» КНОПКА ПОДСКАЗОК — справа под кнопкой «Совместимость» =====
   Позиция: ниже .graph-side-btn-right (top:25%, высота ~60px) с отступом ~14px.
   В правом верхнем углу была коллизия с .fab-login, теперь зона чистая. */
.bodygraph-hints-btn {
  position: absolute;
  top: calc(25% + 50px);
  right: 22px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: rgba(255, 255, 255, 0.85);
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  z-index: 5;
  transition: background 0.15s, color 0.15s, transform 0.15s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}
.bodygraph-hints-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.15);
  transform: scale(1.08);
}
.bodygraph-hints-btn:active {
  transform: scale(0.96);
}
[data-theme="light"] .bodygraph-hints-btn {
  background: rgba(250, 248, 253, 0.95);
  border-color: rgba(26, 26, 46, 0.15);
  color: #4a3c66;
  box-shadow: 0 2px 8px rgba(26, 26, 46, 0.1);
}
[data-theme="light"] .bodygraph-hints-btn:hover {
  background: #fff;
  color: #1a1a2e;
}
/* Мобила: на узких экранах кнопка стоит слишком высоко — опускаем ниже,
   чтобы не наезжала на область контуров головы/горла. */
@media (max-width: 720px) {
  .bodygraph-hints-btn {
    top: calc(25% + 110px);
  }
  .bodygraph-tap-label {
    top: calc(25% + 190px);
  }
}

/* Лёгкая подсказка-ярлык слева от бодиграфа, появляется вместе с pulse
   по клику на «?». */
.bodygraph-tap-label {
  position: absolute;
  top: calc(25% + 130px);
  left: 10px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0.02em;
  color: #ffffff;
  white-space: nowrap;
  pointer-events: none;
  z-index: 4;
  animation: tap-label-pulse 1.5s ease-in-out 3;
}
@keyframes tap-label-pulse {
  0%, 100% { opacity: 0.5; }
  50%      { opacity: 1; }
}
[data-theme="light"] .bodygraph-tap-label {
  color: #1a1a2e;
}

/* === Старый класс .bodygraph-tap-hint оставлен для обратной совместимости,
   но функция теперь рисует pulse, а не плашку. Оставляем CSS для случая
   если где-то ещё вызывается со старым DOM-элементом. === */
.bodygraph-tap-hint {
  position: absolute;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(8px);
  padding: 10px 16px;
  border-radius: 20px;
  background: var(--glass-bg-modal);
  border: 1px solid var(--glass-border-strong);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--text-primary);
  font-size: 13px;
  line-height: 1.3;
  white-space: nowrap;
  max-width: calc(100vw - 32px);
  pointer-events: none;
  z-index: 20;
  opacity: 0;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
  animation: bodygraph-tap-hint-in 0.5s ease-out 0.8s forwards,
             bodygraph-tap-hint-pulse 2.4s ease-in-out 1.3s infinite;
}
.bodygraph-tap-hint--out {
  animation: bodygraph-tap-hint-out 0.4s ease-in forwards !important;
}
@keyframes bodygraph-tap-hint-in {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
@keyframes bodygraph-tap-hint-out {
  from { opacity: 1; transform: translateX(-50%) translateY(0); }
  to   { opacity: 0; transform: translateX(-50%) translateY(8px); }
}
@keyframes bodygraph-tap-hint-pulse {
  0%, 100% { box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4); }
  50%      { box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4), 0 0 0 6px rgba(184, 196, 211, 0.12); }
}
[data-theme="light"] .bodygraph-tap-hint {
  background: rgba(250, 248, 253, 0.95);
  border-color: rgba(26, 26, 46, 0.12);
  color: #1a1a2e;
  box-shadow: 0 6px 24px rgba(26, 26, 46, 0.12);
}
@media (prefers-reduced-motion: reduce) {
  .bodygraph-tap-hint {
    animation: bodygraph-tap-hint-in 0.3s ease-out 0.4s forwards !important;
  }
}

/* Confirm popup — стеклянная карточка, заметная на nebula-фоне */
[data-theme="dark"] .confirm-box {
  background: var(--glass-bg-modal);
  border: 1px solid var(--glass-border-strong);
  backdrop-filter: var(--blur-lg);
  -webkit-backdrop-filter: var(--blur-lg);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
}
[data-theme="dark"] .confirm-btn-cancel {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
}
[data-theme="dark"] .confirm-btn-cancel:active {
  background: rgba(255, 255, 255, 0.12);
}
[data-theme="dark"] .confirm-btn-ok {
  background: var(--accent);
  color: var(--accent-ink);
}
[data-theme="dark"] .confirm-btn-ok:active {
  background: var(--accent-hover);
}

/* Bodygraph popup (Сакральный | Спросить AI) — заметная обводка + плотнее fill */
[data-theme="dark"] .bodygraph-popup {
  background: var(--glass-bg-popup);
  border: 1px solid var(--glass-border-accent);
  backdrop-filter: var(--blur-md);
  -webkit-backdrop-filter: var(--blur-md);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.6);
}

/* Sheet-chat (мобильный bottom sheet) — стекло */
[data-theme="dark"] .sheet-chat {
  background: var(--glass-bg-sheet);
  backdrop-filter: var(--blur-xl);
  -webkit-backdrop-filter: var(--blur-xl);
}
[data-theme="dark"] .sheet-chat.open {
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.5);
  border-top: 1px solid var(--glass-border);
}
[data-theme="dark"] .sheet-chat-input {
  border-top-color: rgba(255, 255, 255, 0.06);
}

/* ===== INBOX / NOTIFICATIONS MODAL (modal-with-hero) — DARK ===== */
[data-theme="dark"] .ooc-overlay .modal-container.modal-with-hero {
  background:
    radial-gradient(ellipse 180% 100% at 50% 0%, rgba(91, 163, 190, 0.22) 0%, transparent 60%),
    linear-gradient(to bottom, rgba(40, 50, 75, 0.55) 0%, rgba(20, 25, 38, 0.85) 100%),
    #0F1421;
  color: #f3f4f6;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Hero (заголовок, описание, иконка, крестик) */
[data-theme="dark"] .modal-with-hero .modal-hero-title { color: #f3f4f6; }
[data-theme="dark"] .modal-with-hero .modal-hero-sub   { color: rgba(243, 244, 246, 0.65); }
[data-theme="dark"] .modal-with-hero .modal-hero-icon  { filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4)); }
[data-theme="dark"] .modal-with-hero .modal-hero-close {
  background: rgba(255, 255, 255, 0.08);
  color: #f3f4f6;
}
[data-theme="dark"] .modal-with-hero .modal-hero-close:hover {
  background: rgba(255, 255, 255, 0.16);
}

/* Toolbar */
[data-theme="dark"] .modal-with-hero .inbox-toolbar {
  background: rgba(255, 255, 255, 0.04);
  border-top-color: rgba(255, 255, 255, 0.08);
  border-bottom-color: rgba(255, 255, 255, 0.08);
}
[data-theme="dark"] .modal-with-hero .inbox-action-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #f3f4f6;
}
[data-theme="dark"] .modal-with-hero .inbox-action-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.24);
}

/* Карточки уведомлений */
[data-theme="dark"] .modal-with-hero .inbox-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
}
[data-theme="dark"] .modal-with-hero .inbox-card:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
[data-theme="dark"] .modal-with-hero .inbox-card.unread::before {
  background: #60a5fa;
}
[data-theme="dark"] .modal-with-hero .inbox-card-title { color: #f3f4f6; }
[data-theme="dark"] .modal-with-hero .inbox-card-body  { color: rgba(243, 244, 246, 0.7); }
[data-theme="dark"] .modal-with-hero .inbox-card-meta  { color: rgba(243, 244, 246, 0.4); }

[data-theme="dark"] .modal-with-hero .inbox-card-action {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(243, 244, 246, 0.7);
}
[data-theme="dark"] .modal-with-hero .inbox-card-action:hover {
  color: #f3f4f6;
  border-color: rgba(255, 255, 255, 0.3);
}
[data-theme="dark"] .modal-with-hero .inbox-card-action.delete:hover {
  color: #f87171;
  border-color: #f87171;
}

[data-theme="dark"] .modal-with-hero .inbox-empty {
  color: rgba(243, 244, 246, 0.5);
}

/* Notif settings */
[data-theme="dark"] .modal-with-hero .notif-hint {
  background: rgba(91, 163, 190, 0.12);
  border-color: rgba(91, 163, 190, 0.3);
  color: #f3f4f6;
}
[data-theme="dark"] .modal-with-hero .notif-hint em {
  background: rgba(255, 255, 255, 0.08);
}
[data-theme="dark"] .modal-with-hero .settings-section-title {
  color: rgba(243, 244, 246, 0.55);
}
[data-theme="dark"] .modal-with-hero .notif-radio,
[data-theme="dark"] .modal-with-hero .notif-checkbox {
  color: #f3f4f6;
}
[data-theme="dark"] .modal-with-hero .notif-radio input,
[data-theme="dark"] .modal-with-hero .notif-checkbox input {
  accent-color: #EDEDE8;
}
[data-theme="dark"] .modal-with-hero .notif-radio-hint {
  color: rgba(243, 244, 246, 0.55);
}
[data-theme="dark"] .modal-with-hero .notif-select {
  background-color: rgba(255, 255, 255, 0.06);
  color: #f3f4f6;
  border-color: rgba(255, 255, 255, 0.12);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23f3f4f6' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
}
[data-theme="dark"] .modal-with-hero .notif-push-status {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
  color: rgba(243, 244, 246, 0.75);
}

/* Welcome-list */
[data-theme="dark"] .modal-with-hero .notif-welcome-list li { color: #f3f4f6; }
[data-theme="dark"] .modal-with-hero .notif-welcome-list li::before { color: #60a5fa; }
[data-theme="dark"] .modal-with-hero .notif-welcome-hint { color: rgba(243, 244, 246, 0.6); }

/* Кнопки внутри */
[data-theme="dark"] .modal-with-hero .btn-calculate {
  background: var(--accent);
  color: var(--accent-ink);
}
[data-theme="dark"] .modal-with-hero .btn-calculate:hover {
  background: var(--accent-hover);
}
[data-theme="dark"] .modal-with-hero .modal-btn-secondary {
  color: rgba(243, 244, 246, 0.55);
}
[data-theme="dark"] .modal-with-hero .modal-btn-secondary:hover {
  color: #f3f4f6;
}
