﻿/* ============================================
   Lunora — Telegram Mini App
   Дизайн-система + компоненты
   ============================================ */

/* ---------- Дизайн-система: радиусы ----------
   Правило: радиус растёт вместе с размером элемента
   xs  (chip, badge, тег)       → 6px
   sm  (кнопка иконка, аккордеон) → 10px
   md  (карточка, plan/journal-item) → 14px
   lg  (большая карточка, card)   → 20px
   full (pill, аватар-badge)      → 999px
   circle (аватар, dot)           → 50%
*/
:root {
  /* Радиусы */
  --r-xs:   6px;
  --r-sm:   10px;
  --r-md:   14px;
  --r-lg:   20px;
  --r-full: 999px;

  /* Дизайн-система: отступы
     Правило: все карточки используют --space-card.
     journal-item/plan-item меньше — --space-item.
     chip/badge — --space-chip.
  */
  --space-card: 20px;      /* все .card, .status-card, .ai-insight-card */
  --space-item: 12px 14px; /* journal-item, plan-item */
  --space-chip: 4px 10px;  /* badge, chip */
}

/* ---------- Переменные темы ---------- */
:root[data-theme="dark"] {
  --bg:            #17153A;
  --bg-elev:       #1D1A45;
  --surface:       #2C295E;
  --surface-2:     #37336B;
  --card:          #2C295E;
  --bg-card:       #2C295E;
  --border:        rgba(212, 207, 255, 0.16);
  --border-strong: rgba(212, 207, 255, 0.30);
  --primary:       #7B6FC4;
  --primary-soft:  rgba(123, 111, 196, 0.18);
  --primary-hover: #8A7FD1;
  --gold:          #FED47A;
  --gold-soft:     rgba(254, 212, 122, 0.18);
  --blue:          #8EC6F0;
  --blue-soft:     rgba(142, 198, 240, 0.15);
  --teal:          #4ECDC4;
  --teal-soft:     rgba(78, 205, 196, 0.18);
  --text:          #F0EFF8;
  --text-secondary:#D4D2EE;
  --text-muted:    #B8B5DA;
  --muted:         #B8B5DA;
  --hover:         rgba(255, 255, 255, 0.10);
  --danger:        #FF7E89;
  --success:       #7BD389;
  /* Единая система теней: 3 уровня */
  --shadow-sm:     0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.08);
  --shadow:        0 2px 8px rgba(0, 0, 0, 0.14), 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-lg:     0 8px 24px rgba(0, 0, 0, 0.22), 0 2px 8px rgba(0, 0, 0, 0.10);
  --gradient-card: linear-gradient(155deg, rgba(123, 111, 196, 0.22) 0%, rgba(37, 35, 80, 0.0) 55%);
  --nav-bg:        #262355;
  --header-bg:     #17153A;
  --track:         rgba(255, 255, 255, 0.06);
  --input-bg:      #3A366F;
  --backdrop:      rgba(5, 4, 20, 0.55);
}

:root[data-theme="light"] {
  /* Фон — очень светлый лаванд, как у референса */
  --bg:            #F5F3FE;
  --bg-elev:       #E8E4FA;
  --surface:       #FFFFFF;
  --surface-2:     #F7F5FF;
  --card:          #FFFFFF;
  --bg-card:       #FFFFFF;
  --border:        rgba(100, 90, 180, 0.10);
  --border-strong: rgba(100, 90, 180, 0.18);
  /* Фиолетовый — чуть насыщеннее, чище */
  --primary:       #7C6FD4;
  --primary-soft:  rgba(124, 111, 212, 0.11);
  --primary-hover: #6F62CB;
  /* Золотой — убираем коричневатость, делаем тёплый солнечный */
  --gold:          #FED47A;
  --gold-soft:     rgba(254, 212, 122, 0.18);
  --blue:          #60A8E0;
  --blue-soft:     rgba(96, 168, 224, 0.12);
  --teal:          #3DBDB5;
  --teal-soft:     rgba(61, 189, 181, 0.15);
  --text:          #1E1A45;
  --text-secondary:#6F6A9F;
  /* #655E9A: контраст 5.80:1 на белом, 5.08:1 на фоне — проходит WCAG AA */
  --text-muted:    #655E9A;
  --muted:         #655E9A;
  --hover:         rgba(124, 111, 212, 0.08);
  --danger:        #E05C5C;
  --success:       #4DB868;
  /* Единая система теней: 3 уровня */
  --shadow-sm:     0 1px 3px rgba(100, 90, 180, 0.08), 0 1px 2px rgba(100, 90, 180, 0.05);
  --shadow:        0 2px 8px rgba(100, 90, 180, 0.10), 0 1px 3px rgba(100, 90, 180, 0.06);
  --shadow-lg:     0 8px 24px rgba(100, 90, 180, 0.14), 0 2px 8px rgba(100, 90, 180, 0.08);
  --gradient-card: linear-gradient(155deg, rgba(124, 111, 212, 0.08) 0%, rgba(255,255,255,0) 60%);
  --nav-bg:        #F5F3FE;
  --header-bg:     #F5F3FE;
  --track:         rgba(100, 90, 180, 0.09);
  --input-bg:      rgba(100, 90, 180, 0.05);
  --backdrop:      rgba(30, 26, 69, 0.35);
}

/* ---------- База ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%;
  min-height: 100vh;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.35s ease, color 0.35s ease;
  overscroll-behavior-y: contain;
}
html {
  scrollbar-gutter: stable;
}

body {
  padding-top: calc(env(safe-area-inset-top) + 64px);
  padding-bottom: calc(env(safe-area-inset-bottom) + 92px);
  padding-left: 16px;
  padding-right: 16px;
  max-width: 560px;
  margin: 0 auto;
  position: relative;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
a { color: inherit; text-decoration: none; }
input { font-family: inherit; }

/* ---------- Декоративный фон (звёзды) ---------- */
.bg-stars {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    radial-gradient(1.5px 1.5px at 12% 18%, rgba(245, 200, 66, 0.9), transparent 60%),
    radial-gradient(1px 1px at 82% 12%, rgba(240, 239, 248, 0.7), transparent 60%),
    radial-gradient(1.2px 1.2px at 45% 8%,  rgba(142, 198, 240, 0.8), transparent 60%),
    radial-gradient(1px 1px at 70% 25%, rgba(240, 239, 248, 0.5), transparent 60%),
    radial-gradient(1.3px 1.3px at 25% 35%, rgba(245, 200, 66, 0.5), transparent 60%),
    radial-gradient(1px 1px at 92% 40%, rgba(240, 239, 248, 0.4), transparent 60%),
    radial-gradient(1.5px 1.5px at 8% 55%, rgba(142, 198, 240, 0.5), transparent 60%),
    radial-gradient(1px 1px at 55% 62%, rgba(245, 200, 66, 0.4), transparent 60%);
  transition: opacity 0.4s ease;
}
:root[data-theme="light"] .bg-stars { opacity: 0; }

/* ---------- Шапка ---------- */
.app-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: calc(env(safe-area-inset-top) + 60px);
  padding: env(safe-area-inset-top) 14px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--header-bg);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-bottom: 1px solid var(--border);
  z-index: 30;
  max-width: 560px;
  margin: 0 auto;
}
:root[data-theme="light"] .app-header { border-bottom-color: rgba(100, 90, 180, 0.06); }

.header-left { display: flex; align-items: center; gap: 10px; min-width: 0; position: relative; }
.logo { flex-shrink: 0; filter: drop-shadow(0 2px 8px rgba(245, 200, 66, 0.25)); }

.brand { font-size: 15px; font-weight: 700; letter-spacing: -0.01em; }

/* Переключатель детей */
.child-switcher {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px 5px 5px;
  border-radius: 999px;
  background: var(--primary-soft);
  transition: background 0.2s ease, transform 0.12s ease;
  min-width: 0;
}
.child-switcher:active { transform: scale(0.97); }
.child-switcher[aria-expanded="true"] { background: var(--primary); color: #fff; }

.child-avatar {
  width: 24px; height: 24px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--primary) 0%, var(--gold) 130%);
  flex-shrink: 0;
}
.child-avatar--add {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, #8f83c1 0%, #9c90d0 100%);
}
.child-avatar-plus {
  width: 14px;
  height: 14px;
  display: block;
  stroke: #ffffff;
  stroke-width: 2.6;
  stroke-linecap: round;
  fill: none;
}
.child-switcher[aria-expanded="true"] .child-avatar {
  background: rgba(255,255,255,0.25);
}
.child-avatar--girl {
  background: linear-gradient(135deg, #e87fa8 0%, #f7b8ce 100%);
}
.child-avatar--boy {
  background: linear-gradient(135deg, #5aabdf 0%, #8fd0f5 100%);
}
:root[data-theme="light"] .child-avatar--girl {
  background: linear-gradient(135deg, #e8699a 0%, #f4a8c4 100%);
}
:root[data-theme="light"] .child-avatar--boy {
  background: linear-gradient(135deg, #3d9fd6 0%, #7cc4ef 100%);
}
.child-name {
  font-size: 13px;
  font-weight: 600;
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chev { transition: transform 0.25s ease; opacity: 0.7; }
.child-switcher[aria-expanded="true"] .chev { transform: rotate(180deg); opacity: 1; }

/* Дропдаун детей */
.child-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 42px;
  min-width: 220px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  padding: 6px;
  box-shadow: var(--shadow-lg);
  display: none;
  flex-direction: column;
  gap: 2px;
  z-index: 40;
  animation: dropIn 0.18s ease;
}
.child-dropdown.open { display: flex; }

@keyframes dropIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.child-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  text-align: left;
  transition: background 0.15s ease;
  width: 100%;
}
.child-option:hover { background: var(--primary-soft); }
.child-option.active {
  background: var(--primary-soft);
}
.child-option .child-avatar { width: 30px; height: 30px; font-size: 13px; }
.child-option-name { font-size: 14px; font-weight: 600; }
.child-option-gender { font-size: 12px; color: var(--text-muted); font-weight: 400; }
.child-option-age  { font-size: 12px; color: var(--text-muted); }
.child-option-meta { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.child-option-check {
  color: var(--primary);
  opacity: 0;
  transition: opacity 0.15s;
}
.child-option.active .child-option-check { opacity: 1; }

.header-right { display: flex; align-items: center; gap: 2px; }

.icon-btn {
  position: relative;
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 12px;
  color: var(--text);
  transition: background 0.2s ease, transform 0.15s ease;
}
.icon-btn:hover { background: var(--primary-soft); }
.icon-btn:active { transform: scale(0.93); }

.notif-dot {
  position: absolute;
  top: 10px; right: 10px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 2px var(--bg);
}

:root[data-theme="dark"] .icon-moon { display: none; }
:root[data-theme="light"] .icon-sun { display: none; }

/* v5.6.25: Кнопка-нота в хедере + плывущие волны. Два состояния: статичное и .is-playing */
.icon-btn-sounds {
  color: var(--text);
  overflow: visible;
}
.icon-btn-sounds.is-playing { color: var(--primary); }
.icon-btn-sounds .icon-note {
  transition: color 0.2s ease, transform 0.2s ease;
}
.icon-btn-sounds.is-playing .icon-note {
  /* лёгкий «drop» при игре — нота живая */
  animation: note-bob 1.6s ease-in-out infinite;
  transform-origin: 50% 70%;
}
@keyframes note-bob {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  25%      { transform: translateY(-1px) rotate(-3deg); }
  50%      { transform: translateY(0) rotate(0deg); }
  75%      { transform: translateY(-1px) rotate(3deg); }
}
.icon-btn-sounds .sound-waves {
  position: absolute;
  top: 7px; right: 4px;
  width: 12px; height: 14px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.icon-btn-sounds.is-playing .sound-waves { opacity: 1; }
.icon-btn-sounds .wave {
  position: absolute;
  top: 50%; left: 0;
  width: 6px; height: 6px;
  border: 1.6px solid currentColor;
  border-color: transparent currentColor currentColor transparent;
  border-radius: 0 6px 6px 0;
  transform: translateY(-50%) scale(0.6);
  opacity: 0;
}
.icon-btn-sounds.is-playing .wave-1 { animation: wave-emit 1.6s ease-out infinite; }
.icon-btn-sounds.is-playing .wave-2 { animation: wave-emit 1.6s ease-out infinite 0.8s; }
@keyframes wave-emit {
  0%   { transform: translateY(-50%) scale(0.4); opacity: 0; }
  20%  { opacity: 0.9; }
  100% { transform: translateY(-50%) scale(1.4) translateX(4px); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .icon-btn-sounds.is-playing .icon-note,
  .icon-btn-sounds.is-playing .wave-1,
  .icon-btn-sounds.is-playing .wave-2 { animation: none; }
  .icon-btn-sounds.is-playing .sound-waves { opacity: 0; }
}

/* Premium lock for header sounds button */
.icon-btn-premium-locked {
  opacity: 0.48;
}
.icon-btn-premium-locked:hover {
  background: transparent;
}
.icon-btn-premium-locked:active {
  transform: none;
}
.icon-btn-premium-locked .sound-waves {
  display: none !important;
}
.header-premium-badge {
  position: absolute;
  top: 4px;
  right: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  box-shadow: 0 1px 3px rgba(0,0,0,0.22);
  z-index: 2;
}

/* ---------- Main ---------- */
.app-main { position: relative; z-index: 1; padding-top: 8px; }

/* Вкладки */
.tab-panel {
  display: none;
  animation: tabEnter 0.32s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.tab-panel.active { display: block; }

@keyframes tabEnter {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Карточки ---------- */
.card {
  border-radius: var(--r-lg);
  background: var(--surface);
  padding: var(--space-card);
  box-shadow: var(--shadow-sm);
  border: none;
  margin-bottom: 14px;
  position: relative;
  overflow: hidden;
}
.card-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 14px;
}

/* ---------- Карточка статуса ---------- */
.status-card {
  padding: var(--space-card);
  background: var(--surface) !important;
}

.status-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 13px;
  font-weight: 600;
}
.status-card.is-sleeping .status-indicator {
  background: var(--primary-soft);
  color: var(--primary);
}
.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 25%, transparent);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.status-time {
  font-size: 13px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.status-timer { margin: 6px 0 18px; }
.timer-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.btn-pause {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--primary);
  background: transparent;
  color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
  padding: 0;
}
.btn-pause.paused {
  background: var(--primary);
  color: #fff;
}
.btn-pause:active { opacity: 0.75; }
.timer-label {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.timer-value {
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  background: linear-gradient(135deg, var(--text) 0%, var(--primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.timer-sub {
  margin-top: 6px;
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}
.timer-sub.over {
  color: var(--danger);
  font-weight: 600;
}

/* Прогресс-бар */
.progress { margin-bottom: 18px; position: relative; }
.progress::before {
  content: '';
  display: block;
  height: 8px;
  border-radius: 999px;
  background: var(--track);
  margin-bottom: 8px;
}
.progress-bar {
  position: absolute;
  top: 0;
  left: 0;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--gold) 0%, var(--gold) 100%);
  transition: width 0.6s cubic-bezier(0.2, 0.8, 0.2, 1), background 0.3s ease;
  width: 0;
  box-shadow: 0 0 12px rgba(245, 200, 66, 0.35);
}
.progress-bar.over {
  background: linear-gradient(90deg, #E57373 0%, #FF8A80 100%);
  box-shadow: 0 0 12px rgba(229, 115, 115, 0.4);
}

/* Сегментированный прогресс-бар (пауза) */
.progress-seg {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 8px;
  display: flex;
}
.progress-seg-sleep {
  height: 100%;
  background: linear-gradient(90deg, var(--gold) 0%, var(--gold) 100%);
  transition: width 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
  flex-shrink: 0;
}
.progress-seg-pause {
  height: 100%;
  background: linear-gradient(90deg, #7C6FCD 0%, #9B8EE8 100%);
  transition: width 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
  flex-shrink: 0;
}
.progress-seg-sleep2 {
  height: 100%;
  background: linear-gradient(90deg, var(--gold) 0%, var(--gold) 100%);
  transition: width 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
  flex-shrink: 0;
}
/* Метка паузы под баром */
.pause-label {
  font-size: 11px;
  color: #9B8EE8;
  font-weight: 500;
  margin-top: 2px;
  display: none;
  text-align: center;
}
.pause-label.visible {
  display: block;
}
.progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* Кнопки действий */
.action-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* Базовая кнопка */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 16px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 600;
  transition: transform 0.12s ease, background 0.2s ease, opacity 0.2s ease, box-shadow 0.2s ease;
  white-space: nowrap;
}
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled {
  opacity: 1;
  cursor: not-allowed;
  background: var(--surface-2) !important;
  color: var(--text-muted) !important;
  box-shadow: none !important;
  border: 1px solid var(--border) !important;
  filter: none !important;
}
.status-card .btn:disabled {
  border: none !important;
  opacity: 1;
  background: #eceaf2 !important;
  color: #9a95b3 !important;
  box-shadow: none !important;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, #8A7ED5 100%);
  color: #fff;
  box-shadow: var(--shadow);
}
.btn-primary:hover:not(:disabled) { box-shadow: var(--shadow-lg); }

.btn-secondary {
  background: var(--gold);
  color: #1A1840;
  box-shadow: var(--shadow-sm);
}
.btn-secondary:hover:not(:disabled) { box-shadow: var(--shadow); }

.status-card #btnSleep {
  background: #8f83c1;
  color: #fff;
  box-shadow: none;
}

.status-card #btnWake {
  background: var(--gold);
  color: #3e315b;
  box-shadow: none;
}
.status-card #btnFeeding {
  background: #eee9fd;
  color: #4a3b74;
  box-shadow: none;
}

.btn-outline {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
}
.btn-outline:hover { background: var(--surface-2); }

.btn-gold-gradient {
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold) 100%);
  color: #1A1840;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.10);
}

.btn-block { width: 100%; }

.btn-danger {
  background: var(--danger);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.btn-danger:hover:not(:disabled) { opacity: 0.9; }

.btn-ai {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
}
.btn-ai:hover { opacity: 0.9; }

/* Кнопка кормления — адаптивные цвета по теме */
.btn-feeding {
  width: 100%;
  margin-top: 10px;
  background: #eee9fd;
  color: #4b3f78;
  box-shadow: none;
}
.btn-feeding:hover:not(:disabled) { opacity: 0.9; }

/* Тёмная тема — насыщенный фиолетовый, белый текст (контраст 5.2:1) */
:root[data-theme="dark"] .btn-feeding {
  background: #eee9fd;
  color: #4b3f78;
  box-shadow: none;
}

/* Светлая тема — нежно-лавандовый, тёмно-фиолетовый текст (контраст 9.3:1) */
:root[data-theme="light"] .btn-feeding {
  background: #eee9fd;
  color: #4b3f78;
  box-shadow: none;
}

/* ---------- Сегодня ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.stat {
  background: var(--surface);
  border-radius: var(--r-md); /* меньше внешней карточки r-lg */
  padding: 12px 10px;
  text-align: center;
  border: none;
  box-shadow: inset 0 0 0 1px rgba(124, 111, 212, 0.14);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.stat-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  background: color-mix(in srgb, var(--primary) 10%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  margin-bottom: 2px;
}
.stat-icon--sleep { background: color-mix(in srgb, var(--primary) 10%, transparent); color: var(--primary); }
.stat-icon--night { background: #2D3A5A; color: #A8C4FF; }
.stat-icon--wake  { background: color-mix(in srgb, var(--gold) 15%, transparent); color: var(--gold); }
.stat-value {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.stat-sub { color: var(--text-muted); font-weight: 500; font-size: 14px; }
.stat-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ---------- Следующий сон ---------- */
.next-nap-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
}
.next-nap-icon {
  width: 48px; height: 48px;
  border-radius: 14px;
  display: grid; place-items: center;
  background: var(--gold-soft);
  color: var(--gold);
  flex-shrink: 0;
}
.next-nap-info { flex: 1; }
.next-nap-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 2px;
}
.next-nap-time {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.next-nap-countdown {
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}
.countdown-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--gold);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.countdown-unit {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  margin-top: 2px;
}

/* ---------- План ---------- */
.plan-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 14px;
  padding: 4px 4px 0;
}
.plan-date-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 2px;
}
.plan-date {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.plan-list { display: flex; flex-direction: column; gap: 10px; }

/* Элемент плана — единый стиль с журналом */
.plan-item {
  background: var(--surface);
  border-radius: var(--r-md);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-sm);
  border: none;
}
/* Статус-бейдж плана */
.plan-status-badge {
  padding: 3px 9px;
  border-radius: var(--r-full);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  margin-left: auto;
}
.plan-status-badge.done    { background: rgba(123, 211, 137, 0.15); color: var(--success); }
.plan-status-badge.upcoming{ background: var(--blue-soft); color: var(--blue); }
.plan-status-badge.missed  { background: rgba(229, 115, 115, 0.15); color: var(--danger); }
.plan-status-badge.active  { background: rgba(167, 139, 250, 0.18); color: var(--primary); }

/* ---------- Журнал ---------- */
.journal-switcher {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border-radius: var(--r-md);
  padding: 6px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
  border: none;
}
.day-nav-btn {
  width: 36px; height: 36px;
  border-radius: var(--r-sm);
  display: grid; place-items: center;
  color: var(--text-muted);
  transition: background 0.2s ease, color 0.2s ease;
}
.day-nav-btn:not(:disabled):hover { background: var(--primary-soft); color: var(--text); }
.day-nav-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.day-label {
  flex: 1;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
}

.journal-list {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.journal-item {
  background: var(--surface);
  border-radius: var(--r-md);
  padding: 12px 14px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  box-shadow: var(--shadow-sm);
  border: none;
  cursor: pointer;
  transition: background 0.15s;
}
.journal-item:active {
  background: var(--surface-2);
}
.journal-item-chevron {
  color: var(--text-muted);
  flex-shrink: 0;
  align-self: center;
  margin-left: auto;
}
.journal-icon {
  width: 40px; height: 40px;
  border-radius: var(--r-sm);
  display: grid; place-items: center;
  font-size: 18px;
  flex-shrink: 0;
}
/* Иконки: сон (любой) = луна фиолетовая, пробуждение = солнце золотое, кормление = лаванда */
.journal-icon.sleep    { background: var(--primary-soft); color: var(--primary); }
.journal-icon.night    { background: #2D3A5A; color: #A8C4FF; }
.journal-icon.wake     { background: var(--gold-soft); color: var(--gold); }
.journal-icon.feeding  { background: rgba(155, 106, 174, 0.15); color: #9B6AAE; }

.journal-main { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.journal-label { font-size: 14px; font-weight: 600; line-height: 1.3; }
.journal-subline {
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}

/* ---------- Настройки ---------- */
.section-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 8px 6px 8px;
  margin-top: 6px;
}
.section-title:first-child { margin-top: 0; }

.section-card {
  padding: 6px 16px;
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
:root[data-theme="light"] .section-card .row {
  border-bottom-color: rgba(100, 90, 180, 0.07);
}
.row:last-child { border-bottom: none; }
.row-main { flex: 1; min-width: 0; }
.row-title { font-size: 14px; font-weight: 600; }
.row-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.row.as-link {
  transition: transform 0.12s ease;
  cursor: pointer;
}
button.row.as-link {
  width: 100%;
  background: none;
  border: none;
  padding-left: 0;
  padding-right: 0;
  text-align: left;
  font-family: inherit;
  color: inherit;
  -webkit-appearance: none;
  appearance: none;
}
.row.as-link:active { transform: scale(0.99); }
.row.as-link svg { color: var(--text-muted); }

.row-action {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 0;
  width: 100%;
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
  text-align: left;
}
.row-action-icon {
  width: 32px; height: 32px;
  border-radius: 10px;
  background: var(--primary-soft);
  display: grid; place-items: center;
  color: var(--primary);
  flex-shrink: 0;
}
.row-action.danger {
  color: var(--danger, #ff3b30);
}
.row-action.danger .row-action-icon {
  background: rgba(255,59,48,0.08);
  color: var(--danger, #ff3b30);
}

/* Дети — список */
.children-list { display: flex; flex-direction: column; }

.child-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.child-row .child-avatar {
  width: 40px; height: 40px;
  font-size: 15px;
}
.child-row-main { flex: 1; min-width: 0; }
.child-row-name { font-size: 14px; font-weight: 600; }
.child-row-age  { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.child-row-actions {
  display: flex;
  gap: 4px;
}
.ghost-btn {
  width: 32px; height: 32px;
  border-radius: 10px;
  display: grid; place-items: center;
  color: var(--text-muted);
  transition: background 0.15s, color 0.15s;
}
.ghost-btn:hover { background: var(--primary-soft); color: var(--text); }
.ghost-btn.danger:hover { background: rgba(229, 115, 115, 0.12); color: var(--danger); }

/* Семья — список */
.family-list { display: flex; flex-direction: column; }
.family-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.family-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.family-avatar.me    { background: linear-gradient(135deg, var(--primary) 0%, #8A7ED5 100%); }
.family-avatar.other { background: linear-gradient(135deg, var(--blue) 0%, #B4DBF5 100%); color: #1A1840; }
.family-row-main { flex: 1; min-width: 0; }
.family-name { font-size: 14px; font-weight: 600; }
.family-role { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.family-empty-hint {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  padding: 16px 0 8px;
}

/* Реферальная карточка */
.referral-card {
  background: var(--surface);
  padding: 20px;
  position: relative;
  overflow: hidden;
}
.referral-badge {
  display: inline-block;
  background: var(--gold);
  color: #1A1840;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}
.referral-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 6px;
}
.referral-text {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 14px;
}
/* Пошаговая инструкция партнёрской программы */
.partner-steps {
  margin-top: 14px;
}
.partner-steps-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
}
.partner-steps-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.partner-steps-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.partner-step-num {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary-soft);
  border: 1px solid var(--primary);
  color: var(--primary);
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
}
.partner-steps-list li span:last-child {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  padding-top: 3px;
}
.partner-link {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.referral-link {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--input-bg);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 4px 4px 4px 12px;
}
.referral-link input {
  flex: 1;
  border: none;
  background: none;
  outline: none;
  color: var(--text);
  font-size: 12px;
  padding: 10px 0;
  min-width: 0;
}
.copy-btn {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: grid; place-items: center;
  background: var(--primary);
  color: #fff;
  transition: background 0.15s, transform 0.12s;
  flex-shrink: 0;
}
.copy-btn:hover { background: #8A7ED5; }
.copy-btn:active { transform: scale(0.92); }
.copy-btn.success { background: var(--success); }

/* Подписка */
.subscription-card {
  padding: 20px;
  background: var(--surface);
  position: relative;
  overflow: hidden;
}
.sub-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.sub-title {
  font-size: 16px;
  font-weight: 700;
}
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.badge-trial   { background: var(--gold-soft); color: var(--gold); }
.badge-premium { background: rgba(123, 211, 137, 0.18); color: var(--success); }

.sub-progress {
  margin: 12px 0;
  position: relative;
}
.sub-progress::before {
  content: '';
  display: block;
  height: 8px;
  border-radius: 999px;
  background: var(--track);
  margin-bottom: 8px;
}
.sub-progress-bar {
  position: absolute;
  top: 0; left: 0;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--gold) 0%, var(--gold) 100%);
  box-shadow: 0 0 12px rgba(245, 200, 66, 0.35);
  transition: width 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.sub-progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
}
.sub-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 8px 0 14px;
}
.sub-cta {
  width: 100%;
  font-size: 15px;
  padding: 14px;
}

.sub-cancel-btn {
  width: 100%;
  margin-top: 4px;
  font-size: 14px;
  color: var(--text-muted);
  border-color: var(--border);
}
.sub-cancel-btn:hover { color: var(--danger, #e05); border-color: var(--danger, #e05); }
.sub-cancel-sheet {
  padding: 4px 0 8px;
}
.sub-cancel-step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 0 0 14px;
  font-size: 15px;
  color: var(--text);
  line-height: 1.5;
}
.sub-cancel-num {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}
.sub-cancel-hint {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  line-height: 1.5;
}
.star-icon {
  display: inline-block;
  color: var(--gold);
  vertical-align: -2px;
}

/* Сегмент-переключатель темы */
.theme-segment {
  display: inline-flex;
  background: var(--surface-2);
  border-radius: 10px;
  padding: 3px;
  border: 1px solid var(--border);
}
.seg-btn {
  width: 34px; height: 30px;
  display: grid; place-items: center;
  border-radius: 8px;
  color: var(--text-muted);
  transition: background 0.2s, color 0.2s;
}
.seg-btn.active {
  background: var(--primary);
  color: #fff;
  box-shadow: none;
}

.profile-disclaimer {
  margin: 8px 0 4px;
  padding: 0 4px;
  font-size: 11px;
  line-height: 1.55;
  color: var(--text-muted);
  opacity: 0.7;
  white-space: pre-line;
}

.footer-hint {
  margin-top: 18px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
}

/* ---------- Нижняя навигация ---------- */
/* v5.6.10: жёстко равняется внутренней ширине body — min(viewport, 560) − 32 */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  transform: none;
  bottom: 0;
  width: 100%;
  max-width: 100%;
  padding: 8px 16px calc(env(safe-area-inset-bottom) + 8px);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  background: var(--surface);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: none;
  border-radius: 0;
  box-shadow: none;
  border-top: 1px solid var(--border);
  z-index: 20;
  margin: 0;
}
.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 4px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  transition: color 0.2s ease, background 0.2s ease, transform 0.12s ease;
}
.nav-item:active { transform: scale(0.94); }
.nav-item.active {
  color: var(--primary);
  background: var(--primary-soft);
}
.nav-item svg { transition: transform 0.2s ease; width: 22px; height: 22px; }
.nav-item.active svg { transform: translateY(-1px); }
/* v5.6.7: выравнивание иконок — обёртка «План» была 26×26, остальные 22 — подписи выбивались */
.nav-item .nav-item-icon-wrap { width: 22px; height: 22px; }

/* ---------- Тост ---------- */
.toast {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom) + 100px);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--surface);
  color: var(--text);
  padding: 14px 22px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-strong);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), visibility 0.3s;
  z-index: 60;
  pointer-events: none;
  max-width: calc(100% - 32px);
}
.toast svg { color: var(--success); flex-shrink: 0; }
.toast.show {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* ---------- Bottom Sheet ---------- */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: var(--backdrop);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
  z-index: 70;
}
.sheet-backdrop.show { opacity: 1; visibility: visible; }

.sheet {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  max-width: 560px;
  margin: 0 auto;
  background: var(--surface);
  border-top-left-radius: 24px;
  border-top-right-radius: 24px;
  padding: 8px 20px calc(env(safe-area-inset-bottom) + 24px);
  transform: translateY(100%);
  visibility: hidden;
  transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1), visibility 0.35s;
  z-index: 71;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
  border-bottom: none;
  max-height: 88vh;
  overflow-y: auto;
}
.sheet.show {
  transform: translateY(0);
  visibility: visible;
}

.sheet-handle {
  width: 40px; height: 4px;
  background: var(--border-strong);
  border-radius: 2px;
  margin: 0 auto 12px;
}
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.sheet-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.sheet-close {
  width: 32px; height: 32px;
  border-radius: 10px;
  display: grid; place-items: center;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: color 0.15s, background 0.15s;
}
.sheet-close:hover { color: var(--text); background: var(--surface-2); }

/* .sheet-body определён ниже в блоке Моод-грид */

/* Формы в sheet */
.field { margin-bottom: 14px; }
.field-label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 600;
}
.field-input {
  width: 100%;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border 0.2s, background 0.2s;
  -webkit-appearance: none;
}
.field-input:focus { border-color: var(--primary); background: var(--surface); }
.field-input::placeholder { color: var(--text-muted); opacity: 0.7; }
.field-textarea { resize: none; line-height: 1.5; font-family: inherit; font-size: 14px; }

.gender-choice {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.gender-opt {
  padding: 12px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  background: var(--input-bg);
  color: var(--text);
  transition: all 0.2s;
}
.gender-opt.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* Sheet-ссылка на приглашение */
.invite-link-block {
  background: var(--input-bg);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 14px;
  font-size: 13px;
  color: var(--text);
  word-break: break-all;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.sheet-hint {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 16px;
}

/* ---------- Светлая тема — перекрытия ---------- */

/* Кнопка «Проснулся» — gold светлый, поэтому тёмный текст для контраста */
:root[data-theme="light"] .btn-secondary {
  background: var(--gold);
  color: #1E1A45;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.10);
}

/* Прогресс-бар подписки — чистый золотой градиент */
:root[data-theme="light"] .sub-progress-bar {
  background: linear-gradient(90deg, var(--gold) 0%, var(--gold) 100%);
  box-shadow: 0 0 10px rgba(245, 184, 0, 0.28);
}

/* Прогресс-бар трекера */
:root[data-theme="light"] .progress-bar {
  box-shadow: 0 0 10px rgba(245, 184, 0, 0.28);
}

/* Бейджи — trial делаем насыщеннее */
:root[data-theme="light"] .badge-trial {
  background: rgba(245, 184, 0, 0.16);
  color: #C98F00;
}

/* Реферальный бейдж — чистый gold с белым текстом */
:root[data-theme="light"] .referral-badge {
  background: var(--gold);
  color: #fff;
}

/* Аватары детей — убираем грязный gold в градиенте, делаем primary→blue */
:root[data-theme="light"] .child-avatar {
  background: linear-gradient(135deg, var(--primary) 0%, #A99EE8 100%);
}

/* Реферальная карточка — пастельно-фиолетовая как у референса */
:root[data-theme="light"] .referral-card {
  background: #FFFFFF;
}

/* Карточка подписки */
:root[data-theme="light"] .subscription-card {
  background: #FFFFFF;
}

/* Кнопка CTA (оформить Premium) — тёмно-фиолетовая, контрастная */
:root[data-theme="light"] .btn-gold-gradient {
  background: linear-gradient(135deg, #6B5FBD 0%, #8A7ED5 100%);
  color: #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

/* ---------- AI-инсайт ---------- */
.ai-insight-card {
  padding: 0;
  overflow: hidden;
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
}
.ai-insight-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  padding: 14px 16px;
  font-family: inherit;
  gap: 8px;
}
.ai-insight-toggle[aria-expanded="true"] .ai-insight-chevron {
  transform: rotate(180deg);
}
.ai-insight-chevron {
  color: var(--text-muted);
  flex-shrink: 0;
  transition: transform 0.2s ease;
}
.ai-insight-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.ai-insight-body {
  padding: 0 var(--space-card) var(--space-card);
  padding-top: 0;
}
.ai-insight-text {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
  text-align: left;
}

/* ---------- Аналитика ---------- */
.analytics-switcher {
  display: flex;
  background: var(--surface);
  border-radius: 14px;
  padding: 5px;
  margin-bottom: 14px;
  gap: 4px;
  border: 1px solid var(--border);
}
.analytics-tab {
  flex: 1;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  transition: background 0.2s, color 0.2s;
  text-align: center;
}
.analytics-tab.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.10);
}

.chart-card { padding: 16px 18px; }
.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.chart-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.chart-legend {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}
.legend-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.legend-primary { background: var(--primary); }
.legend-blue    { background: var(--blue); }

.chart-canvas {
  width: 100%;
  height: 150px;
  position: relative;
}

/* ---------- Mood grid (шторки) ---------- */
.mood-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}
.mood-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 8px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid transparent;
  transition: all 0.18s ease;
  font-family: inherit;
  cursor: pointer;
}
.mood-card:active { transform: scale(0.96); }
.mood-card.active {
  background: var(--primary-soft);
  border-color: var(--primary);
}
.mood-emoji { font-size: 24px; line-height: 1; }
.mood-icon { display: flex; align-items: center; justify-content: center; color: var(--text-muted); }
.feeding-side-letter {
  width: 28px;
  height: 28px;
  font-size: 22px;
  font-weight: 200;
  line-height: 28px;
  letter-spacing: -0.5px;
  font-family: 'Inter', system-ui, sans-serif;
}
.mood-card.active .mood-icon { color: var(--primary); }
/* Текст под эмоджи — достаточный контраст (используем цвет текста, не muted) */
.mood-text { font-size: 11px; font-weight: 600; color: var(--text); opacity: 0.7; }
.mood-card.active .mood-text { color: var(--primary); opacity: 1; }

/* ---------- Counter (счётчик прерываний) ---------- */
.counter-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface-2);
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 16px;
}
.counter-btn {
  width: 40px; height: 40px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  display: grid; place-items: center;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, border-color 0.15s;
  color: var(--primary);
  flex-shrink: 0;
}
.counter-btn:hover { border-color: var(--primary); background: var(--primary-soft); }
.counter-btn:active { transform: scale(0.92); background: var(--primary-soft); }

.counter-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
}
.counter-val {
  font-size: 24px;
  font-weight: 700;
  min-width: 40px;
  text-align: center;
  color: var(--text);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.counter-unit { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }

/* ---------- Лейбл секции в шторке ---------- */
.sheet-section-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  opacity: 0.55;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-top: 20px;
  margin-bottom: 10px;
}
.sheet-section-label:first-child,
.sheet-body > .sheet-section-label:first-child { margin-top: 0; }

/* Отступы внутри шторки */
.sheet-body {
  font-size: 14px;
  padding: 4px 0 16px;
}

/* ---------- Журнал — сводка дня ---------- */
.journal-summary-card {
  padding: 14px 16px;
  margin-bottom: 10px;
}
.journal-summary-row {
  display: flex;
  align-items: center;
  justify-content: space-around;
}
.journal-summary-item { text-align: center; flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.journal-summary-icon { display: flex; align-items: center; justify-content: center; margin-bottom: 2px; }
.journal-summary-val {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 3px;
}
.journal-summary-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.journal-summary-div {
  width: 1px;
  height: 32px;
  background: var(--border-strong);
}

/* ---------- Навигация 4 пункта ---------- */
.bottom-nav {
  grid-template-columns: repeat(4, 1fr) !important;
}
.nav-item span { font-size: 10px; }
.sounds-nav-btn span { font-size: 10px; }

/* ---------- Адаптив ---------- */
@media (max-width: 360px) {
  .timer-value { font-size: 34px; }
  .stats-grid { gap: 6px; }
  .stat-value { font-size: 18px; }
  .btn { font-size: 14px; padding: 12px 12px; }
  .child-name { max-width: 60px; }
  .brand { display: none; }
}


/* ---------- Графики на главной ---------- */
.chart-home-card {
  padding: 14px 16px 18px;
}
/* Устаревшие стили заголовка графика — оставляем для совместимости */
.chart-home-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.chart-home-modes { display: flex; gap: 4px; }
.chart-mode-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  border: 1px solid transparent;
  transition: all 0.18s ease;
}
.chart-mode-btn.active {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: var(--primary);
}
/* Общая строка переключателя периода */
.chart-periods-row {
  display: flex;
  gap: 3px;
  background: var(--surface-2);
  border-radius: 8px;
  padding: 3px;
  border: 1px solid var(--border);
  margin-bottom: 14px;
}
/* Старый вариант — для совместимости */
.chart-home-periods {
  display: flex;
  gap: 3px;
  background: var(--surface-2);
  border-radius: 8px;
  padding: 3px;
  border: 1px solid var(--border);
}
.chart-period-btn {
  padding: 4px 9px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  transition: all 0.15s ease;
  flex: 1;
  text-align: center;
}
.chart-period-btn.active {
  background: var(--primary);
  color: #fff;
}
/* Блок графика с заголовком */
.chart-block {
  margin-bottom: 14px;
}
.chart-block:last-child { margin-bottom: 0; }
.chart-block-title {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.home-chart-canvas {
  width: 100%;
  height: 110px;
  display: block;
}

/* ---------- Журнал — аккордеон и доп. элементы ---------- */
.journal-label-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 0;
}
/* Правая часть заголовка — действия (инфо + удалить) */
.journal-item-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  flex-shrink: 0;
}
.journal-acc-btn {
  width: 28px; height: 28px;
  border-radius: var(--r-sm);
  display: grid; place-items: center;
  color: var(--text-muted);
  background: var(--surface-2);
  transition: background 0.15s, color 0.15s, transform 0.2s;
  flex-shrink: 0;
}
.journal-acc-btn[aria-expanded=true] {
  color: var(--primary);
  background: var(--primary-soft);
  transform: rotate(180deg);
}
.journal-accordion {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.journal-note {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  font-style: normal;
  padding: 6px 10px;
  background: var(--surface-2);
  border-radius: var(--r-xs);
  border-left: 1px solid var(--border-strong);
  margin-top: 6px;
}
.journal-interruption-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: rgba(99, 102, 241, 0.12);
  color: var(--primary);
  border-radius: var(--r-xs);
  font-size: 11px;
  font-weight: 600;
  align-self: flex-start;
  margin-top: 6px;
  margin-right: 4px;
}
:root[data-theme=light] .journal-interruption-badge {
  background: rgba(99, 102, 241, 0.10);
  color: #4f46e5;
}
.journal-rocking-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: var(--gold-soft);
  color: var(--gold);
  border-radius: var(--r-xs);
  font-size: 11px;
  font-weight: 600;
  align-self: flex-start;
  margin-top: 6px;
}
:root[data-theme=light] .journal-rocking-badge {
  color: #C98F00;
  background: rgba(245, 184, 0, 0.13);
}

/* Окно бодрствования между событиями журнала */
.journal-wake-window {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 4px;
  margin: 2px 0;
}
.wake-window-line {
  flex: 1;
  height: 1px;
  background: var(--border);
}
.wake-window-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-full);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

/* v5.6.43: системная пометка «Смена часового пояса» в журнале */
.journal-tz-change {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 4px;
  margin: 6px 0;
}
.tz-change-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: rgba(124, 92, 240, 0.10);
  border: 1px solid rgba(124, 92, 240, 0.35);
  border-radius: var(--r-full);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--accent, #7c5cf0);
  white-space: nowrap;
}
.tz-change-badge svg {
  flex-shrink: 0;
}

/* v5.6.43: read-only отображение TZ в профиле (вместо dropdown-кнопки) */
.tz-readonly {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}
.tz-readonly-label {
  letter-spacing: 0.1px;
}

/* Окно бодрствования в плане */
.plan-morning-wake-card {
  margin-bottom: 4px;
}

.plan-wake-window {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 4px;
  margin: 2px 0;
}
.plan-wake-line {
  flex: 1;
  height: 1px;
  background: var(--border);
}
.plan-wake-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
}
.plan-wake-badge svg { opacity: 0.7; }

/* ---------- AI-план шторка ---------- */
.ai-plan-sheet {
  padding: 4px 0;
}
.ai-plan-icon {
  width: 44px; height: 44px;
  background: var(--gold-soft);
  color: var(--gold);
  border-radius: 14px;
  display: grid; place-items: center;
  margin-bottom: 14px;
}
.ai-plan-text {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 12px;
}
.ai-plan-note {
  padding: 10px 14px;
  background: var(--surface-2);
  border-radius: 10px;
  border-left: 1px solid var(--primary);
  font-style: italic;
}
.ai-plan-tip { font-size: 15px; color: var(--text); line-height: 1.7; margin-bottom: 0; }
.ai-plan-schedule { display: flex; flex-direction: column; gap: 4px; margin: 12px 0; }
.ai-plan-row { display: flex; align-items: flex-start; gap: 8px; font-size: 14px; padding: 6px 0; }
.ai-plan-moon { font-size: 14px; flex-shrink: 0; display: flex; align-items: center; }
.ai-plan-wake { font-size: 12px; color: var(--text-muted); padding: 2px 0 2px 22px; }
.ai-plan-comment { font-size: 13px; color: var(--text); line-height: 1.6; border-top: 1px solid var(--border); padding-top: 12px; margin-top: 8px; }

/* Стили journal-edit-btn / journal-del-btn удалены — кнопки заменены на click по строке */

/* ---------- SVG-иконки в mood-card (кормление, настроение) ---------- */
.mood-icon svg {
  transition: color 0.18s;
}

/* ---------- Print CSS для PDF ---------- */
@media print {
  .app-header, .bottom-nav, .toast, .sheet, .sheet-backdrop,
  .btn-outline, #btnDownloadPdf, .ai-insight-card,
  .chart-home-card { display: none !important; }
  body { padding: 0; background: #fff; color: #000; }
  .card { border: 1px solid #ddd; break-inside: avoid; }
  .tab-panel { display: block !important; }
}

/* ---------- Sheet-section-label для шторок ---------- */
.sheet-section-label + .mood-grid { margin-top: 10px; }

/* ---------- Новые стили v1.1.0 ---------- */

/* Подпись цены подписки */
.sub-price-hint {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 8px;
}

/* ВИКИ — список статей */
.wiki-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.wiki-list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 15px;
  font-weight: 500;
  text-align: left;
  transition: background 0.15s;
}
.wiki-list-item:hover { background: var(--surface); }
.wiki-list-item span { flex: 1; }
.wiki-list-item svg { color: var(--text-muted); flex-shrink: 0; }
.wiki-num {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  min-width: 22px;
  flex-shrink: 0;
  flex: 0 !important;
}
.wiki-label { flex: 1; }

/* ВИКИ — текст статьи */
.wiki-article-text {
  font-size: 14px;
  line-height: 1.75;
  color: var(--text);
  white-space: pre-wrap;
}

/* AI-план — подпись под кнопкой */
.ai-plan-btn-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
}
/* ai-plan-hint — удалена по задаче 8 */
.ai-plan-hint { display: none !important; }

/* Кнопки языка */
.lang-btn {
  font-size: 13px;
  font-weight: 600;
  padding: 6px 12px;
}

/* Select языка */
.lang-select {
  appearance: none;
  -webkit-appearance: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 8px 32px 8px 12px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  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='%239B99C4' 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 10px center;
  min-width: 120px;
}
.lang-select:focus { outline: none; border-color: var(--primary); }

/* ── ВИКИ — таб ──────────────────────────────────────────────────────────── */
.wiki-tab-list {
  padding: 16px 16px 24px;
}
.wiki-tab-header {
  margin-bottom: 16px;
}
.wiki-tab-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
}
.wiki-tab-subtitle {
  font-size: 13px;
  color: var(--text-muted);
}
.wiki-tab-items {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.wiki-tab-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  color: var(--text);
  font-size: 15px;
  text-align: left;
  cursor: pointer;
  width: 100%;
  transition: background 0.15s;
}
.wiki-tab-item:active {
  background: var(--surface-2);
}
.wiki-tab-num {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  min-width: 20px;
}
.wiki-tab-label {
  flex: 1;
  font-weight: 500;
}
.wiki-tab-item svg {
  color: var(--text-muted);
  flex-shrink: 0;
}

/* ── База знаний — кнопка на главной ──────────────────────────────────────── */
.wiki-home-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  width: 100%;
  padding: 14px 16px;
  margin-bottom: 14px;
  background: var(--surface);
  border: none;
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
}
.wiki-home-btn:active { background: var(--surface-2); }
.wiki-home-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.wiki-home-text {
  display: flex;
  flex-direction: column;
  text-align: left;
  min-width: 0;
}
.wiki-home-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--r-sm);
  background: var(--primary-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  flex-shrink: 0;
}
.wiki-home-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.wiki-home-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 1px;
}
.wiki-home-btn > svg { color: var(--text-muted); flex-shrink: 0; }

.home-section-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 20px 0 14px;
}
.home-section-divider::before,
.home-section-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.home-section-divider span {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ── Прикорм ────────────────────────────────────────────────────── */
.feeding-home-icon {
  background: rgba(234, 119, 56, 0.12);
  color: #ea7738;
}
/* Заблокированный прикорм */
.feeding-locked {
  opacity: 0.6;
  cursor: pointer;
}
.pdf-lock-badge {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 5px 14px;
  border-radius: 20px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 3;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
}

.feeding-lock-badge {
  position: absolute;
  right: 40px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 20px;
  white-space: nowrap;
  pointer-events: none;
}

/* Overlay — полноэкранный слайд */
.feeding-overlay {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 60px);
  left: 0; right: 0; bottom: 0;
  background: var(--bg);
  z-index: 25;
  display: flex;
  flex-direction: column;
  max-width: 560px;
  margin: 0 auto;
  transform: translateY(100%);
  transition: transform .25s ease;
  overflow: hidden;
}
.feeding-overlay.open { transform: translateY(0); }

/* ── Шапка overlay ── */
.feeding-header {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 16px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--nav-bg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  flex-shrink: 0;
}
.feeding-header.feeding-header-compact {
  justify-content: flex-end;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: none;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.feeding-header-back {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
  color: var(--text); border: none; cursor: pointer; flex-shrink: 0;
  transition: background 0.15s;
}
.feeding-header-back:active { background: var(--border-strong); }
.feeding-header-title { font-size: 17px; font-weight: 700; color: var(--text); flex: 1; }
.feeding-header-meta { font-size: 12px; color: var(--text-muted); font-weight: 400; margin-top: 1px; }
.feeding-header-add {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  color: #fff; border: none; cursor: pointer; flex-shrink: 0;
  transition: opacity 0.15s; box-shadow: 0 2px 8px rgba(123,111,196,0.4);
}
.feeding-header-add:active { opacity: 0.8; }
.feeding-header-help {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); border: none; cursor: pointer; flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
.feeding-header-help:active { background: var(--border); color: var(--text); }

/* ── Модалка-подсказка прикорма ── */
.feeding-help-modal-backdrop {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(0,0,0,0.45);
  display: flex; align-items: flex-end; justify-content: center;
  padding-bottom: env(safe-area-inset-bottom, 0);
  opacity: 0; transition: opacity 0.2s ease;
  pointer-events: none;
}
.feeding-help-modal-backdrop.open { opacity: 1; pointer-events: all; }
.feeding-help-modal-backdrop.closing { opacity: 0; pointer-events: none; }
.feeding-help-modal {
  background: var(--surface);
  border-radius: 24px 24px 0 0;
  border: 1px solid var(--border);
  border-bottom: none;
  box-shadow: 0 -10px 40px rgba(0,0,0,0.25);
  padding: 28px 24px calc(env(safe-area-inset-bottom, 0px) + 32px);
  width: 100%; max-width: 480px;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  transform: translateY(100%); transition: transform 0.35s cubic-bezier(0.2,0.8,0.2,1);
}
.feeding-help-modal-backdrop.open .feeding-help-modal { transform: translateY(0); }
.feeding-help-modal-backdrop.closing .feeding-help-modal { transform: translateY(100%); }
.feeding-help-modal-icon {
  width: 56px; height: 56px; border-radius: 18px;
  background: rgba(123,111,196,0.12);
  display: flex; align-items: center; justify-content: center;
  color: var(--primary);
  margin-bottom: 4px;
}
.feeding-help-modal-title {
  font-size: 17px; font-weight: 700; color: var(--text);
  text-align: center;
}
.feeding-help-modal-text {
  font-size: 14px; line-height: 1.6; color: var(--text-secondary);
  text-align: center;
}
.feeding-help-modal-btn {
  margin-top: 8px;
  width: 100%; padding: 14px;
  background: var(--primary); color: #fff;
  border: none; border-radius: 14px;
  font-size: 15px; font-weight: 600; cursor: pointer;
  transition: opacity 0.15s;
}
.feeding-help-modal-btn:active { opacity: 0.85; }

/* ── Тело (v5.6.9: проброс под плавающее меню) ── */
.feeding-body {
  flex: 1; overflow-y: auto;
  padding: 0 0 calc(env(safe-area-inset-bottom) + 92px);
  -webkit-overflow-scrolling: touch;
}

/* ── Пустое состояние ── */
.feeding-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 80px 32px; text-align: center;
}
.feeding-empty-emoji { font-size: 52px; line-height: 1; }
.feeding-empty-title { font-size: 17px; font-weight: 700; color: var(--text); }
.feeding-empty-sub   { font-size: 14px; color: var(--text-muted); line-height: 1.5; }

/* ── Группировка по датам ── */
.feeding-day-group { margin-top: 20px; padding: 0 16px; }
.feeding-day-group:first-child { margin-top: 16px; }
.feeding-day-label {
  font-size: 11px; font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.06em;
  margin-bottom: 8px;
  display: flex; align-items: center; gap: 6px;
}
.feeding-day-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; border-radius: 9px;
  background: var(--surface-2);
  font-size: 11px; font-weight: 600; color: var(--text-muted);
  padding: 0 5px;
}
.feeding-day-items { display: flex; flex-direction: column; gap: 6px; }

/* ── Карточка продукта ── */
.feeding-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px;
  background: var(--surface);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.feeding-item:active { background: var(--surface-2); transform: scale(0.99); }
.feeding-item-icon {
  width: 40px; height: 40px; border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}
.feeding-item-icon-img {
  width: 32px; height: 32px; object-fit: contain;
  border-radius: 4px;
}
.feeding-item-body { flex: 1; min-width: 0; }
.feeding-item-top {
  display: flex; align-items: center; gap: 6px;
}
.feeding-item-name {
  font-size: 15px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.feeding-item-allergy-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #ff3b30; flex-shrink: 0;
}
.feeding-item-sub {
  font-size: 12px; color: var(--text-muted); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.feeding-item-note { }
.feeding-item-right {
  display: flex; flex-direction: column; align-items: flex-end;
  gap: 4px; flex-shrink: 0;
}
.feeding-item-stars { display: flex; gap: 1px; }
.feeding-item-stars-empty { width: 13px; }
.feeding-item-chevron { color: var(--text-muted); opacity: 0.45; display: block; }

/* ── Шит добавления / редактирования ── */
.feeding-sheet-wrap { padding: 0 2px; }
.feeding-field {}
.feeding-field-label {
  font-size: 12px; font-weight: 600; color: var(--text-muted);
  letter-spacing: 0.02em; margin-bottom: 8px;
  display: flex; align-items: center; gap: 6px;
}
.feeding-field-optional {
  font-weight: 400; text-transform: none; font-size: 11px;
  color: var(--text-muted); opacity: 0.7;
}

/* Строка поиска (legacy) */
.feeding-search-wrap {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 0 14px; height: 44px;
}
.feeding-search-icon { color: var(--text-muted); flex-shrink: 0; }
.feeding-search-input {
  flex: 1; border: none; background: transparent;
  font-size: 15px; color: var(--text); outline: none; font-family: inherit;
}
.feeding-search-input::placeholder { color: var(--text-muted); }
.feeding-cat-label {
  font-size: 11px; font-weight: 700; color: var(--text-muted);
  letter-spacing: 0.04em; text-transform: uppercase; margin: 14px 0 6px;
}
.feeding-chips-row { display: flex; flex-wrap: wrap; gap: 6px; }
.feeding-product-chip {
  padding: 6px 12px; border-radius: 20px;
  border: 1px solid var(--border); background: var(--surface-2);
  font-size: 13px; color: var(--text); cursor: pointer;
  transition: all 0.15s; font-family: inherit; white-space: nowrap;
}
.feeding-product-chip:active { background: var(--surface); }
.feeding-product-chip.selected {
  border-color: var(--accent);
  background: rgba(var(--accent-rgb, 120,80,220), 0.1);
  color: var(--accent);
  font-weight: 600;
}

/* Имя продукта при редактировании */
.feeding-product-name-display {
  font-size: 16px; font-weight: 600; color: var(--text);
  padding: 10px 0 4px;
}

/* Кнопка-триггер выбора продукта */
.feeding-picker-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: 15px;
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
}
.feeding-picker-trigger:active { background: var(--surface); }
.feeding-picker-trigger .muted { color: var(--text-muted); }
.feeding-picker-trigger svg { color: var(--text-muted); flex-shrink: 0; }

/* Picker-шит: поиск + список */
.feeding-picker-wrap { display: flex; flex-direction: column; gap: 0; }
.feeding-picker-search-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 0 14px;
  height: 44px;
  margin-bottom: 12px;
  flex-shrink: 0;
}
.feeding-picker-search-wrap svg { color: var(--text-muted); flex-shrink: 0; }
.feeding-picker-search {
  flex: 1; border: none; background: transparent;
  font-size: 15px; color: var(--text); outline: none; font-family: inherit;
}
.feeding-picker-search::placeholder { color: var(--text-muted); }
.feeding-picker-group-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 10px 4px 6px;
}
.feeding-picker-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  margin-bottom: 6px;
  font-size: 15px;
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
}
.feeding-picker-item span { flex: 1; }
.feeding-picker-item:active { background: var(--surface); }
.feeding-picker-item svg { color: var(--text-muted); flex-shrink: 0; }
.feeding-picker-item-img {
  width: 36px; height: 36px; object-fit: contain;
  border-radius: 6px; flex-shrink: 0;
}
.feeding-picker-item-img-placeholder {
  width: 36px; height: 36px; flex-shrink: 0;
}
.feeding-picker-empty {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-muted);
  font-size: 14px;
}

/* Picker-оверлей поверх шита */
.feeding-picker-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 80;
  display: flex;
  flex-direction: column;
  max-width: 560px;
  margin: 0 auto;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
}
.feeding-picker-overlay.open { transform: translateX(0); }
.feeding-picker-ov-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--nav-bg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  flex-shrink: 0;
}
.feeding-picker-ov-back {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
  color: var(--text); border: none; cursor: pointer; flex-shrink: 0;
  transition: background 0.15s;
}
.feeding-picker-ov-back:active { background: var(--border); }
.feeding-picker-ov-title { font-size: 17px; font-weight: 700; color: var(--text); flex: 1; }
.feeding-picker-ov-search {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  padding: 10px 16px;
  flex-shrink: 0;
}
.feeding-picker-ov-search svg { color: var(--text-muted); flex-shrink: 0; }
.feeding-picker-ov-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 16px 24px;
  -webkit-overflow-scrolling: touch;
}

/* Выпадающий список продуктов (нативный — не используется, оставлен для совместимости) */
.feeding-select {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px 14px;
  font-size: 15px;
  color: var(--text);
  font-family: inherit;
  outline: none;
  box-sizing: border-box;
  appearance: auto;
}
.feeding-select:focus { border-color: var(--accent); }

/* Дата */
.feeding-date-input {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px 14px;
  font-size: 15px; color: var(--text);
  font-family: inherit; outline: none;
  box-sizing: border-box;
}
.feeding-date-input:focus { border-color: var(--accent); }

/* Звёздный рейтинг в шите */
.feeding-stars-row {
  display: flex; gap: 8px;
}
.feeding-star-btn {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 12px 6px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--surface-2);
  cursor: pointer; transition: all 0.15s; font-family: inherit;
}
.feeding-star-btn-label { font-size: 11px; font-weight: 500; color: var(--text-muted); text-align: center; }
.feeding-star-btn.selected { border-color: transparent; }
.feeding-star-btn.selected.rating-1 { background: rgba(52,199,89,0.1);  border-color: #34c759; }
.feeding-star-btn.selected.rating-2 { background: rgba(255,159,10,0.1); border-color: #ff9f0a; }
.feeding-star-btn.selected.rating-3 { background: rgba(255,59,48,0.1);  border-color: #ff3b30; }
.feeding-star-btn.selected .feeding-star-btn-label { color: var(--text); font-weight: 600; }

/* Тип каши в шите прикорма */
.feeding-milktype-row {
  display: flex;
  gap: 8px;
}
.feeding-milktype-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 74px;
  padding: 10px 8px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--surface-2);
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  color: var(--text-muted);
}
.feeding-milktype-btn-label {
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  line-height: 1.25;
}
.feeding-milktype-btn.selected {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 10%, var(--surface-2));
  color: var(--primary);
}

/* Тоггл аллергии */
.feeding-allergy-toggle {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  cursor: pointer; gap: 12px;
  user-select: none;
}
.feeding-allergy-toggle-text { font-size: 15px; color: var(--text); flex: 1; }
.feeding-allergy-toggle-track {
  width: 44px; height: 26px; border-radius: 13px;
  background: var(--border); flex-shrink: 0;
  position: relative; transition: background 0.2s;
}
.feeding-allergy-toggle-track.on { background: #ff3b30; }
.feeding-allergy-toggle-thumb {
  position: absolute; top: 3px; left: 3px;
  width: 20px; height: 20px; border-radius: 50%;
  background: #fff; transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}
.feeding-allergy-toggle-track.on .feeding-allergy-toggle-thumb { transform: translateX(18px); }

/* ── Нижний nav прикорма (v5.6.9: выровнен с контентом) ── */
/* v5.6.12: фикс привязки к viewport — как у .bottom-nav */
.feeding-nav {
  position: fixed;
  left: 0;
  right: 0;
  transform: none;
  bottom: 0;
  width: 100%;
  max-width: 100%;
  padding: 8px 16px calc(env(safe-area-inset-bottom) + 8px);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  background: var(--surface);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: none;
  border-radius: 0;
  box-shadow: none;
  border-top: 1px solid var(--border);
  z-index: 20;
  margin: 0;
}
.feeding-nav-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 2px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease, transform 0.12s ease;
}
.feeding-nav-tab:active { transform: scale(0.94); }
.feeding-nav-tab.active {
  color: var(--primary);
  background: var(--primary-soft);
}
.feeding-nav-tab svg { transition: transform 0.2s ease; width: 22px; height: 22px; }
.feeding-nav-tab.active svg { transform: none; }

/* ── Сводка прикорма ── */
.feeding-sum-filters {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 16px 16px 8px;
}
.feeding-sum-filter-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 4px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.12s;
  position: relative;
}
.feeding-sum-filter-btn:active { transform: scale(0.94); }
.feeding-sum-filter-btn.active {
  background: var(--surface-2);
  border-color: transparent;
  box-shadow: 0 0 0 2px var(--primary);
}
.feeding-sum-filter-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 20px;
}
.feeding-sum-filter-label {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.2;
}
.feeding-sum-filter-btn.active .feeding-sum-filter-label { color: var(--text); font-weight: 600; }
.feeding-sum-filter-count {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}
.feeding-sum-allergy-dot {
  display: inline-block;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: #ff3b30;
}

/* ── Список сводки ── */
.feeding-sum-list {
  padding: 8px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.feeding-sum-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px 14px;
}
.feeding-sum-item-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}
.feeding-sum-item-icon img { width: 36px; height: 36px; object-fit: contain; }
.feeding-sum-item-icon-empty { width: 36px; height: 36px; }
.feeding-sum-item-info { flex: 1; min-width: 0; }
.feeding-sum-item-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
}
.feeding-sum-item-allergy {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #ff3b30;
  flex-shrink: 0;
}
.feeding-sum-item-date {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}
.feeding-sum-item-note {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.feeding-sum-empty {
  padding: 48px 0;
  text-align: center;
  font-size: 14px;
  color: var(--text-muted);
}

/* Заметка */
.feeding-note-input {
  width: 100%; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--r-md);
  padding: 12px 14px; font-size: 15px; color: var(--text);
  font-family: inherit; outline: none; box-sizing: border-box;
}
.feeding-note-input:focus { border-color: var(--accent); }
.feeding-note-input::placeholder { color: var(--text-muted); }

/* Кнопка удалить — полноценная кнопка с фоном */
.btn-feeding-delete {
  width: 100%; margin-top: 8px; padding: 13px;
  border: 1px solid rgba(255,59,48,0.25);
  background: rgba(255,59,48,0.06);
  font-size: 15px; font-weight: 500; color: var(--danger, #ff3b30);
  cursor: pointer; font-family: inherit; border-radius: var(--r-md);
  transition: background 0.15s, border-color 0.15s;
}
.btn-feeding-delete:active {
  background: rgba(255,59,48,0.14);
  border-color: rgba(255,59,48,0.4);
}

/* ── Chip-toggle multi-select ── */
.chips-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip-toggle {
  padding: 7px 14px;
  border-radius: var(--r-full);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.chip-toggle.active {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  color: var(--primary);
  font-weight: 600;
}
.chip-toggle.active::before {
  content: '✓ ';
  font-size: 11px;
}

/* === Кастомный дропдаун языка === */
.lang-dropdown {
  position: relative;
}
.lang-dropdown-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--surface);  /* используем тот же фон что у карточек */
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  min-width: 130px;
  justify-content: space-between;
  box-shadow: none;
  transition: border-color 0.15s;
}
.lang-dropdown-btn:hover {
  border-color: var(--primary);
}
.lang-dropdown-btn:focus,
.lang-dropdown-btn:focus-visible,
.lang-dropdown-btn:active,
.lang-dropdown-item:focus,
.lang-dropdown-item:focus-visible,
.lang-dropdown-item:active {
  outline: none !important;
  box-shadow: none !important;
}
.lang-chevron {
  margin-left: auto;
  transition: transform 0.2s;
  color: var(--text-muted);
  flex-shrink: 0;
}
.lang-dropdown.open .lang-chevron {
  transform: rotate(180deg);
}
.lang-dropdown-menu {
  display: none;
  position: fixed;
  background: var(--surface);  /* тот же фон что у карточек */
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  z-index: 9999;
  min-width: 160px;
  overflow: hidden;
}
.lang-dropdown.open .lang-dropdown-menu {
  display: block;
}
.lang-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  color: var(--text);
  text-align: left;
  transition: background 0.1s;
}
.lang-dropdown-item:hover {
  background: var(--bg);
}
.lang-dropdown-item.active {
  background: color-mix(in srgb, var(--primary) 8%, transparent);
  color: var(--primary);
  font-weight: 600;
}
/* === Кастомный селект (feeding, sleep location) === */
.custom-select {
  position: relative;
}
.custom-select-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 12px 14px;
  background: var(--input-bg);
  border: 1px solid transparent;
  border-radius: var(--r-md);
  cursor: pointer;
  font-size: 15px;
  font-family: inherit;
  color: var(--text);
  transition: border-color 0.15s;
  text-align: left;
}
.custom-select-btn.open,
.custom-select-btn:focus {
  border-color: var(--primary);
  outline: none;
}
.custom-select-chevron {
  flex-shrink: 0;
  color: var(--text-muted);
  transition: transform 0.2s;
}
.custom-select-btn.open .custom-select-chevron {
  transform: rotate(180deg);
}
.custom-select-menu {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow);
  z-index: 9999;
  overflow: hidden;
}
.custom-select-menu.open {
  display: block;
}
.custom-select-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 11px 14px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  text-align: left;
  transition: background 0.1s;
}
.custom-select-item:hover {
  background: var(--bg);
}
.custom-select-item.active {
  background: color-mix(in srgb, var(--primary) 8%, transparent);
  color: var(--primary);
  font-weight: 600;
}
.custom-select-item.active::after {
  content: '✓';
  font-size: 13px;
  color: var(--primary);
}

.lang-flag {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
  border: none;
  outline: none;
  box-shadow: none;
}

/* === Заголовок секции внутри карточки === */
.card-section-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 14px;
}

/* === Плашки рост/вес — стиль виджета TODAY === */
.growth-latest {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 4px;
}
.growth-stat-item {
  background: var(--surface);
  border: none;
  border-radius: var(--r-lg);
  padding: 14px 12px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: opacity 0.15s;
  box-shadow: inset 0 0 0 1px rgba(124, 111, 212, 0.14);
}
.growth-stat-item:active { opacity: 0.7; }
.growth-stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.growth-stat-icon--weight {
  background: color-mix(in srgb, var(--primary) 10%, transparent);
  color: var(--primary);
}
.growth-stat-icon--height {
  background: color-mix(in srgb, #4CAF82 12%, transparent);
  color: #4CAF82;
}
.growth-stat-icon--head {
  background: color-mix(in srgb, #22c55e 12%, transparent);
  color: #22c55e;
}
.growth-stat-icon--chest {
  background: color-mix(in srgb, #f59e0b 14%, transparent);
  color: #f59e0b;
}
.growth-stat-icon-img {
  width: 22px;
  height: 22px;
  display: block;
  flex-shrink: 0;
}
.growth-stat-icon--weight .growth-stat-icon-img {
  filter: invert(32%) sepia(60%) saturate(800%) hue-rotate(220deg) brightness(90%);
}
.growth-stat-icon--height .growth-stat-icon-img {
  filter: invert(55%) sepia(40%) saturate(500%) hue-rotate(110deg) brightness(85%);
}
.growth-stat-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
  text-align: center;
}
.growth-stat-value--empty {
  color: var(--text-muted);
  font-weight: 400;
}
.growth-stat-unit {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}
.growth-stat-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  text-align: center;
}

/* === Виджет роста и веса === */
.growth-card {
  padding: 16px;
  background: var(--surface); /* Тот же фон что у других .card */
  border-radius: var(--r-lg);
  border: none;
  box-shadow: var(--shadow-sm);
  margin-bottom: 12px;
}
.growth-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.growth-card-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.growth-card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
/* growth-latest-item стили перенесены в growth-stat-item */

/* Кнопка + виджет — колонка */
.growth-stat-col {
  display: flex;
  flex-direction: column;
  gap: 0;
}
/* Кнопка добавления под виджетом — на всю ширину */
.growth-stat-add-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 10px 12px;
  margin-top: 6px;
  background: var(--primary-soft);
  color: var(--primary);
  border: none;
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s, filter 0.15s;
  box-sizing: border-box;
}
.growth-stat-add-btn:active { opacity: 0.9; filter: brightness(0.98); }

/* Оверлей роста и веса */
.growth-overlay {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 60px);
  left: 0; right: 0; bottom: 0;
  background: var(--bg);
  z-index: 25;
  display: flex;
  flex-direction: column;
  max-width: 560px;
  margin: 0 auto;
  transform: translateY(100%);
  transition: transform .25s ease;
  overflow: hidden;
}
.growth-overlay.open { transform: translateY(0); }
.growth-overlay-header {
  /* v5.6.30: убран заголовок раздела — app-header показывает контекст ребёнка */
  display: none;
}
.growth-overlay-body {
  flex: 1; overflow-y: auto;
  /* v5.6.11: padding 16 по бокам — совпадает с навом */
  padding: 12px 16px calc(env(safe-area-inset-bottom) + 92px);
  -webkit-overflow-scrolling: touch;
}
/* v5.6.9: плавающая карточка, back слева */
/* v5.6.12: фикс привязки к viewport */
.growth-nav {
  position: fixed;
  left: 0;
  right: 0;
  transform: none;
  bottom: 0;
  width: 100%;
  max-width: 100%;
  padding: 8px 16px calc(env(safe-area-inset-bottom) + 8px);
  display: flex;
  justify-content: flex-start;
  background: var(--surface);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: none;
  border-radius: 0;
  box-shadow: none;
  border-top: 1px solid var(--border);
  z-index: 20;
  margin: 0;
}
.growth-nav-back {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 16px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease, transform 0.12s ease;
}
.growth-nav-back:active { transform: scale(0.94); }
.growth-nav-back svg { width: 22px; height: 22px; }
.growth-overlay-body .growth-card {
  margin-bottom: 0;
}
.growth-overlay-body .growth-card.growth-card-secondary {
  margin-top: 12px;
}
.growth-overlay-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 4px;
}
/* Карточка-ссылка Рост и вес на главной */
.growth-home-icon {
  background: color-mix(in srgb, #4CAF82 12%, transparent);
  color: #4CAF82;
}

/* === Самочувствие — тумблер здоров/болеет === */
.health-home-card {
  cursor: pointer;
  /* Фон карточки всегда плотный (как у других) — не переопределяем background. */
  transition: border-color 0.2s ease;
}
.health-home-card[data-state="sick"] {
  /* Только лёгкий акцент рамки, фон — стандартный var(--surface) */
  border-color: rgba(217, 119, 6, 0.32);
}
.health-home-icon {
  background: #edfdef;
  color: #59d47f;
  transition: background 0.25s ease, color 0.25s ease;
}
.health-home-card[data-state="sick"] .health-home-icon {
  /* Болеет: янтарно-оранжевый (под тумблер) */
  background: rgba(234, 88, 12, 0.14);
  color: #ea580c;
}

/* Плашка «День недомогания» в журнале */
.journal-sick-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  padding: 8px 12px;
  background: rgba(234, 88, 12, 0.10);
  border: 1px solid rgba(217, 119, 6, 0.28);
  border-radius: var(--r-md);
  color: #b45309;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
}
.journal-sick-badge svg {
  flex-shrink: 0;
  color: #ea580c;
}
.health-toggle {
  background: transparent;
  border: 0;
  padding: 6px;
  margin: -6px;
  cursor: pointer;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}
.health-toggle-track {
  display: inline-flex;
  align-items: center;
  width: 46px;
  height: 28px;
  border-radius: 14px;
  background: var(--surface-2, #e5e7eb);
  position: relative;
  transition: background 0.22s ease;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.04);
}
.health-toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.18), 0 1px 1px rgba(0,0,0,0.06);
  transition: transform 0.22s cubic-bezier(.4,.0,.2,1);
}
.health-toggle[aria-checked="true"] .health-toggle-track {
  background: linear-gradient(180deg, #f59e0b, #d97706);
}
.health-toggle[aria-checked="true"] .health-toggle-thumb {
  transform: translateX(18px);
}
.health-toggle:active .health-toggle-thumb {
  width: 26px;
}
.health-toggle:focus-visible {
  outline: 2px solid rgba(217, 119, 6, 0.4);
  outline-offset: 2px;
  border-radius: 18px;
}

/* === Иконка Самозасыпания === */
.selfsleep-home-icon {
  background: var(--primary-soft);
  color: var(--primary);
}

/* === Иконка Чата с консультантом === */
.chat-home-icon {
  background: #e8f1fd;
  color: #4d94fd;
}

/* === Иконка вечернего AI-анализа === */
.ai-insight-home-icon {
  background: rgba(124, 111, 212, 0.13);
  color: var(--primary);
}

/* === Оверлей: База знаний === */
.wiki-overlay {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 60px);
  left: 0; right: 0; bottom: 0;
  background: var(--bg);
  z-index: 25;
  display: flex;
  flex-direction: column;
  max-width: 560px;
  margin: 0 auto;
  transform: translateY(100%);
  transition: transform .25s ease;
  overflow: hidden;
}
.wiki-overlay.open { transform: translateY(0); }
.wiki-overlay.no-transition { transition: none !important; }
.wiki-overlay-header {
  display: flex; align-items: center; justify-content: center;
  padding: 16px 16px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--nav-bg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  flex-shrink: 0;
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
}
.wiki-overlay-body {
  flex: 1; overflow-y: auto;
  /* v5.6.11: padding 16 по бокам — совпадает с навом */
  padding: 12px 16px calc(env(safe-area-inset-bottom) + 92px);
  -webkit-overflow-scrolling: touch;
}
/* v5.6.12: фикс привязки к viewport */
.wiki-overlay-nav {
  position: fixed;
  left: 0;
  right: 0;
  transform: none;
  bottom: 0;
  width: 100%;
  max-width: 100%;
  padding: 8px 16px calc(env(safe-area-inset-bottom) + 8px);
  display: flex;
  justify-content: flex-start;
  background: var(--surface);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: none;
  border-radius: 0;
  box-shadow: none;
  border-top: 1px solid var(--border);
  z-index: 20;
  margin: 0;
}
.wiki-overlay-back {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 16px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  transition: color 0.2s, background 0.2s, transform 0.12s;
}
.wiki-overlay-back:active { transform: scale(0.94); }
.wiki-overlay-back svg { width: 22px; height: 22px; }

/* Пункты списка базы знаний в оверлее */
.wiki-overlay-list { display: flex; flex-direction: column; gap: 8px; }
.wiki-overlay-item {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: background 0.15s;
}
.wiki-overlay-item:active { background: var(--surface-2); }
.wiki-overlay-item-num {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.wiki-overlay-item-label { flex: 1; font-size: 15px; font-weight: 500; color: var(--text); }
.wiki-overlay-article h3 { font-size: 15px; font-weight: 600; color: var(--text); margin: 16px 0 6px; }
.wiki-overlay-article p { font-size: 14px; line-height: 1.6; color: var(--text-secondary); margin: 0 0 10px; }
.wiki-overlay-back-article {
  display: flex; align-items: center; gap: 6px;
  padding: 10px 0;
  font-size: 14px; font-weight: 500; color: var(--primary);
  background: none; border: none; cursor: pointer;
  margin-bottom: 4px;
}

/* === Оверлей: Самозасыпание === */
.selfsleep-overlay {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 60px);
  left: 0; right: 0; bottom: 0;
  background: var(--bg);
  z-index: 25;
  display: flex;
  flex-direction: column;
  max-width: 560px;
  margin: 0 auto;
  transform: translateY(100%);
  transition: transform .25s ease;
  overflow: hidden;
}
.selfsleep-overlay.open { transform: translateY(0); }
.selfsleep-overlay.no-transition { transition: none !important; }
.selfsleep-overlay-header {
  display: flex; align-items: center; justify-content: center;
  padding: 16px 16px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  flex-shrink: 0;
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
}
.selfsleep-overlay-header:empty {
  /* v5.6.30: в режиме гайда заголовок пустой — скрываем блок */
  display: none;
}
.selfsleep-overlay-body {
  flex: 1; overflow-y: auto;
  /* v5.6.11: padding 16 по бокам */
  padding: 16px 16px calc(env(safe-area-inset-bottom) + 92px);
  -webkit-overflow-scrolling: touch;
}
/* v5.6.12: фикс привязки к viewport */
.selfsleep-overlay-nav {
  position: fixed;
  left: 0;
  right: 0;
  transform: none;
  bottom: 0;
  width: 100%;
  max-width: 100%;
  padding: 8px 16px calc(env(safe-area-inset-bottom) + 8px);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  background: var(--surface);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: none;
  border-radius: 0;
  box-shadow: none;
  border-top: 1px solid var(--border);
  z-index: 20;
  margin: 0;
}
/* v5.6.17: отступ messages под инпут+нав (76 + 56 = 132) */
.selfsleep-chat-screen.active .selfsleep-chat-messages { padding-bottom: calc(env(safe-area-inset-bottom) + 142px); }
.selfsleep-chat-limit { padding-bottom: calc(env(safe-area-inset-bottom) + 142px) !important; }
.selfsleep-overlay-back {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 16px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  transition: color 0.2s, background 0.2s, transform 0.12s;
}
.selfsleep-overlay-back:active { transform: scale(0.94); }
.selfsleep-overlay-back svg { width: 22px; height: 22px; }

/* Предупреждение (красный блок) */
.selfsleep-warn {
  background: var(--surface);
  border: 1px solid rgba(220,60,60,0.25);
  border-radius: var(--r-md);
  padding: 16px;
  margin-bottom: 10px;
}
.selfsleep-warn-header {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 10px;
}

/* Шаги гайда */
.selfsleep-step {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px;
  margin-bottom: 10px;
}
.selfsleep-step-header {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 10px;
}
.selfsleep-step-num {
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(130,100,200,0.12);
  color: #8264C8;
  font-size: 14px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.selfsleep-step-title { font-size: 15px; font-weight: 600; color: var(--text); flex: 1; }
.selfsleep-step-body { font-size: 13.5px; line-height: 1.6; color: var(--text-secondary); }
.selfsleep-step-body b { color: var(--text); }
.selfsleep-intro {
  background: var(--surface);
  border: 1px solid rgba(130,100,200,0.3);
  border-radius: var(--r-md);
  padding: 14px 16px;
  margin-bottom: 14px;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text-secondary);
}
.selfsleep-intro-title {
  font-size: 15px; font-weight: 600; color: #8264C8; margin-bottom: 6px;
}

/* Окошко «Слишком мало» */
.too-young-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 60;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: fadeIn 0.18s ease;
}
@keyframes fadeIn { from { opacity:0 } to { opacity:1 } }
.too-young-modal {
  background: var(--surface);
  border-radius: 20px;
  padding: 28px 24px;
  max-width: 340px;
  width: 100%;
  text-align: center;
  box-shadow: 0 8px 40px rgba(0,0,0,0.18);
  animation: slideUp 0.22s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes slideUp { from { transform: translateY(24px); opacity:0 } to { transform: translateY(0); opacity:1 } }
.too-young-icon {
  width: 64px; height: 64px;
  border-radius: 18px;
  background: rgba(130,100,200,0.12);
  color: #8264C8;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
}
.too-young-title {
  font-size: 18px; font-weight: 700; color: var(--text);
  margin-bottom: 10px;
}
.too-young-body {
  font-size: 14px; line-height: 1.6; color: var(--text-secondary);
  margin-bottom: 20px;
}
.too-young-btn {
  width: 100%;
  padding: 13px;
  border-radius: 12px;
  background: var(--primary);
  color: #fff;
  font-size: 15px; font-weight: 600;
  border: none; cursor: pointer;
}
/* === Чат самозасыпания === */
.selfsleep-chat-screen {
  display: none;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  min-height: 0;
  background: var(--bg);
}
.selfsleep-chat-screen.active { display: flex; }

.selfsleep-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  -webkit-overflow-scrolling: touch;
  background: var(--bg);
  border-top: none;
}

/* Ряд с аватаркой Для assistant-сообщений */
.selfsleep-chat-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
.selfsleep-chat-row.user { justify-content: flex-end; }
.selfsleep-chat-row.assistant { justify-content: flex-start; }

.selfsleep-chat-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.selfsleep-chat-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.selfsleep-chat-bubble {
  max-width: 78%;
  padding: 10px 13px 8px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.55;
  word-break: break-word;
}
.selfsleep-chat-row.user .selfsleep-chat-bubble {
  background: var(--primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.selfsleep-chat-row.assistant .selfsleep-chat-bubble {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
  box-shadow: none;
}
.bubble-time {
  display: block;
  font-size: 10.5px;
  margin-top: 4px;
  opacity: 0.5;
  text-align: right;
}
.selfsleep-chat-row.assistant .bubble-time { text-align: left; color: var(--text-muted); }
.selfsleep-chat-row.user .bubble-time { color: rgba(255,255,255,0.75); opacity: 1; }

/* Тайпинг-ряд */
.selfsleep-chat-typing-row {
  display: none;
  align-items: flex-end;
  gap: 8px;
  padding: 0 14px 4px;
}
.selfsleep-chat-typing-row.visible { display: flex; }
.selfsleep-chat-typing {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  padding: 11px 16px;
  display: flex;
  gap: 5px;
  align-items: center;
  box-shadow: none;
}
.selfsleep-chat-typing span {
  width: 7px; height: 7px;
  background: var(--primary);
  border-radius: 50%;
  opacity: 0.4;
  animation: ssTyping 1.3s infinite ease-in-out;
}
.selfsleep-chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.selfsleep-chat-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes ssTyping {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-5px); }
}

/* Счётчик */
.selfsleep-chat-limit {
  text-align: center;
  font-size: 11.5px;
  color: var(--text-muted);
  padding: 10px 12px 12px;
  letter-spacing: 0.01em;
  background: var(--bg);
}
.selfsleep-chat-limit.warn { color: #d07020; font-weight: 500; }

/* v5.6.22: чат-инпут — премиальный материал, 1-в-1 с .bottom-nav и мини-плеером. Двухслойная тень, воздух 86 */
.selfsleep-chat-input-wrap {
  position: fixed;
  left: 0;
  right: 0;
  transform: none;
  bottom: calc(env(safe-area-inset-bottom) + 70px);
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 10px 16px 10px;
  background: var(--bg);
  border-top: 1px solid var(--border);
  z-index: 25;
}
.selfsleep-chat-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  padding: 6px 8px 6px 12px;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  transition: border-color 0.18s;
}
.selfsleep-chat-textarea {
  flex: 1;
  resize: none;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 12.5px;
  line-height: 1.4;
  padding: 1px 0;
  min-height: 18px;
  max-height: 72px;
  overflow-y: auto;
  outline: none;
  font-family: inherit;
}
.selfsleep-chat-textarea::placeholder { color: var(--text-muted); opacity: 0.55; }
/* v5.6.16: самолёт без фона-круга — только иконка */
.selfsleep-chat-send {
  width: 32px; height: 32px;
  flex-shrink: 0;
  border-radius: 0;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.15s, transform 0.12s, color 0.15s;
  color: var(--primary);
}
.selfsleep-chat-send:disabled { opacity: 0.45; cursor: default; color: var(--text-muted); }
.selfsleep-chat-send:not(:disabled):active { transform: scale(0.91); }
.selfsleep-chat-send svg { width: 20px; height: 20px; stroke: currentColor; fill: none; }

/* Кнопка «Задать вопрос» в nav */
.selfsleep-chat-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--r-sm);
  background: var(--primary-soft);
  border: none;
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
  white-space: nowrap;
}
.selfsleep-chat-btn:active { opacity: 0.65; }
.selfsleep-chat-btn svg { width: 16px; height: 16px; stroke: var(--primary); fill: none; flex-shrink: 0; }

/* Welcome-сообщение */
.selfsleep-chat-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 32px 20px 16px;
  gap: 10px;
}
.selfsleep-chat-welcome-icon {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.selfsleep-chat-welcome-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.selfsleep-chat-welcome h3 {
  font-size: 15px; font-weight: 700;
  color: var(--text);
  margin: 0;
}
.selfsleep-chat-welcome p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0;
}

.growth-empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  padding: 24px 0;
}

/* === Переключатель единиц измерения (удалён, заменён дропдауном) === */

/* === Оценки вечернего анализа === */
.ai-feedback-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.ai-feedback-label {
  font-size: 13px;
  color: var(--text-muted);
  flex: 1;
}
.ai-feedback-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}
.ai-feedback-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 8%, transparent);
}
.ai-feedback-btn.active-up {
  border-color: #4CAF50;
  color: #4CAF50;
  background: rgba(76,175,80,0.10);
}
.ai-feedback-btn.active-down {
  border-color: #F44336;
  color: #F44336;
  background: rgba(244,67,54,0.10);
}
.ai-feedback-btn:disabled {
  cursor: default;
  opacity: 0.55;
}
.ai-feedback-btn:disabled.active-up,
.ai-feedback-btn:disabled.active-down {
  opacity: 1;
}
.ai-feedback-thanks {
  font-size: 13px;
  color: var(--primary);
  font-weight: 500;
}
.ai-analysis-text {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  text-align: left;
}
.ai-analysis-empty {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  padding: 16px 0;
}

/* ─── Смещение времени (N мин назад) ─────────────────────── */
/* ─── Смещение времени — сегментированный контрол ─── */
.offset-segment {
  display: grid;
  grid-template-columns: repeat(5, 1fr) 36px;
  gap: 0;
  background: var(--input-bg);
  border-radius: var(--r-md);
  padding: 3px;
  margin-top: 2px;
}
.offset-chip {
  padding: 8px 4px;
  border-radius: calc(var(--r-md) - 2px);
  border: none;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  text-align: center;
  line-height: 1;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: center;
}
.offset-chip .chip-main {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.offset-chip .chip-sub { display: none; }
.offset-chip.active {
  background: var(--surface);
  box-shadow: 0 1px 4px rgba(0,0,0,0.12);
  color: var(--primary);
}
.offset-chip.active .chip-main { color: var(--primary); }
.offset-chip--custom {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}
.offset-chip--custom svg { display: block; }
.offset-chip--custom.active { background: var(--surface); box-shadow: 0 1px 4px rgba(0,0,0,0.12); }
.offset-chip--custom.active svg { stroke: var(--primary); }
.offset-custom-row {
  display: flex;
  align-items: center;
  margin-top: 8px;
  gap: 8px;
}
.offset-time-input {
  flex: 1;
  height: 44px;
  border: 1px solid var(--border, rgba(0,0,0,0.1));
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--text);
  font-size: 18px;
  font-weight: 600;
  font-family: inherit;
  text-align: center;
  padding: 0 12px;
  outline: none;
}
.offset-time-input:focus {
  border-color: var(--primary);
}

/* ── Баннер «Нет детей» ─────────────────────────────────────────────────────── */
.no-child-banner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px 20px 24px;
  margin-bottom: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.no-child-banner__title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
.no-child-banner__sub {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.45;
}
.no-child-banner__btn {
  margin-top: 8px;
  width: 100%;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary) 0%, #8A7ED5 100%);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: opacity 0.15s;
}
.no-child-banner__btn:active { opacity: 0.8; }

/* ── Настройки уведомлений (bottom sheet) ───────────────────────────────────── */
.notif-settings-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.notif-settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--gold-soft);
  gap: 12px;
}
.notif-settings-row:last-child { border-bottom: none; }
.notif-settings-info { flex: 1; }
.notif-settings-label {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}
.notif-settings-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}
/* Toggle switch */
.notif-toggle {
  position: relative;
  width: 46px;
  height: 26px;
  flex-shrink: 0;
}
.notif-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}
.notif-toggle-track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--track);
  transition: background 0.2s;
  cursor: pointer;
}
.notif-toggle-track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s cubic-bezier(0.34,1.56,0.64,1);
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.notif-toggle input:checked + .notif-toggle-track {
  background: var(--primary);
}
.notif-toggle input:checked + .notif-toggle-track::after {
  transform: translateX(20px);
}

/* Самописный тоггл-кнопка (без native checkbox — для Telegram Android WebView) */
.notif-toggle-btn {
  position: relative;
  width: 46px;
  height: 26px;
  flex-shrink: 0;
  border: none;
  padding: 0;
  margin: 0;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.notif-toggle-btn-track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--track);
  transition: background 0.2s;
  pointer-events: none;
}
.notif-toggle-btn-track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s cubic-bezier(0.34,1.56,0.64,1);
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.notif-toggle-btn[data-checked="true"] .notif-toggle-btn-track {
  background: var(--primary);
}
.notif-toggle-btn[data-checked="true"] .notif-toggle-btn-track::after {
  transform: translateX(20px);
}

/* ── Кастомный confirm-диалог ── */
.app-confirm-backdrop {
  position: fixed; inset: 0; z-index: 400;
  background: rgba(0,0,0,0.5);
  display: flex; align-items: flex-end; justify-content: center;
  padding-bottom: env(safe-area-inset-bottom, 0);
  opacity: 0; transition: opacity 0.2s ease;
  pointer-events: none;
}
.app-confirm-backdrop.open { opacity: 1; pointer-events: all; }
.app-confirm-backdrop.closing { opacity: 0; pointer-events: none; }
.app-confirm-sheet {
  background: var(--surface);
  border-radius: 24px 24px 0 0;
  border: 1px solid var(--border);
  border-bottom: none;
  box-shadow: 0 -10px 40px rgba(0,0,0,0.25);
  padding: 28px 20px calc(env(safe-area-inset-bottom, 0px) + 28px);
  width: 100%; max-width: 480px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  transform: translateY(100%);
  transition: transform 0.32s cubic-bezier(0.2,0.8,0.2,1);
}
.app-confirm-backdrop.open .app-confirm-sheet { transform: translateY(0); }
.app-confirm-backdrop.closing .app-confirm-sheet { transform: translateY(100%); }
.app-confirm-icon {
  width: 58px; height: 58px; border-radius: 18px;
  background: rgba(123,111,196,0.12);
  display: flex; align-items: center; justify-content: center;
  color: var(--primary);
  margin-bottom: 4px;
}
.app-confirm-icon.danger {
  background: rgba(255,59,48,0.12);
  color: #ff3b30;
}
.app-confirm-title {
  font-size: 17px; font-weight: 700; color: var(--text);
  text-align: center;
}
.app-confirm-text {
  font-size: 14px; line-height: 1.55; color: var(--text-secondary);
  text-align: center; padding: 0 4px;
}
.app-confirm-btns {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 10px; width: 100%; margin-top: 8px;
}
.app-confirm-btn {
  padding: 14px; border-radius: 14px;
  font-size: 15px; font-weight: 600;
  border: none; cursor: pointer;
  transition: opacity 0.15s, transform 0.12s;
}
.app-confirm-btn:active { opacity: 0.8; transform: scale(0.97); }
.app-confirm-btn.cancel {
  background: var(--surface-2, var(--border));
  color: var(--text);
}
.app-confirm-btn.danger {
  background: #ff3b30;
  color: #fff;
}
.app-confirm-btn.primary {
  background: var(--primary);
  color: #fff;
}
.app-confirm-btn.gold {
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold) 100%);
  color: #1A1840;
}
.app-confirm-btn.secondary {
  background: var(--primary-soft, rgba(124,111,212,0.13));
  color: var(--primary);
}

/* ── Форма отзыва (bottomsheet) ── */
.feedback-modal-backdrop {
  position: fixed; inset: 0; z-index: 400;
  background: rgba(0,0,0,0.48);
  display: flex; align-items: flex-end; justify-content: center;
  padding-bottom: env(safe-area-inset-bottom, 0);
  opacity: 0; transition: opacity 0.2s ease;
  pointer-events: none;
}
.feedback-modal-backdrop.open { opacity: 1; pointer-events: all; }
.feedback-modal-backdrop.closing { opacity: 0; pointer-events: none; }
.feedback-modal {
  background: var(--surface);
  border-radius: 24px 24px 0 0;
  border: 1px solid var(--border);
  border-bottom: none;
  box-shadow: 0 -10px 40px rgba(0,0,0,0.25);
  padding: 28px 20px calc(env(safe-area-inset-bottom, 0px) + 32px);
  width: 100%; max-width: 480px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.2,0.8,0.2,1);
}
.feedback-modal-backdrop.open .feedback-modal { transform: translateY(0); }
.feedback-modal-backdrop.closing .feedback-modal { transform: translateY(100%); }
.feedback-modal-icon {
  width: 58px; height: 58px; border-radius: 18px;
  background: rgba(123,111,196,0.12);
  display: flex; align-items: center; justify-content: center;
  color: var(--primary); margin-bottom: 2px;
}
.feedback-modal-title {
  font-size: 17px; font-weight: 700; color: var(--text);
  text-align: center;
}
.feedback-modal-subtitle {
  font-size: 13px; line-height: 1.5; color: var(--text-secondary);
  text-align: center; margin-bottom: 4px;
}
.feedback-textarea {
  width: 100%; box-sizing: border-box;
  background: var(--surface-2, var(--bg));
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  font-size: 15px; line-height: 1.55;
  color: var(--text);
  resize: none; outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
}
.feedback-textarea:focus { border-color: var(--primary); }
.feedback-textarea::placeholder { color: var(--text-muted); }
.feedback-counter {
  font-size: 12px; color: var(--text-muted);
  text-align: right; padding-right: 2px; width: 100%;
}
.feedback-modal-btns {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 10px; width: 100%; margin-top: 4px;
}
.feedback-modal-btn {
  padding: 14px; border-radius: 14px;
  font-size: 15px; font-weight: 600;
  border: none; cursor: pointer;
  transition: opacity 0.15s, transform 0.12s;
}
.feedback-modal-btn:active { opacity: 0.8; transform: scale(0.97); }
.feedback-modal-btn.cancel {
  background: var(--surface-2, var(--border));
  color: var(--text);
}
.feedback-modal-btn.send {
  background: var(--primary); color: #fff;
}
.feedback-modal-btn.send:disabled { opacity: 0.6; cursor: default; }

/* ─── Feedback attachments ─────────────────────── */
.fb-attach-row{display:flex;align-items:center;gap:10px;width:100%;margin-top:-2px;flex-wrap:wrap}
.fb-attach-btn{display:inline-flex;align-items:center;gap:6px;padding:8px 12px;border-radius:10px;background:var(--surface-2, rgba(127,127,127,0.08));color:var(--text);border:1px solid var(--border);font-size:13px;font-weight:500;cursor:pointer;transition:background 0.15s, transform 0.1s}
.fb-attach-btn:hover{background:var(--surface-3, rgba(127,127,127,0.14))}
.fb-attach-btn:active{transform:scale(0.97)}
.fb-attach-btn:disabled{cursor:not-allowed}
.fb-attach-hint{font-size:12px;color:var(--text-muted)}
.fb-attach-list{display:flex;gap:8px;flex-wrap:wrap;width:100%}
.fb-attach-list:empty{display:none}
.fb-attach-item{position:relative;width:64px;height:64px;border-radius:10px;overflow:hidden;background:var(--surface-2, rgba(127,127,127,0.08));border:1px solid var(--border)}
.fb-attach-item img{width:100%;height:100%;object-fit:cover;display:block}
.fb-attach-remove{position:absolute;top:3px;right:3px;width:20px;height:20px;border-radius:50%;background:rgba(0,0,0,0.65);color:#fff;border:none;display:inline-flex;align-items:center;justify-content:center;cursor:pointer;padding:0}
.fb-attach-remove:hover{background:rgba(0,0,0,0.85)}

/* ── Premium paywall & lock overlays ─────────────────────────────── */
.paywall-icon {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--surface-2, rgba(255,255,255,0.06));
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 12px;
  color: var(--primary);
}
.paywall-sheet {
  text-align: center;
}
.paywall-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  text-align: center;
  margin: 8px 0 6px;
  letter-spacing: -0.01em;
}
.paywall-desc {
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 4px;
}
/* paywall-close-btn — удалён, используем sheet-close */
.paywall-price-hint {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 8px;
  text-align: center;
}
.paywall-features {
  width: 100%; margin: 14px 0 18px;
  text-align: left;
}
.paywall-feature-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.paywall-feature-row:last-child { border-bottom: none; }
.paywall-feature-row > svg { color: var(--primary); flex-shrink: 0; margin-top: 3px; }
.paywall-feature-text {
  display: flex; flex-direction: column; gap: 1px;
}
.paywall-feature-name {
  font-size: 14px; font-weight: 600; color: var(--text);
}
.paywall-feature-sub {
  font-size: 12px; color: var(--text-muted); line-height: 1.4;
}
.paywall-section-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  opacity: 0.55;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-top: 20px;
  margin-bottom: 8px;
  width: 100%;
  text-align: left;
}

/* Ghost-кнопка "Не сейчас" */
.app-confirm-btn-ghost {
  width: 100%; padding: 8px;
  background: none; border: none; cursor: pointer;
  font-size: 14px; font-weight: 500;
  color: var(--text-muted);
  margin-top: 2px;
  border-radius: 14px;
  transition: opacity 0.15s;
}
.app-confirm-btn-ghost:active { opacity: 0.6; }

/* Lock-оверлей поверх карточки (вечерний анализ) */
.premium-lock-overlay {
  position: absolute; inset: 0;
  border-radius: inherit;
  background: rgba(0,0,0,0.38);
  display: flex; align-items: center; justify-content: center;
  z-index: 10; cursor: pointer;
  backdrop-filter: blur(2px);
  border-radius: 16px;
}
.premium-lock-badge {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--primary);
  color: #fff; font-size: 12px; font-weight: 700;
  padding: 5px 12px; border-radius: 20px;
  letter-spacing: 0.3px;
}

/* Lock-значок на кнопке AI-план */
.btn-lock-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px;
  background: rgba(255,255,255,0.18);
  border-radius: 50%;
  margin-left: 4px;
}

/* Заглушка плана (premium) */
.premium-plan-stub {
  text-align: center;
  padding: 32px 20px;
  color: var(--text-muted);
}
.premium-plan-stub-icon {
  color: var(--primary);
  margin-bottom: 14px;
  opacity: 0.7;
}
.premium-plan-stub-title {
  font-size: 16px; font-weight: 700;
  color: var(--text); margin-bottom: 8px;
}
.premium-plan-stub-desc {
  font-size: 14px; line-height: 1.5;
  color: var(--text-muted);
}

/* Demo-блок модалка — иконка */
.app-confirm-sheet .paywall-icon {
  margin-bottom: 14px;
}

/* ── Premium nav tab lock ─────────────────────────────────────────── */
.nav-item-icon-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px; height: 26px;
}
.nav-premium-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: #fff;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  pointer-events: none;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.20);
  z-index: 2;
}
.nav-premium-badge svg,
.header-premium-badge svg {
  display: block;
  width: 62%;
  height: 62%;
}
/* Скрываем иконку-обёртку когда разблокирован */
.nav-item-premium.unlocked .nav-item-icon-wrap {
  position: static;
}
/* Скрываем замочек когда таб разблокирован */
.nav-item-premium.unlocked .nav-premium-badge {
  display: none;
}
/* Заблокированный таб — серый (только иконка и подпись, не badge) */
.nav-item-premium.locked {
  opacity: 1;
}
.nav-item-premium.locked > svg,
.nav-item-premium.locked .nav-item-icon-wrap > svg,
.nav-item-premium.locked > span:not(.nav-premium-badge) {
  opacity: 0.45;
}
.nav-item-premium.locked:active {
  transform: none;
}

/* ── Premium locked cards ─────────────────────────────────────────── */
.premium-locked {
  position: relative;
  overflow: hidden;
  cursor: pointer;
  user-select: none;
}
.premium-locked::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--surface, var(--bg));
  opacity: 0.55;
  border-radius: inherit;
  pointer-events: none;
  z-index: 2;
}
.premium-locked .premium-card-badge {
  display: flex;
}
.premium-card-badge {
  display: none;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 3;
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 5px 14px;
  border-radius: 20px;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
}

/* Premium features list in profile */
.sub-features-list {
  margin: 8px 0 12px 0;
  padding: 0 0 0 18px;
  list-style: disc;
  color: var(--text);
  font-size: 13px;
  line-height: 1.55;
  opacity: 0.85;
}
.sub-features-list li {
  margin-bottom: 5px;
}

/* Premium features list — checkmark style */
.sub-features {
  margin: 12px 0 16px;
}
.sub-feature-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
}
.sub-feature-item:last-child { border-bottom: none; }
.sub-feature-check {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-top: 1px;
}
.sub-feature-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}
.sub-feature-desc {
  font-size: 12px;
  color: var(--text);
  opacity: 0.55;
  line-height: 1.4;
}

.sub-upsell {
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  opacity: 0.75;
  margin: 12px 0 4px;
}

/* ============================================================================
   Lunora — Звуки сна v5.5.1-dev (overlay + табы + плеер)
   ============================================================================ */

/* Полноэкранный overlay */
.sounds-overlay {
  /* v5.6.27: оверлей оставляет видимой .app-header (юзер видит бейдж ребёнка и может переключать) */
  position: fixed;
  top: calc(env(safe-area-inset-top) + 60px);
  left: 0; right: 0; bottom: 0;
  background: var(--bg, #f6f7fb);
  z-index: 25; /* ниже .app-header (z-index:30) */
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform .25s ease;
  overflow: hidden;
}

/* v5.6.32: убрано переопределение .section-title (ломало мелкие заголовки в профиле).
   Базовый стиль (11px uppercase muted) живёт на строке 881. */
.sounds-overlay.is-open {
  transform: translateY(0);
}

/* v5.6.12: фикс привязки к viewport — как .bottom-nav */
.sounds-bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  transform: none;
  bottom: 0;
  width: 100%;
  max-width: 100%;
  padding: 8px 16px calc(env(safe-area-inset-bottom) + 8px);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  background: var(--surface);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: none;
  border-radius: 0;
  box-shadow: none;
  border-top: 1px solid var(--border);
  z-index: 20;
  margin: 0;
}
.sounds-nav-btn {
  border: 0;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 4px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease, transform 0.12s ease;
}
.sounds-nav-btn:active { transform: scale(0.94); }
.sounds-nav-btn.is-active {
  color: var(--primary);
  background: var(--primary-soft);
}
.sounds-nav-btn svg { display: block; transition: transform 0.2s ease; width: 22px; height: 22px; }
/* v5.6.7: убрал translateY — подписи выравниваются */
.sounds-nav-btn.is-active svg { transform: none; }

.sounds-body {
  flex: 1;
  overflow-y: auto;
  /* v5.6.11: padding 16 по бокам — совпадает с навом (528) */
  padding: 16px 16px calc(env(safe-area-inset-bottom) + 92px);
  -webkit-overflow-scrolling: touch;
}

/* ── Шумы: грид ──────────────────────────────────────────────────────────── */
.sounds-noise-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding-bottom: 16px;
}
/* Карточка шума в стиле приложения (белая + пастельная подложка иконки) */
.noise-card {
  position: relative;
  border: 1px solid var(--border, #eef0f4);
  border-radius: var(--r-md, 18px);
  background: var(--card, #fff);
  color: var(--text, #1f2937);
  padding: 14px 12px;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  box-shadow: var(--shadow-sm, 0 1px 2px rgba(0,0,0,.04));
  transition: transform .12s ease, box-shadow .15s, border-color .15s;
}
.noise-card:active { transform: scale(.98); }
.noise-card.is-playing {
  border-color: var(--primary, #6366f1);
  box-shadow: 0 0 0 2px rgba(99,102,241,.2), 0 4px 12px rgba(99,102,241,.12);
}
.noise-card-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--r-sm, 10px);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.noise-card-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  width: 100%;
}
.noise-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text, #1f2937);
  line-height: 1.2;
}
.noise-card-sub {
  font-size: 12px;
  color: var(--text-muted, #64748b);
  line-height: 1.3;
}
.noise-card-play {
  position: absolute;
  top: 14px;
  right: 12px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted, #94a3b8);
  transition: background .15s, color .15s;
}
.noise-card.is-playing .noise-card-play {
  background: var(--primary, #6366f1);
  color: #fff;
  animation: noisePulse 1.6s ease-in-out infinite;
}
@keyframes noisePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(99,102,241,.45); }
  50%      { box-shadow: 0 0 0 7px rgba(99,102,241,0); }
}

/* Пастельные подложки иконок (light) */
.noise-card.tone-slate  .noise-card-icon { background: #f1f5f9; color: #475569; }
.noise-card.tone-pink   .noise-card-icon { background: #fce7f3; color: #db2777; }
.noise-card.tone-mocha  .noise-card-icon { background: #f4ece4; color: #8b6f4e; }
.noise-card.tone-sky    .noise-card-icon { background: #e0f2fe; color: #0284c7; }
.noise-card.tone-violet .noise-card-icon { background: #ede9fe; color: #7c3aed; }

/* v5.6.9: sticky-bar Шумов полностью убран — подсказки больше нет */
.sounds-sticky { display: none !important; }
.sticky-hint {
  font-size: 11px;
  color: var(--text-muted, #94a3b8);
  text-align: center;
  line-height: 1.4;
}

/* ── Колыбельные: плеер ──────────────────────────────────────────────────── */
.lull-player-wrap {
  background: var(--card, #fff);
  border-radius: 20px;
  padding: 20px 18px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  box-shadow: 0 4px 18px rgba(0,0,0,.05);
}
.lull-cover {
  width: 230px;
  height: 230px;
  max-width: 70vw;
  max-height: 70vw;
  border-radius: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 0 12px 32px rgba(0,0,0,.18);
  overflow: hidden;
}
.lull-cover::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,.25), transparent 60%);
  pointer-events: none;
}
.lull-cover.has-cover::before { display: none; }
.lull-row-cover.has-cover > span { display: none; }
.lull-cover-emoji {
  font-size: 88px;
  filter: drop-shadow(0 6px 16px rgba(0,0,0,.25));
  z-index: 1;
}
.lull-cover-num {
  position: absolute;
  bottom: 12px;
  right: 14px;
  font-size: 28px;
  font-weight: 800;
  color: rgba(255,255,255,.55);
  font-variant-numeric: tabular-nums;
  z-index: 1;
}

.lull-meta {
  text-align: center;
  width: 100%;
}
.lull-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text, #1f2937);
  margin-bottom: 2px;
}
.lull-artist {
  font-size: 13px;
  color: var(--text-muted, #64748b);
}

.lull-progress {
  width: 100%;
}
.lull-progress input[type="range"] {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 2px;
  background: var(--border, #e5e7eb);
  outline: 0;
}
.lull-progress input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--primary, #6366f1);
  cursor: pointer;
}
.lull-progress input[type="range"]::-moz-range-thumb {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--primary, #6366f1);
  cursor: pointer;
  border: 0;
}
.lull-time {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted, #64748b);
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

.lull-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
}
.lull-ctl {
  border: 0;
  background: transparent;
  color: var(--text, #1f2937);
  cursor: pointer;
  width: 56px; height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, transform .12s;
}
.lull-ctl:hover { background: var(--hover, rgba(0,0,0,.05)); }
.lull-ctl:active { transform: scale(.92); }
.lull-ctl.lull-play {
  width: 68px; height: 68px;
  background: var(--primary, #6366f1);
  color: #fff;
  box-shadow: 0 6px 16px rgba(99,102,241,.32);
}
.lull-ctl.lull-play:hover { background: var(--primary-hover, #4f52e5); }

/* Плейлист под плеером */
.lull-list-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-muted, #64748b);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin: 22px 4px 10px;
}
.lull-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-bottom: 96px; /* место для bottom-nav */
}
.lull-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  background: var(--card, #fff);
  border-radius: 14px;
  cursor: pointer;
  transition: background .15s;
}
.lull-row:hover { background: var(--hover, #f4f5fa); }
.lull-row.is-active {
  background: var(--primary-soft, #eef0ff);
}
.lull-row-cover {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,.85);
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}
.lull-row-meta {
  flex: 1;
  min-width: 0;
}
.lull-row-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text, #1f2937);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lull-row-sub {
  font-size: 12px;
  color: var(--text-muted, #64748b);
  margin-top: 2px;
}
.lull-row-action {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary, #6366f1);
  flex-shrink: 0;
}
.lull-row.is-active .lull-row-action {
  background: var(--primary, #6366f1);
  color: #fff;
}

/* Карточка "Звуки сна" на главной — скрываем Premium-бейдж для активных Premium */
/* v5.6.32: бейдж Premium на selfsleep скрываем только у paid (без trial) — иначе trial видит
   разблокированную плитку, кликает и получает пейвол. */
body.is-premium .wiki-home-btn.sounds-home-btn .premium-card-badge,
body.is-premium .wiki-home-btn.chat-home-btn .premium-card-badge,
body.is-paid-premium .wiki-home-btn.selfsleep-home-btn .premium-card-badge {
  display: none;
}
body.is-premium .wiki-home-btn.sounds-home-btn,
body.is-paid-premium .wiki-home-btn.selfsleep-home-btn,
body.is-premium .wiki-home-btn.chat-home-btn {
  /* лёгкая premium-метка вместо бейджа: тонкая золотистая полоса слева */
}

/* Иконка карточки звуков на главной — мятный пастель (в стиле соседних карточек) */
.sounds-home-icon {
  background: #f1edfd;
  color: #7054da;
}

.growth-spurts-home-icon {
  background: #dbeafe;
  color: #2563eb;
}
.growth-spurts-home-card { padding: 14px; }
.growth-spurts-home-card { overflow: visible; }

.growth-spurts-overlay {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 60px);
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg);
  z-index: 25;
  display: flex;
  flex-direction: column;
  max-width: 560px;
  margin: 0 auto;
  transform: translateY(100%);
  transition: transform .25s ease;
  overflow: hidden;
}
.growth-spurts-overlay.open { transform: translateY(0); }

.growth-spurts-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--nav-bg);
}
.growth-spurts-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.growth-spurts-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px 22px;
}
.growth-spurts-summary {
  background: var(--surface);
  border: none;
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  padding: 14px;
}
.growth-spurts-summary-title {
  font-size: 14px;
  color: var(--text-muted);
}
.growth-spurts-summary-week {
  margin-top: 4px;
  font-size: 24px;
  font-weight: 800;
  color: var(--text);
}
.growth-spurts-summary-sub {
  margin-top: 4px;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.35;
}
.growth-spurts-phase {
  margin-top: 10px;
  background: var(--surface);
  border: none;
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  padding: 14px;
}
.growth-spurts-phase-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.growth-spurts-phase-text {
  margin-top: 6px;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.45;
}
.growth-spurts-tips-title {
  margin-top: 10px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: .01em;
}
.growth-spurts-grid-card {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
}
.growth-spurts-grid-card--home { margin-top: 0; }
.growth-spurts-grid-title {
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.growth-spurts-grid-title-text {
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.growth-spurts-info-wrap {
  margin-left: auto;
  position: relative;
}
.growth-spurts-info-btn {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  padding: 0;
}
.growth-spurts-info-tip {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: min(220px, calc(100vw - 64px));
  background: var(--surface);
  color: var(--text-muted);
  border-radius: 12px;
  box-shadow: 0 10px 28px rgba(111, 94, 191, 0.16);
  padding: 10px 12px;
  font-size: 11.5px;
  line-height: 1.45;
  text-transform: none !important;
  letter-spacing: 0;
  font-weight: 500;
  border: 1px solid var(--border);
  z-index: 3;
  display: none;
}
.growth-spurts-info-wrap.open .growth-spurts-info-tip {
  display: block;
}
.growth-spurts-legend {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
}
.growth-spurts-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}
.growth-spurts-legend-item .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
}
.growth-spurts-legend-item .dot.calm {
  background: transparent;
  border: 1px solid rgba(124,111,212,0.45);
}
.growth-spurts-legend-item .dot.leap { background: #fbcfe8; }
.growth-spurts-legend-item .dot.current {
  background: #7c6fd4;
  border: 1px solid #7c6fd4;
}
.growth-spurts-grid {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 5px;
  width: 100%;
  max-width: 100%;
  justify-content: stretch;
  margin-left: auto;
  margin-right: auto;
}
.growth-spurts-week-chip {
  width: 100%;
  height: auto;
  min-height: 0;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: clamp(9px, 2.2vw, 11px);
  font-weight: 700;
  background: transparent;
  border: 1px solid transparent;
  padding: 0;
  cursor: pointer;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  transition: transform .12s ease, box-shadow .16s ease;
}
.growth-spurts-week-chip:active { transform: scale(0.97); }
.growth-spurts-week-chip.is-calm {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border-strong);
}
.growth-spurts-week-chip.is-leap {
  background: #fde7f2;
  color: #a32a63;
  border-color: transparent;
}
.growth-spurts-week-chip.is-current {
  background: #7c6fd4;
  color: #ffffff;
  border-color: #7c6fd4;
}
.growth-spurts-week-chip.is-selected {
  box-shadow: 0 0 0 2px rgba(124,111,212,0.22);
}
.growth-spurts-week-tip-box {
  margin-top: 10px;
  background: var(--surface);
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: none;
  padding: 10px 12px;
  color: var(--text);
}

:root[data-theme="dark"] input[type="time"],
:root[data-theme="dark"] input[type="date"] {
  color-scheme: dark;
}
:root[data-theme="dark"] input[type="time"]::-webkit-calendar-picker-indicator,
:root[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(92%) sepia(8%) saturate(460%) hue-rotate(191deg) brightness(96%) contrast(94%);
  opacity: 0.9;
}
:root[data-theme="dark"] .field-input[type="time"],
:root[data-theme="dark"] .offset-time-input {
  background: var(--surface-2) !important;
  color: var(--text) !important;
  border-color: var(--border-strong) !important;
}
:root[data-theme="dark"] .field-input[type="time"]::-webkit-datetime-edit,
:root[data-theme="dark"] .offset-time-input::-webkit-datetime-edit {
  color: var(--text) !important;
}

:root[data-theme="dark"] .field-input,
:root[data-theme="dark"] .field-textarea,
:root[data-theme="dark"] .feedback-textarea,
:root[data-theme="dark"] .feeding-note-input,
:root[data-theme="dark"] .feeding-date-input,
:root[data-theme="dark"] .custom-select-btn,
:root[data-theme="dark"] .referral-link,
:root[data-theme="dark"] .invite-link-block,
:root[data-theme="dark"] .feeding-picker-search-wrap,
:root[data-theme="dark"] .feeding-search-wrap,
:root[data-theme="dark"] .feeding-picker-trigger,
:root[data-theme="dark"] .feeding-picker-item {
  background: var(--surface-2);
  border-color: var(--border-strong);
  color: var(--text);
}
:root[data-theme="dark"] .field-input::placeholder,
:root[data-theme="dark"] .field-textarea::placeholder,
:root[data-theme="dark"] .feedback-textarea::placeholder,
:root[data-theme="dark"] .feeding-note-input::placeholder,
:root[data-theme="dark"] .feeding-date-input::placeholder,
:root[data-theme="dark"] .selfsleep-chat-textarea::placeholder {
  color: var(--text-muted);
  opacity: 0.92;
}
:root[data-theme="dark"] .field-input:focus,
:root[data-theme="dark"] .field-textarea:focus,
:root[data-theme="dark"] .feedback-textarea:focus,
:root[data-theme="dark"] .feeding-note-input:focus,
:root[data-theme="dark"] .feeding-date-input:focus,
:root[data-theme="dark"] .custom-select-btn:focus,
:root[data-theme="dark"] .custom-select-btn.open {
  border-color: #A398EE;
}
.growth-spurts-week-tip-title {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .01em;
}
.growth-spurts-week-tip-status {
  margin-top: 4px;
  font-size: 11px;
  font-weight: 700;
  color: #6a5fcc;
}
.growth-spurts-week-tip-text {
  margin-top: 6px;
  font-size: 11.5px;
  line-height: 1.42;
  color: var(--text-muted);
}
.growth-spurts-list {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.growth-spurts-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.growth-spurts-row-left {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.growth-spurts-row-week {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.growth-spurts-row-name {
  font-size: 12px;
  color: var(--text);
  opacity: .82;
  margin-top: 2px;
}
.growth-spurts-row-range {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}
.growth-spurts-badge {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  border-radius: 999px;
  padding: 5px 10px;
  border: 1px solid transparent;
}
.growth-spurts-badge.active {
  background: rgba(16, 185, 129, 0.14);
  color: #0f766e;
}
.growth-spurts-badge.upcoming {
  background: rgba(99, 102, 241, 0.12);
  color: #4f46e5;
}
.growth-spurts-badge.done {
  background: rgba(148, 163, 184, 0.16);
  color: #64748b;
}
.growth-spurts-nav {
  border-top: 1px solid var(--border);
  background: var(--nav-bg);
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
}
.growth-spurts-back {
  width: 100%;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
}
.growth-spurts-back:active { transform: scale(0.98); }

.growth-spurts-empty {
  padding: 40px 14px;
  text-align: center;
  font-size: 14px;
  color: var(--text-muted);
}

/* Тёмная тема */
@media (prefers-color-scheme: dark) {
  .sounds-overlay { background: #0f1115; }
  .sounds-sticky, .lull-player-wrap, .lull-row, .noise-card { background: #1a1d23; border-color: #262a31; color: #e6e8eb; }
  .sounds-nav-btn { color: #9aa3b2; }
  .sounds-nav-btn.is-active { background: rgba(99,102,241,.18); color: #a5b4fc; }
  .noise-card-title { color: #e6e8eb; }
  .noise-card-sub { color: #9aa3b2; }
  .noise-card.tone-slate  .noise-card-icon { background: rgba(148,163,184,.18); color: #cbd5e1; }
  .noise-card.tone-pink   .noise-card-icon { background: rgba(244,114,182,.18); color: #f9a8d4; }
  .noise-card.tone-mocha  .noise-card-icon { background: rgba(168,128,86,.18);  color: #d4a574; }
  .noise-card.tone-sky    .noise-card-icon { background: rgba(56,189,248,.18);  color: #7dd3fc; }
  .noise-card.tone-violet .noise-card-icon { background: rgba(167,139,250,.18); color: #c4b5fd; }
  .lull-row:hover { background: #20242b; }
  .lull-row.is-active { background: rgba(99,102,241,.18); }
  .sounds-home-icon { background: #f1edfd; color: #7054da; }
  .growth-spurts-home-icon { background: rgba(59,130,246,.18); color: #93c5fd; }
}
body.theme-dark .sounds-overlay { background: #0f1115; }
body.theme-dark .sounds-sticky,
body.theme-dark .lull-player-wrap,
body.theme-dark .lull-row,
body.theme-dark .noise-card { background: #1a1d23; border-color: #262a31; color: #e6e8eb; }
body.theme-dark .sounds-nav-btn { color: #9aa3b2; }
body.theme-dark .sounds-nav-btn.is-active { background: rgba(99,102,241,.18); color: #a5b4fc; }
body.theme-dark .noise-card-title { color: #e6e8eb; }
body.theme-dark .noise-card-sub { color: #9aa3b2; }
body.theme-dark .noise-card.tone-slate  .noise-card-icon { background: rgba(148,163,184,.18); color: #cbd5e1; }
body.theme-dark .noise-card.tone-pink   .noise-card-icon { background: rgba(244,114,182,.18); color: #f9a8d4; }
body.theme-dark .noise-card.tone-mocha  .noise-card-icon { background: rgba(168,128,86,.18);  color: #d4a574; }
body.theme-dark .noise-card.tone-sky    .noise-card-icon { background: rgba(56,189,248,.18);  color: #7dd3fc; }
body.theme-dark .noise-card.tone-violet .noise-card-icon { background: rgba(167,139,250,.18); color: #c4b5fd; }
body.theme-dark .lull-row.is-active { background: rgba(99,102,241,.18); }
body.theme-dark .sounds-home-icon { background: #f1edfd; color: #7054da; }
body.theme-dark .growth-spurts-home-icon { background: rgba(59,130,246,.18); color: #93c5fd; }

:root[data-theme="dark"] .sounds-overlay { background: var(--bg); }
:root[data-theme="dark"] .sounds-sticky,
:root[data-theme="dark"] .lull-player-wrap,
:root[data-theme="dark"] .lull-row,
:root[data-theme="dark"] .noise-card { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
:root[data-theme="dark"] .sounds-nav-btn { color: #9aa3b2; }
:root[data-theme="dark"] .sounds-nav-btn.is-active { background: rgba(99,102,241,.18); color: #a5b4fc; }
:root[data-theme="dark"] .noise-card-title { color: var(--text); }
:root[data-theme="dark"] .noise-card-sub { color: var(--text-muted); }
:root[data-theme="dark"] .noise-card.tone-slate .noise-card-icon { background: rgba(148,163,184,.18); color: #cbd5e1; }
:root[data-theme="dark"] .noise-card.tone-pink .noise-card-icon { background: rgba(244,114,182,.18); color: #f9a8d4; }
:root[data-theme="dark"] .noise-card.tone-mocha .noise-card-icon { background: rgba(168,128,86,.18); color: #d4a574; }
:root[data-theme="dark"] .noise-card.tone-sky .noise-card-icon { background: rgba(56,189,248,.18); color: #7dd3fc; }
:root[data-theme="dark"] .noise-card.tone-violet .noise-card-icon { background: rgba(167,139,250,.18); color: #c4b5fd; }
:root[data-theme="dark"] .lull-row:hover { background: #20242b; }
:root[data-theme="dark"] .lull-row.is-active { background: rgba(99,102,241,.18); }
:root[data-theme="dark"] .sounds-home-icon { background: #f1edfd; color: #7054da; }
:root[data-theme="dark"] .growth-spurts-home-icon { background: rgba(59,130,246,.18); color: #93c5fd; }

/* Контрастные controls в dark */
:root[data-theme="dark"] .mood-card {
  background: var(--surface-2);
  border-color: var(--border);
}
:root[data-theme="dark"] .mood-icon { color: var(--text-secondary); }
:root[data-theme="dark"] .mood-text {
  color: var(--text-secondary);
  opacity: 0.95;
}
:root[data-theme="dark"] .mood-card.active {
  background: color-mix(in srgb, var(--primary) 24%, var(--surface-2));
  border-color: #9D92E6;
}
:root[data-theme="dark"] .mood-card.active .mood-icon,
:root[data-theme="dark"] .mood-card.active .mood-text { color: #E8E5FF; }

:root[data-theme="dark"] .chip-toggle {
  background: var(--surface-2);
  border-color: var(--border-strong);
  color: var(--text-secondary);
}
:root[data-theme="dark"] .chip-toggle.active {
  background: color-mix(in srgb, var(--primary) 28%, var(--surface));
  border-color: #A095EB;
  color: #E8E5FF;
}

:root[data-theme="dark"] .app-confirm-btn.secondary {
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  color: #D8D4FF;
}
:root[data-theme="dark"] .invite-friend-card .app-confirm-btn.secondary {
  background: color-mix(in srgb, var(--primary) 16%, var(--surface));
  border-color: #9186E1;
  color: #EDEAFF;
}

:root[data-theme="dark"] .btn-feeding-delete {
  background: rgba(255, 126, 137, 0.16);
  border-color: rgba(255, 126, 137, 0.48);
  color: #FFB0B7;
}
:root[data-theme="dark"] .btn-feeding-delete:active {
  background: rgba(255, 126, 137, 0.24);
  border-color: rgba(255, 126, 137, 0.62);
}

:root[data-theme="dark"] .sub-cancel-btn {
  color: var(--text-secondary);
  border-color: var(--border-strong);
}
:root[data-theme="dark"] .plan-wake-badge {
  background: var(--surface-2);
  border-color: var(--border-strong);
  color: var(--text-secondary);
}
:root[data-theme="dark"] .plan-wake-line { background: var(--border-strong); }
:root[data-theme="dark"] .stat-sub,
:root[data-theme="dark"] .stat-label,
:root[data-theme="dark"] .row-sub,
:root[data-theme="dark"] .wiki-home-sub,
:root[data-theme="dark"] .journal-subline {
  color: var(--text-secondary);
}

/* ──────────────────────────────────────────────────────────────
   v5.6.0: Редактор плана сна (bottom-sheet)
   ────────────────────────────────────────────────────────────── */
/* Редактируемые слоты — плавный hover/active */
.plan-item.editable {
  cursor: pointer;
  transition: background-color 120ms ease, transform 120ms ease;
  -webkit-tap-highlight-color: transparent;
}
.plan-item.editable:active { transform: scale(0.985); }

.plan-wake-badge.editable {
  cursor: pointer;
  transition: background-color 120ms ease;
}

/* v5.6.0: глобально скрытый scrollbar */
html, body, *, *::before, *::after {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
html::-webkit-scrollbar,
body::-webkit-scrollbar,
*::-webkit-scrollbar { width: 0; height: 0; display: none; }

/* Affordance «можно редактировать» — бледный карандаш на editable слотах */
.plan-edit-affordance {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px; height: 18px;
  margin-left: 6px;
  color: var(--text-muted, #9ca3af);
  opacity: 0.55;
  vertical-align: middle;
  transition: opacity .15s ease;
}
.plan-item.editable:hover .plan-edit-affordance,
.plan-item.editable:active .plan-edit-affordance,
.plan-wake-badge.editable:hover .plan-edit-affordance,
.plan-wake-badge.editable:active .plan-edit-affordance { opacity: 1; }
body.theme-dark .plan-edit-affordance { color: rgba(255,255,255,0.45); }
@media (prefers-color-scheme: dark) {
  .plan-edit-affordance { color: rgba(255,255,255,0.45); }
}

/* Hint-карточка перед днём (белая, в стиле plan-item) */
.plan-edit-hint-card {
  cursor: default;
}
.plan-edit-hint-card .journal-subline {
  color: var(--text-muted, #6b7280);
  font-size: 13px;
}

/* Индикатор «ваша правка» */
.plan-edit-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px; height: 18px;
  margin-left: 6px;
  border-radius: 50%;
  background: #d1fae5;
  color: #059669;
  vertical-align: middle;
}
body.theme-dark .plan-edit-mark {
  background: rgba(52,211,153,.18);
  color: #6ee7b7;
}
@media (prefers-color-scheme: dark) {
  .plan-edit-mark { background: rgba(52,211,153,.18); color: #6ee7b7; }
}

.plan-item.overridden {
  border-left: 1px solid #10b981;
}
body.theme-dark .plan-item.overridden { border-left-color: #6ee7b7; }
@media (prefers-color-scheme: dark) {
  .plan-item.overridden { border-left-color: #6ee7b7; }
}

.plan-wake-badge.edited {
  background: rgba(16,185,129,.10);
  color: #047857;
  border-color: rgba(16,185,129,.25);
}
body.theme-dark .plan-wake-badge.edited {
  background: rgba(52,211,153,.18);
  color: #6ee7b7;
  border-color: rgba(52,211,153,.30);
}

/* Карточка «Изменить число снов» */
.plan-naps-count-card {
  margin-top: 12px;
}
.plan-naps-count-card .plan-status-badge.upcoming {
  background: #d1fae5;
  color: #059669;
  font-weight: 700;
  min-width: 28px;
  text-align: center;
}
body.theme-dark .plan-naps-count-card .plan-status-badge.upcoming {
  background: rgba(52,211,153,0.18);
  color: #6ee7b7;
}
@media (prefers-color-scheme: dark) {
  .plan-naps-count-card .plan-status-badge.upcoming {
    background: rgba(52,211,153,0.18);
    color: #6ee7b7;
  }
}

/* Контейнер редактора в bottom-sheet */
.plan-editor {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 18px;
  padding: 4px 0 12px;
}

.plan-editor-hint {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted, #6b7280);
  line-height: 1.4;
}
.plan-editor-info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

/* Степпер: – значение + */
.plan-editor-stepper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--bg-soft, #f3f4f6);
  border-radius: 16px;
  padding: 14px 18px;
}
body.theme-dark .plan-editor-stepper { background: #20242b; }
@media (prefers-color-scheme: dark) {
  .plan-editor-stepper { background: #20242b; }
}

.plan-editor-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: #fff;
  color: #111827;
  border: none;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  transition: transform 100ms ease, background-color 120ms ease;
  -webkit-tap-highlight-color: transparent;
}
.plan-editor-btn:hover { background: #f9fafb; }
.plan-editor-btn:active:not(:disabled) { transform: scale(0.92); }
.plan-editor-btn:disabled { opacity: 0.4; cursor: not-allowed; }
body.theme-dark .plan-editor-btn { background: #2a2f37; color: #e6e8eb; }
body.theme-dark .plan-editor-btn:hover { background: #343941; }
@media (prefers-color-scheme: dark) {
  .plan-editor-btn { background: #2a2f37; color: #e6e8eb; }
  .plan-editor-btn:hover { background: #343941; }
}

.plan-editor-value {
  flex: 1;
  text-align: center;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text, #111827);
  font-variant-numeric: tabular-nums;
}
body.theme-dark .plan-editor-value { color: #e6e8eb; }
@media (prefers-color-scheme: dark) {
  .plan-editor-value { color: #e6e8eb; }
}

.plan-editor-step-hint {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted, #9ca3af);
}

/* Кнопка «Сохранить» */
.plan-editor-save {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 50px;
  border-radius: 14px;
  border: none;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  background: #10b981;
  color: #fff;
  transition: background-color 120ms ease, transform 100ms ease;
  -webkit-tap-highlight-color: transparent;
}
.plan-editor-save:hover { background: #059669; }
.plan-editor-save:active { transform: scale(0.98); }
.plan-editor-save:disabled { opacity: 0.6; cursor: not-allowed; }
.plan-editor-save.loading {
  background: #6b7280;
}

/* v5.7.0 — Banner сигнала перехода (3->2 / 2->1) в редакторе плана */
.plan-transition-banner {
  background: linear-gradient(135deg, rgba(99,102,241,0.10), rgba(168,85,247,0.08));
  border: 1px solid rgba(99,102,241,0.28);
  border-radius: 14px;
  align-items: flex-start;
}
.plan-transition-banner.signal-hard {
  background: linear-gradient(135deg, rgba(99,102,241,0.16), rgba(168,85,247,0.14));
  border-color: rgba(99,102,241,0.45);
}
.plan-transition-banner .journal-icon.plan-transition-icon {
  background: rgba(99,102,241,0.16);
  color: #4f46e5;
}
body.theme-dark .plan-transition-banner .journal-icon.plan-transition-icon {
  background: rgba(99,102,241,0.22);
  color: #a5b4fc;
}
.plan-transition-banner .journal-label {
  color: var(--text-primary);
  font-weight: 600;
}
.plan-transition-banner .journal-subline {
  color: var(--text-muted);
  margin-bottom: 10px;
}
.plan-transition-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}
.plan-transition-btn {
  appearance: none;
  border: 1px solid rgba(99,102,241,0.30);
  background: var(--surface);
  color: var(--text-primary);
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .08s ease, background .15s ease, border-color .15s ease, opacity .15s ease;
}
.plan-transition-btn:active { transform: scale(0.97); }
.plan-transition-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.plan-transition-btn.primary {
  background: #4f46e5;
  border-color: #4f46e5;
  color: #fff;
}
.plan-transition-btn.primary:hover { background: #4338ca; }
.plan-transition-btn.ghost {
  background: transparent;
  border-color: rgba(107,114,128,0.30);
  color: var(--text-muted);
}
body.theme-dark .plan-transition-btn {
  background: rgba(99,102,241,0.10);
  border-color: rgba(99,102,241,0.40);
}
body.theme-dark .plan-transition-btn.primary {
  background: #6366f1;
  border-color: #6366f1;
  color: #fff;
}
body.theme-dark .plan-transition-btn.ghost {
  background: transparent;
  border-color: rgba(156,163,175,0.30);
  color: var(--text-muted);
}

/* ─── iOS: запрет авто-зума и double-tap zoom ──────────────────────────── */
/* 1) Шрифт инпутов >=16px чтобы iOS Safari не зумил при фокусе.            */
/* 2) touch-action: manipulation убирает double-tap zoom (быстрее тапы).    */
html { -webkit-text-size-adjust: 100%; touch-action: manipulation; }
input, textarea, select { font-size: 16px; }
button, a, [role="button"] { touch-action: manipulation; }

/* === v5.6.35: \u0421\u0435\u043b\u0435\u043a\u0442\u043e\u0440 \u0447\u0430\u0441\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u044f\u0441\u0430 \u0432 \u0441\u0442\u0438\u043b\u0435 Google Calendar === */
.row-aside {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 13px;
  flex-shrink: 0;
  max-width: 60%;
}
.row-aside-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* TZ dropdown menu (v5.6.36) — компактное меню в стиле lang-dropdown */
/* Кнопка tz — обрезаем длинный текст многоточием */
#tzDropdownBtn { max-width: 200px; }
#tzDropdownLabel {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
  text-align: left;
}
.tz-menu {
  max-height: 360px;
  min-width: 280px;
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--surface, #ffffff);
  border: 1px solid rgba(100, 90, 180, 0.25);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(60, 50, 120, 0.18), 0 4px 12px rgba(60, 50, 120, 0.10);
}
.tz-menu-search-wrap {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 8px 10px;
  background: var(--bg-card, var(--bg, #1a1830));
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}
.tz-menu-search-ic {
  position: absolute;
  left: 20px;
  color: var(--text-muted);
  pointer-events: none;
}
.tz-menu-search {
  flex: 1;
  width: 100%;
  height: 32px;
  background: var(--border);
  border: 1px solid var(--border-strong, var(--border));
  border-radius: 8px;
  color: inherit;
  padding: 0 10px 0 28px;
  font-size: 16px; /* 16px чтобы iOS не зумил */
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
.tz-menu-search:focus { border-color: var(--accent, #7a6cf2); }
.tz-menu-list {
  flex: 1;
  overflow-y: auto;
  max-height: 320px;
  padding: 4px 0 6px;
  -webkit-overflow-scrolling: touch;
}
.tz-menu-group-header {
  padding: 8px 12px 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  text-transform: uppercase;
  position: sticky;
  top: 0;
  background: var(--bg-card, var(--bg, #1a1830));
  z-index: 1;
}
.tz-menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: none;
  border: none;
  text-align: left;
  font-family: inherit;
  color: inherit;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}
.tz-menu-item:hover,
.tz-menu-item:active { background: var(--border); }
.tz-menu-item.active {
  background: rgba(122, 108, 242, 0.10);
}
.tz-menu-item.active .tz-menu-item-title {
  color: var(--accent, #7a6cf2);
}
.tz-menu-item-main {
  flex: 1;
  min-width: 0;
}
.tz-menu-item-title {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tz-menu-item-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tz-menu-item-time {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.tz-menu-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}
.tz-menu-empty {
  padding: 20px 12px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}
