/* ============================================
   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;
  --safe-area-top: env(safe-area-inset-top, 0px);
  --safe-area-bottom: env(safe-area-inset-bottom, 0px);
  /* One native inset, plus the shared 3 x 8px navigation breathing room. */
  --app-nav-bottom-padding: max(24px, calc(8px + var(--safe-area-bottom)));
  --app-nav-bottom-extra: max(16px, var(--safe-area-bottom));
  --app-header-height: 60px;
  --app-top-offset: calc(var(--safe-area-top) + var(--app-header-height));

  /* Дизайн-система: отступы
     Правило: все карточки используют --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:            #1A1840;
  --bg-elev:       #1F1D47;
  --surface:       #252350;
  --surface-2:     #2D2B5C;
  --border:        rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.12);
  --primary:       #7B6FC4;
  --primary-soft:  rgba(123, 111, 196, 0.18);
  --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-muted:    #9B99C4;
  --danger:        #E57373;
  --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:        #211f4b;
  --header-bg:     #211f4b;
  --track:         rgba(255, 255, 255, 0.06);
  --input-bg:      rgba(255, 255, 255, 0.05);
  --backdrop:      rgba(5, 4, 20, 0.55);
}

:root[data-theme="light"] {
  /* Фон — очень светлый лаванд, как у референса */
  --bg:            #F5F3FE;
  --bg-elev:       #E8E4FA;
  --surface:       #FFFFFF;
  --surface-2:     #F7F5FF;
  --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);
  /* Золотой — убираем коричневатость, делаем тёплый солнечный */
  --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;
  /* #655E9A: контраст 5.80:1 на белом, 5.08:1 на фоне — проходит WCAG AA */
  --text-muted:    #655E9A;
  --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: var(--app-top-offset);
  padding-bottom: calc(var(--app-nav-bottom-extra) + 92px);
  padding-left: 16px;
  padding-right: 16px;
  max-width: 560px;
  margin: 0 auto;
  position: relative;
}

html[data-platform="max"] {
  --safe-area-top: 0px;
}

/* Telegram's device safe area and control area are distinct, additive insets.
   Its bundled SDK updates both variables on fullscreen and orientation changes.
   max() keeps the browser/device notch inset from being counted twice. */
html[data-platform="telegram"] {
  --safe-area-bottom: max(env(safe-area-inset-bottom, 0px), var(--tg-safe-area-inset-bottom, 0px), var(--tg-content-safe-area-inset-bottom, 0px));
  --safe-area-top: calc(max(env(safe-area-inset-top, 0px), var(--tg-safe-area-inset-top, 0px)) + max(0px, var(--tg-content-safe-area-inset-top, 0px)));
}

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: var(--app-top-offset);
  padding: var(--safe-area-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 {
  position: relative;
  color: var(--text);
  overflow: visible;
}
.icon-btn-sounds.locked {
  color: var(--text-muted);
}
.icon-btn-sounds.locked .icon-note {
  animation: none !important;
  transform: none !important;
  opacity: 0.9;
}
.icon-btn-sounds.locked .sound-waves {
  opacity: 0 !important;
}
.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;
}
.sounds-lock-badge {
  position: absolute;
  top: 5px;
  right: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  pointer-events: none;
  z-index: 3;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}
.sounds-lock-badge svg {
  width: 9px;
  height: 9px;
  display: block;
}
.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; }
}

/* ---------- Main ---------- */
.app-main { position: relative; z-index: 1; padding-top: 14px; }

/* Вкладки */
.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: 2px 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-danger-outline {
  background: rgba(255, 59, 48, 0.06);
  color: var(--danger, #ff3b30);
  border: 1px solid rgba(255, 59, 48, 0.25);
}
.btn-danger-outline:hover:not(:disabled) {
  background: rgba(255, 59, 48, 0.1);
}

.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; }

.care-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
}

.btn-care {
    width: 100%;
    background: #eef4ff;
    color: #657cc6;
    box-shadow: none;
    border: none;
  }

.btn-care svg {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
  }

.status-card #btnToilet {
    background: #eef4ff;
    color: #657cc6;
  }

.status-card #btnDiaper {
    background: #fff1f6;
    color: #b26f97;
  }

.status-card #btnToilet svg,
.status-card #btnDiaper svg {
    width: 20px;
    height: 20px;
    transform: scale(1.08);
    transform-origin: center;
  }

.feeding-last-row {
  margin-top: 8px;
  min-height: 0;
  padding: 0;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.25;
  text-align: center;
}

.feeding-last-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.feeding-last-row.is-empty {
  color: var(--muted);
}

/* Тёмная тема — насыщенный фиолетовый, белый текст (контраст 5.2:1) */
:root[data-theme="dark"] .btn-feeding {
  background: #eee9fd;
  color: #4b3f78;
  box-shadow: none;
}
:root[data-theme="dark"] .feeding-last-row {
  color: rgba(238, 233, 253, 0.82);
}

/* Светлая тема — нежно-лавандовый, тёмно-фиолетовый текст (контраст 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;
}

.journal-filters {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 4px;
  margin-bottom: 14px;
  scrollbar-width: none;
}

.journal-filters::-webkit-scrollbar {
  display: none;
}

.journal-filter-chip {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  color: #c46f7d;
  border: none;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
}

.journal-filter-chip.active {
  background: #fff;
  color: #4f9d67;
}

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

.journal-filter-icon svg {
  width: 16px;
  height: 16px;
  display: block;
}

.journal-filter-label {
  display: inline-block;
  line-height: 1;
}

.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;
  }

.day-label-btn {
    min-height: 36px;
    padding: 0 12px;
    border: 0;
    background: transparent;
    color: var(--text);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
}

.journal-day-calendar-icon {
    width: 17px;
    height: 17px;
    color: var(--primary);
    flex: 0 0 auto;
}

.day-label-btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: var(--r-sm);
}

.journal-date-picker-native {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

/* ---------- Lunora date / time picker ---------- */
.lunora-temporal-field {
  position: relative;
  width: 100%;
  min-width: 0;
}

.lunora-temporal-source {
  display: none !important;
}

.lunora-temporal-trigger {
  width: 100%;
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: 12px;
  background: var(--input-bg);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 9px;
  font: inherit;
  font-size: 14px;
  font-weight: 400;
  line-height: 1;
  text-align: left;
  cursor: pointer;
  transition: box-shadow 0.18s ease, background 0.18s ease;
}

.lunora-temporal-trigger:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(127, 108, 210, 0.11);
}

.lunora-temporal-trigger.is-invalid,
.lunora-temporal-field.is-invalid .lunora-temporal-trigger {
  border-color: var(--danger, #ff3b30) !important;
  box-shadow: 0 0 0 2px rgba(255, 59, 48, 0.12);
}

.lunora-temporal-trigger.is-empty {
  color: var(--text-muted);
  font-weight: 400;
}

.lunora-temporal-trigger.is-empty .lunora-temporal-value {
  opacity: 0.7;
}

.lunora-temporal-trigger:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.lunora-temporal-icon {
  width: 18px;
  height: 18px;
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.lunora-temporal-icon svg {
  width: 18px;
  height: 18px;
  display: block;
}

.lunora-temporal-value {
  white-space: nowrap;
}

.lunora-temporal-field--compact {
  width: auto;
  display: inline-flex;
  justify-content: flex-start;
}

.lunora-temporal-field--compact .lunora-temporal-trigger {
  width: auto;
  min-width: 112px;
  min-height: 44px;
  padding-left: 20px;
  padding-right: 20px;
}

.lunora-temporal-field--grid .lunora-temporal-trigger {
  min-width: 0;
  min-height: 44px;
  padding: 0 12px;
  font-size: 14px;
}

.lunora-temporal-field--grid .lunora-temporal-icon {
  width: 17px;
  height: 17px;
}

.field-input-wrap.lunora-temporal-field .field-input-native-placeholder {
  display: none !important;
}

.lunora-temporal-overlay {
  position: fixed;
  inset: 0;
  z-index: 12000;
  padding: max(18px, var(--safe-area-top, 0px)) 18px max(18px, var(--safe-area-bottom, 0px));
  background: rgba(25, 22, 47, 0.52);
  display: grid;
  place-items: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.18s ease, visibility 0.18s ease;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.lunora-temporal-overlay.is-visible {
  opacity: 1;
  visibility: visible;
}

.lunora-temporal-dialog {
  width: min(100%, 390px);
  max-height: min(720px, calc(100dvh - 36px));
  overflow: hidden;
  border-radius: 25px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 22px 70px rgba(31, 24, 72, 0.24);
  transform: translateY(12px) scale(0.985);
  transition: transform 0.18s ease;
}

.lunora-temporal-overlay.is-visible .lunora-temporal-dialog {
  transform: translateY(0) scale(1);
}

.lunora-temporal-dialog-header {
  min-height: 72px;
  padding: 15px 18px 10px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.lunora-temporal-dialog-title {
  font-size: 21px;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.lunora-temporal-close {
  width: 42px;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--text-muted);
  display: grid;
  place-items: center;
  background: var(--surface);
}

.lunora-calendar-month-bar {
  padding: 4px 17px 15px;
  display: grid;
  grid-template-columns: 42px 1fr 42px;
  align-items: center;
  gap: 8px;
}

.lunora-calendar-month-title {
  text-align: center;
  font-size: 17px;
  font-weight: 700;
}

.lunora-calendar-nav {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  color: var(--text);
  background: var(--surface-2);
}

.lunora-calendar-nav:disabled {
  opacity: 0.28;
}

.lunora-calendar-weekdays,
.lunora-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.lunora-calendar-weekdays {
  padding: 0 16px 7px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 650;
  text-align: center;
}

.lunora-calendar-grid {
  padding: 0 14px 18px;
  row-gap: 4px;
}

.lunora-calendar-day {
  width: 40px;
  height: 40px;
  max-width: 100%;
  margin: 0 auto;
  border-radius: 13px;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  display: grid;
  place-items: center;
  background: transparent;
}

.lunora-calendar-day.is-outside {
  color: var(--text-muted);
  opacity: 0.45;
}

.lunora-calendar-day.is-today:not(.is-selected) {
  color: var(--primary);
  box-shadow: inset 0 0 0 1px var(--primary);
}

.lunora-calendar-day.is-selected {
  color: #fff;
  background: var(--primary);
  box-shadow: 0 7px 17px rgba(127, 108, 210, 0.24);
}

.lunora-calendar-day:disabled {
  opacity: 0.2;
}

.lunora-temporal-clear-row {
  padding: 0 20px 18px;
  display: flex;
  justify-content: center;
}

.lunora-temporal-clear {
  padding: 8px 14px;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
}

.lunora-time-dialog {
  width: min(100%, 330px);
}

.lunora-time-wheels {
  position: relative;
  width: 230px;
  height: 220px;
  margin: 2px auto 12px;
  display: grid;
  grid-template-columns: 1fr 30px 1fr;
  align-items: center;
}

.lunora-time-wheels::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 88px;
  height: 44px;
  border-radius: 14px;
  background: var(--surface-2);
  pointer-events: none;
}

.lunora-time-wheels::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(var(--surface) 0, transparent 34%, transparent 66%, var(--surface) 100%);
  pointer-events: none;
}

.lunora-time-wheel {
  position: relative;
  z-index: 1;
  height: 220px;
  padding: 88px 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-snap-type: none;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: grab;
  scrollbar-width: none;
}

.lunora-time-wheel.is-dragging {
  cursor: grabbing;
}

.lunora-time-wheel::-webkit-scrollbar {
  display: none;
}

.lunora-time-option {
  width: 100%;
  height: 44px;
  scroll-snap-align: center;
  scroll-snap-stop: normal;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  display: grid;
  place-items: center;
  color: var(--text-muted);
  background: transparent;
  font-size: 21px;
  font-weight: 600;
  transition: color 0.15s ease, transform 0.15s ease;
}

.lunora-time-option.is-selected {
  color: var(--text);
  transform: scale(1.08);
}

.lunora-time-colon {
  position: relative;
  z-index: 3;
  font-size: 25px;
  font-weight: 750;
  text-align: center;
}

.lunora-temporal-actions {
  padding: 0 18px 18px;
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 10px;
}

.lunora-temporal-action {
  min-height: 50px;
  padding: 0 16px;
  border-radius: 15px;
  font-size: 15px;
  font-weight: 700;
}

.lunora-temporal-action-secondary {
  color: var(--text-muted);
  background: var(--surface-2);
}

.lunora-temporal-action-primary {
  color: #fff;
  background: var(--primary);
  box-shadow: 0 8px 18px rgba(127, 108, 210, 0.22);
}

@media (max-width: 390px) {
  .lunora-calendar-day {
    width: 37px;
    height: 37px;
  }
}

.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(--input-bg);
}
.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-icon.pee      { background: #eef4ff; color: #657cc6; }
.journal-icon.poop     { background: #f0ddd0; color: #804b33; }
.journal-icon.diaper   { background: #fff1f6; color: #b26f97; }
:root[data-theme="dark"] .journal-icon.sleep {
  background: rgba(123, 111, 196, 0.16);
  color: #bcaef4;
}
:root[data-theme="dark"] .journal-icon.night {
  background: rgba(84, 111, 156, 0.18);
  color: #b5caf7;
}
:root[data-theme="dark"] .journal-icon.wake {
  background: rgba(184, 144, 92, 0.18);
  color: #f0cf83;
}
:root[data-theme="dark"] .journal-icon.feeding {
  background: rgba(149, 126, 204, 0.16);
  color: #c9b4ea;
}
:root[data-theme="dark"] .journal-icon.pee {
  background: rgba(117, 162, 255, 0.18);
  color: #cfe0ff;
}
:root[data-theme="dark"] .journal-icon.poop {
  background: #513345;
  color: #f0b8a3;
}
:root[data-theme="dark"] .journal-icon.diaper {
  background: rgba(255, 153, 198, 0.18);
  color: #ffd6e9;
}

.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);
}
.platform-link-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
#platformLinkCard.section-card {
  padding: 20px;
}
.platform-link-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.platform-link-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}
.platform-link-sub {
  margin-top: 6px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-muted);
}
.platform-link-badge {
  flex-shrink: 0;
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 600;
  align-self: flex-start;
}
.platform-link-badge.is-linked {
  background: rgba(104, 211, 145, 0.16);
  color: #2f855a;
}
.platform-link-badge.is-muted {
  background: var(--surface-2, rgba(255,255,255,.06));
  color: var(--text-muted);
}
.platform-link-code-box,
.platform-link-empty {
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--surface-2, rgba(255,255,255,.04));
  padding: 16px;
}
.platform-link-code-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.platform-link-code-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}
.platform-link-code-value {
  flex: 1;
  min-width: 0;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: var(--text);
}
.platform-link-code-hint {
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-muted);
}
.platform-link-empty {
  font-size: 14px;
  line-height: 1.45;
  color: var(--text-muted);
}
.platform-link-empty--placeholder {
  font-size: 13px;
  color: var(--text-muted);
  opacity: 0.7;
}
.platform-link-copy-btn {
  white-space: nowrap;
}
.platform-link-form {
  display: flex;
  align-items: stretch;
  gap: 10px;
}
.platform-link-input {
  text-transform: uppercase;
}
.platform-link-actions {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 0;
  padding-bottom: 0;
}
@media (max-width: 640px) {
  .platform-link-head,
  .platform-link-code-row,
  .platform-link-form {
    flex-direction: column;
  }
  .platform-link-copy-btn,
  .platform-link-form .btn,
  .platform-link-actions .btn {
    width: 100%;
  }
}

/* Дети — список */
.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-age--secondary { margin-top: 4px; }
.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;
}
.invite-qr-modal {
  max-width: 440px;
}
.invite-qr-subtitle {
  margin-bottom: 14px;
}
.invite-qr-preview-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 14px;
  border-radius: 20px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  margin-bottom: 14px;
}
.invite-qr-image {
  display: block;
  width: min(100%, 280px);
  aspect-ratio: 1 / 1;
  border-radius: 16px;
  background: #fff;
  object-fit: contain;
}
.invite-qr-close {
  width: 100%;
  margin-top: 10px;
}
/* Пошаговая инструкция партнёрской программы */
.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-note {
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
}
.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 var(--app-nav-bottom-padding);
  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;
  top: calc(76px + var(--safe-area-top, 0px));
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  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: 10020;
  pointer-events: none;
  width: max-content;
  max-width: calc(100% - 32px);
}
.toast svg { color: var(--success); flex-shrink: 0; }
.toast[data-kind="warning"] svg { display: none; }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }
.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(--input-bg);
  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(--input-bg); }
.field-input::placeholder { color: var(--text-muted); opacity: 0.7; }
.field-input-wrap {
  position: relative;
}
.field-input-wrap--native-placeholder {
  min-height: 44px;
  background: var(--input-bg);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  transition: border 0.2s, background 0.2s, box-shadow 0.2s;
}
.field-input-wrap--native-placeholder.is-focused {
  border-color: var(--primary);
  background: var(--input-bg);
}
.field-input-wrap.is-invalid .field-input {
  border-color: var(--danger, #ff3b30) !important;
  box-shadow: 0 0 0 2px rgba(255,59,48,0.12);
}
.field-input-wrap--native-placeholder.is-invalid {
  border-color: var(--danger, #ff3b30) !important;
  box-shadow: 0 0 0 2px rgba(255,59,48,0.12);
}
.field-input-wrap--native-placeholder .field-input-native-placeholder {
  position: absolute;
  top: 50%;
  left: 14px;
  right: 44px;
  transform: translateY(-50%);
  color: var(--text-muted);
  opacity: 0.74;
  font-size: 14px;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: text;
  user-select: none;
  z-index: 2;
}
.field-input-wrap--native-placeholder .field-input[data-lunora-preserve-native="1"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  z-index: 1;
  opacity: 0;
  cursor: pointer;
}
.field-input-wrap--native-placeholder .field-input-native-placeholder.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.field-input-wrap--native-placeholder .field-input-native-placeholder.is-filled {
  color: var(--text);
  opacity: 1;
}
.field-hint {
  display: block;
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-muted);
}
.field-hint--compact {
  font-size: 11px;
  line-height: 1.4;
  opacity: 0.92;
}
@media (hover: hover) and (pointer: fine) {
  .field-input-wrap--native-placeholder .field-input-native-placeholder {
    display: none;
  }
}
.field-textarea { resize: none; line-height: 1.5; font-family: inherit; font-size: 14px; }
.sleep-comment-field { margin-top: 20px; }
.sleep-settling-stepper {
    margin-top: 10px;
    min-height: 42px;
    padding: 5px 8px;
    border-radius: var(--r-md);
    background: var(--input-bg);
}
.sleep-settling-stepper.plan-editor-stepper {
    background: var(--input-bg);
}
:root[data-theme="dark"] .sleep-settling-stepper.plan-editor-stepper {
    background: var(--input-bg);
}
.sleep-settling-stepper.plan-editor-stepper .plan-editor-btn {
    background: var(--surface);
}
:root[data-theme="dark"] .sleep-settling-stepper.plan-editor-stepper .plan-editor-btn {
    background: var(--surface);
}
.sleep-settling-stepper .plan-editor-btn {
    width: 28px;
    height: 28px;
    font-size: 15px;
    font-weight: 600;
  color: var(--text);
  background: var(--surface);
}
.sleep-settling-stepper .plan-editor-value {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
  font-size: 15px;
  line-height: 1;
  font-weight: 700;
  letter-spacing: 0;
  color: var(--text);
}

.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;
}

.chart-point-tooltip {
  position: fixed;
  z-index: 60;
  min-width: 124px;
  max-width: 220px;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--surface, #fff);
  border: 1px solid rgba(124, 106, 247, 0.16);
  box-shadow: 0 14px 34px rgba(35, 28, 77, 0.16);
  pointer-events: none;
  opacity: 0;
  transform: translateY(6px) scale(0.98);
  transition: opacity 0.16s ease, transform 0.16s ease;
  backdrop-filter: blur(16px);
}
.chart-point-tooltip.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.chart-point-tooltip-title {
  font-size: 11px;
  line-height: 1.3;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.chart-point-tooltip-value {
  font-size: 14px;
  line-height: 1.35;
  font-weight: 700;
  color: var(--text);
}

/* ---------- 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(--input-bg);
  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: 13px; 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;
}

/* 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;
}

/* ---------- 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-hero {
  margin: 0 0 12px 0;
}
.ai-plan-hero-label,
.ai-plan-section-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.ai-plan-hero-label {
  margin: 0 0 8px 2px;
  color: var(--primary);
}
.ai-plan-hero-label::before,
.ai-plan-section-label::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.72;
}
.ai-plan-body {
  margin: 0 0 14px 0;
}
.ai-plan-body .ai-plan-comment + .ai-plan-comment {
  margin-top: 12px;
}
.ai-plan-section {
  padding: 14px 0 0 0;
  margin: 0 0 14px 0;
  border-top: 1px solid var(--border);
}
.ai-plan-section-label {
  margin: 0 0 8px 2px;
  color: var(--text-muted);
}
.ai-plan-section-action {
  padding: 14px 14px 0 14px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255,255,255,0.55), rgba(255,255,255,0.15)), var(--surface-2);
  border: 1px solid rgba(146, 132, 233, 0.12);
}
.ai-plan-section-action .ai-plan-section-label {
  color: var(--primary);
}
.ai-plan-section-improve {
  padding: 14px 14px 0 14px;
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(185, 236, 214, 0.28), rgba(255,255,255,0.10)),
    var(--surface-2);
  border: 1px solid rgba(95, 181, 140, 0.16);
}
.ai-plan-section-improve .ai-plan-section-label {
  color: #47956e;
}
.ai-plan-improve-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 8px 0;
}
.ai-plan-improve-icon {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: rgba(95, 181, 140, 0.16);
  color: #47956e;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}
.ai-plan-section-label.ai-plan-section-label-plain::before {
  display: none;
}
.ai-plan-section-label.ai-plan-section-label-plain {
  gap: 0;
  letter-spacing: normal;
  text-transform: none;
  font-size: 13px;
}
.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: 14px;
  color: var(--text);
  line-height: 1.66;
  margin: 0;
}
.ai-plan-comment.ai-plan-comment-lead {
  font-size: 14px;
  line-height: 1.66;
  margin: 0;
}
.ai-plan-feedback-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 0 0;
}
.ai-plan-feedback-btn {
  appearance: none;
  border: 1px solid rgba(127, 101, 218, 0.22);
  border-radius: var(--r-full);
  background: var(--surface);
  color: var(--primary);
  box-shadow: 0 6px 16px rgba(62, 49, 120, 0.06);
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  padding: 10px 13px;
}
.ai-plan-feedback-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* Стили 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: var(--app-top-offset);
  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(var(--app-nav-bottom-extra) + 112px);
  -webkit-overflow-scrolling: touch;
}

/* ── Пустое состояние ── */
.feeding-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 96px 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);
  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-help-wrap {
  margin-left: auto;
  position: relative;
  flex-shrink: 0;
}
.feeding-picker-help-btn {
  width: 22px;
  height: 22px;
  border: none;
  background: transparent;
  color: #6a5fcc;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  box-shadow: none;
  cursor: pointer;
  border-radius: 999px;
}
.feeding-picker-help-tip {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: min(220px, calc(100vw - 64px));
  background: #ffffff;
  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;
  font-weight: 500;
  z-index: 3;
  display: none;
}
.feeding-picker-help-wrap.open .feeding-picker-help-tip {
  display: block;
}
.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: 10px 16px var(--app-nav-bottom-padding);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 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;
  overflow: visible;
}
.feeding-nav-add {
  position: relative;
  width: 100%;
  min-height: 48px;
  border-radius: 0;
  border: none;
  background: transparent;
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  box-shadow: none;
  cursor: pointer;
  z-index: 2;
  transition: opacity 0.16s ease;
}
.feeding-nav-add:active {
  opacity: 0.9;
}
.feeding-nav-add-bubble {
  width: 46px;
  height: 46px;
  margin-top: 0;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  top: -38px;
  transition: transform 0.16s ease, opacity 0.16s ease;
}
.feeding-nav-add:active .feeding-nav-add-bubble {
  transform: scale(0.96);
}
.feeding-nav-add-bubble svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}
.feeding-nav-add-label {
  display: none;
}
.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; }

/* Primary add action follows the shared full-width pattern above navigation. */
.feeding-overlay-cta {
  position: sticky;
  bottom: calc(var(--app-nav-bottom-extra) + 74px);
  z-index: 21;
  padding: 10px 16px 0;
  background: linear-gradient(180deg, transparent 0%, var(--bg) 24%, var(--bg) 100%);
}
.feeding-overlay-cta .app-confirm-btn { width: 100%; min-height: 50px; box-shadow: none; }
.feeding-empty-panel { margin: 16px; }

/* Popup-подсказка по прикорму */
.feeding-help-modal-backdrop {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(15, 17, 28, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity 0.22s ease;
  z-index: 90;
  padding: 16px 16px calc(env(safe-area-inset-bottom) + 16px);
}
.feeding-help-modal-backdrop.open { opacity: 1; }
.feeding-help-modal {
  width: min(100%, 560px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 18px 18px 16px;
  box-shadow: 0 18px 50px rgba(0,0,0,0.28);
  transform: translateY(14px);
  transition: transform 0.22s ease;
}
.feeding-help-modal-backdrop.open .feeding-help-modal { transform: translateY(0); }
.feeding-help-modal-title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--text);
  margin-bottom: 10px;
}
.feeding-help-modal-text {
  font-size: 14px;
  line-height: 1.65;
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* ── Сводка прикорма ── */
.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;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.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;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}
.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;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.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: 12px;
  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: var(--app-top-offset);
  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(var(--app-nav-bottom-extra) + 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 var(--app-nav-bottom-padding);
  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: var(--app-top-offset);
  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(var(--app-nav-bottom-extra) + 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 var(--app-nav-bottom-padding);
  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: var(--app-top-offset);
  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-header.guide-mode {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 12px 16px 8px;
  border-bottom: none;
}
.selfsleep-overlay-body {
  flex: 1; overflow-y: auto;
  /* v5.6.11: padding 16 по бокам */
  padding: 16px 16px calc(var(--app-nav-bottom-extra) + 92px);
  -webkit-overflow-scrolling: touch;
}
.selfsleep-overlay.guide-view .selfsleep-overlay-body {
  padding-bottom: calc(var(--app-nav-bottom-extra) + 112px);
  scroll-padding-bottom: calc(var(--app-nav-bottom-extra) + 112px);
}
/* 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 var(--app-nav-bottom-padding);
  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: 26;
  margin: 0;
  gap: 8px;
}
.selfsleep-overlay-nav.guide-only {
  justify-content: flex-start;
}
.selfsleep-guide-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  background: none;
  border: none;
  color: var(--primary);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.selfsleep-guide-back svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
.selfsleep-guide-back:active {
  transform: scale(0.98);
}
/* v5.6.17: отступ messages под инпут+нав */
.selfsleep-chat-screen.active .selfsleep-chat-messages { padding-bottom: calc(var(--app-nav-bottom-extra) + 196px); }
.selfsleep-overlay-nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  justify-content: center;
  min-height: 48px;
  padding: 6px 10px;
  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-nav-btn[hidden] {
  display: none !important;
}
.selfsleep-overlay-nav-btn.active {
  color: var(--text);
  background: rgba(130,100,200,0.10);
}
.selfsleep-overlay-nav.guide-only .selfsleep-overlay-nav-btn {
  flex: 0 0 auto;
  min-height: 48px;
  padding: 6px 16px;
  font-size: 10px;
  gap: 2px;
  border-radius: 10px;
  color: var(--text-muted);
  background: none;
}
.selfsleep-overlay-nav.guide-only .selfsleep-overlay-nav-btn.active {
  color: var(--text-muted);
  background: none;
}
.selfsleep-overlay-nav.guide-only .selfsleep-overlay-nav-btn svg {
  width: 22px;
  height: 22px;
}
.selfsleep-overlay-nav-btn:active { transform: scale(0.94); }
.selfsleep-overlay-nav-btn 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-panel-screen {
  display: none;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 14px calc(var(--app-nav-bottom-extra) + 168px);
  background: var(--bg);
  -webkit-overflow-scrolling: touch;
}
.selfsleep-panel-screen.active { display: block; }
.selfsleep-panel-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.selfsleep-overlay-cta {
  position: sticky;
  bottom: calc(var(--app-nav-bottom-extra) + 74px);
  z-index: 42;
  padding: 10px 14px 0;
  background: linear-gradient(180deg, rgba(247, 245, 255, 0) 0%, rgba(247, 245, 255, 0.92) 24%, rgba(247, 245, 255, 1) 100%);
}
.selfsleep-dialogs-primary-btn {
  width: 100%;
  background: #8f83c1;
  color: #fff;
  box-shadow: none;
}
.selfsleep-dialogs-primary-btn:active {
  opacity: 0.9;
}
.selfsleep-panel-loading,
.selfsleep-panel-error,
.selfsleep-panel-empty,
.selfsleep-dialog-card,
.selfsleep-balance-card,
.selfsleep-balance-note {
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--surface);
}
.selfsleep-panel-loading,
.selfsleep-panel-error,
.selfsleep-panel-empty {
  padding: 18px 16px;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.55;
}
.selfsleep-panel-error {
  color: #c43030;
  border-color: rgba(196,48,48,0.22);
}
.selfsleep-panel-empty-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.selfsleep-panel-empty-body {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.55;
}
.selfsleep-panel-empty-cta {
  margin-top: 12px;
}
.selfsleep-dialog-card {
  display: flex;
  align-items: stretch;
  gap: 10px;
  width: 100%;
  padding: 12px;
}
.selfsleep-dialog-card-main {
  flex: 1;
  min-width: 0;
  text-align: left;
  cursor: pointer;
}
.selfsleep-dialog-card-top,
.selfsleep-dialog-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.selfsleep-dialog-card-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.selfsleep-dialog-card-delete {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid rgba(196,48,48,0.14);
  background: rgba(196,48,48,0.06);
  color: #c43030;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.selfsleep-dialog-card-delete svg {
  width: 16px;
  height: 16px;
}
.selfsleep-dialog-card-preview {
  margin-top: 8px;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text-secondary);
}
.selfsleep-dialog-card-meta {
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-muted);
}
.selfsleep-balance-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.selfsleep-balance-card {
  padding: 15px 14px;
}
.selfsleep-balance-card-hero {
  padding: 16px 14px;
}
.selfsleep-balance-card-topup {
  padding: 16px 14px;
}
.selfsleep-balance-label,
.selfsleep-balance-note-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}
.selfsleep-balance-value {
  margin-top: 8px;
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}
.selfsleep-balance-sub {
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.45;
}
.selfsleep-balance-meter {
  margin-top: 14px;
  margin-bottom: 0;
}
.selfsleep-balance-meter::before {
  height: 8px;
  margin-bottom: 8px;
}
.selfsleep-balance-meter-bar {
  background: linear-gradient(90deg, var(--gold) 0%, var(--gold) 100%);
  box-shadow: 0 0 12px rgba(245, 200, 66, 0.35);
}
.selfsleep-balance-meter-labels {
  font-size: 11px;
}
.selfsleep-balance-inline-meta {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
}
.selfsleep-balance-inline-meta strong {
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
}
.selfsleep-balance-card-topline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.selfsleep-balance-value-compact {
  margin-top: 0;
  flex-shrink: 0;
}
.selfsleep-balance-package-note {
  margin-top: 10px;
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
  line-height: 1.35;
  text-align: center;
}
.selfsleep-balance-buy-btn {
  width: 100%;
  margin-top: 14px;
}
.selfsleep-balance-grid-compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.selfsleep-balance-note {
  padding: 15px 14px;
}
.selfsleep-balance-note-body {
  margin-top: 6px;
  font-size: 13.5px;
  color: var(--text);
  line-height: 1.55;
}
.selfsleep-balance-note.accent {
  border-color: rgba(130,100,200,0.20);
  background: rgba(130,100,200,0.06);
}

@media (max-width: 420px) {
  .selfsleep-balance-card-topline {
    flex-direction: column;
    align-items: flex-start;
  }
  .selfsleep-balance-value-compact {
    margin-top: 6px;
  }
}

.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: #fff;
  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-avatar-icon {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #7b6ef6 0%, #9a8cff 100%);
  color: #fff6d9;
}
.selfsleep-chat-avatar-icon svg {
  width: 17px;
  height: 17px;
  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-bubble p {
  margin: 0 0 10px;
}
.selfsleep-chat-bubble p:last-of-type {
  margin-bottom: 0;
}
.selfsleep-chat-bubble strong {
  font-weight: 700;
}
.selfsleep-chat-bubble em {
  font-style: italic;
}
.selfsleep-chat-section-title {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: var(--text);
}
.selfsleep-chat-list {
  margin: 0 0 10px 18px;
  padding: 0;
}
.selfsleep-chat-list:last-of-type {
  margin-bottom: 0;
}
.selfsleep-chat-list li + li {
  margin-top: 5px;
}
.selfsleep-chat-bubble-attachments {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}
.selfsleep-chat-bubble-file {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(100, 90, 180, 0.12);
  color: #2e295f;
  background: #fff;
  cursor: default;
}
.selfsleep-chat-bubble-file-icon {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(123, 110, 246, 0.08);
  color: var(--primary);
  flex-shrink: 0;
}
.selfsleep-chat-bubble-file-icon svg {
  width: 13px;
  height: 13px;
  display: block;
  stroke: currentColor;
  fill: none;
}
.selfsleep-chat-bubble-file-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.selfsleep-chat-bubble-file-name {
  font-size: 10.5px;
  font-weight: 500;
  line-height: 1.22;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: normal;
}
.selfsleep-chat-bubble-file-meta {
  font-size: 9px;
  line-height: 1.2;
  color: #837ca8;
}
.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: #fff;
  color: var(--text);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
  box-shadow: none;
}
.selfsleep-chat-row.user .selfsleep-chat-section-title,
.selfsleep-chat-row.user .selfsleep-chat-bubble strong,
.selfsleep-chat-row.user .selfsleep-chat-bubble em {
  color: inherit;
}
.selfsleep-chat-row.user .selfsleep-chat-bubble-file {
  background: #fff;
  border-color: rgba(100, 90, 180, 0.12);
}
.selfsleep-chat-row.user .selfsleep-chat-bubble-file-icon {
  background: rgba(123, 110, 246, 0.08);
  color: var(--primary);
}
.selfsleep-chat-row.user .selfsleep-chat-bubble-file-name {
  color: #2e295f;
}
.selfsleep-chat-row.user .selfsleep-chat-bubble-file-meta {
  color: #837ca8;
}
.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;
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--app-nav-bottom-extra) + 152px);
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  align-items: flex-end;
  gap: 8px;
  padding: 0 14px 2px;
  z-index: 26;
  pointer-events: none;
}
.selfsleep-chat-typing-row.visible { display: flex; }
.selfsleep-chat-typing {
  background: #fff;
  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 {
  display: block;
  text-align: center;
  font-size: 10px;
  line-height: 1.35;
  color: var(--text-muted);
  padding: 2px 6px 8px;
}
.selfsleep-chat-limit.warn { color: #d07020; }

.selfsleep-chat-input-wrap {
  position: fixed;
  left: 0;
  right: 0;
  transform: none;
  bottom: calc(var(--app-nav-bottom-extra) + 58px);
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 8px 16px 8px;
  background: var(--bg);
  border-top: none;
  z-index: 25;
}
.selfsleep-chat-input-wrap::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -10px;
  height: 10px;
  background: var(--bg);
  pointer-events: none;
}
.selfsleep-chat-attachment-list {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}
.selfsleep-chat-attachment-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid var(--border);
}
.selfsleep-chat-attachment-thumb,
.selfsleep-chat-attachment-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  flex-shrink: 0;
  border: 1px solid var(--border);
  background: rgba(123, 110, 246, 0.06);
}
.selfsleep-chat-attachment-thumb {
  object-fit: cover;
  display: block;
}
.selfsleep-chat-attachment-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}
.selfsleep-chat-attachment-chip-body {
  min-width: 0;
  flex: 1;
}
.selfsleep-chat-attachment-chip-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: normal;
}
.selfsleep-chat-attachment-chip-meta {
  margin-top: 2px;
  font-size: 11px;
  color: var(--text-muted);
}
.selfsleep-chat-attachment-remove {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
  cursor: pointer;
}
.selfsleep-chat-attachment-meta {
  display: none;
  margin-top: 7px;
  font-size: 10px;
  line-height: 1.35;
  color: var(--text-muted);
  padding: 0 4px 0 2px;
}
.selfsleep-chat-attachment-meta.warn {
  color: #d07020;
}
.selfsleep-chat-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border: 1px solid rgba(100, 90, 180, 0.12);
  border-radius: 999px;
  min-height: 46px;
  padding: 6px 8px 6px 14px;
  box-shadow: 0 6px 18px rgba(100, 90, 180, 0.08);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  transition: border-color 0.18s, box-shadow 0.18s;
}
.selfsleep-chat-input-row:focus-within {
  border-color: rgba(124, 111, 212, 0.24);
  box-shadow: 0 8px 20px rgba(100, 90, 180, 0.1);
}
.selfsleep-chat-attach-btn {
  width: 20px;
  height: 20px;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #8a7ee7;
  background: transparent;
  border: none;
  flex-shrink: 0;
  cursor: pointer;
  padding: 0;
}
.selfsleep-chat-attach-btn svg {
  width: 20px;
  height: 20px;
  display: block;
  stroke: currentColor;
  fill: none;
}
.selfsleep-chat-textarea {
  flex: 1;
  resize: none;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
  padding: 2px 0;
  min-height: 22px;
  max-height: 72px;
  overflow-y: auto;
  outline: none;
  font-family: inherit;
}
.selfsleep-chat-textarea::placeholder { color: var(--text-muted); opacity: 0.8; }
.selfsleep-chat-send {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: 50%;
  background: #8a7ee7;
  border: none;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.15s, transform 0.12s, color 0.15s, background 0.15s;
  color: #fff;
}
.selfsleep-chat-send:disabled { opacity: 1; cursor: default; color: #fff; background: #d9d1f7; }
.selfsleep-chat-send:not(:disabled):active { transform: scale(0.91); }
.selfsleep-chat-send svg { width: 16px; height: 16px; 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(4, 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: 12px;
  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: 12px;
  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;
  }
.journal-edit-time-wrap {
    padding: 0;
}
.journal-edit-time-control {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    min-height: 44px;
    width: fit-content;
    max-width: 100%;
    padding: 0 16px;
    border: 1px solid var(--border, rgba(0,0,0,0.1));
    border-radius: var(--r-md);
    background: var(--surface);
}
.journal-edit-time-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    pointer-events: none;
    flex: 0 0 auto;
}
  .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;
  appearance: none;
  -webkit-appearance: none;
}
.offset-time-input::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
  display: none;
  -webkit-appearance: none;
  opacity: 0;
}
  .offset-time-input:focus {
    border-color: var(--primary);
  }
.offset-time-input--compact {
    flex: 0 0 auto;
    width: 84px;
    min-width: 84px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    text-align: center;
    font-variant-numeric: tabular-nums;
}
.offset-time-input--compact:focus {
    border-color: transparent;
    outline: none;
}
.offset-time-input--compact::-webkit-date-and-time-value {
    text-align: center;
    min-height: 0;
}
.offset-time-input--compact::-webkit-datetime-edit,
.offset-time-input--compact::-webkit-datetime-edit-fields-wrapper,
.offset-time-input--compact::-webkit-datetime-edit-hour-field,
.offset-time-input--compact::-webkit-datetime-edit-minute-field {
    padding: 0;
}
.offset-time-input--compact::-webkit-datetime-edit-text {
    padding: 0 1px;
}
.journal-edit-time-control:focus-within {
    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: rgba(255,59,48,0.06);
  color: var(--danger, #ff3b30);
  border: 1px solid rgba(255,59,48,0.25);
}
.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; }

.field-input.is-invalid,
.field-textarea.is-invalid,
.offset-time-input.is-invalid,
.custom-select-btn.is-invalid {
  border-color: var(--danger, #ff3b30) !important;
  box-shadow: 0 0 0 2px rgba(255,59,48,0.12);
}

.validation-toast-mini {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 110px);
  transform: translateX(-50%) translateY(12px);
  width: min(340px, calc(100vw - 32px));
  background: rgba(255,255,255,0.98);
  color: #1a1840;
  border-radius: 18px;
  box-shadow: 0 16px 40px rgba(35, 25, 90, 0.16);
  padding: 14px 16px;
  z-index: 2200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.validation-toast-mini.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.validation-toast-mini-title {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 4px;
  color: #2b2458;
}

.validation-toast-mini-text {
  font-size: 13px;
  line-height: 1.4;
  color: #5f5b82;
}

/* ─── 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-item-file{width:100%;height:auto;min-height:64px;padding:10px 36px 10px 12px;display:flex;align-items:center;overflow:visible}
.fb-attach-file-meta{display:flex;flex-direction:column;gap:4px;min-width:0}
.fb-attach-file-name{font-size:13px;font-weight:700;color:var(--text);word-break:break-word;line-height:1.2}
.fb-attach-file-size{font-size:11px;color:var(--text-muted);line-height:1.2}
.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)}

.support-center-overlay {
  position: fixed;
  inset: 0;
  z-index: 2400;
  background:
    radial-gradient(circle at top, rgba(255, 170, 205, 0.26), transparent 36%),
    linear-gradient(180deg, var(--bg) 0%, color-mix(in srgb, var(--bg) 92%, #fff 8%) 100%);
  display: none;
}
.support-center-overlay.active { display: block; }
.support-center-open { overflow: hidden; }
.support-center-screen {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: calc(env(safe-area-inset-top) + 18px) 16px calc(env(safe-area-inset-bottom) + 16px);
}
.support-center-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}
.support-center-back {
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 999px;
  background: rgba(255,255,255,0.88);
  color: var(--text);
  box-shadow: 0 10px 24px rgba(76, 44, 112, 0.08);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.support-center-head-copy { min-width: 0; }
.support-center-title {
  font-size: 32px;
  line-height: 1.05;
  font-weight: 800;
  color: var(--text);
}
.support-center-subtitle {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 14px;
}
.support-center-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding-bottom: 112px;
}
.support-center-fab {
  position: absolute;
  right: 16px;
  bottom: calc(env(safe-area-inset-bottom) + 18px);
  border: none;
  border-radius: 999px;
  padding: 16px 22px;
  background: linear-gradient(135deg, #ff7baa 0%, #f3418a 100%);
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 18px 38px rgba(243, 65, 138, 0.28);
}
.support-center-fab-plus { font-size: 26px; line-height: 1; }
.support-loading,
.support-error-state {
  padding: 24px 18px;
  border-radius: 24px;
  background: rgba(255,255,255,0.82);
  color: var(--text-muted);
}
.support-empty-state {
  min-height: calc(100vh - 260px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 10px;
  padding: 20px 12px 110px;
}
.support-empty-state.compact { min-height: 180px; padding-bottom: 32px; }
.support-empty-icon {
  width: 88px;
  height: 88px;
  border-radius: 999px;
  background: rgba(255, 122, 170, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 38px;
}
.support-empty-state h3 {
  font-size: 30px;
  line-height: 1.1;
  font-weight: 800;
}
.support-empty-state p {
  max-width: 290px;
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1.55;
}
.support-ticket-list {
  display: grid;
  gap: 12px;
}
.support-ticket-card {
  position: relative;
  width: 100%;
  text-align: left;
  border: 1px solid rgba(109, 94, 164, 0.08);
  border-radius: 26px;
  background: rgba(255,255,255,0.92);
  box-shadow: 0 16px 38px rgba(76, 44, 112, 0.06);
  padding: 18px;
}
.support-ticket-top,
.support-thread-badges {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.support-ticket-chip,
.support-ticket-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 700;
}
.support-ticket-chip {
  background: rgba(255, 122, 170, 0.12);
  color: #d34e88;
}
.support-ticket-status.waiting-admin {
  background: rgba(143, 229, 218, 0.2);
  color: #168f82;
}
.support-ticket-status.waiting-user {
  background: rgba(130, 188, 255, 0.18);
  color: #2f77d1;
}
.support-ticket-status.closed {
  background: rgba(187, 187, 204, 0.2);
  color: #71718d;
}
.support-ticket-title {
  margin-top: 14px;
  font-size: 21px;
  line-height: 1.2;
  font-weight: 800;
  color: var(--text);
}
.support-ticket-preview {
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.55;
}
.support-ticket-bottom,
.support-thread-meta,
.support-thread-contact,
.support-thread-note {
  margin-top: 12px;
  font-size: 13px;
  color: var(--text-muted);
}
.support-ticket-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.support-ticket-unread {
  position: absolute;
  top: 18px;
  right: 18px;
  min-width: 22px;
  height: 22px;
  border-radius: 999px;
  background: #ff4d94;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
}
.support-form,
.support-thread-head {
  background: rgba(255,255,255,0.9);
  border-radius: 28px;
  padding: 18px;
  box-shadow: 0 16px 38px rgba(76, 44, 112, 0.06);
}
.support-form-label {
  margin-top: 14px;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.support-form-label:first-child { margin-top: 0; }
.support-category-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.support-category-chip {
  border: 1px solid rgba(109, 94, 164, 0.14);
  background: rgba(255,255,255,0.86);
  border-radius: 18px;
  padding: 13px 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  font-weight: 700;
  color: var(--text);
}
.support-category-chip.active {
  border-color: rgba(243, 65, 138, 0.45);
  background: rgba(255, 122, 170, 0.12);
  color: #d34e88;
}
.support-form-input,
.support-form-textarea,
.support-thread-textarea {
  width: 100%;
  border: 1px solid rgba(109, 94, 164, 0.14);
  background: rgba(255,255,255,0.94);
  border-radius: 20px;
  padding: 15px 16px;
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
}
.support-form-textarea { min-height: 138px; resize: none; }
.support-form-foot {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-muted);
  font-size: 13px;
}
.support-link-btn {
  border: none;
  background: none;
  color: #d34e88;
  font-weight: 700;
  font-size: 14px;
}
.support-file-list,
.support-thread-files,
.support-chat-files {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}
.support-file-chip,
.support-chat-file {
  width: 100%;
  border: 1px solid rgba(109, 94, 164, 0.12);
  background: rgba(255,255,255,0.88);
  border-radius: 18px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.support-file-thumb,
.support-chat-file > span:first-child {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: rgba(255, 122, 170, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}
.support-file-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.support-file-copy,
.support-chat-file-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
}
.support-file-name,
.support-chat-file-copy span:first-child {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.support-file-meta,
.support-chat-file-copy span:last-child {
  font-size: 12px;
  color: var(--text-muted);
}
.support-file-remove {
  margin-left: auto;
  border: none;
  background: rgba(39, 34, 72, 0.08);
  width: 28px;
  height: 28px;
  border-radius: 999px;
  font-size: 18px;
  color: var(--text);
}
.support-form-note {
  margin-top: 14px;
  border-radius: 18px;
  padding: 14px 16px;
  background: rgba(255, 122, 170, 0.08);
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.55;
}
.support-submit-btn,
.support-reopen-btn {
  width: 100%;
  margin-top: 16px;
  border: none;
  border-radius: 20px;
  padding: 16px;
  background: linear-gradient(135deg, #ff7baa 0%, #f3418a 100%);
  color: #fff;
  font-size: 18px;
  font-weight: 800;
  box-shadow: 0 18px 38px rgba(243, 65, 138, 0.22);
}
.support-chat-stream {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 0 20px;
}
.support-chat-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}
.support-chat-row.user { justify-content: flex-end; }
.support-chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: rgba(255,255,255,0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 20px rgba(76, 44, 112, 0.08);
}
.support-chat-bubble-wrap { max-width: 82%; }
.support-chat-meta {
  margin-bottom: 4px;
  font-size: 12px;
  color: var(--text-muted);
}
.support-chat-row.user .support-chat-meta { text-align: right; }
.support-chat-bubble {
  border-radius: 22px;
  padding: 13px 15px;
  background: rgba(255,255,255,0.9);
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
  box-shadow: 0 12px 26px rgba(76, 44, 112, 0.06);
}
.support-chat-row.user .support-chat-bubble {
  background: linear-gradient(135deg, #ff7baa 0%, #f3418a 100%);
  color: #fff;
}
.support-thread-composer {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: calc(env(safe-area-inset-bottom) + 12px);
  padding-top: 10px;
  background: linear-gradient(180deg, transparent 0%, var(--bg) 18%);
}
.support-thread-input-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  border-radius: 24px;
  padding: 10px;
  background: rgba(255,255,255,0.94);
  box-shadow: 0 18px 36px rgba(76, 44, 112, 0.08);
}
.support-thread-textarea {
  border: none;
  background: transparent;
  min-height: 52px;
  max-height: 150px;
  padding: 10px 6px;
  resize: none;
}
.support-thread-attach,
.support-thread-send {
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 999px;
  background: rgba(255, 122, 170, 0.14);
  color: #cf4a84;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.support-thread-send {
  background: linear-gradient(135deg, #ff7baa 0%, #f3418a 100%);
  color: #fff;
}

:root[data-theme="dark"] .support-center-overlay {
  background:
    radial-gradient(circle at top, rgba(216, 147, 191, 0.16), transparent 34%),
    linear-gradient(180deg, #171432 0%, #151229 100%);
}
:root[data-theme="dark"] .support-center-back,
:root[data-theme="dark"] .support-ticket-card,
:root[data-theme="dark"] .support-form,
:root[data-theme="dark"] .support-thread-head,
:root[data-theme="dark"] .support-chat-bubble,
:root[data-theme="dark"] .support-thread-input-row,
:root[data-theme="dark"] .support-file-chip,
:root[data-theme="dark"] .support-chat-file,
:root[data-theme="dark"] .support-loading,
:root[data-theme="dark"] .support-error-state {
  background: rgba(31, 27, 58, 0.94);
  border-color: rgba(255,255,255,0.06);
}
:root[data-theme="dark"] .support-form-input,
:root[data-theme="dark"] .support-form-textarea,
:root[data-theme="dark"] .support-thread-textarea,
:root[data-theme="dark"] .support-category-chip {
  background: rgba(39, 34, 72, 0.94);
  border-color: rgba(255,255,255,0.06);
}
:root[data-theme="dark"] .support-thread-composer {
  background: linear-gradient(180deg, transparent 0%, #151229 18%);
}

/* ── 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: -3px;
  right: -3px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: #fff;
  width: 15px; height: 15px;
  border-radius: 50%;
  pointer-events: none;
  flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
  z-index: 2;
}
.nav-premium-badge svg {
  width: 8px;
  height: 8px;
  display: block;
}
/* Скрываем иконку-обёртку когда разблокирован */
.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);
}

/* Profile news card */
.profile-news-card {
  position: relative;
  padding: 0;
  overflow: hidden;
  margin-bottom: 14px;
  background: linear-gradient(135deg, #6f62f6 0%, #8e7cff 38%, #f0a6bb 68%, #ffd982 100%);
  border: 0;
  box-shadow: var(--shadow-sm);
}

.profile-news-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: 0;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.profile-news-card__button {
  position: relative;
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 15px;
  text-align: left;
  cursor: pointer;
  isolation: isolate;
  overflow: hidden;
}

.profile-news-card__button:active {
  transform: scale(0.995);
}

.profile-news-card__backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(100deg, rgba(44, 31, 121, 0.34) 0%, rgba(72, 49, 170, 0.24) 44%, rgba(112, 78, 228, 0.14) 72%, rgba(255, 219, 143, 0.06) 100%),
    url('assets/profile-news/bg.png') right center / cover no-repeat;
  filter: saturate(1.08) blur(1.5px);
  transform: scale(1.03);
}

.profile-news-card__backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 16% 18%, rgba(255,255,255,0.22), transparent 24%),
    radial-gradient(circle at 90% 14%, rgba(255, 239, 190, 0.16), transparent 24%),
    linear-gradient(115deg, rgba(28, 18, 90, 0.20) 0%, rgba(64, 44, 166, 0.14) 48%, rgba(111, 76, 228, 0.06) 72%, rgba(255,255,255,0.00) 100%);
}

.profile-news-card__body {
  position: relative;
  z-index: 1;
  min-width: 0;
  flex: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.profile-news-card__title {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
  color: #fff;
  text-shadow: 0 1px 2px rgba(43, 28, 116, 0.16);
  max-width: none;
}

.profile-news-card__text {
  font-size: 11px;
  line-height: 1.3;
  color: rgba(255,255,255,0.92);
  max-width: none;
  text-shadow: 0 1px 2px rgba(43, 28, 116, 0.12);
}

.profile-news-card__arrow {
  position: relative;
  z-index: 1;
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #fff;
  color: var(--primary);
  border: 1px solid rgba(126, 110, 255, 0.12);
  box-shadow: 0 6px 14px rgba(64, 39, 164, 0.10);
}

body.dark .profile-news-card {
  background: linear-gradient(135deg, #5d50e6 0%, #7a66f1 38%, #d98fb6 68%, #f0c96a 100%);
  box-shadow: var(--shadow-sm);
}

body.dark .profile-news-card::before {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.10);
}

body.dark .profile-news-card__backdrop {
  background:
    linear-gradient(100deg, rgba(26,18,74,0.38) 0%, rgba(56, 38, 146, 0.28) 44%, rgba(108, 78, 208, 0.16) 72%, rgba(255, 219, 143, 0.08) 100%),
    url('assets/profile-news/bg.png') right center / cover no-repeat;
  filter: saturate(1.02) blur(1.5px);
  transform: scale(1.03);
}

body.dark .profile-news-card__backdrop::after {
  background:
    radial-gradient(circle at 16% 18%, rgba(255,255,255,0.18), transparent 28%),
    radial-gradient(circle at 88% 14%, rgba(255, 233, 167, 0.12), transparent 24%),
    linear-gradient(115deg, rgba(18, 12, 58, 0.24) 0%, rgba(56, 39, 150, 0.16) 48%, rgba(106, 76, 209, 0.08) 72%, rgba(255,255,255,0.00) 100%);
}

body.dark .profile-news-card__arrow {
  background: #fff;
  color: var(--primary);
  border-color: rgba(126, 110, 255, 0.12);
  box-shadow: 0 6px 14px rgba(0,0,0,0.14);
}

/* 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: var(--app-top-offset);
  left: 0; right: 0; bottom: 0;
  background: var(--bg, #f6f7fb);
  z-index: 26; /* above Diary (25), below the shared header (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 var(--app-nav-bottom-padding);
  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(var(--app-nav-bottom-extra) + 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: var(--app-top-offset);
  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: 12px;
  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: 22px;
  height: 22px;
  border: none;
  background: transparent;
  color: #6a5fcc;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  box-shadow: none;
}
.growth-spurts-info-tip {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: min(220px, calc(100vw - 64px));
  background: #ffffff;
  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: none;
  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: #2a244f;
  border-color: rgba(124,111,212,0.24);
}
.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: #ffffff;
  border-radius: 12px;
  border: 1px solid rgba(124,111,212,0.24);
  box-shadow: none;
  padding: 10px 12px;
  color: var(--text);
}
.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(var(--app-nav-bottom-padding) + 2px);
}
.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);
}

/* Тёмная тема */
/* Sound colors follow the explicit app theme, not the OS preference. */
:root[data-theme="dark"] .sounds-overlay { background: #0f1115; }
: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: #1a1d23; border-color: #262a31; color: #e6e8eb; }
: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: #e6e8eb; }
:root[data-theme="dark"] .noise-card-sub { color: #9aa3b2; }
: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.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; }
:root[data-theme="dark"] .status-card {
  background: var(--surface) !important;
}
:root[data-theme="dark"] .status-card .btn:disabled {
  background: rgba(255, 255, 255, 0.08) !important;
  color: #938fbd !important;
}
:root[data-theme="dark"] .timer-value {
  background: none;
  -webkit-background-clip: initial;
  -webkit-text-fill-color: currentColor;
  background-clip: initial;
  color: #c2bdf0;
}
:root[data-theme="dark"] .timer-label,
:root[data-theme="dark"] .timer-sub,
:root[data-theme="dark"] .status-time,
:root[data-theme="dark"] .progress-labels {
  color: #a7a4d0;
}
:root[data-theme="dark"] .progress::before {
  background: rgba(255, 255, 255, 0.08);
}
:root[data-theme="dark"] .status-card #btnFeeding {
    background: rgba(145, 126, 227, 0.16);
    color: #d9d2ff;
  }
:root[data-theme="dark"] .status-card #btnToilet {
    background: rgba(117, 162, 255, 0.18);
    color: #cfe0ff;
  }
:root[data-theme="dark"] .status-card #btnDiaper {
    background: rgba(255, 153, 198, 0.18);
    color: #ffd6e9;
  }
:root[data-theme="dark"] .sounds-overlay,
:root[data-theme="dark"] .selfsleep-overlay,
:root[data-theme="dark"] .growth-spurts-overlay {
  background: var(--bg);
}
:root[data-theme="dark"] .selfsleep-overlay-cta {
  background: linear-gradient(180deg, rgba(24, 22, 43, 0) 0%, rgba(24, 22, 43, 0.94) 24%, rgba(24, 22, 43, 1) 100%);
}
: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,
:root[data-theme="dark"] .selfsleep-chat-row.assistant .selfsleep-chat-bubble,
:root[data-theme="dark"] .selfsleep-chat-typing,
:root[data-theme="dark"] .selfsleep-chat-input-row {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}
:root[data-theme="dark"] .sounds-bottom-nav,
:root[data-theme="dark"] .selfsleep-overlay-nav,
:root[data-theme="dark"] .selfsleep-chat-input-wrap,
:root[data-theme="dark"] .selfsleep-chat-limit,
:root[data-theme="dark"] .growth-spurts-header {
  background: var(--bg-elev);
}
:root[data-theme="dark"] .selfsleep-chat-avatar {
  background: var(--surface-2);
  border-color: var(--border);
}
:root[data-theme="dark"] .selfsleep-chat-textarea::placeholder {
  color: #a09dc9;
  opacity: 0.72;
}
:root[data-theme="dark"] .sounds-home-icon,
:root[data-theme="dark"] .chat-home-icon,
:root[data-theme="dark"] .selfsleep-home-icon,
:root[data-theme="dark"] .growth-spurts-home-icon {
  box-shadow: none;
  filter: saturate(0.92) brightness(0.94);
}
:root[data-theme="dark"] .chat-home-icon {
  background: rgba(96, 168, 224, 0.18);
  color: #8bbcf2;
}
:root[data-theme="dark"] .selfsleep-home-icon {
  background: rgba(123, 111, 196, 0.18);
  color: #b4abf3;
}
:root[data-theme="dark"] .sounds-home-icon {
  background: rgba(123, 111, 196, 0.18);
  color: #b8b0f7;
}
:root[data-theme="dark"] .growth-spurts-grid-title-text,
:root[data-theme="dark"] .growth-spurts-legend-item,
:root[data-theme="dark"] .growth-spurts-summary-title,
:root[data-theme="dark"] .growth-spurts-summary-sub,
:root[data-theme="dark"] .growth-spurts-phase-text {
  color: #b4b0d8;
}
:root[data-theme="dark"] .growth-spurts-week-chip.is-calm {
  color: #b3aedf;
  border-color: rgba(149, 140, 220, 0.35);
}
:root[data-theme="dark"] .growth-spurts-week-chip.is-leap {
  background: #f7d9e8;
  color: #9a3160;
}
:root[data-theme="dark"] .growth-spurts-info-btn {
  background: var(--surface-2);
  color: #c9c3fb;
  border-color: rgba(149, 140, 220, 0.4);
}
:root[data-theme="dark"] .feeding-picker-help-btn {
  background: var(--surface-2);
  color: #c9c3fb;
  border-color: rgba(149, 140, 220, 0.4);
}
:root[data-theme="dark"] .growth-spurts-info-tip,
:root[data-theme="dark"] .growth-spurts-week-tip-box {
  background: var(--surface);
  color: var(--text-muted);
  border-color: rgba(149, 140, 220, 0.22);
}
:root[data-theme="dark"] .feeding-picker-help-tip {
  background: var(--surface);
  color: var(--text-muted);
  border-color: rgba(149, 140, 220, 0.22);
}

/* v5704: dark theme consistency polish */
:root[data-theme="dark"] .app-header {
  background: var(--header-bg) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
:root[data-theme="dark"] .status-card {
  background: #2a285a !important;
}
:root[data-theme="dark"] .status-card .btn:disabled,
:root[data-theme="dark"] .status-card #btnWake:disabled {
  background: rgba(255, 255, 255, 0.07) !important;
  color: #9e9ac7 !important;
  box-shadow: none !important;
}
:root[data-theme="dark"] .status-card #btnSleep:not(:disabled) {
  background: #9889dd !important;
  color: #ffffff !important;
}
:root[data-theme="dark"] .status-card #btnFeeding {
  background: rgba(176, 160, 244, 0.2) !important;
  color: #ddd5ff !important;
}
:root[data-theme="dark"] .timer-label,
:root[data-theme="dark"] .timer-sub,
:root[data-theme="dark"] .status-time,
:root[data-theme="dark"] .progress-labels {
  color: #b6b1dc !important;
}
:root[data-theme="dark"] .timer-value {
  color: #d5cff8 !important;
}
:root[data-theme="dark"] .selfsleep-chat-screen,
:root[data-theme="dark"] .selfsleep-chat-messages,
:root[data-theme="dark"] .selfsleep-overlay,
:root[data-theme="dark"] .selfsleep-chat-input-wrap,
:root[data-theme="dark"] .selfsleep-chat-limit {
  background: var(--bg) !important;
}
:root[data-theme="dark"] .selfsleep-chat-row.assistant .selfsleep-chat-bubble,
:root[data-theme="dark"] .selfsleep-chat-row.assistant .selfsleep-chat-bubble *,
:root[data-theme="dark"] .selfsleep-chat-typing,
:root[data-theme="dark"] .selfsleep-chat-input-row {
  background: var(--surface) !important;
  border-color: rgba(149, 140, 220, 0.18) !important;
  color: var(--text) !important;
}
:root[data-theme="dark"] .selfsleep-chat-input-row {
  background: var(--surface-2) !important;
}
:root[data-theme="dark"] .selfsleep-chat-attachment-chip,
:root[data-theme="dark"] .selfsleep-chat-attachment-remove {
  background: var(--surface) !important;
  border-color: rgba(149, 140, 220, 0.18) !important;
  color: var(--text) !important;
}
:root[data-theme="dark"] .selfsleep-chat-attachment-thumb,
:root[data-theme="dark"] .selfsleep-chat-attachment-icon {
  background: rgba(149, 140, 220, 0.12) !important;
  border-color: rgba(149, 140, 220, 0.18) !important;
}
:root[data-theme="dark"] .selfsleep-chat-send {
  background: transparent !important;
  color: #b9b1d7 !important;
}
:root[data-theme="dark"] .selfsleep-chat-send:disabled {
  background: transparent !important;
  color: #7b7498 !important;
}
:root[data-theme="dark"] .selfsleep-chat-attach-btn {
  color: #b9b1d7 !important;
}
:root[data-theme="dark"] .selfsleep-chat-textarea {
  color: var(--text) !important;
}
:root[data-theme="dark"] .selfsleep-chat-textarea::placeholder {
  color: #b1add8 !important;
  opacity: 0.7 !important;
}
:root[data-theme="dark"] .selfsleep-chat-row.assistant .bubble-time,
:root[data-theme="dark"] .selfsleep-chat-limit {
  color: #a8a4cf !important;
}
:root[data-theme="dark"] .sounds-overlay,
:root[data-theme="dark"] .lullabies-overlay,
:root[data-theme="dark"] .sounds-screen,
:root[data-theme="dark"] .sounds-scroll,
:root[data-theme="dark"] .sounds-shell {
  background: var(--bg) !important;
}
:root[data-theme="dark"] .noise-card,
:root[data-theme="dark"] .lull-player-wrap,
:root[data-theme="dark"] .lull-row {
  background: var(--surface) !important;
  border-color: var(--border) !important;
  color: var(--text) !important;
  box-shadow: none !important;
}
:root[data-theme="dark"] .noise-card-title,
:root[data-theme="dark"] .lull-title,
:root[data-theme="dark"] .lull-row-title,
:root[data-theme="dark"] .lull-ctl {
  color: #f1effa !important;
}
:root[data-theme="dark"] .noise-card-sub,
:root[data-theme="dark"] .lull-artist,
:root[data-theme="dark"] .lull-time,
:root[data-theme="dark"] .lull-list-title,
:root[data-theme="dark"] .lull-row-subtitle {
  color: #a9a5cc !important;
}
:root[data-theme="dark"] .noise-card-play {
  color: #b9b2ee !important;
  background: transparent !important;
}
:root[data-theme="dark"] .noise-card.is-playing .noise-card-play,
:root[data-theme="dark"] .lull-ctl.lull-play {
  background: #7f70d8 !important;
  color: #ffffff !important;
  box-shadow: 0 10px 24px rgba(127, 112, 216, 0.25) !important;
}
:root[data-theme="dark"] .lull-progress input[type="range"] {
  background: rgba(255, 255, 255, 0.08) !important;
}
:root[data-theme="dark"] .noise-card.tone-slate .noise-card-icon {
  background: rgba(148, 163, 184, 0.14) !important;
  color: #c7cfda !important;
}
:root[data-theme="dark"] .noise-card.tone-pink .noise-card-icon {
  background: rgba(196, 120, 156, 0.14) !important;
  color: #dcb2c9 !important;
}
:root[data-theme="dark"] .noise-card.tone-mocha .noise-card-icon {
  background: rgba(138, 114, 92, 0.16) !important;
  color: #c6ab97 !important;
}
:root[data-theme="dark"] .noise-card.tone-sky .noise-card-icon {
  background: rgba(88, 140, 176, 0.16) !important;
  color: #a6c8df !important;
}
:root[data-theme="dark"] .noise-card.tone-violet .noise-card-icon {
  background: rgba(133, 120, 190, 0.16) !important;
  color: #c9c0f1 !important;
}
:root[data-theme="dark"] .health-home-icon {
  background: rgba(100, 180, 127, 0.16) !important;
  color: #78d39a !important;
}
:root[data-theme="dark"] .chat-home-icon {
  background: rgba(96, 168, 224, 0.14) !important;
  color: #9fc4e8 !important;
}
:root[data-theme="dark"] .selfsleep-home-icon,
:root[data-theme="dark"] .sounds-home-icon {
  background: rgba(123, 111, 196, 0.16) !important;
  color: #c2b8f0 !important;
}
:root[data-theme="dark"] .growth-spurts-home-icon {
  background: rgba(110, 124, 194, 0.16) !important;
  color: #b8c0f4 !important;
}
:root[data-theme="dark"] .growth-spurts-legend-item,
:root[data-theme="dark"] .growth-spurts-grid-title-text,
:root[data-theme="dark"] .growth-spurts-summary-title,
:root[data-theme="dark"] .growth-spurts-summary-sub,
:root[data-theme="dark"] .growth-spurts-phase-text {
  color: #bbb7dd !important;
}
:root[data-theme="dark"] .growth-spurts-week-chip.is-calm {
  color: #c6c1eb !important;
  border-color: rgba(162, 154, 230, 0.42) !important;
}
:root[data-theme="dark"] .growth-spurts-week-chip.is-leap {
  background: #f1d9e4 !important;
  color: #97355f !important;
}
:root[data-theme="dark"] .growth-spurts-info-btn {
  background: rgba(115, 107, 183, 0.18) !important;
  color: #d2ccfb !important;
  border-color: rgba(162, 154, 230, 0.36) !important;
}
:root[data-theme="dark"] .feeding-picker-help-btn {
  background: rgba(115, 107, 183, 0.18) !important;
  color: #d2ccfb !important;
  border-color: rgba(162, 154, 230, 0.36) !important;
}
:root[data-theme="dark"] .growth-spurts-info-tip,
:root[data-theme="dark"] .growth-spurts-week-tip-box {
  background: var(--surface) !important;
  color: #c0bbe4 !important;
  border-color: rgba(162, 154, 230, 0.22) !important;
}
:root[data-theme="dark"] .feeding-picker-help-tip {
  background: var(--surface) !important;
  color: #c0bbe4 !important;
  border-color: rgba(162, 154, 230, 0.22) !important;
}
:root[data-theme="dark"] .ai-plan-sheet {
  color: var(--text) !important;
}
:root[data-theme="dark"] .ai-plan-hero-label {
  color: #cfc7ff !important;
}
:root[data-theme="dark"] .ai-plan-section-label {
  color: #a8a2cf !important;
}
:root[data-theme="dark"] .ai-plan-section-action .ai-plan-section-label {
  color: #d6cfff !important;
}
:root[data-theme="dark"] .ai-plan-tip.ai-plan-tip-card {
  background: linear-gradient(135deg, rgba(145, 126, 227, 0.24), rgba(145, 126, 227, 0.08)) !important;
  color: #f0eeff !important;
  border-color: rgba(172, 160, 242, 0.22) !important;
  box-shadow: 0 14px 30px rgba(18, 10, 48, 0.28);
}
:root[data-theme="dark"] .ai-plan-section {
  border-top-color: rgba(162, 154, 230, 0.16) !important;
}
:root[data-theme="dark"] .ai-plan-section-action {
  background: rgba(255,255,255,0.03) !important;
  border-color: rgba(162, 154, 230, 0.18) !important;
}
:root[data-theme="dark"] .ai-plan-comment {
  color: #c6c2e9 !important;
  line-height: 1.65;
}
:root[data-theme="dark"] .ai-plan-text,
:root[data-theme="dark"] .ai-plan-formula-note {
  color: #aaa6cf !important;
}
.ai-plan-text-center {
  text-align: center;
  padding: 20px 0;
}

/* ──────────────────────────────────────────────────────────────
   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-skip-nap-btn {
  margin-top: 8px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--danger);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
}
.plan-skip-nap-btn:active { opacity: 0.66; }
.plan-missed-summary { cursor: default; }

.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-mark оставляем как совместимый fallback для старых кешей bundle. */
.plan-edit-affordance,
.plan-edit-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px; height: 18px;
  margin-left: 6px;
  background: transparent;
  border-radius: 0;
  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,
.plan-item.editable:hover .plan-edit-mark,
.plan-item.editable:active .plan-edit-mark,
.plan-wake-badge.editable:hover .plan-edit-mark,
.plan-wake-badge.editable:active .plan-edit-mark { opacity: 1; }
:root[data-theme="dark"] .plan-edit-affordance,
:root[data-theme="dark"] .plan-edit-mark { color: rgba(255,255,255,0.45); }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .plan-edit-affordance,
  :root:not([data-theme]) .plan-edit-mark { color: rgba(255,255,255,0.45); }
}

/* Hint-карточка перед днём (белая, в стиле plan-item) */
.plan-edit-hint-card {
  cursor: default;
  align-items: center;
}
.plan-edit-hint-card .journal-icon.info {
  background: #dbeafe;
  color: #2563eb;
}
.plan-naps-count-card .journal-icon.naps-count {
  background: var(--mint-bg, #d1fae5);
  color: var(--mint-fg, #059669);
}
.plan-edit-hint-card .journal-subline {
  color: var(--text-muted, #6b7280);
  font-size: 13px;
}
.newborn-guidance-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
  padding: 22px 20px;
  border-radius: 24px;
  background: var(--card-bg, #fff);
  box-shadow: var(--card-shadow);
  color: var(--text-primary);
}
.newborn-guidance-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: #f0ebff;
  color: #7f70c8;
  font-size: 28px;
  line-height: 1;
  margin: 0 auto;
}
.newborn-guidance-icon svg {
  display: block;
}
.newborn-guidance-card h3 {
  margin: 0 0 10px;
  font-size: 18px;
  line-height: 1.25;
  text-align: left;
}
.newborn-guidance-card p {
  margin: 0;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
}
.newborn-guidance-card .newborn-guidance-note {
  margin-top: 12px;
  color: #6f62a6;
  font-size: 14px;
}
.transition-guidance-card {
  margin-bottom: 14px;
  background: #fffdf7;
}
.transition-guidance-card .newborn-guidance-icon {
  background: #fff1ca;
  color: #ad7a16;
}
.transition-plan-item {
  cursor: default;
}
.transition-plan-badge {
  flex: 0 0 auto;
  padding: 4px 8px;
  border-radius: 8px;
  background: #fff4d7;
  color: #8d6a22;
  font-size: 11px;
  font-weight: 600;
}
.transition-plan-empty {
  margin-top: 12px;
  padding: 24px 20px;
  color: var(--text-muted);
  line-height: 1.5;
  text-align: center;
}
:root[data-theme="dark"] .transition-guidance-card {
  background: rgba(255, 244, 215, 0.07);
}
:root[data-theme="dark"] .transition-guidance-card .newborn-guidance-icon,
:root[data-theme="dark"] .transition-plan-badge {
  background: rgba(255, 213, 117, 0.13);
  color: #e7c878;
}
:root[data-theme="dark"] .plan-edit-hint-card .journal-icon.info {
  background: rgba(96, 168, 224, 0.14);
  color: #9fc4e8;
}
:root[data-theme="dark"] .plan-naps-count-card .journal-icon.naps-count {
  background: rgba(100, 180, 127, 0.16);
  color: #78d39a;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .plan-edit-hint-card .journal-icon.info {
    background: rgba(96, 168, 224, 0.14);
    color: #9fc4e8;
  }
  :root:not([data-theme]) .plan-naps-count-card .journal-icon.naps-count {
    background: rgba(100, 180, 127, 0.16);
    color: #78d39a;
  }
}

/* Индикатор «ваша правка» */
.plan-item.overridden {
  border-left: 0;
}

.plan-wake-badge.edited {
  background: var(--surface);
  color: var(--text-muted);
  border-color: var(--border);
}
:root[data-theme="dark"] .plan-wake-badge.edited {
  background: var(--surface);
  color: var(--text-muted);
  border-color: var(--border);
}

/* Карточка «Изменить число снов» */
.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;
}
:root[data-theme="dark"] .plan-naps-count-card .plan-status-badge.upcoming {
  background: rgba(52,211,153,0.18);
  color: #6ee7b7;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .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: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-muted, #6b7280);
  line-height: 1.5;
}
.plan-editor-info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
:root[data-theme="dark"] .plan-editor-info-icon {
  color: #b7b2dd;
}

/* Степпер: – значение + */
.plan-editor-stepper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--surface-2, #f3f4f6);
  border-radius: 16px;
  padding: 14px 18px;
}
:root[data-theme="dark"] .plan-editor-stepper { background: var(--surface-2, #2D2B5C); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .plan-editor-stepper { background: var(--surface-2, #2D2B5C); }
}

.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; }
:root[data-theme="dark"] .plan-editor-btn { background: var(--surface, #252350); color: var(--text, #F0EFF8); }
:root[data-theme="dark"] .plan-editor-btn:hover { background: var(--primary-soft, rgba(123, 111, 196, 0.18)); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .plan-editor-btn { background: var(--surface, #252350); color: var(--text, #F0EFF8); }
  :root:not([data-theme]) .plan-editor-btn:hover { background: var(--primary-soft, rgba(123, 111, 196, 0.18)); }
}

.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;
}
:root[data-theme="dark"] .plan-editor-value { color: var(--text, #F0EFF8); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .plan-editor-value { color: var(--text, #F0EFF8); }
}

.plan-editor-step-hint {
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted, #9ca3af);
}

.plan-editor-preference {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(139, 123, 255, 0.10);
  box-shadow: inset 0 0 0 1px rgba(139, 123, 255, 0.08);
}

:root[data-theme="dark"] .plan-editor-preference {
  background: rgba(139, 123, 255, 0.14);
  box-shadow: inset 0 0 0 1px rgba(139, 123, 255, 0.14);
}

.plan-editor-remember {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  user-select: none;
  cursor: pointer;
}

.plan-editor-remember-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 1px;
  height: 1px;
}

.plan-editor-remember-box {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  border: 1.5px solid var(--border-strong);
  background: var(--surface);
  color: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease, transform 100ms ease;
}

.plan-editor-remember-text {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text);
}

.plan-editor-remember-input:checked + .plan-editor-remember-box {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.plan-editor-remember-input:checked + .plan-editor-remember-box svg {
  transform: scale(1);
}

.plan-editor-remember-input:focus-visible + .plan-editor-remember-box {
  box-shadow: 0 0 0 4px var(--primary-soft), var(--shadow-sm);
}

.plan-editor-remember:active .plan-editor-remember-box {
  transform: scale(0.96);
}

.plan-editor-note {
  margin-left: 34px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
  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: linear-gradient(135deg, var(--primary) 0%, #8A7ED5 100%);
  color: #fff;
  box-shadow: var(--shadow);
  transition: background-color 120ms ease, box-shadow 120ms ease, transform 100ms ease;
  -webkit-tap-highlight-color: transparent;
}
.plan-editor-save:hover { box-shadow: var(--shadow-lg); }
.plan-editor-save:active { transform: scale(0.98); }
.plan-editor-save:disabled { opacity: 0.6; cursor: not-allowed; }
.plan-editor-save.loading {
  background: var(--text-muted);
  box-shadow: none;
}

.plan-editor-skip {
  height: 48px;
  border: 0;
  border-radius: 14px;
  background: var(--danger-soft, #fff1f1);
  color: var(--danger, #dc5f5f);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 100ms ease, opacity 120ms ease;
  -webkit-tap-highlight-color: transparent;
}
.plan-editor-skip:active { transform: scale(0.98); opacity: 0.82; }

/* 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;
}
:root[data-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);
}
:root[data-theme="dark"] .plan-transition-btn {
  background: rgba(99,102,241,0.10);
  border-color: rgba(99,102,241,0.40);
}
:root[data-theme="dark"] .plan-transition-btn.primary {
  background: #6366f1;
  border-color: #6366f1;
  color: #fff;
}
:root[data-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; }

/* Buttons are flat throughout Lunora.  Cards and sheets retain their own
   elevation; actionable controls never cast a drop shadow. */
button,
[role="button"],
.btn,
.app-confirm-btn {
  box-shadow: none !important;
}
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;
}

.past-nap-from,
.past-nap-to {
  -webkit-appearance: none;
  appearance: none;
  background-image: none;
  padding-right: 12px;
}

.past-nap-from::-webkit-calendar-picker-indicator,
.past-nap-to::-webkit-calendar-picker-indicator {
  display: none;
  -webkit-appearance: none;
  opacity: 0;
}

/* ---------- Support Shell ---------- */
.support-shell {
  position: relative;
  padding-bottom: calc(var(--app-nav-bottom-extra) + 110px);
}
.support-shell-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}
.support-shell-back {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}
.support-shell-head-copy {
  min-width: 0;
  padding-top: 2px;
}
.support-shell-title {
  font-size: 28px;
  line-height: 1.08;
  font-weight: 800;
  color: var(--text);
}
.support-shell-subtitle {
  margin-top: 5px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--text-muted);
}
.support-shell-body {
  min-height: 320px;
}
.support-shell-fab {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--app-nav-bottom-extra) + 82px);
  width: calc(100% - 32px);
  max-width: 360px;
  height: 56px;
  border-radius: 18px;
  border: none;
  background: linear-gradient(135deg, var(--primary) 0%, #9a8cff 100%);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 700;
  box-shadow: 0 18px 36px rgba(123, 110, 246, 0.28);
  z-index: 19;
}
.support-shell-fab:active {
  transform: translateX(-50%) scale(0.98);
}
.support-empty,
.support-loading,
.support-error {
  text-align: center;
  padding: 28px 20px;
}
.support-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.support-empty-icon {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  background: var(--primary-soft);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
}
.support-empty h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
}
.support-empty p,
.support-loading,
.support-error {
  margin: 0;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.55;
}
.support-ticket-list {
  display: grid;
  gap: 12px;
}
.support-ticket-card {
  width: 100%;
  text-align: left;
  padding: 18px;
  cursor: pointer;
}
.support-ticket-card-top,
.support-thread-badges {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.support-ticket-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
}
.support-ticket-status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.support-ticket-status.waiting-admin {
  background: rgba(79, 194, 140, 0.16);
  color: #1f9b66;
}
.support-ticket-status.waiting-user {
  background: rgba(255, 194, 77, 0.2);
  color: #bb7a00;
}
.support-ticket-status.closed {
  background: rgba(147, 161, 188, 0.18);
  color: #71819d;
}
.support-ticket-title {
  margin-top: 14px;
  font-size: 17px;
  line-height: 1.35;
  font-weight: 800;
  color: var(--text);
}
.support-ticket-preview {
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.support-ticket-meta,
.support-thread-meta {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-muted);
  font-size: 12px;
}
.support-ticket-unread-dot {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 3px var(--surface);
}
.support-shell--chat .support-shell-body {
  min-height: calc(100dvh - 260px);
}
.support-thread-info {
  margin-bottom: 10px;
}
.support-thread-note {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(123, 110, 246, 0.08);
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
}
.support-thread-reopen {
  margin-top: 14px;
}
.support-chat-screen {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.support-chat-messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 6px 0 calc(var(--app-nav-bottom-extra) + 132px);
}
.support-chat-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
.support-chat-row.user {
  justify-content: flex-end;
}
.support-chat-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.support-chat-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.support-chat-bubble-wrap {
  max-width: 82%;
}
.support-chat-author {
  margin: 0 0 4px 6px;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
}
.support-chat-bubble {
  padding: 10px 13px 8px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.55;
  word-break: break-word;
}
.support-chat-bubble.assistant {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
}
.support-chat-bubble.user {
  background: linear-gradient(135deg, var(--primary) 0%, #8d7dff 100%);
  color: #fff;
}
.support-chat-bubble .bubble-time {
  display: block;
  margin-top: 8px;
  font-size: 11px;
  line-height: 1;
  opacity: 0.78;
}
.support-chat-bubble.user .bubble-time {
  color: rgba(255, 255, 255, 0.78);
}
.support-chat-files {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}
.support-chat-file {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(123, 110, 246, 0.08);
  color: inherit;
  text-align: left;
}
.support-chat-bubble.user .support-chat-file {
  background: rgba(255, 255, 255, 0.14);
}
.support-chat-file-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.support-chat-bubble.user .support-chat-file-icon {
  background: rgba(255, 255, 255, 0.2);
}
.support-chat-file-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.support-chat-file-copy span:first-child {
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.support-chat-file-copy span:last-child {
  margin-top: 2px;
  font-size: 11px;
  opacity: 0.78;
}
.support-chat-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  padding: 38px 18px 20px;
}
.support-chat-welcome.compact {
  padding-top: 20px;
}
.support-chat-welcome-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--border);
}
.support-chat-welcome-icon img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}
.support-chat-welcome h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
}
.support-chat-welcome p {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-muted);
}
.support-chat-composer {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--app-nav-bottom-extra) + 68px);
  width: calc(100% - 20px);
  max-width: 560px;
  padding: 8px 10px 10px;
  background: var(--bg);
  z-index: 18;
}
.support-composer-shell {
  display: grid;
  gap: 8px;
}
.support-composer-attachment-meta {
  font-size: 12px;
  color: var(--text-muted);
  padding: 0 6px;
}
.support-composer-attachment-list {
  display: grid;
  gap: 8px;
}
.support-composer-attachment-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid var(--border);
}
.support-composer-attachment-thumb,
.support-composer-attachment-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  flex-shrink: 0;
  border: 1px solid var(--border);
  background: rgba(123, 110, 246, 0.06);
}
.support-composer-attachment-thumb {
  display: block;
  object-fit: cover;
}
.support-composer-attachment-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}
.support-composer-attachment-copy {
  min-width: 0;
  flex: 1;
}
.support-composer-attachment-name {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.support-composer-attachment-size {
  margin-top: 2px;
  font-size: 11px;
  color: var(--text-muted);
}
.support-composer-attachment-remove {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
}
.support-composer-input-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: flex-end;
  padding: 10px 12px;
  border-radius: 22px;
  background: #fff;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.support-composer-attach-btn {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.support-composer-attach-btn svg {
  width: 16px;
  height: 16px;
}
.support-composer-textarea {
  min-height: 24px;
  max-height: 110px;
  resize: none;
  padding: 6px 0 5px;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
}
.support-composer-textarea::placeholder {
  color: var(--text-muted);
  opacity: 0.8;
}
.support-composer-send {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--primary) 0%, #8d7dff 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.support-composer-send:disabled {
  background: #d9d1f7;
  color: #fff;
}
.support-composer-send svg {
  width: 16px;
  height: 16px;
}

:root[data-theme="dark"] .support-shell-back,
:root[data-theme="dark"] .support-chat-bubble.assistant,
:root[data-theme="dark"] .support-composer-input-row,
:root[data-theme="dark"] .support-composer-attachment-chip,
:root[data-theme="dark"] .support-chat-avatar,
:root[data-theme="dark"] .support-chat-welcome-icon {
  background: var(--surface);
  border-color: rgba(255, 255, 255, 0.08);
}
:root[data-theme="dark"] .support-chat-composer,
:root[data-theme="dark"] .support-chat-messages {
  background: transparent;
}
:root[data-theme="dark"] .support-chat-file {
  background: rgba(255, 255, 255, 0.06);
}
:root[data-theme="dark"] .support-chat-bubble.user .support-chat-file {
  background: rgba(255, 255, 255, 0.12);
}
:root[data-theme="dark"] .support-composer-send:disabled {
  background: rgba(123, 110, 246, 0.36);
}

/* ---------- Support Hub V2 ---------- */
.support-hub {
  background: #f5f3fe;
}
.support-hub-shell {
  min-height: calc(100vh - 132px);
  display: flex;
  flex-direction: column;
  padding: 22px 18px 18px;
  box-sizing: border-box;
}
.support-hub-head {
  padding: 6px 2px 10px;
}
.support-hub-title {
  color: #221b53;
  font-size: 2rem;
  font-weight: 900;
  line-height: 1.05;
}
.support-hub-subtitle {
  margin-top: 6px;
  color: #7d76a8;
  font-size: 0.98rem;
}
.support-hub-content {
  flex: 1;
  padding-bottom: 18px;
}
.support-hub-loading,
.support-hub-error,
.support-hub-empty {
  padding: 26px 22px;
  border-radius: 28px;
}
.support-hub-empty {
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 12px;
  min-height: 340px;
  align-content: center;
}
.support-hub-empty-icon {
  width: 86px;
  height: 86px;
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(137, 107, 255, 0.14), rgba(137, 107, 255, 0.06));
  display: grid;
  place-items: center;
}
.support-hub-empty-icon img {
  width: 54px;
  height: 54px;
  object-fit: cover;
}
.support-hub-empty h3 {
  margin: 0;
  color: #221b53;
  font-size: 1.55rem;
  font-weight: 900;
}
.support-hub-empty p,
.support-hub-loading,
.support-hub-error {
  color: #7d76a8;
  line-height: 1.6;
}
.support-hub-footer {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  position: sticky;
  bottom: 0;
  padding-top: 10px;
  background: linear-gradient(180deg, rgba(245, 243, 254, 0), #f5f3fe 28%);
}
.support-hub-nav-btn {
  position: relative;
  min-height: 58px;
  border: none;
  border-radius: 22px;
  background: transparent;
  color: #5d5693;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 3px;
  font-size: 0.84rem;
  font-weight: 700;
}
.support-hub-nav-btn.active {
  background: rgba(137, 107, 255, 0.14);
  color: #5e45dd;
}
.support-hub-nav-badge {
  position: absolute;
  top: 6px;
  right: 12px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #8265ff;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  font-weight: 800;
}
.support-primary-btn,
.support-secondary-btn,
.support-success-btn,
.support-ghost-btn {
  width: 100%;
  min-height: 56px;
  border-radius: 20px;
  border: none;
  font-size: 1rem;
  font-weight: 800;
}
.support-primary-btn {
  background: linear-gradient(135deg, #6d5cf6, #8b75ff);
  color: #fff;
}
.support-secondary-btn {
  background: rgba(132, 108, 255, 0.12);
  color: #5e45dd;
}
.support-success-btn {
  background: #f6ca63;
  color: #4b3b00;
}
.support-ghost-btn {
  background: #fff;
  color: #7b73a9;
  border: 1px solid rgba(126, 111, 184, 0.18);
}
.support-primary-btn:disabled {
  opacity: 0.5;
}
.support-filter-row {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  overflow-x: auto;
  padding-bottom: 2px;
}
.support-filter-chip {
  border: none;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  background: #fff;
  color: #6f68a0;
  font-size: 0.84rem;
  font-weight: 800;
  white-space: nowrap;
}
.support-filter-chip.active {
  background: rgba(132, 108, 255, 0.14);
  color: #5e45dd;
}
.support-dialog-list {
  display: grid;
  gap: 12px;
}
.support-dialog-card {
  position: relative;
  width: 100%;
  border: none;
  border-radius: 28px;
  background: #fff;
  padding: 16px;
  box-shadow: 0 10px 28px rgba(46, 30, 103, 0.08);
  text-align: left;
}
.support-dialog-card.compact {
  margin-bottom: 14px;
}
.support-dialog-top,
.support-thread-chip-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.support-dialog-chip,
.support-dialog-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 800;
}
.support-dialog-chip {
  background: rgba(132, 108, 255, 0.11);
  color: #6a57d4;
}
.support-dialog-status.is-new {
  background: rgba(137, 107, 255, 0.12);
  color: #6a57d4;
}
.support-dialog-status.is-open,
.support-dialog-status.is-waiting-support {
  background: rgba(92, 214, 139, 0.18);
  color: #228055;
}
.support-dialog-status.is-waiting-user {
  background: rgba(248, 196, 88, 0.2);
  color: #9e6b00;
}
.support-dialog-status.is-resolved {
  background: rgba(106, 184, 255, 0.18);
  color: #2b6da2;
}
.support-dialog-status.is-closed {
  background: rgba(153, 160, 181, 0.16);
  color: #66718a;
}
.support-dialog-title {
  margin-top: 12px;
  color: #221b53;
  font-size: 1.14rem;
  font-weight: 900;
}
.support-dialog-preview {
  margin-top: 8px;
  color: #7d76a8;
  line-height: 1.55;
}
.support-dialog-meta,
.support-thread-ticket-meta {
  margin-top: 12px;
  color: #8c85b5;
  font-size: 0.8rem;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.support-dialog-unread {
  position: absolute;
  top: 14px;
  right: 14px;
  min-width: 22px;
  height: 22px;
  border-radius: 999px;
  background: #8668ff;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 900;
  padding: 0 6px;
}
.support-compose-screen {
  display: grid;
  gap: 14px;
}
.support-compose-label {
  color: #221b53;
  font-size: 1rem;
  font-weight: 900;
}
.support-category-list {
  display: grid;
  gap: 10px;
}
.support-category-card {
  width: 100%;
  border: 1px solid rgba(126, 111, 184, 0.15);
  background: #fff;
  border-radius: 22px;
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
}
.support-category-card.active {
  border-color: #7e62ff;
  box-shadow: 0 0 0 2px rgba(126, 98, 255, 0.1);
}
.support-category-icon {
  width: 42px;
  height: 42px;
  border-radius: 16px;
  background: rgba(132, 108, 255, 0.1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}
.support-category-copy {
  display: grid;
  gap: 4px;
}
.support-category-copy strong {
  color: #221b53;
  font-size: 0.98rem;
}
.support-category-copy span {
  color: #7d76a8;
  font-size: 0.8rem;
}
.support-step-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  align-self: flex-start;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(132, 108, 255, 0.12);
  color: #6652d3;
  font-weight: 800;
}
.support-step-chip button {
  border: none;
  background: transparent;
  color: #7d76a8;
  font-weight: 700;
}
.support-field {
  display: grid;
  gap: 8px;
}
.support-field > span {
  color: #221b53;
  font-size: 0.88rem;
  font-weight: 900;
}
.support-field input,
.support-field textarea,
.support-rating-comment {
  width: 100%;
  border: 1px solid rgba(126, 111, 184, 0.18);
  border-radius: 22px;
  background: #fff;
  color: #221b53;
  padding: 16px 18px;
  font: inherit;
  box-sizing: border-box;
  resize: vertical;
}
.support-field textarea {
  min-height: 142px;
}

/* Comment and note fields use the same borderless surface across the mini app. */
textarea.field-textarea,
.feedback-textarea,
.feeding-note-input,
.support-field .support-rating-comment {
  border: none;
  outline: none;
}

textarea.field-textarea:focus,
.feedback-textarea:focus,
.feeding-note-input:focus,
.support-field .support-rating-comment:focus {
  border: none;
  outline: none;
}
.support-field-counter,
.support-field-hint {
  color: #8b84b2;
  font-size: 0.76rem;
  text-align: right;
}
.support-attach-actions {
  display: flex;
  gap: 10px;
}
.support-attach-action {
  border: 1px dashed rgba(126, 111, 184, 0.28);
  background: rgba(255, 255, 255, 0.7);
  color: #6755d3;
  border-radius: 18px;
  min-height: 46px;
  padding: 0 14px;
  font-weight: 800;
}
.support-attach-list,
.support-chat-attachments {
  display: grid;
  gap: 8px;
}
.support-attach-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border: 1px solid rgba(126, 111, 184, 0.14);
  border-radius: 18px;
  padding: 10px 12px;
}
.support-attach-chip.compact {
  background: rgba(255, 255, 255, 0.92);
}
.support-attach-thumb,
.support-attach-icon {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  background: rgba(132, 108, 255, 0.12);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 40px;
}
.support-attach-thumb {
  object-fit: cover;
}
.support-attach-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}
.support-attach-copy span:first-child {
  color: #221b53;
  font-size: 0.84rem;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.support-attach-copy span:last-child {
  color: #8b84b2;
  font-size: 0.72rem;
}
.support-attach-remove {
  margin-left: auto;
  border: none;
  background: transparent;
  color: #8b84b2;
  font-size: 1.1rem;
}
.support-suggestion-list {
  display: grid;
  gap: 10px;
}
.support-suggestion-card {
  display: flex;
  gap: 12px;
  background: #fff;
  border-radius: 22px;
  padding: 14px;
  box-shadow: 0 10px 24px rgba(46, 30, 103, 0.06);
}
.support-suggestion-icon {
  width: 42px;
  height: 42px;
  border-radius: 16px;
  background: rgba(107, 188, 255, 0.18);
  color: #2b6da2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
}
.support-suggestion-copy {
  display: grid;
  gap: 4px;
}
.support-suggestion-copy strong {
  color: #221b53;
  font-size: 0.96rem;
}
.support-suggestion-copy span {
  color: #7d76a8;
  font-size: 0.82rem;
  line-height: 1.45;
}
.support-suggestion-actions,
.support-thread-quick-actions {
  display: grid;
  gap: 10px;
}
.support-thread-screen {
  display: grid;
  gap: 14px;
}
.support-thread-top-card,
.support-thread-banner,
.support-rating-card {
  background: #fff;
  border-radius: 24px;
  padding: 16px;
  box-shadow: 0 10px 24px rgba(46, 30, 103, 0.06);
}
.support-thread-banner {
  display: grid;
  gap: 8px;
}
.support-thread-banner strong,
.support-rating-title {
  color: #221b53;
  font-size: 1rem;
  font-weight: 900;
}
.support-thread-banner span {
  color: #7d76a8;
  line-height: 1.55;
}
.support-thread-banner.warning {
  background: linear-gradient(180deg, rgba(246, 202, 99, 0.18), rgba(255, 255, 255, 0.96));
}
.support-thread-banner.success {
  background: linear-gradient(180deg, rgba(104, 192, 255, 0.16), rgba(255, 255, 255, 0.96));
}
.support-thread-banner.closed {
  background: linear-gradient(180deg, rgba(156, 163, 175, 0.13), rgba(255, 255, 255, 0.96));
}
.support-thread-close-cta {
  width: 100%;
  min-height: 52px;
  border: none;
  border-radius: 18px;
  background: rgba(132, 108, 255, 0.1);
  color: #5e45dd;
  font-weight: 800;
}
.support-thread-stream {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 10px;
}
.support-thread-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}
.support-thread-row.user {
  justify-content: flex-end;
}
.support-thread-avatar {
  width: 38px;
  height: 38px;
  border-radius: 16px;
  background: rgba(132, 108, 255, 0.1);
  display: grid;
  place-items: center;
  flex: 0 0 38px;
}
.support-thread-avatar img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
}
.support-thread-bubble-wrap {
  max-width: 82%;
}
.support-thread-author {
  margin: 0 0 6px 8px;
  color: #8b84b2;
  font-size: 0.74rem;
}
.support-thread-bubble {
  position: relative;
  border-radius: 22px;
  padding: 14px 16px 18px;
  line-height: 1.55;
  box-shadow: 0 10px 24px rgba(46, 30, 103, 0.06);
}
.support-thread-bubble.assistant {
  background: #fff;
  color: #221b53;
  border-top-left-radius: 10px;
}
.support-thread-bubble.user {
  background: linear-gradient(135deg, #7a64f7, #8f75ff);
  color: #fff;
  border-top-right-radius: 10px;
}
.support-thread-files {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}
.support-thread-file {
  width: 100%;
  border: none;
  background: rgba(132, 108, 255, 0.08);
  border-radius: 16px;
  padding: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
}
.support-thread-bubble.user .support-thread-file {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}
.support-thread-file-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.support-thread-file-copy span:first-child {
  font-size: 0.82rem;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.support-thread-file-copy span:last-child {
  font-size: 0.72rem;
  opacity: 0.8;
}
.support-thread-system {
  display: flex;
  justify-content: center;
}
.support-thread-system-card {
  max-width: 88%;
  background: rgba(255, 255, 255, 0.82);
  color: #6f68a0;
  border-radius: 18px;
  padding: 10px 14px;
  font-size: 0.82rem;
  line-height: 1.45;
  text-align: center;
}
.support-hub-chat-footer {
  position: sticky;
  bottom: 0;
  padding-top: 10px;
  background: linear-gradient(180deg, rgba(245, 243, 254, 0), #f5f3fe 24%);
}
.support-chat-caption {
  color: #8b84b2;
  font-size: 0.76rem;
  text-align: center;
  margin-bottom: 8px;
}
.support-chat-composer-shell {
  background: #fff;
  border-radius: 24px;
  padding: 10px;
  box-shadow: 0 10px 28px rgba(46, 30, 103, 0.08);
}
.support-chat-input-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}
.support-chat-attach,
.support-chat-send {
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 42px;
}
.support-chat-attach {
  background: rgba(132, 108, 255, 0.12);
  color: #6a57d4;
  font-size: 1.5rem;
}
.support-chat-send {
  background: rgba(132, 108, 255, 0.14);
  color: #6a57d4;
}
.support-chat-send:disabled {
  opacity: 0.45;
}
.support-chat-input {
  flex: 1;
  min-height: 42px;
  max-height: 130px;
  border: none;
  background: transparent;
  color: #221b53;
  font: inherit;
  resize: none;
  padding: 10px 0;
}
.support-chat-back-btn {
  width: 100%;
  min-height: 48px;
  margin-top: 10px;
  border: none;
  border-radius: 18px;
  background: transparent;
  color: #6b64a0;
  font-size: 0.95rem;
  font-weight: 800;
}
.support-quick-btn {
  min-height: 48px;
  border: none;
  border-radius: 16px;
  background: #fff;
  color: #5e45dd;
  font-weight: 800;
}
.support-quick-btn.secondary {
  background: rgba(132, 108, 255, 0.1);
}
.support-rating-stars {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 8px 0 12px;
}
.support-rating-star {
  border: none;
  background: transparent;
  color: #dacff9;
  font-size: 1.8rem;
  line-height: 1;
}
.support-rating-star.active {
  color: #8a6eff;
}

.feeding-last-row,
.feeding-last-row.is-empty {
  color: var(--text-muted);
  background: linear-gradient(135deg, var(--text-muted) 0%, var(--primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Dark-theme contrast pass: light-only component colors must not leak here. */
:root[data-theme="dark"] .journal-filter-chip,
:root[data-theme="dark"] .journal-filter-chip.active {
  background: var(--surface-2);
  color: #b7dcbf;
  border: 1px solid rgba(123, 211, 137, 0.22);
  box-shadow: none;
}

:root[data-theme="dark"] .journal-filter-chip:not(.active) {
  color: #d29aa8;
  border-color: var(--border-strong);
}

:root[data-theme="dark"] .growth-spurts-week-chip.is-leap {
  background: rgba(238, 160, 194, 0.20) !important;
  color: #f2bdd2 !important;
  border-color: rgba(238, 160, 194, 0.24) !important;
}

:root[data-theme="dark"] .growth-spurts-week-chip.is-current {
  background: #9586e5;
  color: #ffffff;
  border-color: #b3a8f5;
  box-shadow: 0 0 0 3px rgba(149, 134, 229, 0.22);
}

:root[data-theme="dark"] .newborn-guidance-card {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

:root[data-theme="dark"] .newborn-guidance-card h3 {
  color: var(--text);
}

:root[data-theme="dark"] .newborn-guidance-card p {
  color: var(--text);
}

:root[data-theme="dark"] .newborn-guidance-card .newborn-guidance-note {
  color: #c4c1df;
}

:root[data-theme="dark"] .newborn-guidance-icon {
  background: rgba(139, 124, 220, 0.18);
  color: #c1b7ff;
}

:root[data-theme="dark"] .journal-filter-chip,
:root[data-theme="dark"] .journal-filter-chip.active,
:root[data-theme="dark"] .journal-filter-chip:not(.active) {
  border: none;
}

/* MAX WebView may inject its own dark palette after the app CSS.
   Pin the semantic sleep accents so they match the Telegram Mini App. */
html[data-platform="max"][data-theme="dark"] {
  color-scheme: dark;
  --gold: #ffd675 !important;
  --gold-soft: rgba(255, 214, 117, 0.18) !important;
}

html[data-platform="max"][data-theme="light"] {
  color-scheme: light;
}

html[data-platform="max"][data-theme="dark"] .status-card #btnWake:not(:disabled) {
  background: #ffd675 !important;
  color: #3e315b !important;
}

html[data-platform="max"][data-theme="dark"] .progress-bar:not(.over),
html[data-platform="max"][data-theme="dark"] .progress-seg-sleep,
html[data-platform="max"][data-theme="dark"] .progress-seg-sleep2 {
  background: #ffd675 !important;
  box-shadow: 0 0 12px rgba(255, 214, 117, 0.28);
}

html[data-platform="max"][data-theme="dark"] .health-toggle-track {
  background: #363365 !important;
}

html[data-platform="max"][data-theme="dark"] .health-toggle-thumb {
  background: #f8f6ff !important;
}

/* ---------- Diary / Timeline ---------- */
.diary-home-icon { background: rgba(126, 102, 208, 0.14); color: var(--primary); }
.diary-overlay {
  position: fixed;
  /* Дневник — экран приложения: шапка (30) и её список детей должны быть выше. */
  z-index: 25;
  inset: var(--app-top-offset) 0 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  transform: translateX(101%);
  transition: transform .26s ease;
  overflow: hidden;
}
.diary-overlay.open { transform: translateX(0); }
.diary-header {
  min-height: 58px;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: center;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.diary-header-title { font-size: 18px; font-weight: 750; text-align: center; color: var(--text); }
.diary-icon-btn {
  width: 40px; height: 40px; border: 0; border-radius: 13px;
  display: grid; place-items: center; color: var(--text); background: transparent;
}
.diary-icon-btn:active { background: var(--surface-2); transform: scale(.95); }
.diary-icon-btn svg { width: 21px; height: 21px; }
.diary-body {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  padding: 14px 16px calc(var(--app-nav-bottom-extra) + 100px);
  -webkit-overflow-scrolling: touch;
}
.diary-tools { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.diary-search {
  min-height: 44px; display: flex; align-items: center; gap: 9px;
  padding: 0 13px; border: 1px solid var(--border); border-radius: 14px;
  background: var(--surface); color: var(--text-muted);
}
.diary-search:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.diary-search svg { width: 18px; height: 18px; flex: 0 0 auto; }
.diary-search input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; font-size: 14px; }
.diary-search input::placeholder { color: var(--text-muted); }
.diary-controls { display: flex; justify-content: flex-end; }
.diary-date { display: inline-flex; align-items: center; gap: 7px; color: var(--text-muted); font-size: 12px; font-weight: 650; }
.diary-date input { min-height: 32px; border: 1px solid var(--border); border-radius: 10px; padding: 0 8px; background: var(--surface); color: var(--text); font: inherit; font-size: 12px; }
.diary-filter-row { display: flex; gap: 7px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.diary-filter-row::-webkit-scrollbar { display: none; }
.diary-filter-chip {
  flex: 0 0 auto; min-height: 32px; padding: 0 11px; border: 1px solid var(--border);
  border-radius: 999px; color: var(--text-muted); background: var(--surface); font: inherit; font-size: 12px; font-weight: 650;
}
.diary-filter-chip.active { color: var(--primary); border-color: transparent; background: var(--primary-soft); }
.diary-day-group { margin: 0 0 22px; }
.diary-day-title { margin: 0 0 10px 2px; color: var(--text); font-size: 16px; font-weight: 760; }
.diary-timeline { position: relative; display: flex; flex-direction: column; gap: 8px; }
.diary-timeline-sentinel { height: 24px; }
.diary-timeline-card {
  position: relative; width: 100%; min-height: 90px; display: flex; align-items: flex-start; gap: 11px;
  padding: 13px 13px 13px 8px; text-align: left; border: 1px solid var(--border); border-radius: 17px;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm);
}
.diary-timeline-card:active { transform: scale(.99); background: var(--surface-2); }
.diary-timeline-line { position: absolute; z-index: 0; left: 25px; top: 40px; bottom: -18px; width: 2px; background: var(--border-strong); }
.diary-day-group:last-child .diary-timeline-card:last-child .diary-timeline-line { display: none; }
.diary-event-icon { position: relative; z-index: 1; width: 35px; height: 35px; display: grid; place-items: center; border-radius: 12px; background: var(--primary-soft); font-size: 18px; flex: 0 0 auto; }
.diary-event-content { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.diary-event-title { overflow: hidden; color: var(--text); font-size: 15px; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.diary-event-meta { color: var(--text-muted); font-size: 12px; font-weight: 550; }
.diary-event-body { color: var(--text-muted); font-size: 13px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.diary-empty { max-width: 320px; margin: 58px auto 0; text-align: center; color: var(--text-muted); }
.diary-empty-icon { width: 54px; height: 54px; margin: 0 auto 14px; display: grid; place-items: center; border-radius: 18px; background: var(--primary-soft); color: var(--primary); font-size: 26px; }
.diary-empty h2 { margin: 0 0 8px; color: var(--text); font-size: 18px; line-height: 1.25; }
.diary-empty p { margin: 0; font-size: 14px; line-height: 1.5; }
.diary-empty--error .diary-empty-icon { background: rgba(225, 91, 91, .13); color: var(--danger, #d65c5c); }
.diary-empty .btn { margin-top: 18px; }
.diary-loading { min-height: 118px; display: flex; justify-content: center; align-items: center; gap: 6px; color: var(--primary); }
.diary-loading span { width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: diary-loading 1s infinite ease-in-out; }
.diary-loading span:nth-child(2) { animation-delay: .15s; }.diary-loading span:nth-child(3) { animation-delay: .3s; }
@keyframes diary-loading { 0%, 100% { opacity: .25; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-5px); } }
.diary-detail { max-width: 520px; margin: 0 auto; padding: 4px 2px 28px; }
.diary-detail-back { display: inline-flex; align-items: center; gap: 5px; border: 0; padding: 8px 0; background: transparent; color: var(--primary); font: inherit; font-size: 14px; font-weight: 700; }
.diary-detail-back svg { width: 17px; height: 17px; }.diary-detail-icon { width: 56px; height: 56px; display: grid; place-items: center; margin: 18px 0 12px; border-radius: 18px; background: var(--primary-soft); font-size: 28px; }
.diary-detail-category { color: var(--text-muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.diary-detail h1 { margin: 5px 0 8px; color: var(--text); font-size: 26px; line-height: 1.18; }.diary-detail-meta { color: var(--text-muted); font-size: 13px; }
.diary-detail p { margin: 22px 0 0; color: var(--text); font-size: 16px; line-height: 1.55; }.diary-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 20px; }.diary-tags span { padding: 5px 9px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-size: 12px; font-weight: 650; }
.diary-observation { max-width: 520px; margin: 0 auto; padding: 10px 2px 28px; }
.diary-observation-intro { margin: 4px 0 18px; }.diary-observation-intro .diary-empty-icon { margin: 0 0 12px; }.diary-observation-intro h1 { margin: 0 0 7px; color: var(--text); font-size: 24px; line-height: 1.2; }.diary-observation-intro p { margin: 0; color: var(--text-muted); font-size: 14px; line-height: 1.45; }
.diary-observation-field { display: block; }.diary-observation-field textarea { box-sizing: border-box; width: 100%; min-height: 164px; resize: vertical; padding: 15px; border: 1px solid var(--border); border-radius: 18px; outline: 0; background: var(--surface); color: var(--text); font: inherit; font-size: 16px; line-height: 1.45; }.diary-observation-field textarea::placeholder { color: var(--text-muted); }.diary-observation-field textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.diary-observation-date { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; margin-top: 12px; padding: 0 12px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); color: var(--text-muted); font-size: 13px; font-weight: 650; }.diary-observation-date input { min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; font-size: 13px; text-align: right; }
.diary-attachment-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 12px; }.diary-attachment-controls .btn { min-height: 42px; padding-inline: 8px; font-size: 13px; }.diary-attachment-controls .btn.is-recording { color: var(--danger, #c95858); border-color: rgba(201, 88, 88, .35); background: rgba(201, 88, 88, .1); }
.diary-draft-attachments { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 12px; }.diary-draft-attachment { position: relative; overflow: hidden; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-2); }.diary-draft-attachment button { position: absolute; top: 5px; right: 5px; width: 24px; height: 24px; border: 0; border-radius: 50%; background: rgba(20, 17, 45, .7); color: #fff; font: inherit; font-size: 18px; line-height: 1; }.diary-draft-attachment--image { width: 76px; height: 76px; }.diary-draft-attachment--image img { width: 100%; height: 100%; object-fit: cover; }.diary-draft-attachment--audio { display: flex; align-items: center; gap: 7px; min-height: 48px; max-width: 100%; padding: 0 34px 0 12px; color: var(--text); font-size: 13px; }.diary-draft-attachment--audio span { color: var(--primary); font-size: 22px; }.diary-draft-attachment--audio strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }.diary-draft-attachments--preview { margin-top: 18px; }
.diary-observation-next { width: 100%; min-height: 50px; margin-top: 20px; }
.diary-observation-kicker { margin: 8px 0 10px; color: var(--primary); font-size: 13px; font-weight: 750; }.diary-observation-preview-card { padding: 18px; border: 1px solid var(--border); border-radius: 20px; background: var(--surface); box-shadow: var(--shadow-sm); }.diary-observation-preview-card .diary-detail-icon { margin: 0 0 12px; }.diary-observation-preview-card h1 { margin: 0 0 8px; color: var(--text); font-size: 20px; line-height: 1.25; }.diary-observation-preview-card p { margin: 17px 0 0; color: var(--text); font-size: 15px; line-height: 1.55; }
.diary-parser-status { display: inline-flex; margin: 0 0 13px; padding: 5px 8px; border-radius: 999px; background: var(--surface-2); color: var(--text-muted); font-size: 11px; font-weight: 700; }.diary-parser-status.is-rule { color: var(--primary); background: var(--primary-soft); }.diary-preview-field { display: block; margin: 12px 0; }.diary-preview-field > span { display: block; margin-bottom: 5px; color: var(--text-muted); font-size: 11px; font-weight: 750; text-transform: uppercase; letter-spacing: .03em; }.diary-preview-field input, .diary-preview-field select { box-sizing: border-box; width: 100%; min-height: 42px; padding: 0 11px; border: 1px solid var(--border); border-radius: 12px; outline: 0; background: var(--surface-2); color: var(--text); font: inherit; font-size: 14px; }.diary-preview-field input:focus, .diary-preview-field select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.diary-observation-actions { display: grid; grid-template-columns: minmax(0, .72fr) minmax(0, 1.28fr); gap: 10px; margin-top: 16px; }.diary-observation-actions .btn { min-height: 50px; }
.diary-reminders { max-width: 520px; margin: 0 auto; padding: 10px 2px 28px; }.diary-reminder-schedule-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .82fr); gap: 10px; }.diary-reminder-private-note { margin: 15px 0 0; color: var(--text-muted); font-size: 13px; line-height: 1.45; }.diary-reminder-list { margin-top: 28px; }.diary-reminder-list--loading { min-height: 32px; }.diary-reminder-list h2 { margin: 0 0 10px; color: var(--text); font-size: 16px; }.diary-reminder-empty { display: flex; flex-direction: column; gap: 4px; padding: 16px; border: 1px dashed var(--border-strong); border-radius: 16px; color: var(--text-muted); font-size: 13px; line-height: 1.4; }.diary-reminder-empty strong { color: var(--text); font-size: 14px; }.diary-reminder-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-sm); }.diary-reminder-card + .diary-reminder-card { margin-top: 8px; }.diary-reminder-card > div:first-child { min-width: 0; display: flex; flex-direction: column; gap: 4px; }.diary-reminder-card strong { overflow: hidden; color: var(--text); font-size: 14px; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }.diary-reminder-card span { color: var(--text-muted); font-size: 12px; }.diary-reminder-card-actions { display: flex; flex: 0 0 auto; gap: 5px; }.diary-reminder-action { min-height: 30px; padding: 0 8px; border: 0; border-radius: 9px; background: var(--primary-soft); color: var(--primary); font: inherit; font-size: 11px; font-weight: 750; }.diary-reminder-action.is-danger { background: rgba(196, 86, 86, .11); color: var(--danger, #c95858); }
.diary-entry-attachments { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }.diary-entry-attachment { overflow: hidden; border: 1px solid var(--border); border-radius: 16px; background: var(--surface-2); }.diary-entry-attachment--image { width: min(100%, 230px); aspect-ratio: 1; }.diary-entry-attachment--image img { display: block; width: 100%; height: 100%; object-fit: cover; }.diary-entry-attachment--audio { display: flex; align-items: center; gap: 8px; width: 100%; padding: 10px; }.diary-entry-attachment--audio span { color: var(--primary); font-size: 24px; }.diary-entry-attachment--audio audio { min-width: 0; flex: 1; height: 34px; }
.diary-nav { position: fixed; z-index: 2; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 8px 16px var(--app-nav-bottom-padding); border-top: 1px solid var(--border); background: var(--surface); }
.diary-nav-item { min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 7px 2px; border: 0; border-radius: 12px; background: transparent; color: var(--text-muted); font: inherit; font-size: 10px; font-weight: 600; }.diary-nav-item svg { width: 20px; height: 20px; }.diary-nav-item.active { color: var(--primary); background: var(--primary-soft); }.diary-nav-item:active { transform: scale(.95); }

@media (min-width: 561px) { .diary-overlay { left: 50%; right: auto; width: min(100%, 560px); transform: translateX(101%); } .diary-overlay.open { transform: translateX(-50%); } .diary-nav { left: 50%; right: auto; width: min(100%, 560px); transform: translateX(-50%); } }

/* Global interaction rule: actions stay flat; only surfaces may have depth. */
button,
[role="button"],
.btn,
.app-confirm-btn {
  box-shadow: none !important;
}

/* Shared modal typography. Sleep/Wake define the reference scale. */
:root {
  --modal-title-size: 18px;
  --modal-body-size: 14px;
  --modal-label-size: 12px;
  --modal-side-padding: 20px;
  --modal-section-gap: 20px;
}

.sheet-title,
.diary-entry-editor .diary-entry-editor-heading h2,
.diary-storage-sheet-heading .sheet-title,
.app-confirm-title,
.feedback-modal-title,
.feeding-help-modal-title,
.too-young-title,
.paywall-title,
.lunora-temporal-dialog-title {
  font-size: var(--modal-title-size);
  font-weight: 700;
  line-height: normal;
  letter-spacing: -.01em;
  color: var(--text);
}

/* Only label nodes: never style spans belonging to a date/time control. */
.sheet .field-label,
.sheet .feeding-field-label,
.diary-entry-editor .field-label,
.diary-entry-editor .diary-preview-field > span,
.diary-entry-editor .diary-entry-editor-text > span {
  display: block;
  margin: 0 0 10px;
  color: var(--text);
  opacity: .55;
  font-size: var(--modal-label-size);
  font-weight: 700;
  line-height: normal;
  letter-spacing: .07em;
  text-transform: uppercase;
}
.sheet .feeding-field-optional {
  font: inherit;
  color: inherit;
  opacity: 1;
  letter-spacing: inherit;
}

.diary-entry-editor-sheet,
.diary-storage-sheet-card,
.app-confirm-sheet,
.feedback-modal,
.feeding-help-modal,
.too-young-modal {
  font-family: inherit;
  font-size: var(--modal-body-size);
  padding-left: var(--modal-side-padding);
  padding-right: var(--modal-side-padding);
}
.app-confirm-text,
.feedback-modal-subtitle,
.feeding-help-modal-text,
.too-young-body,
.diary-storage-sheet-heading p {
  font-size: var(--modal-body-size);
  font-weight: 400;
  line-height: 1.5;
  color: var(--text-muted);
}
.feedback-textarea {
  font-size: var(--modal-body-size);
  line-height: 1.5;
  padding: 12px 14px;
}

/* A single vertical rhythm for forms in the shared sheet. */
.sheet-body > .field { margin-bottom: var(--modal-section-gap); }
.sheet .feeding-sheet-wrap { padding: 0; }
.sheet .feeding-field + .feeding-field { margin-top: var(--modal-section-gap) !important; }

/* Centre the icon + value together, without changing any labels. */
.lunora-temporal-trigger { justify-content: center; text-align: center; }

/* Sleep offsets and settling time use the same tone as idle mood labels. */
#sleepOffsetChips .offset-chip:not(.active) .chip-main,
.sleep-settling-stepper .plan-editor-value {
  color: var(--text);
  opacity: .7;
}

/* Native script fallbacks keep the existing Latin/Cyrillic interface typography. */
body:lang(zh) { font-family:'Inter','PingFang SC','Microsoft YaHei','Noto Sans SC',sans-serif; }
body:lang(ja) { font-family:'Inter','Hiragino Kaku Gothic ProN','Yu Gothic','Noto Sans JP',sans-serif; }
body:lang(ko) { font-family:'Inter','Apple SD Gothic Neo','Malgun Gothic','Noto Sans KR',sans-serif; }
body:lang(hi) { font-family:'Inter','Kohinoor Devanagari','Nirmala UI','Noto Sans Devanagari',sans-serif; line-height:1.55; }
.settings-choice-options { max-height:min(56vh,420px); overflow-y:auto; overscroll-behavior:contain; }
body:lang(hi) .row-title,body:lang(hi) .settings-label { line-height:1.5; }


/* Complementary foods: bounded forms and a standalone reading page. */
.sheet[data-sheet-kind="complementary"] {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  bottom: var(--sheet-keyboard-gap, 0px);
  max-height: min(86vh, calc(var(--sheet-visible-height, 100dvh) - 20px));
  overflow: hidden;
  padding-bottom: max(16px, env(safe-area-inset-bottom));
}
.sheet[data-sheet-kind="complementary"] .sheet-handle,
.sheet[data-sheet-kind="complementary"] .sheet-head { flex-shrink: 0; }
.sheet[data-sheet-kind="complementary"] .sheet-head { gap: 12px; }
.sheet[data-sheet-kind="complementary"] .sheet-title { min-width: 0; }
.sheet[data-sheet-kind="complementary"] .sheet-close { flex: 0 0 36px; height: 36px; }
.sheet[data-sheet-kind="complementary"] .sheet-body {
  min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch; padding: 0 2px 4px;
}
.sheet[data-sheet-kind="complementary"] .feeding-stars-row { gap: 8px; }
.sheet[data-sheet-kind="complementary"] .feeding-star-btn { min-width: 0; }
.sheet[data-sheet-kind="complementary"] .feeding-milktype-row { flex-wrap: wrap; }
.sheet[data-sheet-kind="complementary"] .feeding-date-input,
.sheet[data-sheet-kind="complementary"] .feeding-note-input { box-sizing: border-box; min-width: 0; }

.feeding-picker-overlay.feeding-picker-dialog {
  inset: 0 0 var(--feeding-picker-keyboard-gap, 0px);
  max-width: none; margin: 0; padding: 16px 0 0; box-sizing: border-box;
  align-items: center; justify-content: flex-end;
  background: var(--backdrop); transform: none;
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .2s ease, visibility .2s;
}
.feeding-picker-overlay.feeding-picker-dialog.open {
  transform: none; opacity: 1; visibility: visible; pointer-events: auto;
}
.feeding-picker-panel {
  display: flex; flex-direction: column; width: min(100%, 560px);
  max-height: min(78vh, calc(var(--feeding-picker-visible-height, 100dvh) - 24px));
  min-height: 0; overflow: hidden; box-sizing: border-box;
  border: 1px solid var(--border); border-bottom: 0;
  border-radius: 24px 24px 0 0; background: var(--surface);
}
.feeding-picker-panel .feeding-picker-ov-header { background: var(--surface); padding: 16px; }
.feeding-picker-panel .feeding-picker-ov-back,
.feeding-picker-panel .feeding-picker-help-btn { width: 36px; height: 36px; flex: 0 0 36px; }
.feeding-picker-panel .feeding-picker-ov-search { margin: 0 16px 8px; border: 1px solid var(--border); border-radius: 14px; padding: 10px 12px; }
.feeding-picker-panel .feeding-picker-search { min-width: 0; width: 100%; font-size: 16px; }
.feeding-picker-panel .feeding-picker-ov-list { min-height: 0; overscroll-behavior: contain; padding-bottom: max(20px, env(safe-area-inset-bottom)); }
.feeding-picker-panel .feeding-picker-item { min-height: 48px; }
.feeding-picker-panel .feeding-picker-item > span:not(.feeding-picker-item-img-placeholder) { min-width: 0; overflow-wrap: anywhere; }

.feeding-sum-filter-btn { border-width: 2px; min-height: 82px; }
.feeding-sum-filter-btn.active,
.feeding-sum-filter-btn[aria-pressed="true"] { background: var(--primary-soft); border-color: var(--primary); }
.feeding-sum-filter-btn.active .feeding-sum-filter-label,
.feeding-sum-filter-btn.active .feeding-sum-filter-count { color: var(--primary); font-weight: 700; }
.feeding-sum-filter-btn:focus-visible,
.feeding-guide-back:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
.feeding-overlay.is-guide .feeding-overlay-cta { display: none; }
.feeding-overlay.is-guide .feeding-body { padding-bottom: calc(var(--app-nav-bottom-extra) + 80px); }
.feeding-guide-page { padding: 20px 16px 24px; }
.feeding-guide-title { margin: 0 0 10px; color: var(--text); font-size: 22px; line-height: 1.25; overflow-wrap: anywhere; }
.feeding-guide-subtitle { margin: 0 0 20px; color: var(--text-muted); font-size: 14px; line-height: 1.5; }
.feeding-guide-back { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; margin: 0 0 16px; padding: 0; border: 0; background: transparent; color: var(--primary); font: inherit; font-size: 14px; text-align: left; }
.feeding-guide-back svg { flex: 0 0 20px; width: 20px; height: 20px; }
.feeding-guide-article .wiki-article-text { font-size: 15px; line-height: 1.65; overflow-wrap: anywhere; }
@media (min-width: 600px) {
  .feeding-picker-overlay.feeding-picker-dialog { padding: 24px; justify-content: center; }
  .feeding-picker-panel { border-bottom: 1px solid var(--border); border-radius: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  .feeding-picker-overlay.feeding-picker-dialog { transition: none; }
}


/* Measurement history: compact rows, 44px touch actions, shared Lunora tokens. */
.growth-measurement-history {padding:20px;margin-top:16px;min-width:0;}
.growth-history-heading {display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:8px;}
.growth-history-heading h2 {font-size:18px;line-height:1.35;margin:0;color:var(--text);}
.growth-history-heading > span {color:var(--text-muted);font-size:13px;}
.growth-history-list {list-style:none;padding:0;margin:0;}
.growth-history-row {display:flex;align-items:center;gap:12px;padding:16px 0;border-bottom:1px solid var(--border,#eceaf4);}
.growth-history-row:last-child {border-bottom:0;}
.growth-history-content {flex:1;min-width:0;}
.growth-history-content time {display:block;font-size:14px;font-weight:600;color:var(--text);margin-bottom:8px;}
.growth-history-values {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px 18px;}
.growth-history-metric {display:flex;flex-wrap:wrap;align-items:baseline;gap:3px 8px;font-size:13px;line-height:1.45;}
.growth-history-metric > span {color:var(--text-muted);}
.growth-history-metric strong {font-weight:500;color:var(--text);font-variant-numeric:tabular-nums;}
.growth-history-edit {flex:0 0 44px;width:44px;height:44px;display:grid;place-items:center;border:0;border-radius:14px;background:var(--primary-soft);color:var(--primary);cursor:pointer;}
.growth-history-edit:focus-visible,.growth-history-load-error button:focus-visible {outline:2px solid var(--primary);outline-offset:3px;}
.growth-history-empty,.growth-edit-help {font-size:13px;line-height:1.5;color:var(--text-muted);}
.growth-history-more {margin-top:12px;}
.growth-history-load-error {display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:8px;padding:10px 0;font-size:13px;color:var(--text-muted);}
.growth-history-load-error button {border:0;background:transparent;color:var(--primary);padding:8px 0;font:inherit;cursor:pointer;}
.growth-edit-form {display:grid;gap:16px;min-width:0;padding-bottom:max(8px,env(safe-area-inset-bottom));}
.growth-edit-grid {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px 12px;}
.growth-edit-field {display:grid;gap:8px;min-width:0;}
.growth-edit-field > span {font-size:13px;font-weight:500;line-height:1.4;color:var(--text-muted);}
.growth-edit-unit {font-weight:400;white-space:nowrap;}
.growth-edit-field .field-input {margin:0;width:100%;min-width:0;box-sizing:border-box;}
.growth-edit-help,.growth-edit-notice {margin:0;}
.growth-edit-notice {font-size:13px;line-height:1.5;color:var(--text-muted);overflow-wrap:anywhere;}
.growth-edit-notice:empty {display:none;}
.growth-edit-delete {justify-self:center;min-height:44px;padding:8px 12px;border:0;background:transparent;color:var(--danger,#bc5365);font:inherit;font-size:14px;cursor:pointer;}
.growth-delete-confirm {padding:16px;border-radius:16px;background:var(--bg);border:1px solid var(--border,#eceaf4);}
.growth-delete-confirm p {margin:0 0 12px;color:var(--text);font-size:14px;line-height:1.5;}
.growth-delete-confirm > div {display:grid;grid-template-columns:1fr 1fr;gap:10px;}
.growth-delete-confirm-button {background:var(--danger,#bc5365);color:#fff;}
.growth-edit-form [hidden] {display:none!important;}
@media(max-width:360px) {.growth-measurement-history {padding:16px;}.growth-edit-grid,.growth-history-values {grid-template-columns:1fr;}}

/* Three workspaces share one data set; the journal is never period-filtered. */
.growth-workspace-tabs {position:sticky;top:-12px;z-index:2;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:4px;padding:5px;margin:0 0 16px;background:var(--surface);border:1px solid var(--border);border-radius:16px;}
.growth-workspace-tabs button {min-width:0;min-height:44px;padding:8px 6px;border:0;border-radius:12px;background:transparent;color:var(--text-muted);font:inherit;font-size:14px;font-weight:500;cursor:pointer;}
.growth-workspace-tabs button.active {color:var(--primary);background:var(--primary-soft);}
.growth-workspace-tabs button:focus-visible {outline:2px solid var(--primary);outline-offset:1px;}
.growth-overlay-body > [role="tabpanel"][hidden] {display:none!important;}
.growth-add-card {padding:20px;margin:0;}
.growth-add-heading {display:grid;gap:6px;}
.growth-add-heading h2 {font-size:18px;line-height:1.35;margin:0;}
.growth-add-heading > span {color:var(--text-muted);font-size:13px;}
#growthJournalPane .growth-measurement-history {margin-top:0;}
.growth-chart-toolbar {position:relative;display:flex;align-items:center;gap:14px;margin-bottom:16px;}
.growth-chart-toolbar > label {color:var(--text-muted);font-size:14px;}
.growth-chart-toolbar select {flex:1;min-width:0;min-height:44px;padding-right:38px;}
.growth-chart-toolbar::after {position:absolute;right:17px;top:16px;content:'';width:7px;height:7px;border-right:1.8px solid var(--text-muted);border-bottom:1.8px solid var(--text-muted);transform:rotate(45deg);pointer-events:none;}
.growth-chart-grid {display:grid;grid-template-columns:minmax(0,1fr);gap:16px;}
.growth-chart-card {margin:0;padding:20px 14px 16px;min-width:0;overflow:hidden;}
.growth-chart-card > header {display:flex;align-items:baseline;justify-content:space-between;gap:12px;padding:0 6px 12px;}
.growth-chart-card h2 {font-size:15px;font-weight:600;line-height:1.4;margin:0;}
.growth-chart-summary {color:var(--text);font-size:18px;font-weight:600;font-variant-numeric:tabular-nums;white-space:nowrap;}
.growth-chart-card canvas {display:block;width:100%;height:264px;touch-action:pan-y;}
.growth-chart-caption {margin:8px 6px 0;color:var(--text-muted);font-size:12px;line-height:1.5;}
@media(min-width:768px) {.growth-chart-card canvas {height:300px;}}

/* Product search follows the same 16 px content grid as the picker list. */
.feeding-picker-panel .feeding-picker-ov-search {
  margin: 0 16px 12px;
  min-height: 48px;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md, 14px);
  background: #fff;
  color: var(--text-muted);
  box-shadow: var(--shadow-sm);
}
.feeding-picker-panel .feeding-picker-ov-search:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.feeding-picker-panel .feeding-picker-ov-search > svg { flex: 0 0 20px; width: 20px; height: 20px; }
.feeding-picker-panel .feeding-picker-search {
  flex: 1 1 auto;
  min-width: 0;
  height: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 16px;
  line-height: 1.5;
  outline: none;
  box-shadow: none;
}
.feeding-picker-panel .feeding-picker-search::placeholder { color: var(--text-muted); opacity: 1; }
:root[data-theme="dark"] .feeding-picker-panel .feeding-picker-ov-search { background: var(--surface-2); }

/* Keep the main and contextual navigation on the same 560 px app canvas. */
:root { --app-shell-width: 560px; }
body { max-width: var(--app-shell-width); }
:is(.bottom-nav, .feeding-nav, .wiki-overlay-nav, .selfsleep-overlay-nav, .sounds-bottom-nav) {
  left: 50%;
  right: auto;
  width: 100%;
  max-width: var(--app-shell-width);
  transform: translateX(-50%);
}
body:has(:is(#selfSleepOverlay, #feedingOverlay, #growthOverlay, #wikiOverlay).open) > .bottom-nav {
  visibility: hidden;
  pointer-events: none;
}
/* The product picker header and its search field form one continuous surface. */
.feeding-picker-panel .feeding-picker-ov-header { border-bottom: 0; box-shadow: none; }

body:has(#supportTabPanel.active) > .bottom-nav { visibility: hidden; pointer-events: none; }

/* Recorded sleep/awake charts: tall, calendar-based, no estimated full days. */
#homeChartsCard { padding: 18px 16px; overflow: visible; }
#homeChartsCard .card-section-title { margin-bottom: 16px; }
#homeChartsCard .home-chart-controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: end; margin-bottom: 16px; }
#homeChartsCard .chart-periods-row { margin: 0; min-width: 0; align-self: stretch; align-items: center; border-radius: 12px; padding: 4px; }
#homeChartsCard .chart-period-btn { min-height: 36px; padding: 7px 8px; font-size: 12px; border-radius: 9px; }
#homeChartsCard .home-chart-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
#homeChartsCard .home-chart-control-label { font-size: 12px; color: var(--text-muted); padding-left: 2px; }
#homeChartsCard .home-chart-field .custom-select { width: 100%; min-width: 0; }
#homeChartsCard .home-chart-field .custom-select-btn { min-height: 46px; padding: 11px 12px; font-size: 13px; }
#homeChartsCard .home-chart-field .custom-select-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
#homeChartsCard .chart-block { position: relative; min-width: 0; padding: 16px 10px 12px; margin: 0; border: 1px solid var(--border); border-radius: 18px; }
#homeChartsCard .chart-block + .chart-block { margin-top: 16px; }
#homeChartsCard .home-chart-heading { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; padding: 0 4px 12px; }
#homeChartsCard .home-chart-name { display: flex; align-items: center; gap: 9px; min-width: 0; padding-top: 2px; font-size: 15px; font-weight: 650; color: var(--text); }
#homeChartsCard .home-chart-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 10px; color: var(--primary); background: var(--primary-soft); flex: 0 0 30px; }
#homeChartsCard [data-chart-metric="wake"] .home-chart-icon { color: var(--text); background: var(--gold-soft, var(--surface-2)); }
#homeChartsCard .home-chart-icon svg { width: 17px; height: 17px; }
#homeChartsCard .home-chart-summary { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; text-align: right; }
#homeChartsCard .home-chart-value { font-size: 22px; font-weight: 700; letter-spacing: -.4px; line-height: 1.2; color: var(--text); }
#homeChartsCard .home-chart-value-label { font-size: 10px; color: var(--text-muted); line-height: 1.4; max-width: 155px; }
#homeChartsCard .home-chart-canvas { height: 264px; width: 100%; display: block; touch-action: pan-y; }
#homeChartsCard .home-chart-empty { position: absolute; inset: 42% 28px auto 50px; margin: 0; padding: 12px; border-radius: 12px; background: var(--surface); color: var(--text-muted); font-size: 13px; line-height: 1.6; text-align: center; }
#homeChartsCard .home-chart-empty[hidden] { display: none; }
@media (min-width: 740px) { #homeChartsCard .home-chart-canvas { height: 310px; } }
@media (max-width: 480px) {
  #homeChartsCard .home-chart-controls { gap: 10px; }
  #homeChartsCard .home-chart-field .custom-select-btn { padding-inline: 10px; font-size: 12px; }
  #homeChartsCard .home-chart-field .custom-select-item { padding-inline: 10px; font-size: 12px; }
  #homeChartsCard .chart-block { padding: 14px 6px 10px; }
  #homeChartsCard .home-chart-name { font-size: 13px; gap: 6px; }
  #homeChartsCard .home-chart-heading { gap: 6px; }
  #homeChartsCard .home-chart-value { font-size: 20px; }
  #homeChartsCard .home-chart-value-label { max-width: 132px; }
}
@media (max-width: 360px) {
  #homeChartsCard .home-chart-heading { flex-direction: column; gap: 10px; }
  #homeChartsCard .home-chart-summary { align-items: flex-start; text-align: left; padding-left: 36px; }
  #homeChartsCard .home-chart-value-label { max-width: none; }
}

/* Grouping follows the chosen range; wake icon reuses the journal source. */
#homeChartsCard .home-chart-field .custom-select-item:disabled { color: var(--text-muted); opacity: .45; cursor: not-allowed; }
#homeChartsCard [data-chart-metric="wake"] .home-chart-icon { color: var(--gold); background: var(--gold-soft); }
#homeChartsCard [data-chart-metric="wake"] .home-chart-icon svg { width: 20px; height: 20px; }
:root[data-theme="dark"] #homeChartsCard [data-chart-metric="wake"] .home-chart-icon { color: #f0cf83; background: rgba(184, 144, 92, 0.18); }

/* Shared period/grouping controls. No permanent hints below the charts. */
#homeChartsCard .custom-select-menu { max-height: min(240px, 45dvh); overflow-y: auto; overscroll-behavior: contain; }
#homeChartsCard .custom-select-menu[hidden] { display: none; }
#homeChartsCard .custom-select.drop-up .custom-select-menu { top: auto; bottom: calc(100% + 4px); }
#homeChartsCard .custom-select-item { min-height: 44px; }
#homeChartsCard .custom-select-item:focus-visible { outline: 2px solid var(--primary); outline-offset: -3px; background: var(--primary-soft); }

/* Later component stylesheets keep the same footer inset and content reserve. */
:root body :is(.bottom-nav, .feeding-nav, .growth-nav, .wiki-overlay-nav, .selfsleep-overlay-nav, .sounds-bottom-nav, .diary-nav) { padding-bottom: var(--app-nav-bottom-padding); }
.diary-overlay .diary-body { padding-bottom: calc(var(--app-nav-bottom-extra) + 100px); }
.diary-overlay .diary-overlay-cta { bottom: calc(var(--app-nav-bottom-extra) + 74px); }

/* Sleep sounds use the same centered canvas as the shared header and footer. */
.sounds-body {
  box-sizing: border-box;
  width: 100%;
  max-width: var(--app-shell-width, 560px);
  min-width: 0;
  min-height: 0;
  align-self: center;
}
.sounds-noise-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.sounds-body :is(.noise-card, .lull-player-wrap, .lull-list) { min-width: 0; }

/* V2 palette swaps atomically with its header, cards and navigation. */
html[data-lunora-ui="2"],
html[data-lunora-ui="2"] body { transition: none; }
