/* v2.7.0 — добавлены .skeleton-плейсхолдеры для гибридного режима логина */
/* ===== RESET & VARIABLES ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  /* Modern neutral palette */
  --bg: #f8fafc;
  --bg-subtle: #f1f5f9;
  --card-bg: #ffffff;
  
  /* Primary - refined blue */
  --primary: #0f766e;
  --primary-dark: #0d5d56;
  --primary-light: #ccfbf1;
  --primary-muted: #14b8a6;
  
  /* Accent - warm amber */
  --accent: #f59e0b;
  --accent-dark: #d97706;
  --accent-light: #fef3c7;
  
  /* Text hierarchy */
  --text: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-light: #cbd5e1;
  
  /* Borders & surfaces */
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  
  /* Status colors */
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #3b82f6;
  
  /* Shadows - layered for depth */
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.08), 0 2px 4px -2px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.08), 0 8px 10px -6px rgba(0,0,0,0.04);
  
  /* Radius */
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;
  
  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Typography scale */
  --text-xs:   11px;
  --text-sm:   13px;
  --text-base: 15px;
  --text-lg:   17px;
  --text-xl:   20px;
  --text-2xl:  24px;

  /* Status semantic backgrounds & text */
  --success-bg:    #d1fae5;
  --success-text:  #065f46;
  --success-light: #a7f3d0;
  --warning-bg:    #fef3c7;
  --warning-border:#fde68a;
  --warning-text:  #92400e;
  --warning-light: #fde68a;
  --danger-bg:     #fee2e2;
  --danger-border: #fecaca;
  --danger-text:   #991b1b;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===== LAYOUT UTILITIES =====
   Минимальная утилитарная система. Визуальные стили — в компонентных классах,
   layout между компонентами — через эти утилиты. Inline style= для layout не используем. */

/* Вертикальный стек с gap между дочерними элементами */
.stack { display: flex; flex-direction: column; }
.stack > * + * { margin-top: var(--stack-gap, 12px); }
.stack-sm { --stack-gap: 8px; }
.stack-lg { --stack-gap: 20px; }

/* Горизонтальный ряд с gap */
.row { display: flex; align-items: center; gap: 12px; }
.row-sm { gap: 8px; }
.row-lg { gap: 20px; }
.row-wrap { flex-wrap: wrap; }
.row-between { justify-content: space-between; }
.row-end { justify-content: flex-end; }
.row-baseline { align-items: baseline; }
.row-top { align-items: flex-start; }

/* Сетки */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--col-min, 160px), 1fr)); gap: 12px; }

/* Видимость — без !important: JS код el.style.display='block' должен нормально перекрывать класс через inline specificity */
.hidden { display: none; }

/* ===== HEADER ===== */
.header {
  background: transparent;
  color: var(--text);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
  z-index: 100;
}

.header-white {
  background: var(--card-bg);
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  border-bottom: 1px solid var(--border-light);
}

.header-back {
  background: var(--bg-subtle);
  border: none;
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
  padding: 10px 12px;
  border-radius: var(--radius);
  display: none;
  transition: all var(--transition-fast);
}
.header-back:hover { 
  background: var(--border);
}
.header-back:active {
  transform: scale(0.95);
}
.header-back.visible { display: flex; align-items: center; justify-content: center; }

.header-title {
  font-size: 18px;
  font-weight: 600;
  flex: 1;
  letter-spacing: -0.01em;
}

.header-icon {
  width: 44px;
  height: 44px;
  background: var(--primary-light);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--primary);
  font-weight: 600;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-btn {
  width: 40px;
  height: 40px;
  background: var(--bg-subtle);
  border: none;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
}

.header-btn:hover {
  background: var(--border);
}

.header-btn .badge {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  background: var(--danger);
  border-radius: 50%;
}

/* ===== MAIN CONTENT ===== */
.main {
  flex: 1;
  max-width: 480px;
  width: 100%;
  margin: 0 auto;
  padding: 0 0 100px 0;
}

/* ===== VIEWS ===== */
.view {
  display: none;
  animation: fadeIn var(--transition-base) ease-out;
}
.view.active { display: block; }

/* ===== BOOT SPLASH (показывается до того как onAuthChange определит сессию) ===== */
#bootSplash {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  transition: opacity 280ms ease-out;
}
#bootSplash.boot-splash-hide {
  opacity: 0;
}
.boot-splash-avatar-wrap {
  position: relative;
  width: 180px;
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.boot-splash-avatar {
  position: relative;
  z-index: 2;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(15, 23, 42, 0.12);
  border: 3px solid rgba(15, 118, 110, 0.18);
  background: #fff;
}
.boot-splash-avatar .boot-splash-img,
.boot-splash-avatar video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.boot-splash-avatar .boot-splash-img {
  z-index: 1;
}
.boot-splash-avatar video {
  z-index: 2;
  opacity: 0;
  transition: opacity 250ms ease-out;
}
.boot-splash-avatar video.loaded {
  opacity: 1;
}
.boot-splash-pulse {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid rgba(15, 118, 110, 0.45);
  animation: bootSplashPulse 1.8s ease-out infinite;
  pointer-events: none;
}
@keyframes bootSplashPulse {
  0%   { transform: scale(1);    opacity: 0.7; }
  80%  { opacity: 0.05; }
  100% { transform: scale(1.55); opacity: 0; }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes voicePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.3); }
}
.mic-recording {
  background: var(--danger) !important;
  animation: voicePulse 1s infinite;
}

/* ===== CARDS ===== */
.card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  transition: box-shadow var(--transition-base);
}
.card:hover {
  box-shadow: var(--shadow-md);
}

.card-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
  letter-spacing: -0.01em;
}

.card-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 20px;
  line-height: 1.5;
}

/* ===== BUTTONS ===== */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px 20px;
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
}
.btn:active { 
  transform: scale(0.98); 
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}
.btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  box-shadow: var(--shadow-sm), 0 2px 8px rgba(15, 118, 110, 0.25);
}
.btn-primary:hover:not(:disabled) { 
  box-shadow: var(--shadow-md), 0 4px 12px rgba(15, 118, 110, 0.3);
  transform: translateY(-1px);
}
.btn-primary:active:not(:disabled) { 
  transform: translateY(0) scale(0.98);
}

.btn-accent {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  color: white;
  box-shadow: var(--shadow-sm), 0 2px 8px rgba(245, 158, 11, 0.25);
}
.btn-accent:hover:not(:disabled) { 
  box-shadow: var(--shadow-md), 0 4px 12px rgba(245, 158, 11, 0.3);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
}
.btn-outline:hover:not(:disabled) { 
  background: var(--primary-light);
  border-color: var(--primary-dark);
}
.btn-outline:active:not(:disabled) {
  background: var(--primary-light);
}

/* Q&A filter chips */
.qa-species-chip {
  background: var(--bg-subtle);
  color: var(--text-muted);
  border: 1.5px solid transparent;
  transition: all 0.2s;
  cursor: pointer;
  width: auto;
  flex: 0 0 auto;
}
.qa-species-chip.active {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
  font-weight: 600;
}
.qa-species-chip:hover:not(.active) {
  background: var(--bg-subtle);
  border-color: var(--border);
}
/* Q&A search mode cards */
.qa-mode-options {
  display: flex; flex-direction: column; gap: 8px;
}
.qa-mode-option {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius);
  border: 1.5px solid var(--border-light);
  background: var(--bg); cursor: pointer;
  transition: all 0.2s; user-select: none;
}
.qa-mode-option:hover:not(.active) { border-color: var(--border); }
.qa-mode-option.active {
  border-color: var(--primary);
  background: var(--primary-light);
}
.qa-mode-icon { font-size: 20px; flex-shrink: 0; width: 28px; text-align: center; }
.qa-mode-label { font-size: 14px; font-weight: 600; color: var(--text); }
.qa-mode-desc { font-size: 11px; color: var(--text-muted); display: block; margin-top: 1px; }

.btn-large {
  padding: 16px 24px;
  font-size: 16px;
  font-weight: 600;
  border-radius: var(--radius-lg);
}

.btn-icon {
  font-size: 20px;
}

.btn-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Pill-кнопка в шапке («+ Задать», «+ Новая» и т.п.)
   variant через .btn-pill — визуал полностью тут, layout (положение) — через .row на родителе */
.btn-pill {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.btn-pill:hover { background: var(--primary-dark); }

@keyframes pillPulse {
  0%   { box-shadow: 0 0 0 0 rgba(13,148,136,0.55); transform: scale(1); }
  60%  { box-shadow: 0 0 0 10px rgba(13,148,136,0); transform: scale(1.04); }
  100% { box-shadow: 0 0 0 0 rgba(13,148,136,0); transform: scale(1); }
}
.btn-pill-pulse { animation: pillPulse 1.6s ease-in-out infinite; }

/* ===== CHOICE BUTTONS (domain, species, etc) ===== */
.choice-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.choice-btn {
  background: var(--card-bg);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 16px;
  cursor: pointer;
  text-align: center;
  transition: all var(--transition-fast);
}
.choice-btn:hover { 
  border-color: var(--primary-muted); 
  background: var(--primary-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.choice-btn.selected { 
  border-color: var(--primary); 
  background: var(--primary-light);
  box-shadow: var(--shadow-sm), 0 0 0 3px rgba(15, 118, 110, 0.15);
}

.choice-btn .icon { 
  font-size: 36px; 
  margin-bottom: 10px; 
  display: block;
}
.choice-btn .label { 
  font-size: 15px; 
  font-weight: 600; 
  color: var(--text);
  display: block;
}
.choice-btn .desc { 
  font-size: 12px; 
  color: var(--text-secondary); 
  margin-top: 4px;
  display: block;
}

.choice-single {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.choice-row {
  background: var(--card-bg);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: all var(--transition-fast);
}
.choice-row:hover { 
  border-color: var(--primary-muted);
  background: var(--bg-subtle);
}
.choice-row.selected { 
  border-color: var(--primary); 
  background: var(--primary-light);
  box-shadow: var(--shadow-sm), 0 0 0 3px rgba(15, 118, 110, 0.15);
}
.choice-row .icon {
  font-size: 24px;
  width: 32px;
  text-align: center;
}
.choice-row .icon.has-photo {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  overflow: hidden;
  flex-shrink: 0;
  background: var(--surface-muted, #f3f4f6);
}
.choice-row .icon.has-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.choice-row .label { 
  font-size: 15px; 
  font-weight: 500; 
}

/* ===== IMAGE FULLSCREEN ===== */
.img-fullscreen-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,0.92); display: flex;
  align-items: center; justify-content: center;
  animation: chatFadeIn 0.2s ease-out; cursor: zoom-out;
}
.img-fullscreen-overlay img {
  max-width: 95vw; max-height: 90vh; object-fit: contain;
  border-radius: 8px; user-select: none;
  transform-origin: center; transition: transform 0.2s;
}
.img-fullscreen-close {
  position: absolute; top: 16px; right: 16px;
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(255,255,255,0.15); border: none;
  color: white; font-size: 24px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.img-fullscreen-close:hover { background: rgba(255,255,255,0.3); }

/* ===== BELL & NOTIFICATION CENTER ===== */
@keyframes bellShake {
  0% { transform: rotate(0); }
  15% { transform: rotate(14deg); }
  30% { transform: rotate(-14deg); }
  45% { transform: rotate(10deg); }
  60% { transform: rotate(-8deg); }
  75% { transform: rotate(4deg); }
  85% { transform: rotate(-2deg); }
  100% { transform: rotate(0); }
}
.bell-shaking { animation: bellShake 0.8s ease-in-out; animation-iteration-count: 3; }
.bell-badge {
  position: absolute; top: 4px; right: 4px;
  min-width: 18px; height: 18px; padding: 0 5px;
  background: #ef4444; color: white; font-size: 11px; font-weight: 700;
  border-radius: 9px; display: none; align-items: center; justify-content: center;
  line-height: 1; box-shadow: 0 1px 3px rgba(239,68,68,0.4);
}
.bell-badge.visible { display: flex; }

.notif-overlay { position: fixed; inset: 0; z-index: 500; background: rgba(0,0,0,0.3); animation: chatFadeIn 0.15s; }
.notif-panel {
  position: fixed; top: 0; right: 0; width: 100%; max-width: 400px; height: 100vh;
  background: var(--card-bg); z-index: 501; box-shadow: -4px 0 20px rgba(0,0,0,0.1);
  display: flex; flex-direction: column; animation: notifSlideIn 0.25s ease-out;
}
@keyframes notifSlideIn { from { transform: translateX(100%); } to { transform: translateX(0); } }
.notif-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border-light); flex-shrink: 0;
}
.notif-header h3 { font-size: 18px; font-weight: 600; }
.notif-header-actions { display: flex; gap: 8px; align-items: center; }
.notif-mark-all {
  font-size: 13px; color: var(--primary); background: none; border: none;
  cursor: pointer; font-weight: 500; padding: 4px 8px; border-radius: 6px;
}
.notif-mark-all:hover { background: var(--primary-light); }
.notif-close {
  width: 32px; height: 32px; border: none; background: none;
  font-size: 20px; color: var(--text-muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center; border-radius: 8px;
}
.notif-close:hover { background: var(--bg-subtle); }

.notif-list { flex: 1; overflow-y: auto; }
.notif-item-wrap {
  position: relative; overflow: hidden;
  border-bottom: 1px solid var(--border-light);
  max-height: 200px;
}
.notif-item-bg, .notif-item-bg-right {
  position: absolute; top: 0; right: 0; bottom: 0; width: 80px;
  background: #ef4444; display: flex; align-items: center; justify-content: center;
  color: white; font-size: 13px; font-weight: 600;
}
.notif-item-bg-left {
  position: absolute; top: 0; left: 0; bottom: 0; width: 80px;
  background: #10b981; display: flex; align-items: center; justify-content: center;
  color: white; font-size: 12px; font-weight: 600; text-align: center; line-height: 1.3;
  white-space: pre-line;
}
.notif-item {
  position: relative; display: flex; gap: 12px; padding: 14px 20px;
  cursor: pointer; background: var(--card-bg);
  transition: transform 0.2s ease-out, background 0.1s;
  touch-action: pan-y; align-items: flex-start;
}
.notif-item:hover { background: var(--bg-subtle); }
.notif-item.unread { background: #f0fdf4; }
.notif-item.unread:hover { background: #dcfce7; }
.notif-item.swiping { transition: none; }
.notif-sel-check {
  flex-shrink: 0;
  margin-top: 4px;
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--primary);
  display: none; /* скрыт по умолчанию, показывается в режиме «Выбрать» */
}
/* Когда select-bar активен, показываем чекбоксы у всех элементов */
.notif-panel.selecting .notif-sel-check { display: inline-block; }

@keyframes notifSlideOut { to { transform: translateX(-100%); opacity: 0; } }
@keyframes notifSlideOutLeft { to { transform: translateX(100%); opacity: 0; } }

.notif-item-wrap.removing,
.notif-item-wrap.removing-right {
  animation: notifSlideOut 0.25s ease-in forwards;
  max-height: 80px; overflow: hidden;
}
.notif-item-wrap.removing-left {
  animation: notifSlideOutLeft 0.25s ease-in forwards;
  max-height: 80px; overflow: hidden;
}
.notif-item-wrap.removing-collapse {
  max-height: 0 !important; transition: max-height 0.2s ease-out;
  border-bottom: none;
}

.notif-select-bar {
  display: none; align-items: center; gap: 8px;
  padding: 8px 20px; border-bottom: 1px solid var(--border-light);
  background: var(--bg-subtle); flex-shrink: 0;
}
.notif-select-bar.visible { display: flex; }
.notif-select-bar label {
  font-size: 13px; display: flex; align-items: center; gap: 6px;
  cursor: pointer; flex: 1;
}
.notif-del-sel {
  font-size: 13px; color: #ef4444; background: none;
  border: 1px solid #fca5a5; padding: 4px 10px; border-radius: 6px;
  cursor: pointer; white-space: nowrap;
}
.notif-del-sel:hover { background: #fff5f5; }
.notif-del-sel:disabled { opacity: 0.5; cursor: default; }
.notif-icon {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.notif-icon.doctor_message { background: var(--primary-light); }
.notif-icon.session_status { background: #dbeafe; }
.notif-icon.reminder { background: var(--accent-light); }
.notif-icon.news { background: #f3e8ff; }
.notif-body { flex: 1; min-width: 0; }
.notif-title { font-size: 14px; font-weight: 500; color: var(--text); }
.notif-item.unread .notif-title { font-weight: 700; }
.notif-text { font-size: 12px; color: var(--text-muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notif-time { font-size: 11px; color: var(--text-muted); flex-shrink: 0; white-space: nowrap; }
.notif-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 60px 20px; color: var(--text-muted);
}
.notif-empty-icon { font-size: 48px; opacity: 0.3; margin-bottom: 12px; }

/* ===== TOGGLE SWITCH ===== */
.notif-toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0; border-bottom: 1px solid var(--border-light);
}
.notif-toggle-row:last-child { border-bottom: none; }
.notif-toggle-info { flex: 1; min-width: 0; }
.notif-toggle-label { font-size: 14px; font-weight: 500; color: var(--text); }
.notif-toggle-desc { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.notif-sub-options {
  display: flex;
  gap: 16px;
  padding: 4px 0 10px 16px;
  border-bottom: 1px solid var(--border-light);
}
.notif-sub-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
}
.notif-sub-row input[type=checkbox] {
  width: 14px;
  height: 14px;
  accent-color: var(--primary);
}
.notif-vibrate-select {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 2px 6px;
  cursor: pointer;
  outline: none;
  cursor: pointer;
}
.toggle-switch {
  position: relative; width: 44px; height: 24px; flex-shrink: 0; cursor: pointer;
}
.toggle-switch input { display: none; }
.toggle-track {
  position: absolute; inset: 0; background: #cbd5e1; border-radius: 12px;
  transition: background 0.2s;
}
.toggle-switch input:checked + .toggle-track { background: var(--primary); }
.toggle-knob {
  position: absolute; top: 2px; left: 2px; width: 20px; height: 20px;
  background: white; border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  transition: transform 0.2s;
}
.toggle-switch input:checked ~ .toggle-knob { transform: translateX(20px); }

/* ===== WIZARD STEPS ===== */
@keyframes stepSlideIn {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
.step-card {
  background: var(--card-bg); border-radius: var(--radius-lg);
  padding: 20px; margin-bottom: 14px;
  box-shadow: var(--shadow-sm); border: 1px solid var(--border-light);
  animation: stepSlideIn 0.3s ease-out;
}
.step-card.locked {
  opacity: 0.4; pointer-events: none;
}
.step-header {
  display: flex; align-items: center; gap: 12px; margin-bottom: 14px;
}
.step-number {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--primary); color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700; flex-shrink: 0;
}
.step-number.done {
  background: var(--success);
}
.step-title {
  font-size: 16px; font-weight: 600; color: var(--text);
}
.step-summary {
  display: none; font-size: 13px; color: var(--text-secondary);
  margin-left: 44px; margin-top: -8px; margin-bottom: 4px;
}
.step-card.completed .step-body { display: none; }
.step-card.completed .step-summary { display: block; }
.step-card.completed { cursor: pointer; }
.step-card.completed:hover { box-shadow: var(--shadow-md); }

/* ===== SLOT PICKER ===== */
.slot-day-btn {
  flex-shrink: 0; display: flex; flex-direction: column; align-items: center;
  padding: 8px 12px; border-radius: var(--radius); border: 2px solid var(--border);
  background: var(--card-bg); cursor: pointer; transition: all 0.15s; min-width: 52px;
  user-select: none;
}
.slot-day-btn .day-weekday { font-size: 11px; color: var(--text-muted); font-weight: 500; text-transform: uppercase; }
.slot-day-btn .day-num { font-size: 20px; font-weight: 700; color: var(--text); line-height: 1.2; }
.slot-day-btn .day-month { font-size: 11px; color: var(--text-muted); }
.slot-day-btn.active { border-color: var(--primary); background: var(--primary-light); }
.slot-day-btn.active .day-weekday, .slot-day-btn.active .day-month { color: var(--primary); }
.slot-day-btn.active .day-num { color: var(--primary); }
.slot-day-btn.blocked { opacity: 0.35; pointer-events: none; }
.slot-day-btn.no-slots { opacity: 0.45; }
.slot-time-btn {
  padding: 10px 4px; border-radius: var(--radius); border: 2px solid var(--border);
  background: var(--card-bg); cursor: pointer; transition: all 0.15s;
  font-size: 14px; font-weight: 600; color: var(--text); text-align: center;
  user-select: none;
}
.slot-time-btn:hover:not(.booked):not(:disabled) { border-color: var(--primary); background: var(--primary-light); }
.slot-time-btn.selected { border-color: var(--primary); background: var(--primary); color: white; }
.slot-time-btn.booked { opacity: 0.35; cursor: default; text-decoration: line-through; color: var(--text-muted); }

/* ===== FORM ===== */
.form-group {
  margin-bottom: 18px;
}
.form-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.form-input, .form-select {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 16px;
  color: var(--text);
  background: white;
  transition: all var(--transition-fast);
}
.form-input:focus, .form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}
.form-input::placeholder { 
  color: var(--text-muted); 
}
.form-input:hover:not(:focus), .form-select:hover:not(:focus) {
  border-color: var(--text-muted);
}
/* Password requirements checklist */
.pwd-requirements {
  margin: 8px 0 4px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.pwd-req {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--text-muted);
  transition: color 0.2s;
}
.pwd-req.met { color: #16a34a; }
.pwd-req-icon { font-size: 14px; line-height: 1; flex-shrink: 0; }
.pwd-confirm-hint {
  font-size: 12px;
  margin-top: 5px;
  min-height: 16px;
  transition: color 0.2s;
}
.pwd-confirm-hint.ok  { color: #16a34a; }
.pwd-confirm-hint.err { color: var(--danger); }

.form-input:disabled, .form-select:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  background: var(--bg-subtle);
  border-color: var(--border);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

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

/* ===== UPLOAD ===== */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  background: var(--bg-subtle);
}
.upload-area:hover { 
  border-color: var(--primary-muted); 
  background: var(--primary-light);
}
.upload-area .icon { 
  font-size: 56px; 
  margin-bottom: 16px;
  display: block;
}
.upload-area .text { 
  font-size: 15px; 
  color: var(--text-secondary);
  font-weight: 500;
}
.upload-area .formats { 
  font-size: 13px; 
  color: var(--text-muted); 
  margin-top: 8px;
}

.upload-preview {
  display: none;
  margin-top: 16px;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}
.upload-preview img {
  max-width: 100%;
  max-height: 300px;
  display: block;
  margin: 0 auto;
}
.upload-preview .pdf-badge {
  background: linear-gradient(135deg, var(--danger) 0%, #dc2626 100%);
  color: white;
  padding: 16px 24px;
  text-align: center;
  font-size: 15px;
  font-weight: 500;
}

/* ===== PARAMS TABLE (review) ===== */
.param-item.ocr-filled {
  background: rgba(15, 118, 110, 0.06);
  border-radius: var(--radius);
  padding: 8px;
  margin: -8px;
  margin-bottom: 4px;
  border-left: 3px solid var(--primary);
}

/* ===== RESULTS ===== */
.result-section {
  margin-bottom: 20px;
}
.result-section-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.result-text {
  font-size: 15px;
  line-height: 1.7;
  color: var(--text);
}
.result-text p {
  margin-bottom: 10px;
}
.result-text p:last-child {
  margin-bottom: 0;
}
.result-text h2 {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  margin: 16px 0 8px;
}
.result-text h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin: 12px 0 6px;
}
.result-text strong {
  font-weight: 600;
  color: var(--text);
}
.result-text em {
  font-style: italic;
}
/* ===== ALERT BLOCKS ===== */
.alert {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  line-height: 1.5;
  margin-bottom: 12px;
}
.alert-warning {
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
  color: var(--warning-text);
}
.alert-danger {
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  color: var(--danger-text);
}
.alert-info {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e40af;
}
.alert-success {
  background: var(--success-bg);
  border: 1px solid #6ee7b7;
  color: var(--success-text);
}

.result-disclaimer {
  margin-top: 20px;
  padding: 12px 14px;
  background: #f8f4e8;
  border-left: 3px solid #c9a227;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.6;
  color: #6b5c2e;
}
.result-disclaimer-title {
  font-weight: 600;
  margin-bottom: 4px;
  color: #5a4c20;
}
.result-text ul, .result-text ol {
  margin: 8px 0;
  padding-left: 20px;
}
.result-text li {
  margin-bottom: 4px;
}

.result-params {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.result-param-tag {
  background: var(--primary-light);
  color: var(--primary-dark);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid rgba(15, 118, 110, 0.2);
}
/* Цвет чипа по статусу параметра: норма — зелёный, отклонение — жёлтый, критично — красный */
.result-param-tag.is-normal {
  background: #bbf7d0;
  color: #166534;
  border-color: rgba(22, 163, 74, 0.5);
}
.result-param-tag.is-warn {
  background: #fde68a;
  color: #854d0e;
  border-color: rgba(202, 138, 4, 0.55);
  font-weight: 600;
}
.result-param-tag.is-crit {
  background: #fecaca;
  color: #991b1b;
  border-color: rgba(220, 38, 38, 0.55);
  font-weight: 700;
}
.result-param-tag.is-unknown {
  background: #e2e8f0;
  color: #475569;
  border-color: rgba(100, 116, 139, 0.35);
}

/* ===== LOADING ===== */
.loading-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(255,255,255,0.97);
  backdrop-filter: blur(6px);
  z-index: 200;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.loading-overlay.active { display: flex; opacity: 1; }

/* Fizzy Loading Animation */
.fizzy-container {
  position: relative;
  width: 120px;
  height: 120px;
}
.fizzy-center {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent, #6366f1));
  box-shadow: 0 0 30px rgba(37, 99, 235, 0.3), 0 0 60px rgba(37, 99, 235, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fizzy-pulse 1.8s ease-in-out infinite;
}
.fizzy-icon {
  width: 72px; height: 72px;
  border-radius: 18px;
  overflow: hidden;
  animation: fizzy-icon-bob 1.8s ease-in-out infinite;
}
.fizzy-icon img {
  width: 100%; height: 100%; object-fit: cover;
}
.fizzy-check {
  position: absolute;
  font-size: 32px;
  color: white;
  font-weight: bold;
  transform: scale(0);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.loading-overlay.fizzy-done .fizzy-check {
  transform: scale(1);
}
.loading-overlay.fizzy-done .fizzy-icon {
  display: none;
}
.loading-overlay.fizzy-done .fizzy-center {
  animation: none;
  background: linear-gradient(135deg, #10b981, #059669);
  box-shadow: 0 0 30px rgba(16, 185, 129, 0.4);
}
.loading-overlay.fizzy-done .fizzy-p {
  animation-play-state: paused;
  opacity: 0 !important;
  transition: opacity 0.3s;
}
.fizzy-particles {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
}
.fizzy-p {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  top: 50%; left: 50%;
  margin: -4px 0 0 -4px;
  opacity: 0;
  animation: fizzy-orbit 2.4s ease-in-out infinite;
  animation-delay: calc(var(--i) * -0.12s);
}
/* Particle colors — cycling through vibrant palette */
.fizzy-p:nth-child(5n+1) { background: #3b82f6; width: 7px; height: 7px; }
.fizzy-p:nth-child(5n+2) { background: #8b5cf6; width: 9px; height: 9px; }
.fizzy-p:nth-child(5n+3) { background: #ec4899; width: 6px; height: 6px; }
.fizzy-p:nth-child(5n+4) { background: #06b6d4; width: 8px; height: 8px; }
.fizzy-p:nth-child(5n+5) { background: #f59e0b; width: 7px; height: 7px; }
/* Unique orbit paths via --i */
.fizzy-p:nth-child(1)  { --ox: -48px; --oy: -20px; }
.fizzy-p:nth-child(2)  { --ox: -30px; --oy: -45px; }
.fizzy-p:nth-child(3)  { --ox: 0px;   --oy: -52px; }
.fizzy-p:nth-child(4)  { --ox: 30px;  --oy: -45px; }
.fizzy-p:nth-child(5)  { --ox: 48px;  --oy: -20px; }
.fizzy-p:nth-child(6)  { --ox: 52px;  --oy: 10px; }
.fizzy-p:nth-child(7)  { --ox: 40px;  --oy: 38px; }
.fizzy-p:nth-child(8)  { --ox: 15px;  --oy: 50px; }
.fizzy-p:nth-child(9)  { --ox: -15px; --oy: 50px; }
.fizzy-p:nth-child(10) { --ox: -40px; --oy: 38px; }
.fizzy-p:nth-child(11) { --ox: -52px; --oy: 10px; }
.fizzy-p:nth-child(12) { --ox: -55px; --oy: -8px; }
.fizzy-p:nth-child(13) { --ox: -38px; --oy: -48px; }
.fizzy-p:nth-child(14) { --ox: -8px;  --oy: -55px; }
.fizzy-p:nth-child(15) { --ox: 22px;  --oy: -50px; }
.fizzy-p:nth-child(16) { --ox: 50px;  --oy: -28px; }
.fizzy-p:nth-child(17) { --ox: 55px;  --oy: 5px; }
.fizzy-p:nth-child(18) { --ox: 42px;  --oy: 42px; }
.fizzy-p:nth-child(19) { --ox: 5px;   --oy: 55px; }
.fizzy-p:nth-child(20) { --ox: -35px; --oy: 45px; }

@keyframes fizzy-pulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-50%, -50%) scale(1.08); }
}
@keyframes fizzy-icon-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}
@keyframes fizzy-orbit {
  0% {
    transform: translate(0, 0) scale(0);
    opacity: 0;
  }
  15% {
    opacity: 0.9;
    transform: translate(calc(var(--ox) * 0.5), calc(var(--oy) * 0.5)) scale(1);
  }
  50% {
    opacity: 0.7;
    transform: translate(var(--ox), var(--oy)) scale(0.8);
  }
  85% {
    opacity: 0.3;
    transform: translate(calc(var(--ox) * 0.6), calc(var(--oy) * 0.6)) scale(0.4);
  }
  100% {
    transform: translate(0, 0) scale(0);
    opacity: 0;
  }
}
.loading-text {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.01em;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes dqPulse { 0%,100% { opacity:0.3; } 50% { opacity:1; } }
.mq-chip { padding:6px 14px;border-radius:20px;border:1px solid var(--border-light);background:var(--card-bg);font-size:13px;color:var(--text-secondary);cursor:pointer;transition:all .2s;white-space:nowrap; }
.mq-chip-active { background:var(--primary);color:white;border-color:var(--primary); }
.mq-confirm-overlay { position:fixed;inset:0;background:rgba(0,0,0,0.45);z-index:9999;display:flex;align-items:center;justify-content:center;padding:20px; }
.mq-confirm-box { background:var(--card-bg);border-radius:16px;padding:24px;max-width:320px;width:100%;text-align:center;box-shadow:0 8px 32px rgba(0,0,0,0.2); }
@keyframes mqUnreadPulse {
  0% { box-shadow: inset 0 0 0 0 rgba(245,158,11,0.35); }
  50% { box-shadow: inset 0 0 20px 8px rgba(245,158,11,0.10); }
  100% { box-shadow: inset 0 0 0 0 rgba(245,158,11,0.35); }
}
.mq-card-unread { animation: mqUnreadPulse 2.5s ease-in-out infinite; border-color: #fbbf24 !important; }
@keyframes doctorRipple {
  0% { box-shadow: 0 0 0 0 rgba(16,185,129,0.45); }
  70% { box-shadow: 0 0 0 10px rgba(16,185,129,0); }
  100% { box-shadow: 0 0 0 0 rgba(16,185,129,0); }
}
.nav-item.has-unread .nav-icon { animation: doctorRipple 2s ease-out infinite; border-radius: 50%; }

.loading-text {
  font-size: 16px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ===== Q&A ===== */
.qa-result {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 12px;
  transition: all var(--transition-fast);
}
.qa-result:hover {
  box-shadow: var(--shadow-sm);
  border-color: var(--primary-muted);
}
.qa-question { 
  font-size: 15px; 
  font-weight: 600; 
  margin-bottom: 8px;
  color: var(--text);
}
.qa-answer { 
  font-size: 14px; 
  color: var(--text-secondary); 
  line-height: 1.6; 
}
.qa-category {
  display: inline-block;
  background: var(--primary-light);
  color: var(--primary);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 8px;
}

/* ===== ERROR TOAST ===== */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, var(--danger) 0%, #dc2626 100%);
  color: white;
  padding: 14px 28px;
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 500;
  z-index: 300;
  box-shadow: var(--shadow-lg), 0 4px 12px rgba(239, 68, 68, 0.3);
  display: none;
  max-width: 90%;
  text-align: center;
}
.toast.visible { 
  display: block; 
  animation: toastIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); 
}
@keyframes toastIn { 
  from { 
    opacity: 0; 
    transform: translateX(-50%) translateY(20px) scale(0.9); 
  } 
  to { 
    opacity: 1; 
    transform: translateX(-50%) translateY(0) scale(1); 
  } 
}

/* ===== FOOTER LINK ===== */
.footer-link {
  text-align: center;
  margin-top: 20px;
}
.footer-link a {
  color: var(--primary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: color var(--transition-fast);
}
.footer-link a:hover { 
  color: var(--primary-dark);
  text-decoration: underline; 
}

/* ===== STEP INDICATOR ===== */
.steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 24px;
}
.step-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border);
  transition: all var(--transition-base);
}
.step-dot.active { 
  background: var(--primary); 
  width: 28px; 
  border-radius: 6px; 
}
.step-dot.done { 
  background: var(--success); 
}

/* ===== BOTTOM NAVIGATION ===== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--card-bg);
  display: flex;
  justify-content: space-around;
  padding: 8px 0 max(8px, env(safe-area-inset-bottom));
  z-index: 100;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px 4px;
  cursor: pointer;
  transition: all var(--transition-fast);
  border-radius: var(--radius-sm);
  min-width: 0;
  flex: 1;
  position: relative;
  background: none;
  border: none;
  color: var(--text-muted);
}

.nav-item:hover {
  background: var(--bg-subtle);
}

.nav-item.active {
  color: var(--primary);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 3px;
  background: var(--primary);
  border-radius: 0 0 3px 3px;
}

.nav-icon {
  font-size: 20px;
  margin-bottom: 2px;
  transition: transform var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.nav-item.active .nav-icon {
  transform: scale(1.1);
}

.nav-item:active .nav-icon {
  transform: scale(0.95);
}

.nav-label {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* Hide bottom nav on certain views */
.bottom-nav.hidden {
  display: none;
}

/* Hide header back button in tab views */
.header-back.tab-view {
  display: none !important;
}

/* ===== COMPACT CONTEXT BAR ===== */
.context-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.context-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 2px solid var(--border);
  background: var(--card-bg);
  color: var(--text-secondary);
  white-space: nowrap;
}
.context-chip:hover {
  border-color: var(--primary-muted);
  background: var(--bg-subtle);
}
.context-chip.active {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary-dark);
}
.context-chip .chip-icon {
  font-size: 16px;
}

/* Context chip group */
.context-group {
  margin-bottom: 16px;
}
.context-group-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}

/* Analysis pet selection */
.analysis-pet-list {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 4px 0;
  scrollbar-width: none;
}
.analysis-pet-list::-webkit-scrollbar { display: none; }
.analysis-pet-card {
  flex: 0 0 auto;
  min-width: 130px;
  background: var(--card-bg);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: center;
}
.analysis-pet-card:hover { border-color: var(--primary-muted); }
.analysis-pet-card.selected {
  border-color: var(--primary);
  background: var(--primary-light);
}
.analysis-pet-card-avatar {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-full);
  font-size: 28px;
  line-height: 1;
  margin: 0 auto 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--surface-muted, #f3f4f6);
}
.analysis-pet-card-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.analysis-pet-card-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.analysis-pet-card-info {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}
.analysis-pet-manual-btn {
  margin-top: 8px;
  font-size: 13px;
  color: var(--primary);
  cursor: pointer;
  font-weight: 500;
  padding: 6px 0;
}
.analysis-pet-manual-btn:hover { text-decoration: underline; }
.analysis-pet-selected-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--primary-light);
  color: var(--primary-dark);
  border-radius: var(--radius-full);
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
}

/* Dosage Calculator - Drug Carousel */
.dos-drug-carousel {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding: 4px 0 8px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.dos-drug-carousel::-webkit-scrollbar { display: none; }
.dos-drug-card {
  flex: 0 0 auto;
  width: 110px;
  text-align: center;
  cursor: pointer;
  padding: 12px 8px;
  border-radius: var(--radius);
  border: 2px solid var(--border);
  background: var(--card-bg);
  scroll-snap-align: start;
  transition: border-color var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
}
.dos-drug-card:hover { border-color: var(--primary-muted); transform: translateY(-2px); }
.dos-drug-card.selected { border-color: var(--primary); background: var(--primary-light); box-shadow: 0 2px 8px rgba(15,118,110,0.15); }
.dos-drug-card-img {
  width: 56px;
  height: 56px;
  margin: 0 auto 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.dos-drug-card-img img { width: 100%; height: 100%; object-fit: cover; border-radius: var(--radius-sm); }
.dos-drug-card-img svg { width: 40px; height: 40px; }
.dos-drug-card-name { font-size: 12px; font-weight: 600; line-height: 1.3; color: var(--text); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; }
.dos-drug-card-mg { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* Dosage Calculator - Preview carousel (below pet block) */
.dos-preview-wrap {
  margin-top: 16px;
}
.dos-preview-carousel {
  overflow: hidden;
  padding: 4px 0 8px;
  cursor: grab;
}
.dos-preview-inner {
  display: flex;
  gap: 10px;
  width: max-content;
  animation: dos-preview-scroll 55s linear infinite;
}
.dos-preview-inner.paused,
.dos-preview-carousel:hover .dos-preview-inner,
.dos-preview-carousel:active .dos-preview-inner {
  animation-play-state: paused;
}
@keyframes dos-preview-scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}
.dos-preview-card {
  flex: 0 0 90px;
  scroll-snap-align: start;
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 8px 8px;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition-fast), transform var(--transition-fast);
}
.dos-preview-card:active { transform: scale(0.96); border-color: var(--primary-muted); }
.dos-preview-card-img {
  width: 44px; height: 44px;
  margin: 0 auto 6px;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.dos-preview-card-img img { width: 100%; height: 100%; object-fit: cover; }
.dos-preview-card-img svg { width: 28px; height: 28px; }
.dos-preview-card-name { font-size: 11px; font-weight: 600; line-height: 1.3; color: var(--text); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; }
.dos-preview-cat-badge { font-size: 9px; margin-top: 3px; padding: 1px 5px; border-radius: 8px; display: inline-block; font-weight: 600; }

/* Цветовые варианты для бейджей категорий препаратов — применяются вместе с любым layout-классом бейджа */
.cat-badge-vet { background: #d1fae5; color: #065f46; }
.cat-badge-med { background: #dbeafe; color: #1e40af; }

/* Dosage Calculator - Search Button */
.dos-search-btn {
  width: 38px; height: 38px;
  border-radius: var(--radius-full);
  border: 2px solid var(--border);
  background: var(--card-bg);
  color: var(--primary);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition-base);
  position: relative;
}
.dos-search-btn:hover { border-color: var(--primary); background: var(--primary-light); transform: scale(1.1); }
.dos-search-btn:active { transform: scale(0.95); }
.dos-search-btn svg { transition: transform 0.3s ease; }
.dos-search-btn:hover svg { transform: rotate(-15deg) scale(1.1); }

/* Dosage Calculator - Search Overlay */
.dos-search-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1100;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 60px;
}
.dos-search-overlay.active { display: flex; }
.dos-search-panel {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 20px;
  width: 90%;
  max-width: 420px;
  max-height: 70vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  animation: dosSearchSlideDown 0.25s ease;
}
@keyframes dosSearchSlideDown { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }
.dos-search-result {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition-fast);
}
.dos-search-result:hover { background: var(--bg-subtle); }
.dos-search-result-icon { width: 40px; height: 40px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.dos-search-result-icon img { width: 100%; height: 100%; object-fit: cover; border-radius: 6px; }
.dos-search-result-name { font-weight: 600; font-size: 14px; }
.dos-search-result-meta { font-size: 12px; color: var(--text-muted); }

/* Dosage Calculator - Bottom Sheet */
.dos-bottom-sheet-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4);
  z-index: 1200;
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s ease;
}
.dos-bottom-sheet-overlay.active { opacity: 1; pointer-events: auto; }
.dos-bottom-sheet {
  position: fixed; left: 0; right: 0; bottom: 0;
  background: var(--card-bg);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: 16px 24px 32px;
  z-index: 1201;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
  max-width: 480px;
  margin: 0 auto;
}
/* box-shadow только когда лист реально открыт — иначе тень от translateY(100%)
   рендерится прямо над нижним краем экрана и видна поверх bottom-nav */
.dos-bottom-sheet.active { transform: translateY(0); box-shadow: 0 -4px 24px rgba(0,0,0,0.15); }
.dos-bottom-sheet-handle {
  width: 36px; height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 0 auto 16px;
}

/* Dosage Calculator - Variants Carousel */
.dos-variants-carousel {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}
.dos-variant-card {
  padding: 10px 16px;
  border-radius: var(--radius);
  border: 2px solid var(--border);
  background: var(--card-bg);
  cursor: pointer;
  text-align: center;
  transition: all var(--transition-fast);
  min-width: 80px;
}
.dos-variant-card:hover { border-color: var(--primary-muted); }
.dos-variant-card.selected { border-color: var(--primary); background: var(--primary-light); }
.dos-variant-card-mg { font-size: 18px; font-weight: 700; color: var(--text); line-height: 1.2; }
.dos-variant-card-form { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* Dosage Calculator - Course option chips */
.dos-course-chip {
  padding: 8px 12px;
  border-radius: var(--radius);
  border: 2px solid var(--border);
  background: var(--card-bg);
  cursor: pointer;
  text-align: center;
  transition: all var(--transition-fast);
  min-width: 70px;
  flex: 1;
}
.dos-course-chip:hover { border-color: var(--primary-muted); }
.dos-course-chip.active { border-color: var(--primary); background: var(--primary-light); }

/* Tablet split visualization */
#dosTabletViz { text-align: center; padding: 4px 0 8px; }
.dos-tablet-item {
  display: inline-flex; flex-direction: column; align-items: center; gap: 4px;
  animation: dosTabletPop 0.4s cubic-bezier(0.34,1.56,0.64,1) both;
}
@keyframes dosTabletPop {
  from { transform: scale(0.5); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

/* Age inline input */
.age-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  border: 2px solid var(--border);
  background: var(--card-bg);
  transition: all var(--transition-fast);
}
.age-inline:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}
.age-inline input {
  width: 36px;
  border: none;
  outline: none;
  font-size: 13px;
  text-align: center;
  background: transparent;
  color: var(--text);
  font-weight: 500;
}
.age-inline input::placeholder {
  color: var(--text-muted);
}
.age-inline span {
  font-size: 12px;
  color: var(--text-muted);
}

/* ===== UPLOAD BUTTON (wide) ===== */
.upload-wide-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 18px 24px;
  border: 2px dashed var(--primary-muted);
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--primary-light) 0%, rgba(204,251,241,0.5) 100%);
  color: var(--primary-dark);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  margin-bottom: 16px;
}
.upload-wide-btn:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.upload-wide-btn:active {
  transform: scale(0.98);
}
.upload-wide-btn .upload-icon {
  font-size: 24px;
}

/* Upload preview in combined view */
.upload-inline-preview {
  display: none;
  margin-bottom: 12px;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  position: relative;
}
.upload-inline-preview img {
  max-width: 100%;
  max-height: 200px;
  display: block;
  margin: 0 auto;
}
.upload-inline-preview .pdf-badge {
  background: linear-gradient(135deg, var(--danger) 0%, #dc2626 100%);
  color: white;
  padding: 14px 20px;
  text-align: center;
  font-size: 14px;
  font-weight: 500;
}
.upload-inline-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

/* ===== COLLAPSIBLE SECTION ===== */
.collapsible-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition-fast);
  margin-bottom: 0;
  user-select: none;
}
.collapsible-header:hover {
  background: var(--bg-subtle);
}
.collapsible-header .collapsible-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.collapsible-header .collapsible-arrow {
  font-size: 14px;
  color: var(--text-muted);
  transition: transform var(--transition-base);
}
.collapsible-header.open .collapsible-arrow {
  transform: rotate(180deg);
}
.collapsible-header.open {
  border-radius: var(--radius) var(--radius) 0 0;
  border-bottom-color: transparent;
}
.collapsible-body {
  display: none;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 16px 18px;
}
.collapsible-body.open {
  display: block;
}

/* Treatment: mobile-collapsible sections */
.treat-section-toggle {
  display: flex; align-items: center; justify-content: space-between; cursor: pointer; user-select: none;
}
@keyframes treat-arrow-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30%           { transform: translateY(5px); }
}
.treat-arrow {
  position: relative; display: inline-flex; flex-direction: column;
  align-items: center; justify-content: center;
  width: 16px; height: 13px; flex-shrink: 0;
  font-size: 0; transition: transform 0.3s; color: #f97316;
}
.treat-arrow::before,
.treat-arrow::after {
  content: '';
  display: block;
  width: 7px; height: 7px;
  border-right: 2px solid #f97316;
  border-bottom: 2px solid #f97316;
  transform: rotate(45deg);
}
.treat-arrow::before { margin-bottom: -3px; opacity: 0.5; }
.treat-arrow::after  { opacity: 1; }
.treat-arrow.open { transform: rotate(180deg); animation: none; }
.treat-section-toggle:not(.open) .treat-arrow.bounce,
.treat-arrow.bounce:not(.open) { animation: treat-arrow-bounce 1.8s ease-in-out infinite; }
.treat-section-toggle.open .treat-arrow { transform: rotate(180deg); animation: none; }
.treat-section-body { display: none; }
.treat-section-body.open { display: block; }
@media (min-width: 1024px) {
  .treat-section-body { display: block !important; }
  .treat-section-toggle .treat-arrow { display: none; }
}

/* ===== TWO-COLUMN PARAMS GRID ===== */
.params-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
.params-grid .param-item {
  display: flex;
  flex-direction: column;
}
.params-grid .param-item.full-width {
  grid-column: 1 / -1;
}
.params-grid .param-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
  white-space: normal;
  line-height: 1.3;
}
.param-info-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 50%; background: var(--primary);
  color: #fff; font-size: 10px; font-weight: 700; margin-left: 4px;
  cursor: pointer; vertical-align: middle; line-height: 1; border: none; padding: 0;
}
.param-info-tip {
  display: none; font-size: 11px; color: var(--text-muted); margin-top: 4px;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px;
  padding: 6px 8px; line-height: 1.4;
}
.param-info-tip.visible { display: block; }
.params-grid .param-unit {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
}
.params-grid .param-input {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text);
  background: white;
  transition: all var(--transition-fast);
}
.params-grid .param-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.1);
}
.params-grid .param-input::placeholder {
  color: var(--text-muted);
}
.params-grid .param-input:hover:not(:focus) {
  border-color: var(--text-muted);
}
.params-grid .param-ref-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}
.params-grid select.param-input {
  appearance: auto;
}

/* ===== DASHBOARD COMPONENTS ===== */

/* Welcome Section */
.welcome-section {
  padding: 16px;
  margin: 0 12px 8px;
  background: linear-gradient(135deg, #1a6560 0%, #14524e 100%);
  color: white;
  border-radius: 2rem;
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 20px 40px rgba(0,0,0,0.25);
}

.welcome-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.welcome-user {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-left: 4px;
}

.welcome-avatar {
  width: 48px;
  height: 48px;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  position: relative;
  box-shadow: 0 0 20px rgba(16,185,129,0.15);
  overflow: hidden;
}
.welcome-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.welcome-text h2 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 2px;
  color: rgba(255,255,255,0.9);
}

.welcome-text p {
  font-size: 11px;
  letter-spacing: 0.02em;
  font-weight: 600;
  color: rgba(52,211,153,0.85);
}

.welcome-actions {
  display: flex;
  gap: 8px;
  padding-right: 4px;
}

.welcome-search-desktop {
  display: none;
}

.welcome-btn {
  width: 40px;
  height: 40px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  color: rgba(167,243,208,0.9);
}

.welcome-btn:hover {
  background: rgba(255,255,255,0.1);
}

.welcome-btn.btn-accent-glow {
  background: var(--primary);
  color: #051414;
  border: none;
  box-shadow: 0 0 20px rgba(16,185,129,0.3);
}
.welcome-btn.btn-accent-glow:hover {
  background: var(--primary-muted);
}

.welcome-btn .badge {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
}

/* Search Bar */
.search-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255,255,255,0.15);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
}

.search-bar input {
  flex: 1;
  background: transparent;
  border: none;
  color: white;
  font-size: 15px;
  outline: none;
}

.search-bar input::placeholder {
  color: rgba(255,255,255,0.7);
}

.search-bar button {
  width: 36px;
  height: 36px;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.search-bar button:hover {
  background: var(--accent-dark);
}

/* Posts Search Bar */
.posts-search-wrap {
  display: flex;
  align-items: center;
}
.posts-search-checkbox {
  display: none;
}
.posts-search-btn {
  width: 40px;
  height: 40px;
  background: var(--bg-subtle);
  border: none;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  flex-shrink: 0;
  order: 2;
}
.posts-search-btn:hover {
  background: var(--border);
}
.posts-search-input {
  max-width: 0;
  opacity: 0;
  padding: 0;
  border: 1.5px solid transparent;
  background: var(--bg-subtle);
  border-radius: var(--radius);
  font-size: 15px;
  color: var(--text);
  outline: none;
  transition: max-width 0.3s ease, opacity 0.2s ease, padding 0.3s ease, margin 0.3s ease, border-color 0.2s ease;
  height: 40px;
  box-sizing: border-box;
  order: 1;
  pointer-events: none;
}
.posts-search-input::placeholder {
  color: var(--text-muted);
}
.posts-search-input:focus {
  border-color: var(--primary);
}
.posts-search-checkbox:checked ~ .posts-search-input {
  max-width: 220px;
  opacity: 1;
  padding: 0 14px;
  margin-right: 8px;
  pointer-events: auto;
}
.posts-search-checkbox:checked ~ .posts-search-btn {
  background: var(--primary-light);
  color: var(--primary);
}
@media (max-width: 380px) {
  .posts-search-checkbox:checked ~ .posts-search-input {
    max-width: 160px;
  }
}

/* Section Headers */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding: 0 4px;
}

.section-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
}

.section-link {
  font-size: 14px;
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
  cursor: pointer;
}

.section-link:hover {
  text-decoration: underline;
}

/* Pet Cards */
.pets-scroll {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 4px 0 16px;
  margin: 0 -20px;
  padding-left: 20px;
  padding-right: 20px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.pets-scroll::-webkit-scrollbar {
  display: none;
}

.pet-card {
  flex-shrink: 0;
  width: 100px;
  text-align: center;
  cursor: pointer;
  transition: transform var(--transition-fast);
}

.pet-card:active {
  transform: scale(0.95);
}

.pet-card-avatar {
  width: 72px;
  height: 72px;
  margin: 0 auto 8px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.pet-card-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pet-card-add {
  background: var(--bg-subtle);
  border: 2px dashed var(--border);
}

.pet-card-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.pet-card-type {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Quick Actions */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.quick-action {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-xs);
  border: 1px solid var(--border-light);
  min-width: 0;
}

.quick-action:hover {
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}

.quick-action:active {
  transform: translateY(0);
}

.quick-action-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.quick-action-icon.primary {
  background: var(--primary-light);
  color: var(--primary);
}

.quick-action-icon.accent {
  background: var(--accent-light);
  color: var(--accent-dark);
}

.quick-action-icon.info {
  background: #dbeafe;
  color: var(--info);
}

.quick-action-icon.success {
  background: #d1fae5;
  color: var(--success);
}

.quick-action-icon.pink {
  background: #fce7f3;
  color: #db2777;
}

.quick-action-icon.purple {
  background: #f3e8ff;
  color: #9333ea;
}

.quick-action-text {
  min-width: 0;
  flex: 1;
}

.quick-action-text h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.quick-action-text p {
  font-size: 12px;
  color: var(--text-muted);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* Reminder Cards */
.reminders-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Avatar upload — profile & pet editor */
.avatar-upload-wrap {
  position: relative;
  width: 96px; height: 96px;
  margin: 0 auto 16px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.avatar-upload-wrap.lg { width: 120px; height: 120px; }
.avatar-upload-circle {
  width: 100%; height: 100%;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  display: flex; align-items: center; justify-content: center;
  font-size: 42px; color: #fff;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.avatar-upload-circle img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.avatar-upload-edit {
  position: absolute; right: 0; bottom: 0;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; line-height: 1;
  transform: translateY(-1px);
  border: 2px solid var(--card-bg);
  box-shadow: var(--shadow-sm);
}
.avatar-upload-hint {
  text-align: center;
  font-size: 11px;
  color: var(--primary);
  font-weight: 500;
  margin-top: 5px;
  line-height: 1.2;
}
.avatar-upload-wrap.has-photo + .avatar-upload-hint { display: none; }
/* пульсирующая рамка когда нет фото */
.avatar-upload-wrap:not(.has-photo) .avatar-upload-circle {
  box-shadow: 0 0 0 3px var(--primary-light), var(--shadow-lg);
}
@keyframes avatar-pulse {
  0%, 100% { box-shadow: 0 0 0 3px var(--primary-light), var(--shadow-lg); }
  50%       { box-shadow: 0 0 0 6px color-mix(in srgb, var(--primary) 15%, transparent), var(--shadow-lg); }
}
.avatar-upload-wrap:not(.has-photo) .avatar-upload-circle {
  animation: avatar-pulse 2.5s ease-in-out infinite;
}
/* баннер-совет */
.avatar-tip-banner {
  display: flex; align-items: flex-start; gap: 10px;
  background: linear-gradient(135deg, #eff6ff 0%, #ecfdf5 100%);
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--text);
  position: relative;
}
.avatar-tip-banner-close {
  position: absolute; top: 8px; right: 10px;
  background: none; border: none; cursor: pointer;
  font-size: 16px; color: var(--text-muted); line-height: 1;
  padding: 2px 4px;
}
.avatar-upload-wrap.loading .avatar-upload-circle { opacity: 0.6; }
.avatar-upload-wrap.loading .avatar-upload-edit::after {
  content: ''; width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff; border-radius: 50%;
  animation: spin 0.8s linear infinite;
  position: absolute;
}
.avatar-upload-wrap.loading .avatar-upload-edit { font-size: 0; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Pet card / list avatar — render image if present */
.pet-card-avatar img,
.pet-list-avatar img {
  width: 100%; height: 100%; object-fit: cover;
  border-radius: inherit; display: block;
}

/* Danger zone card in profile */
.danger-zone-card {
  border: 1px solid #fecaca;
  background: #fffafa;
}
.danger-zone-card .card-title { color: #dc2626; }

/* Delete account view */
.delete-account-list {
  list-style: none; padding: 0; margin: 0 0 16px;
}
.delete-account-list li {
  padding: 8px 0 8px 24px;
  position: relative;
  font-size: 14px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-light);
}
.delete-account-list li::before {
  content: '\2022'; position: absolute; left: 8px; color: #dc2626;
  font-size: 18px; line-height: 1;
}
.delete-account-list li:last-child { border-bottom: none; }
.delete-confirm-input {
  width: 100%; padding: 12px 14px;
  border: 2px solid #fecaca; border-radius: var(--radius);
  font-size: 16px; font-weight: 500; letter-spacing: 2px;
  text-align: center; background: #fff;
  margin-bottom: 16px;
}
.delete-confirm-input:focus {
  outline: none; border-color: #dc2626;
}
.btn-danger {
  background: #dc2626; color: #fff;
  border: none; padding: 14px 20px; border-radius: var(--radius);
  font-size: 15px; font-weight: 600; width: 100%;
  cursor: pointer;
  transition: background var(--transition-fast), opacity var(--transition-fast);
}
.btn-danger:hover:not(:disabled) { background: #b91c1c; }
.btn-danger:disabled { opacity: 0.4; cursor: not-allowed; }

/* Edit sheet — reused pattern for name/email modals */
.edit-sheet-overlay {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: none; align-items: flex-end; justify-content: center;
  z-index: 1000;
}
.edit-sheet-overlay.active { display: flex; }
.edit-sheet {
  background: var(--card-bg);
  width: 100%; max-width: 560px;
  border-radius: 20px 20px 0 0;
  padding: 20px 20px max(20px, env(safe-area-inset-bottom));
  transform: translateY(100%);
  transition: transform 0.25s cubic-bezier(.2,.9,.3,1);
}
.edit-sheet-overlay.active .edit-sheet { transform: translateY(0); box-shadow: 0 -8px 30px rgba(0,0,0,0.15); }
.edit-sheet-handle {
  width: 40px; height: 4px; border-radius: 2px;
  background: var(--border); margin: 0 auto 16px;
}
.edit-sheet-title {
  font-size: 17px; font-weight: 600; color: var(--text);
  margin-bottom: 12px; text-align: center;
}
.edit-sheet-hint {
  font-size: 13px; color: var(--text-muted);
  margin-bottom: 12px; line-height: 1.5;
}
.edit-sheet-actions {
  display: flex; gap: 10px; margin-top: 16px;
}
.edit-sheet-actions .btn { flex: 1; }

/* Articles carousel on home */
.articles-carousel-wrap {
  padding: 0 20px 20px;
}
.articles-carousel {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 4px 0;
}
.articles-carousel::-webkit-scrollbar { display: none; }

.article-slide {
  flex: 0 0 260px;
  scroll-snap-align: start;
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  cursor: pointer;
  position: relative;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}
.article-slide-video-wrap {
  position: relative;
  width: 100%;
  height: 140px;
  overflow: hidden;
  background: var(--bg-subtle);
}
.article-slide-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity 0.3s;
}
.article-slide-ph {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, #f0f0f0 25%, #e4e4e4 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: vidShimmer 1.4s ease-in-out infinite;
  z-index: 1;
}
.article-slide:active {
  transform: scale(0.97);
}
.article-slide-img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  display: block;
  background: var(--bg-subtle);
}
.article-slide-body {
  padding: 12px 14px;
}
.article-slide-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.article-slide-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}


.articles-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 10px;
}
.articles-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-light);
  transition: all var(--transition-fast);
}
.articles-dot.active {
  width: 18px;
  border-radius: 3px;
  background: var(--primary);
}

.articles-skeleton {
  display: flex;
  gap: 14px;
  padding: 4px 0;
}
.articles-skeleton-card {
  flex: 0 0 260px;
  height: 200px;
  background: var(--bg-subtle);
  border-radius: var(--radius-lg);
  animation: pulse 1.5s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes chevronPulse {
  0%, 100% { transform: translateY(0) scale(1); opacity: 1; }
  50%       { transform: translateY(3px) scale(1.2); opacity: 0.6; }
}
.calorie-chevron-pulse {
  animation: chevronPulse 1.2s ease-in-out infinite;
}

.reminder-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-xs);
  border: 1px solid var(--border-light);
  transition: all var(--transition-fast);
  cursor: pointer;
}

.reminder-card:hover {
  box-shadow: var(--shadow-sm);
}

.reminder-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

.reminder-icon.appointment {
  background: #fef3c7;
}

.reminder-icon.vaccine {
  background: #dbeafe;
}

.reminder-icon.analysis {
  background: #d1fae5;
}

.reminder-icon.treatment {
  background: #fce7f3;
}

.reminder-content {
  flex: 1;
  min-width: 0;
}

.reminder-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.reminder-date {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.reminder-pet {
  font-size: 12px;
  color: var(--text-secondary);
}

.reminder-arrow {
  color: var(--text-muted);
  font-size: 18px;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 40px 20px;
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state h3 {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

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

/* Feature Badge */
.feature-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--accent-light);
  color: var(--accent-dark);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 500;
  margin-left: 8px;
}

/* Analysis History Item */
.history-item {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-xs);
  border: 1px solid var(--border-light);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.history-item:hover {
  box-shadow: var(--shadow-sm);
}

.history-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  background: var(--primary-light);
  color: var(--primary);
}

.history-content {
  flex: 1;
}

.history-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.history-meta {
  font-size: 12px;
  color: var(--text-muted);
}

.history-status {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-weight: 500;
}

.history-status.normal {
  background: #d1fae5;
  color: #059669;
}

.history-status.warning {
  background: #fef3c7;
  color: #d97706;
}

.history-status.critical {
  background: #fee2e2;
  color: #dc2626;
}

.history-see-all {
  text-align: center;
  padding: 10px 16px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}
.history-see-all:active { opacity: 0.6; }

/* ===== AUTH / LOGIN VIEW ===== */
.auth-container {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: linear-gradient(180deg, var(--primary-light) 0%, var(--bg) 40%);
}
.auth-logo {
  width: 100px; height: 100px;
  border-radius: var(--radius-xl);
  overflow: hidden;
  margin-bottom: 16px;
  box-shadow: var(--shadow-lg);
}
.auth-logo img {
  width: 100%; height: 100%; object-fit: cover;
}
.auth-title {
  font-size: 24px; font-weight: 700; color: var(--text);
  margin-bottom: 4px; text-align: center;
}
.auth-subtitle {
  font-size: 14px; color: var(--text-secondary);
  margin-bottom: 32px; text-align: center;
}
.auth-card {
  width: 100%; max-width: 400px;
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-light);
}
.auth-tabs {
  display: flex; gap: 0; margin-bottom: 24px;
  background: var(--bg-subtle); border-radius: var(--radius);
  padding: 4px;
}
.auth-tab {
  flex: 1; padding: 10px; border: none; background: none;
  font-size: 14px; font-weight: 500; color: var(--text-muted);
  cursor: pointer; border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}
.auth-tab.active {
  background: var(--card-bg); color: var(--primary);
  font-weight: 600; box-shadow: var(--shadow-xs);
}
.auth-error {
  background: #fef2f2; color: #dc2626; border: 1px solid #fecaca;
  padding: 10px 14px; border-radius: var(--radius-sm);
  font-size: 13px; margin-bottom: 16px; display: none;
}
.auth-divider {
  text-align: center; color: var(--text-muted); font-size: 13px;
  margin: 20px 0; position: relative;
}
.auth-divider::before, .auth-divider::after {
  content: ''; position: absolute; top: 50%;
  width: 40%; height: 1px; background: var(--border);
}
.auth-divider::before { left: 0; }
.auth-divider::after { right: 0; }
.btn-google {
  width: 100%; padding: 12px 16px; border: 1px solid var(--border);
  background: white; color: #3c4043; font-size: 14px; font-weight: 500;
  border-radius: var(--radius); cursor: pointer; display: flex;
  align-items: center; justify-content: center; gap: 10px;
  transition: all var(--transition-fast);
}
.btn-google:hover { background: #f8f9fa; box-shadow: var(--shadow-sm); }
.btn-google:active { transform: scale(0.98); }

/* ===== AUTH CONSENT + FOOTER ===== */
.auth-consent {
  display: flex; align-items: flex-start; gap: 10px;
  font-size: 12px; color: var(--text-muted); line-height: 1.5;
  margin: 4px 0 14px;
}
.auth-consent input[type="checkbox"] {
  flex-shrink: 0; width: 16px; height: 16px; margin-top: 2px;
  accent-color: var(--primary); cursor: pointer;
}
.auth-consent a {
  color: var(--primary); text-decoration: none; font-weight: 500;
}
.auth-consent a:hover { text-decoration: underline; }
.auth-footer-legal {
  margin-top: 20px; text-align: center; font-size: 12px;
  color: var(--text-muted); line-height: 1.7;
}
.auth-footer-legal a {
  color: var(--text-muted); text-decoration: none;
  border-bottom: 1px dotted var(--text-muted);
}
.auth-footer-legal a:hover { color: var(--primary); border-bottom-color: var(--primary); }
.auth-footer-legal .sep { margin: 0 8px; opacity: 0.5; }

/* ===== LEGAL DOCUMENT VIEW ===== */
.legal-doc {
  padding: 20px 20px 40px;
  max-width: 780px;
  margin: 0 auto;
  font-size: 15px;
  line-height: 1.7;
  color: var(--text);
}
.legal-doc .legal-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-light);
}
.legal-doc h1 {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 8px;
  color: var(--text);
  line-height: 1.3;
}
.legal-doc h2 {
  font-size: 17px;
  font-weight: 600;
  margin: 26px 0 10px;
  color: var(--text);
  line-height: 1.35;
}
.legal-doc h3 {
  font-size: 15px;
  font-weight: 600;
  margin: 18px 0 6px;
  color: var(--text);
}
.legal-doc p { margin: 0 0 12px; }
.legal-doc ul, .legal-doc ol { margin: 0 0 14px; padding-left: 22px; }
.legal-doc li { margin-bottom: 6px; }
.legal-doc .legal-callout {
  background: #fef3c7;
  border: 1px solid #fde68a;
  border-left: 4px solid #f59e0b;
  padding: 14px 16px;
  border-radius: 10px;
  margin: 16px 0;
  font-size: 14px;
  color: #78350f;
}
.legal-doc .legal-callout strong { color: #78350f; }
.legal-doc .legal-info-box {
  background: var(--primary-light);
  border-radius: 12px;
  padding: 14px 16px;
  margin: 16px 0;
  font-size: 14px;
  color: var(--primary-dark);
}
.legal-doc a { color: var(--primary); text-decoration: none; }
.legal-doc a:hover { text-decoration: underline; }

/* ===== PET EDITOR ===== */
.pet-form-group { margin-bottom: 16px; }
.pet-form-label {
  display: block; font-size: 14px; font-weight: 500;
  color: var(--text-secondary); margin-bottom: 6px;
}
.pet-feed-tabs {
  display: flex; gap: 6px; flex-wrap: wrap;
}
.pet-feed-tab {
  flex: 1; min-width: 0; padding: 9px 6px; font-size: 13px; font-weight: 500;
  border: 1.5px solid var(--border); border-radius: 10px;
  background: var(--bg-subtle); color: var(--text-secondary);
  cursor: pointer; transition: all 0.15s; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.pet-feed-tab.active {
  border-color: var(--primary); background: #ecfdf5; color: var(--primary);
}
.pet-age-mode-tabs {
  display: flex; gap: 4px; margin-bottom: 10px;
  background: var(--bg-subtle); border-radius: 8px; padding: 3px;
}
.pet-age-mode-tab {
  flex: 1; padding: 6px 10px; font-size: 13px; font-weight: 500;
  border: none; background: transparent; border-radius: 6px;
  color: var(--text-muted); cursor: pointer; transition: all 0.15s;
}
.pet-age-mode-tab.active {
  background: #fff; color: var(--text);
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}
.pet-form-label .required { color: var(--danger); }
.pet-species-toggle {
  display: flex; gap: 10px;
}
.pet-species-btn {
  flex: 1; padding: 14px; border: 2px solid var(--border);
  border-radius: var(--radius); background: var(--card-bg);
  cursor: pointer; text-align: center; font-size: 14px;
  font-weight: 500; transition: all var(--transition-fast);
}
.pet-species-btn.active {
  border-color: var(--primary); background: var(--primary-light);
  color: var(--primary);
}
.pet-species-btn .emoji { font-size: 28px; display: flex; align-items: center; justify-content: center; margin-bottom: 4px; }

/* Pet cards in list */
.pet-list-card {
  background: var(--card-bg); border-radius: var(--radius-lg);
  padding: 16px; margin-bottom: 12px; display: flex;
  align-items: center; gap: 14px; border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm); cursor: pointer;
  transition: all var(--transition-fast);
}
.pet-list-card:hover { box-shadow: var(--shadow-md); }
.pet-list-avatar {
  width: 52px; height: 52px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; flex-shrink: 0;
}
.pet-list-info { flex: 1; }
.pet-list-name { font-size: 16px; font-weight: 600; color: var(--text); }
.pet-list-meta { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.pet-list-actions { display: flex; gap: 8px; }
.pet-list-btn {
  width: 36px; height: 36px; border: none; border-radius: var(--radius-sm);
  background: var(--bg-subtle); cursor: pointer; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition-fast);
}
.pet-list-btn:hover { background: var(--border); }
.pet-list-btn.danger:hover { background: #fee2e2; color: var(--danger); }

/* Add pet button */
.add-pet-card {
  background: var(--bg-subtle); border: 2px dashed var(--border);
  border-radius: var(--radius-lg); padding: 24px;
  text-align: center; cursor: pointer;
  transition: all var(--transition-fast);
}
.add-pet-card:hover {
  border-color: var(--primary-muted); background: var(--primary-light);
}
.add-pet-card .icon { font-size: 32px; margin-bottom: 8px; }
.add-pet-card .text { font-size: 14px; font-weight: 500; color: var(--text-secondary); }

/* ════════════════════════════════════════════════════════════════════
   PETS CAROUSEL — горизонтальный список питомцев + action-кнопки
   ──────────────────────────────────────────────────────────────────── */
.pets-carousel-wrap {
  position: relative;
  margin-bottom: 20px;
}
.pets-carousel {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 4px 20px 12px;
  scroll-padding-left: 20px;
}
.pets-carousel::-webkit-scrollbar { display: none; }

.pet-car-card {
  position: relative;
  flex: 0 0 280px;
  scroll-snap-align: start;
  /* Тот же градиент что у hero-баннера «Возможности приложения», но прозрачнее */
  background: linear-gradient(135deg,
    rgba(15, 118, 110, 0.55) 0%,
    rgba(13, 148, 136, 0.55) 30%,
    rgba(14, 165, 233, 0.55) 70%,
    rgba(99, 102, 241, 0.55) 100%);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 22px;
  padding: 18px 18px 14px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  box-shadow: 0 8px 22px -10px rgba(15, 23, 42, 0.22), 0 2px 6px -2px rgba(15, 23, 42, 0.10);
  transition: transform 200ms cubic-bezier(0.22, 0.61, 0.36, 1), box-shadow 200ms ease;
  user-select: none;
  overflow: hidden;
  isolation: isolate;
}
.pet-car-card:active {
  transform: scale(0.98);
}
/* «бегущий блик» — как у hero-баннера */
.pet-car-card:not(.pet-car-add)::before {
  content: '';
  position: absolute;
  top: 0;
  left: -120%;
  width: 60%;
  height: 100%;
  background: linear-gradient(105deg, transparent 0%, rgba(255, 255, 255, 0.18) 50%, transparent 100%);
  transform: skewX(-20deg);
  animation: fxShineSweep 6s ease-in-out 1.4s infinite;
  z-index: 1;
  pointer-events: none;
}
.pet-car-card > * { position: relative; z-index: 2; }

.pet-car-avatar {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 56px;
  overflow: hidden;
  background: var(--bg-subtle);
  border: 3px solid #fff;
  box-shadow: 0 6px 20px -6px rgba(15, 23, 42, 0.28);
  margin-bottom: 14px;
  flex-shrink: 0;
}
.pet-car-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.pet-car-name {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.3px;
  line-height: 1.2;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.28);
}
.pet-car-meta {
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.92);
  margin-top: 6px;
  line-height: 1.35;
  font-weight: 500;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.22);
}
.pet-car-open {
  margin-top: 12px;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--primary);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1px;
  box-shadow: 0 2px 6px -1px rgba(0, 0, 0, 0.15);
}

/* «+ Добавить питомца» в конце карусели */
.pet-car-card.pet-car-add {
  background: var(--bg-subtle);
  border: 2px dashed var(--border);
  justify-content: center;
  min-height: 240px;
  box-shadow: none;
}
.pet-car-card.pet-car-add:hover {
  border-color: var(--primary-muted);
  background: var(--primary-light);
}
.pet-car-add-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 300;
  color: var(--primary);
  margin-bottom: 12px;
  box-shadow: 0 4px 10px -3px rgba(15, 23, 42, 0.12);
}
.pet-car-add-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
}

/* Точки-индикатор */
.pets-carousel-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 4px;
}
.pets-carousel-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--border);
  transition: background 200ms ease, width 200ms ease;
}
.pets-carousel-dot.active {
  background: var(--primary);
  width: 18px;
  border-radius: 4px;
}

/* Action-кнопки под каруселью */
.pets-actions-wrap {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 0 20px;
}
.pets-action-btn {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 14px 8px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: transform 200ms ease, box-shadow 200ms ease, border-color 200ms ease;
  box-shadow: 0 2px 8px -2px rgba(15, 23, 42, 0.06);
}
.pets-action-btn:active {
  transform: scale(0.96);
}
.pets-action-btn:hover {
  border-color: var(--primary-muted);
  box-shadow: 0 4px 12px -3px rgba(15, 118, 110, 0.18);
}
.pets-action-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pets-action-icon img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  filter: drop-shadow(0 3px 8px rgba(15, 23, 42, 0.15));
}
.pets-action-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.1px;
}

/* Цветные акценты для action-кнопок */
.pets-action-calorie .pets-action-icon { background: linear-gradient(135deg, #fef3c7, #fde68a); }
.pets-action-exam    .pets-action-icon { background: linear-gradient(135deg, #f0fdf4, #dcfce7); }
.pets-action-test    .pets-action-icon { background: linear-gradient(135deg, #eef2ff, #e0e7ff); }

/* ===== PLANS ===== */
.plan-card {
  background: var(--card-bg); border: 2px solid var(--border);
  border-radius: var(--radius-lg); padding: 24px; margin-bottom: 16px;
  transition: all var(--transition-fast); position: relative;
}
.plan-card.current { border-color: var(--primary); }
.plan-card.popular { border-color: var(--accent); }
.plan-card-badge {
  position: absolute; top: -10px; right: 16px;
  background: var(--accent); color: white; font-size: 11px;
  font-weight: 600; padding: 3px 10px; border-radius: var(--radius-full);
}
.plan-card-name { font-size: 18px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.plan-card-price { font-size: 28px; font-weight: 700; color: var(--primary); margin-bottom: 16px; }
.plan-card-price span { font-size: 14px; font-weight: 400; color: var(--text-muted); }
.plan-features { list-style: none; padding: 0; margin: 0 0 20px; }
.plan-features li {
  font-size: 13px; color: var(--text-secondary); padding: 6px 0;
  border-bottom: 1px solid var(--border-light); display: flex; align-items: center; gap: 8px;
}
.plan-features li::before { content: '\2713'; color: var(--success); font-weight: 700; font-size: 14px; }
.plan-economics-hint {
  font-size: 12px; font-weight: 600; color: var(--primary);
  background: color-mix(in srgb, var(--primary) 10%, transparent);
  border-radius: 8px; padding: 8px 12px; margin-bottom: 16px;
  text-align: center; line-height: 1.4;
}

/* ===== LIMIT MODAL ===== */
.modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5); z-index: 1000;
  display: none; align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay.active { display: flex; }
.modal-content {
  background: var(--card-bg); border-radius: var(--radius-xl);
  padding: 32px 24px; max-width: 400px; width: 100%;
  box-shadow: var(--shadow-xl); text-align: center;
}
.modal-icon { font-size: 48px; margin-bottom: 16px; }
.modal-title { font-size: 20px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.modal-text { font-size: 14px; color: var(--text-secondary); margin-bottom: 24px; line-height: 1.6; }
.modal-actions { display: flex; flex-direction: column; gap: 10px; }

/* ===== SERVICE TERMS MODAL ===== */
.service-terms-content {
  max-width: 480px; padding: 22px 22px 18px; text-align: left;
}
.service-terms-title {
  font-size: 19px; font-weight: 700; color: var(--text);
  margin-bottom: 12px;
}
.service-terms-body {
  font-size: 14px; line-height: 1.5; color: var(--text-secondary);
  max-height: 50vh; overflow-y: auto;
  margin-bottom: 14px; padding-right: 4px;
}
.service-terms-body h4 {
  font-size: 14px; font-weight: 700; color: var(--text);
  margin: 14px 0 4px;
}
.service-terms-body h4:first-child { margin-top: 0; }
.service-terms-body ul {
  margin: 0 0 4px 18px; padding: 0;
}
.service-terms-body li { margin-bottom: 3px; }
.service-terms-body b { color: var(--text); font-weight: 600; }

/* Маленькая ссылка «Подробнее об условиях» рядом с кнопками оплаты */
.service-terms-link {
  display: inline-block; margin-top: 8px;
  font-size: 12px; color: var(--text-muted);
  text-decoration: underline; cursor: pointer;
  background: none; border: none; padding: 0;
}
.service-terms-link:hover { color: var(--primary); }

/* ===== О ВРАЧЕ — карточка на view-doctor-hub ===== */
.about-doctor-card {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px; margin-bottom: 24px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 8%, transparent), color-mix(in srgb, var(--primary) 2%, transparent));
  border: 1px solid color-mix(in srgb, var(--primary) 18%, transparent);
  border-radius: 16px; cursor: pointer;
  transition: box-shadow 0.15s, transform 0.1s;
}
.about-doctor-card:active { transform: scale(0.99); box-shadow: var(--shadow-sm); }
.about-doctor-avatar {
  position: relative;
  width: 52px; height: 52px; border-radius: 50%;
  overflow: hidden;
  background: var(--card-bg);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; flex-shrink: 0;
  border: 1px solid color-mix(in srgb, var(--primary) 20%, transparent);
}
.about-doctor-avatar > img,
.about-doctor-avatar > video {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover; display: block;
}
.about-doctor-avatar > img { z-index: 1; }
.about-doctor-avatar > video {
  z-index: 2;
  opacity: 0;
  transition: opacity 250ms ease-out;
}
.about-doctor-avatar > video.loaded { opacity: 1; }
.about-doctor-meta { flex: 1; min-width: 0; }
.about-doctor-name { font-size: 14px; font-weight: 700; color: var(--text); line-height: 1.3; }
.about-doctor-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.about-doctor-arrow { font-size: 22px; color: var(--text-muted); flex-shrink: 0; }

/* ===== О ВРАЧЕ — страница view-about-doctor ===== */
.about-doctor-page {
  padding: 20px 20px 100px;
  max-width: 640px; margin: 0 auto;
}
.about-doctor-photo {
  display: block;
  width: 100%;
  max-width: 360px;
  aspect-ratio: 1 / 1;
  margin: 4px auto 18px;
  object-fit: cover;
  object-position: center 30%;
  background: var(--bg-subtle);
  border-radius: 18px;
  box-shadow: var(--shadow-md);
}
.about-doctor-fullname {
  text-align: center; font-size: 19px; font-weight: 700;
  color: var(--text); margin-bottom: 6px;
}
.about-doctor-spec {
  text-align: center; font-size: 13px; color: var(--text-muted);
  line-height: 1.5; margin-bottom: 22px;
}
.about-doctor-text p {
  margin: 0 0 14px;
  font-size: 15px; line-height: 1.6; color: var(--text-secondary);
}
.about-app-section {
  margin-top: 28px; padding-top: 22px;
  border-top: 1px solid var(--border);
}
.about-app-title {
  font-size: 17px; font-weight: 700; color: var(--text);
  margin: 0 0 12px;
}
.about-app-text p {
  margin: 0 0 12px;
  font-size: 15px; line-height: 1.6; color: var(--text-secondary);
}
.about-app-list {
  margin: 0 0 14px 20px; padding: 0;
}
.about-app-list li {
  font-size: 15px; line-height: 1.55;
  color: var(--text-secondary); margin-bottom: 8px;
}
.about-app-list li b { color: var(--text); font-weight: 600; }

/* ===== USAGE COUNTER ===== */
.usage-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; color: var(--text-muted); background: var(--bg-subtle);
  padding: 4px 10px; border-radius: var(--radius-full);
}
.usage-badge.warning { background: #fef3c7; color: #92400e; }
.usage-badge.depleted { background: #fee2e2; color: #991b1b; }

/* ===== CHAT BUBBLES ===== */
/* Session tabs */
.sess-tab {
  flex: 1; padding: 12px 0; font-size: 14px; font-weight: 600;
  background: none; border: none; border-bottom: 2px solid transparent;
  color: var(--text-muted); cursor: pointer; transition: all 0.2s;
}
.sess-tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* Session cards */
.sess-card {
  display: flex; align-items: center; gap: 14px; padding: 14px;
  background: var(--card-bg); border-radius: 14px; margin-bottom: 10px;
  cursor: pointer; transition: box-shadow 0.15s;
  box-shadow: var(--shadow-xs);
}
.sess-card:active { box-shadow: var(--shadow-md); }
.sess-card-icon {
  width: 48px; height: 48px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; flex-shrink: 0;
}
.sess-card-info { flex: 1; min-width: 0; }
.sess-card-title { font-size: 15px; font-weight: 600; color: var(--text); }
.sess-card-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.sess-card-badge {
  font-size: 10px; font-weight: 600; padding: 2px 8px;
  border-radius: 20px; color: white; flex-shrink: 0;
}
.sess-card-arrow { color: var(--text-light); font-size: 16px; flex-shrink: 0; }

#view-session-chat.active { display: flex; flex-direction: column; position: fixed; inset: 0; z-index: 10; background: var(--bg); }

/* Chat gradient header */
#view-session-chat .chat-header-gradient {
  background: linear-gradient(135deg, #0f766e 0%, #14b8a6 100%);
  color: white; padding: 0; flex-shrink: 0;
  border-radius: 0 0 16px 16px;
  box-shadow: 0 2px 10px rgba(15,118,110,0.25);
}
#view-session-chat .chat-header-gradient .header-back {
  color: white;
  background: rgba(255,255,255,0.18);
  border: 1px solid rgba(255,255,255,0.25);
  backdrop-filter: blur(4px);
}
#view-session-chat .chat-header-gradient .header-back:hover {
  background: rgba(255,255,255,0.28);
}
#view-session-chat .chat-header-gradient .header-title { color: white; }
#view-session-chat .chat-header-gradient .chat-header-status {
  font-size: 12px; color: rgba(255,255,255,0.75);
  padding: 0 0 10px 56px; line-height: 1.3;
}
#view-session-chat .chat-header-gradient .chat-header-dots {
  color: white; background: none; border: none; font-size: 18px;
  cursor: pointer; padding: 8px; opacity: 0.8;
}
#view-session-chat .chat-header-gradient .chat-header-dots:hover { opacity: 1; }

/* Chat messages area */
#chatMessages {
  background: #f0f4f3;
}

/* ===== MESSENGER-STYLE CHAT (inspired by CodePen gradient design) ===== */
@keyframes chatSlideRight {
  from { opacity: 0; transform: translateX(40px) scale(0.92); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes chatSlideLeft {
  from { opacity: 0; transform: translateX(-40px) scale(0.92); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes chatFadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes chatSpinner {
  to { transform: rotate(360deg); }
}

.chat-msg {
  margin-bottom: 6px; display: flex; padding: 0 6px;
}
.chat-msg.user {
  justify-content: flex-end;
  animation: chatSlideRight 0.3s ease-out;
}
.chat-msg.doctor {
  justify-content: flex-start;
  animation: chatSlideLeft 0.3s ease-out;
}
.chat-msg.system {
  justify-content: center;
  animation: chatFadeIn 0.3s ease-out;
}

.chat-bubble {
  max-width: 78%; padding: 9px 13px; font-size: 14.5px;
  line-height: 1.45; word-break: break-word; position: relative;
  border-radius: 18px; transition: box-shadow 0.15s;
}
.chat-msg.user .chat-bubble {
  background: #ffffff; color: #6b7280;
  border-radius: 18px 18px 4px 18px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}
.chat-msg.doctor .chat-bubble {
  background: var(--primary-light); color: var(--text);
  border-radius: 18px 18px 18px 4px;
  box-shadow: -1px 2px 4px rgba(0,0,0,0.08);
}
.chat-msg.system .chat-bubble {
  background: rgba(0,0,0,0.05); color: var(--text-muted);
  font-size: 12px; padding: 5px 14px; border-radius: 14px;
  max-width: 90%;
}

/* Timestamp inline */
.chat-time {
  font-size: 10px; float: right;
  margin: 6px 0 -4px 10px; opacity: 0.6; line-height: 1;
}
.chat-msg.user .chat-time { color: #9ca3af; }
.chat-msg.doctor .chat-time { color: var(--text-muted); }

/* Images in chat */
.chat-img {
  max-width: 260px; max-height: 300px; border-radius: 12px;
  cursor: pointer; display: block; margin: 2px 0 4px;
  object-fit: cover;
}
.chat-msg.user .chat-img { border-radius: 12px 12px 4px 12px; }
.chat-msg.doctor .chat-img { border-radius: 12px 12px 12px 4px; }
.chat-bubble.chat-bubble-img {
  padding: 3px; overflow: hidden; line-height: 0;
}
.chat-bubble.chat-bubble-img .chat-time {
  position: absolute; bottom: 8px; right: 10px;
  background: rgba(0,0,0,0.45); color: white; padding: 1px 6px;
  border-radius: 8px; font-size: 10px; float: none; margin: 0;
  opacity: 1;
}

/* Audio player */
.chat-audio-wrap {
  display: flex; align-items: center; gap: 8px; min-width: 200px;
  padding: 2px 0;
}
.chat-audio-btn {
  width: 36px; height: 36px; border-radius: 50%; border: none;
  background: rgba(255,255,255,0.2); color: inherit; font-size: 16px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: background 0.15s;
}
.chat-msg.doctor .chat-audio-btn { background: var(--primary-light); color: var(--primary); }
.chat-audio-btn:active { transform: scale(0.92); }
.chat-audio-wave {
  flex: 1; height: 28px; display: flex; align-items: center; gap: 2px;
}
.chat-audio-bar {
  width: 3px; border-radius: 2px; background: currentColor; opacity: 0.4;
  transition: height 0.1s;
}
.chat-audio-dur { font-size: 12px; opacity: 0.7; flex-shrink: 0; }

/* File card in bubble */
.chat-file-card {
  display: flex; align-items: center; gap: 10px; padding: 4px 0;
  text-decoration: none; color: inherit; min-width: 180px;
}
.chat-file-icon {
  width: 40px; height: 40px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.chat-msg.user .chat-file-icon { background: var(--primary-light); color: var(--primary); }
.chat-msg.doctor .chat-file-icon { background: rgba(15,118,110,0.12); color: var(--primary); }
.chat-file-name { font-size: 13px; font-weight: 500; word-break: break-all; }
.chat-file-size { font-size: 11px; opacity: 0.6; }

/* Sending state */
.chat-msg-sending .chat-bubble { opacity: 0.65; }
.chat-msg-sending .chat-send-indicator {
  display: inline-block; width: 12px; height: 12px;
  border: 2px solid rgba(0,0,0,0.12); border-top-color: var(--primary);
  border-radius: 50%; animation: chatSpinner 0.6s linear infinite;
  margin-left: 6px; vertical-align: middle;
}
.chat-msg.doctor .chat-msg-sending .chat-send-indicator {
  border-color: rgba(0,0,0,0.12); border-top-color: var(--primary);
}

/* File preview above input */
.chat-attach-preview {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px;
  background: var(--bg-subtle); border-radius: 12px; margin-bottom: 8px;
  position: relative;
}
.chat-attach-thumb {
  width: 48px; height: 48px; border-radius: 8px; object-fit: cover;
}
.chat-attach-file-icon {
  width: 48px; height: 48px; border-radius: 8px; background: var(--primary-light);
  display: flex; align-items: center; justify-content: center; font-size: 22px;
  flex-shrink: 0; color: var(--primary);
}
.chat-attach-info { flex: 1; min-width: 0; }
.chat-attach-name {
  font-size: 13px; font-weight: 500; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-attach-size { font-size: 11px; color: var(--text-muted); }
.chat-attach-remove {
  position: absolute; top: -6px; right: -6px; width: 22px; height: 22px;
  border-radius: 50%; background: var(--danger); color: white; border: none;
  font-size: 14px; cursor: pointer; display: flex; align-items: center;
  justify-content: center; box-shadow: var(--shadow-sm);
}

/* Input area — Messenger style */
.chat-input-row {
  display: flex; gap: 8px; align-items: flex-end;
}
.chat-input-field-wrap {
  flex: 1; display: flex; align-items: flex-end;
  background: #ffffff; border-radius: 24px;
  border: none; padding: 0 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
  transition: box-shadow 0.2s;
}
.chat-input-field-wrap:focus-within { box-shadow: 0 2px 8px rgba(15,118,110,0.18); }
.chat-input-icon {
  width: 38px; height: 38px; border: none; background: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; color: var(--text-muted); cursor: pointer;
  flex-shrink: 0; transition: color 0.15s;
  padding: 0; margin: 1px 0;
}
.chat-input-icon:hover { color: var(--primary); }
.chat-input-icon:active { transform: scale(0.9); }
.chat-input-textarea {
  flex: 1; border: none; background: transparent;
  padding: 9px 4px; font-size: 15px; line-height: 1.4;
  resize: none; min-height: 40px; max-height: 120px;
  font-family: inherit; outline: none;
}
.chat-input-textarea::placeholder { color: var(--text-light); }
.chat-input-btn {
  width: 44px; height: 44px; border-radius: 50%; border: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; cursor: pointer; flex-shrink: 0;
  transition: background 0.15s, transform 0.15s;
  box-shadow: 0 2px 6px rgba(15,118,110,0.25);
}
.chat-input-btn:active { transform: scale(0.88); }
.chat-input-btn-send {
  background: var(--primary-dark); color: white;
}
.chat-input-btn-mic {
  background: var(--primary-dark); color: white;
}

/* ===== Context menu ===== */
.chat-context-backdrop {
  position: fixed; inset: 0; z-index: 999; background: rgba(0,0,0,0.15);
  animation: chatFadeIn 0.15s ease-out;
}
.chat-context-menu {
  position: fixed; z-index: 1000; background: white;
  border-radius: 14px; box-shadow: 0 4px 20px rgba(0,0,0,0.18);
  padding: 6px 0; min-width: 170px; overflow: hidden;
  animation: chatFadeIn 0.15s ease-out;
}
.chat-context-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 16px; font-size: 14px; color: var(--text);
  border: none; background: none; width: 100%;
  cursor: pointer; text-align: left; transition: background 0.1s;
}
.chat-context-item:active { background: var(--bg-subtle); }
.chat-context-item:hover { background: var(--bg-subtle); }
.chat-context-icon { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }
.chat-context-item.danger { color: var(--danger); }

/* ===== Reply preview ===== */
.chat-reply-bar {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px;
  background: var(--primary-light); border-left: 3px solid var(--primary);
  border-radius: 8px; margin-bottom: 8px;
  animation: chatFadeIn 0.15s ease-out;
}
.chat-reply-bar-text { flex: 1; min-width: 0; }
.chat-reply-bar-name { font-size: 12px; font-weight: 600; color: var(--primary); }
.chat-reply-bar-content {
  font-size: 13px; color: var(--text-secondary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-reply-bar-close {
  width: 24px; height: 24px; border-radius: 50%; border: none;
  background: none; color: var(--text-muted); font-size: 16px;
  cursor: pointer; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
}
.chat-reply-bar-close:hover { background: rgba(0,0,0,0.06); }

/* ===== Edit mode bar ===== */
.chat-edit-bar {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px;
  background: var(--accent-light); border-left: 3px solid var(--accent);
  border-radius: 8px; margin-bottom: 8px;
  animation: chatFadeIn 0.15s ease-out;
}
.chat-edit-bar-icon { font-size: 16px; }
.chat-edit-bar-text { flex: 1; min-width: 0; font-size: 13px; color: var(--text-secondary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-edit-bar-close {
  width: 24px; height: 24px; border-radius: 50%; border: none;
  background: none; color: var(--text-muted); font-size: 16px;
  cursor: pointer; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
}
.chat-edit-bar-close:hover { background: rgba(0,0,0,0.06); }

/* ===== Reply quote in bubble ===== */
.chat-reply-quote {
  padding: 6px 10px; margin-bottom: 4px;
  background: rgba(0,0,0,0.04); border-left: 2px solid var(--primary);
  border-radius: 4px; cursor: pointer;
}
.chat-reply-quote-name { font-size: 11px; font-weight: 600; color: var(--primary); }
.chat-reply-quote-text {
  font-size: 12px; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px;
}

/* ===== Edited badge ===== */
.chat-edited { font-size: 10px; opacity: 0.55; margin-right: 4px; font-style: italic; }

/* ===== Deleted message ===== */
.chat-bubble-deleted {
  font-style: italic; color: var(--text-muted) !important; opacity: 0.7;
}
.chat-bubble-deleted .chat-time { opacity: 0.5; }

/* ===== Message highlight on reply click ===== */
.chat-msg-highlight .chat-bubble {
  box-shadow: 0 0 0 2px var(--primary) !important;
  transition: box-shadow 0.3s;
}

/* Disabled */
.chat-disabled {
  text-align: center; padding: 16px; color: var(--text-muted); font-size: 13px;
  background: var(--bg-subtle); border-radius: var(--radius);
}

/* Posts feed — Telegram-style */
.post-feed-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow var(--transition-base), transform var(--transition-fast);
}
.post-feed-card:active { transform: scale(0.98); }
.post-feed-card:hover { box-shadow: var(--shadow-md); }
.post-feed-media {
  width: 100%;
  max-height: 280px;
  object-fit: cover;
  display: block;
}
.post-feed-video-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 280px;
  overflow: hidden;
  background: var(--bg-subtle);
}
.post-feed-video-ph {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, #f0f0f0 25%, #e4e4e4 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: vidShimmer 1.4s ease-in-out infinite;
  z-index: 1;
}
@keyframes vidShimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.post-feed-media-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity 0.3s;
}
.post-feed-body { padding: 16px; }
.post-feed-title {
  font-size: 16px; font-weight: 600; color: var(--text);
  line-height: 1.4; margin-bottom: 6px;
}
.post-feed-summary {
  font-size: 14px; color: var(--text-secondary);
  line-height: 1.5; margin-bottom: 10px;
  display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.post-feed-meta {
  display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--text-muted);
  flex-wrap: wrap; row-gap: 6px;
}
.post-feed-tag {
  display: inline-block; background: var(--primary-light); color: var(--primary);
  padding: 2px 8px; border-radius: var(--radius-full); font-size: 11px; font-weight: 500;
}
/* Хештеги в карточке ленты — прижаты вправо, переносятся при раскрытии «…» */
.post-feed-tags {
  display: flex; flex-wrap: wrap; align-items: center; gap: 5px;
  margin-left: auto; justify-content: flex-end; min-width: 0;
}
.post-feed-hashtag {
  display: inline-block; background: var(--bg-subtle); color: var(--primary);
  padding: 2px 8px; border-radius: var(--radius-full); font-size: 11px; font-weight: 500;
  cursor: pointer; white-space: nowrap; transition: background 0.15s;
}
.post-feed-hashtag:hover { background: var(--primary-light); }
.post-feed-hashtag-more { font-weight: 700; padding: 2px 10px; letter-spacing: 1px; }
/* Post detail */
.post-detail-media {
  width: 100%; max-height: 360px; object-fit: cover;
  border-radius: var(--radius); margin-bottom: 16px;
}
.post-detail-title {
  font-size: 20px; font-weight: 700; color: var(--text);
  line-height: 1.35; margin-bottom: 12px;
}
.post-detail-meta {
  display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-muted);
  margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--border-light);
}
.post-detail-html {
  font-size: 15px; line-height: 1.7; color: var(--text);
  word-wrap: break-word;
  overflow-wrap: anywhere;
  overflow-x: hidden;
}
.post-detail-html p { margin-bottom: 12px; }
/* Пустые абзацы (только с <br>) — компактный gap, без дублирующихся margin'ов */
.post-detail-html p:empty,
.post-detail-html p:has(> br:only-child) { margin: 0; min-height: 0.6em; line-height: 1; }
/* Несколько пустых абзацев подряд → показываем только первый */
.post-detail-html p:has(> br:only-child) + p:has(> br:only-child) { display: none; }
/* Заголовки/списки/цитаты — 1-в-1 как в редакторе админки (buildAdvancedRichEditor),
   чтобы опубликованный пост совпадал с тем, что врач видит при наборе. */
.post-detail-html h1 { font-size: 1.5em; font-weight: 700; margin: .5em 0; }
.post-detail-html h2 { font-size: 1.25em; font-weight: 700; margin: .4em 0; }
.post-detail-html h3 { font-size: 1.1em; font-weight: 600; margin: .3em 0; }
.post-detail-html ul, .post-detail-html ol { padding-left: 1.6em; margin: .3em 0; }
.post-detail-html blockquote { border-left: 3px solid var(--primary); padding-left: 10px; color: var(--text-secondary); margin: .4em 0; }
.post-detail-html a { color: var(--primary); text-decoration: underline; }
.post-detail-html img { max-width: 100%; height: auto; border-radius: var(--radius-sm); margin: 8px 0; }
/* Колонки: grid-items должны разрешать сжатие — иначе длинные неразрывные слова ломают layout */
.post-detail-html div[style*="grid-template-columns"] { max-width: 100%; }
.post-detail-html div[style*="grid-template-columns"] > div {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}
/* Таблицы: фиксированный layout + перенос длинных слов в ячейках */
.post-detail-html table { max-width: 100%; table-layout: fixed; border-collapse: collapse; }
.post-detail-html table th, .post-detail-html table td {
  overflow-wrap: anywhere;
  word-break: break-word;
}
/* Сабскрипты и надстрочные — небольшие визуальные подгонки */
.post-detail-html sub, .post-detail-html sup { font-size: 0.75em; line-height: 0; }

/* Post detail — tags */
.post-detail-tags {
  display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 20px;
}
.post-tag-chip {
  display: inline-block; background: var(--bg-subtle); color: var(--primary);
  padding: 4px 10px; border-radius: var(--radius-full); font-size: 12px; font-weight: 500;
  cursor: pointer; transition: background 0.15s;
}
.post-tag-chip:hover { background: var(--primary-light); }

/* Tag filter pill (feed) */
.tag-filter-pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--primary-light); color: var(--primary);
  border-radius: var(--radius-full); padding: 6px 14px; font-size: 13px; font-weight: 600;
  margin-bottom: 12px;
}
.tag-filter-close {
  background: none; border: none; cursor: pointer; color: var(--primary);
  font-size: 16px; line-height: 1; padding: 0;
}

/* Series navigation */
.post-series-nav {
  background: var(--bg-subtle); border-radius: var(--radius);
  padding: 14px 16px; margin: 20px 0; border: 1px solid var(--border-light);
}
.post-series-header {
  display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap;
}
.post-series-label {
  font-weight: 600; font-size: 14px; color: var(--text); flex: 1;
}
.post-series-count {
  font-size: 12px; color: var(--text-muted); background: var(--bg);
  padding: 2px 8px; border-radius: var(--radius-full); border: 1px solid var(--border-light);
}
.post-series-arrows {
  display: flex; gap: 8px;
}
.post-series-btn {
  flex: 1; display: flex; align-items: center; gap: 6px;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 8px 12px; font-size: 13px; cursor: pointer; color: var(--primary);
  transition: background 0.15s; text-align: left; min-width: 0;
}
.post-series-btn span:last-child, .post-series-btn-next span:first-child {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1;
}
.post-series-btn:hover:not(:disabled) { background: var(--primary-light); }
.post-series-btn-disabled { color: var(--text-muted); cursor: default; }
.post-series-btn-next { justify-content: flex-end; text-align: right; }

/* Related posts */
.post-related-section {
  margin: 24px 0; padding-top: 20px; border-top: 1px solid var(--border-light);
}
.post-related-title {
  font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 12px;
}
.post-related-list {
  display: flex; flex-direction: column; gap: 10px;
}
.post-related-card {
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--bg-subtle); border-radius: var(--radius);
  padding: 12px; cursor: pointer; transition: background 0.15s;
  border: 1px solid var(--border-light);
}
.post-related-card:hover { background: var(--primary-light); }
.post-related-img {
  width: 64px; height: 64px; object-fit: cover;
  border-radius: var(--radius-sm); flex-shrink: 0;
}
.post-related-info { flex: 1; min-width: 0; }
.post-related-series {
  font-size: 11px; color: var(--primary); font-weight: 500; margin-bottom: 3px;
}
.post-related-card-title {
  font-size: 14px; font-weight: 600; color: var(--text); line-height: 1.35;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.post-related-snippet {
  font-size: 12px; color: var(--text-muted); margin-top: 3px;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}

/* ===== POST COMMENTS ===== */
.post-comments-section {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border-light);
}
.post-comments-title {
  font-size: 15px; font-weight: 600; color: var(--text);
  margin-bottom: 16px;
}
.post-comment-item {
  display: flex; gap: 10px;
  margin-bottom: 14px;
}
.post-comment-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--primary-light); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
  flex-shrink: 0; overflow: hidden;
}
.post-comment-avatar img { width: 100%; height: 100%; object-fit: cover; }
.post-comment-body {
  flex: 1; min-width: 0;
}
.post-comment-meta {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 3px;
}
.post-comment-name {
  font-size: 13px; font-weight: 600; color: var(--text);
}
.post-comment-date {
  font-size: 11px; color: var(--text-muted);
}
.post-comment-text {
  font-size: 14px; color: var(--text); line-height: 1.5;
  word-wrap: break-word;
}
.post-comment-own-del {
  background: none; border: none; padding: 0;
  font-size: 11px; color: var(--text-muted); cursor: pointer;
  margin-left: auto; opacity: 0.6;
}
.post-comment-own-del:hover { opacity: 1; color: var(--danger); }
.post-comment-input {
  flex: 1; min-height: 40px; max-height: 120px;
  padding: 10px 12px; font-size: 14px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-secondary); color: var(--text);
  resize: none; outline: none; overflow-y: auto; line-height: 1.4;
  transition: border-color 0.15s;
}
.post-comment-input:focus { border-color: var(--primary); }
.post-comment-submit {
  flex-shrink: 0; width: 40px; height: 40px; padding: 0;
  font-size: 18px; border-radius: var(--radius-sm);
}
.post-comment-emoji-btn {
  flex-shrink: 0; width: 36px; height: 40px;
  background: none; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); transition: border-color 0.15s, background 0.15s;
}
.post-comment-emoji-btn:hover { border-color: var(--primary); background: var(--primary-light); }
.post-comment-emoji-picker {
  position: absolute; bottom: calc(100% + 6px); left: 0;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px;
  display: flex; flex-wrap: wrap; gap: 2px;
  width: 228px; box-shadow: 0 4px 16px rgba(0,0,0,.12);
  z-index: 50;
}
.post-comment-emoji-picker button {
  width: 32px; height: 32px; font-size: 18px;
  background: none; border: none; border-radius: 4px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.1s;
}
.post-comment-emoji-picker button:hover { background: var(--primary-light); }
.post-comment-form-wrap {
  position: relative; display: flex; gap: 8px; align-items: flex-end;
  margin-top: 16px;
}
.post-comments-upsell {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--bg-secondary); border: 1px solid var(--border-light);
  margin-top: 8px;
}
.post-comments-upsell-icon { font-size: 20px; flex-shrink: 0; }
.post-comments-upsell-text { font-size: 13px; color: var(--text-muted); line-height: 1.4; }
.post-comments-upsell-text a { color: var(--primary); text-decoration: none; font-weight: 600; }
.post-comment-reply-btn {
  background: none; border: none; padding: 0 2px; margin-top: 2px;
  font-size: 12px; color: var(--text-muted); cursor: pointer; opacity: 0.7;
  display: inline-flex; align-items: center; gap: 3px;
}
.post-comment-reply-btn:hover { opacity: 1; color: var(--primary); }
.post-comment-reply-context {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; border-radius: 8px;
  background: var(--primary-light); border-left: 3px solid var(--primary);
  margin-bottom: 4px; font-size: 12px; color: var(--text-secondary);
}
.post-comment-reply-context-cancel {
  margin-left: auto; background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 16px; line-height: 1; padding: 0 2px;
}
.post-comment-reply-quote {
  padding: 4px 8px; border-radius: 6px; border-left: 2px solid var(--primary);
  background: var(--bg-secondary); font-size: 12px; color: var(--text-muted);
  margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.post-comment-admin-badge {
  font-size: 10px; font-weight: 700; color: var(--primary);
  background: var(--primary-light); border-radius: 4px; padding: 1px 5px;
  flex-shrink: 0;
}

/* ===== RESPONSIVE: TABLET (768px+) ===== */
@media (min-width: 768px) {
  .main {
    max-width: 680px;
  }
  .card {
    padding: 28px;
  }
  .welcome-section {
    margin: 0 16px 8px;
    padding: 20px;
  }
  .article-slide {
    flex: 0 0 300px;
  }
  .article-slide-img { height: 160px; }
  .article-slide-video-wrap { height: 160px; }
  .params-grid {
    grid-template-columns: 1fr 1fr;
    gap: 14px;
  }
  .choice-grid {
    grid-template-columns: 1fr 1fr 1fr;
  }
  .reminder-card {
    padding: 18px;
  }
  .post-feed-card:active {
    transform: none;
  }
  .nav-icon {
    font-size: 22px;
  }
  .nav-label {
    font-size: 11px;
  }
  .bottom-nav {
    padding: 10px 0 max(10px, env(safe-area-inset-bottom));
  }
}

/* ===== RESPONSIVE: DESKTOP (1024px+) ===== */
@media (min-width: 1024px) {
  /* Sidebar navigation */
  .bottom-nav {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    right: auto;
    width: 220px;
    flex-direction: column;
    justify-content: flex-start;
    padding: 24px 12px;
    gap: 4px;
    border-top: none;
    border-right: 1px solid var(--border);
    box-shadow: 4px 0 20px rgba(0,0,0,0.04);
    overflow-y: auto;
  }
  .bottom-nav.hidden {
    display: none;
  }
  .nav-item {
    flex-direction: row;
    justify-content: flex-start;
    padding: 12px 16px;
    border-radius: var(--radius);
    flex: 0 0 auto;
    gap: 12px;
  }
  .nav-item.active::before {
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    width: 3px;
    height: 24px;
    border-radius: 0 3px 3px 0;
  }
  .nav-icon {
    font-size: 22px;
    margin-bottom: 0;
  }
  .nav-label {
    font-size: 14px;
    font-weight: 500;
  }

  /* Main content shifts right */
  .main {
    max-width: 860px;
    margin-left: 220px;
    margin-right: auto;
    padding-bottom: 40px;
  }
  /* Login screen stays centered */
  #view-login {
    margin-left: 0 !important;
  }

  .card {
    padding: 32px;
  }
  .welcome-section {
    padding: 20px 24px;
    margin: 0 20px 12px;
  }
  .welcome-text h2 {
    font-size: 18px;
  }
  .welcome-search-desktop {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0,0,0,0.2);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 12px;
    padding: 8px 14px;
    margin-right: 8px;
    cursor: pointer;
    font-size: 12px;
    color: rgba(255,255,255,0.4);
    transition: all var(--transition-fast);
    white-space: nowrap;
  }
  .welcome-search-desktop:hover {
    background: rgba(0,0,0,0.3);
    color: rgba(255,255,255,0.6);
  }
  .params-grid {
    grid-template-columns: 1fr 1fr 1fr;
  }
  .article-slide {
    flex: 0 0 320px;
  }
  .article-slide-img { height: 170px; }
  .article-slide-video-wrap { height: 170px; }

  /* Posts feed: 2-column grid */
  #postsFeed {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }
  .post-feed-card {
    margin-bottom: 0;
  }

  .header {
    padding: 20px 24px;
  }
  .header-title {
    font-size: 20px;
  }

  /* Q&A wider */
  .qa-result {
    padding: 22px;
  }

  /* Post detail: bigger image on desktop, no crop */
  .post-detail-media {
    max-height: 520px;
    max-width: 680px;
    margin-left: auto;
    margin-right: auto;
    object-fit: contain;
  }
}

/* ===== RESPONSIVE: WIDE DESKTOP (1280px+) ===== */
@media (min-width: 1280px) {
  .bottom-nav {
    width: 260px;
  }
  .main {
    max-width: 1000px;
    margin-left: 260px;
  }
  .article-slide {
    flex: 0 0 340px;
  }
  .article-slide-img { height: 180px; }
  .article-slide-video-wrap { height: 180px; }
  .choice-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ===== Feature Showcase ===== */
#featuresShowcase {
  display: block;
}
.feature-showcase-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 14px;
}
.features-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.feature-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 14px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  overflow: hidden;
}
.feature-card:active { transform: scale(0.97); }
.feature-card-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.feature-card-icon img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}
.feature-card-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}
.feature-card-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}
.feature-card-arrow {
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 12px;
  color: var(--text-muted);
  opacity: 0.5;
}
.feature-card.accent {
  grid-column: 1 / -1;
  flex-direction: row;
  align-items: center;
  gap: 16px;
  background: linear-gradient(135deg, var(--primary) 0%, #0ea5e9 100%);
  border-color: transparent;
}
.feature-card.accent .feature-card-name,
.feature-card.accent .feature-card-desc,
.feature-card.accent .feature-card-arrow { color: rgba(255,255,255,0.9); }
.feature-card.accent .feature-card-desc { color: rgba(255,255,255,0.75); }
.feature-card.accent .feature-card-arrow { opacity: 0.7; }
.feature-card.accent .feature-card-icon { background: rgba(255,255,255,0.2); }

/* ════════════════════════════════════════════════════════════════════
   FEATURE SHOWCASE v2 — hero + цветные плитки (.fx-* classes)
   ──────────────────────────────────────────────────────────────────── */

/* — Заголовок секции — */
.fx-showcase-head {
  margin-bottom: 16px;
  padding-left: 2px;
}
.fx-showcase-title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.4px;
  background: linear-gradient(135deg, #0f766e 0%, #0ea5e9 60%, #6366f1 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  line-height: 1.15;
}
.fx-showcase-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
  font-weight: 500;
}

/* — HERO BANNER (компактный, кластер иконок) — */
.fx-hero-banner {
  position: relative;
  border-radius: 22px;
  padding: 18px 18px;
  margin-bottom: 18px;
  overflow: hidden;
  background: linear-gradient(135deg, #0f766e 0%, #0d9488 30%, #0ea5e9 70%, #6366f1 100%);
  box-shadow: 0 10px 28px -10px rgba(15, 118, 110, 0.5), 0 3px 10px -3px rgba(99, 102, 241, 0.3);
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 116px;
  isolation: isolate;
  opacity: 0;
  animation: fxFadeUp 520ms cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
  animation-delay: var(--anim-delay, 0ms);
}
.fx-hero-banner-deco {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}
.fx-hero-banner-deco span {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  filter: blur(2px);
  animation: fxFloat 6s ease-in-out infinite;
}
.fx-hero-banner-deco span:nth-child(1) { width: 90px; height: 90px; top: -30px; left: -25px; }
.fx-hero-banner-deco span:nth-child(2) { width: 60px; height: 60px; bottom: -22px; left: 32%; animation-delay: 1.5s; }

/* «Бегущий» блик */
.fx-hero-banner::before {
  content: '';
  position: absolute;
  top: 0;
  left: -120%;
  width: 60%;
  height: 100%;
  background: linear-gradient(105deg, transparent 0%, rgba(255, 255, 255, 0.22) 50%, transparent 100%);
  transform: skewX(-20deg);
  animation: fxShineSweep 4.8s ease-in-out 1.2s infinite;
  z-index: 1;
  pointer-events: none;
}

.fx-hero-banner-text {
  position: relative;
  z-index: 2;
  flex: 1;
  min-width: 0;
}
.fx-hero-banner-title {
  font-size: 19px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.3px;
  line-height: 1.18;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}
.fx-hero-banner-sub {
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.92);
  margin-top: 6px;
  line-height: 1.4;
}

/* Кластер плавающих иконок справа */
.fx-hero-banner-icons {
  position: relative;
  z-index: 2;
  width: 96px;
  height: 96px;
  flex-shrink: 0;
}
.fx-hero-banner-icon {
  position: absolute;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.96);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px -2px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.7);
  animation: fxIconBob 3s ease-in-out infinite;
}
.fx-hero-banner-icon img {
  width: 26px;
  height: 26px;
  object-fit: contain;
}
/* Раскладка 5 иконок: 1 сверху-середина, 2 средние по краям, 2 снизу */
.fx-hib-0 { top: 0;     left: 30px; animation-delay: 0s;   }
.fx-hib-1 { top: 28px;  left: 0;    animation-delay: 0.4s; transform: rotate(-8deg); }
.fx-hib-2 { top: 28px;  right: 0;   animation-delay: 0.8s; transform: rotate(8deg);  }
.fx-hib-3 { bottom: 0;  left: 12px; animation-delay: 1.2s; transform: rotate(-4deg); }
.fx-hib-4 { bottom: 0;  right: 12px; animation-delay: 1.6s; transform: rotate(4deg); }

@media (max-width: 360px) {
  .fx-hero-banner-icons { width: 80px; height: 80px; }
  .fx-hero-banner-icon { width: 32px; height: 32px; border-radius: 10px; }
  .fx-hero-banner-icon img { width: 22px; height: 22px; }
  .fx-hib-0 { left: 24px; }
  .fx-hib-1 { top: 22px; }
  .fx-hib-2 { top: 22px; }
  .fx-hib-3 { left: 8px; }
  .fx-hib-4 { right: 8px; }
  .fx-hero-banner-title { font-size: 17px; }
  .fx-hero-banner-sub { font-size: 11.5px; }
}

/* — HERO CARD (legacy, более не рендерится — оставлено на случай отката) — */
.fx-hero-card {
  position: relative;
  border-radius: 22px;
  padding: 22px 20px 22px 20px;
  margin-bottom: 14px;
  overflow: hidden;
  cursor: pointer;
  background: linear-gradient(135deg, #0f766e 0%, #0d9488 35%, #0ea5e9 80%, #6366f1 100%);
  box-shadow: 0 12px 32px -8px rgba(15, 118, 110, 0.55), 0 4px 12px -2px rgba(99, 102, 241, 0.35);
  display: flex;
  flex-direction: column;
  gap: 6px;
  isolation: isolate;
  opacity: 0;
  animation: fxFadeUp 520ms cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
  animation-delay: var(--anim-delay, 0ms);
  transition: transform 200ms cubic-bezier(0.22, 0.61, 0.36, 1), box-shadow 200ms ease;
}
.fx-hero-card:active {
  transform: scale(0.98);
  box-shadow: 0 6px 18px -8px rgba(15, 118, 110, 0.55), 0 2px 6px -2px rgba(99, 102, 241, 0.35);
}

/* плавающие декоративные круги в фоне */
.fx-hero-deco {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}
.fx-hero-deco span {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  filter: blur(2px);
  animation: fxFloat 6s ease-in-out infinite;
}
.fx-hero-deco span:nth-child(1) { width: 110px; height: 110px; top: -40px; right: -30px; animation-delay: 0s; }
.fx-hero-deco span:nth-child(2) { width: 70px;  height: 70px;  bottom: -25px; left: 30%; animation-delay: 1.5s; background: rgba(255, 255, 255, 0.10); }
.fx-hero-deco span:nth-child(3) { width: 50px;  height: 50px;  top: 50%; left: -15px; animation-delay: 3s; background: rgba(255, 255, 255, 0.08); }

/* «бегущий блик» по hero */
.fx-hero-card::before {
  content: '';
  position: absolute;
  top: 0; left: -120%;
  width: 60%; height: 100%;
  background: linear-gradient(105deg, transparent 0%, rgba(255,255,255,0.25) 50%, transparent 100%);
  transform: skewX(-20deg);
  animation: fxShineSweep 4.5s ease-in-out 1.2s infinite;
  z-index: 1;
  pointer-events: none;
}

.fx-hero-badge {
  align-self: flex-start;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  color: #fff;
  background: rgba(255, 255, 255, 0.22);
  padding: 4px 10px;
  border-radius: 12px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  margin-bottom: 6px;
  position: relative;
  z-index: 2;
}

.fx-hero-icon {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 20px -4px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.4);
  z-index: 2;
  animation: fxIconBob 3s ease-in-out infinite;
}
.fx-hero-icon img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.18));
}

.fx-hero-body {
  position: relative;
  z-index: 2;
  padding-right: 76px;
}
.fx-hero-name {
  font-size: 20px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.3px;
  line-height: 1.2;
  text-shadow: 0 1px 2px rgba(0,0,0,0.12);
}
.fx-hero-desc {
  font-size: 13.5px;
  color: rgba(255, 255, 255, 0.92);
  margin-top: 6px;
  line-height: 1.45;
  padding-right: 0;
}
.fx-hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding: 9px 18px;
  background: rgba(255, 255, 255, 0.95);
  color: #0f766e;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.1px;
  box-shadow: 0 4px 14px -2px rgba(0, 0, 0, 0.2);
  align-self: flex-start;
  transition: transform 200ms ease;
}
.fx-hero-card:active .fx-hero-cta { transform: scale(0.96); }
.fx-hero-arrow {
  display: inline-block;
  transition: transform 200ms ease;
}
.fx-hero-card:hover .fx-hero-arrow { transform: translateX(3px); }

/* — Сетка плиток — */
.fx-tiles-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  grid-auto-rows: 1fr; /* плитки в одном ряду равной высоты */
  margin-bottom: 4px;
}

/* — Базовая плитка (тёмный градиент, глубокая как hero-баннер) — */
/* Grid-раскладка: иконка слева, имя+описание справа */
.fx-tile {
  position: relative;
  border-radius: 18px;
  padding: 12px 12px 14px;
  cursor: pointer;
  overflow: hidden;
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 10px;
  align-items: center;
  isolation: isolate;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 8px 22px -8px rgba(15, 23, 42, 0.4), 0 2px 6px -2px rgba(15, 23, 42, 0.18);
  opacity: 0;
  animation: fxFadeUp 460ms cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
  animation-delay: var(--anim-delay, 0ms);
  transition: transform 200ms cubic-bezier(0.22, 0.61, 0.36, 1), box-shadow 200ms ease;
}
.fx-tile:active {
  transform: scale(0.96);
  box-shadow: 0 4px 12px -4px rgba(15, 23, 42, 0.45);
}

/* «бегущий блик» — автоматически, как у hero-баннера */
.fx-tile::before {
  content: '';
  position: absolute;
  top: 0;
  left: -120%;
  width: 60%;
  height: 100%;
  background: linear-gradient(105deg, transparent 0%, rgba(255, 255, 255, 0.20) 50%, transparent 100%);
  transform: skewX(-20deg);
  animation: fxShineSweep 5.2s ease-in-out var(--shine-delay, 1.2s) infinite;
  z-index: 1;
  pointer-events: none;
}

/* фоновый блоб (декоративный круг в углу) — теперь крупнее и ярче */
.fx-tile-blob {
  position: absolute;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  top: -42px;
  right: -36px;
  z-index: 0;
  filter: blur(2px);
  opacity: 0.55;
  animation: fxFloat 7s ease-in-out infinite;
  animation-delay: var(--anim-delay, 0ms);
}

/* shine — оставлен на случай hover/tap (поверх auto-блика добавит ярче проход) */
.fx-tile-shine {
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 30%, rgba(255,255,255,0.45) 50%, transparent 70%);
  transform: translateX(-100%);
  pointer-events: none;
  z-index: 1;
  transition: transform 600ms ease;
}
.fx-tile:hover .fx-tile-shine,
.fx-tile:active .fx-tile-shine { transform: translateX(100%); }

.fx-tile-icon {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: -2px 0 6px -2px;
  transition: transform 220ms ease;
}
.fx-tile:active .fx-tile-icon { transform: scale(1.08) rotate(-3deg); }
.fx-tile-icon img {
  width: 38px;
  height: 38px;
  object-fit: contain;
  filter: drop-shadow(0 4px 10px rgba(15, 23, 42, 0.14));
}

.fx-tile-name {
  position: relative;
  z-index: 2;
  font-size: 13.5px;
  font-weight: 500;
  color: #fff;
  letter-spacing: -0.2px;
  line-height: 1.2;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
}
.fx-tile-desc {
  position: relative;
  z-index: 2;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.86);
  margin-top: 3px;
  line-height: 1.3;
  font-weight: 500;
  /* desc не больше 2 строк, одинаково смотрится в ряду */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
/* Иконка-картинка на тёмном фоне — белый «глассморфный» подложкой для контраста.
   Grid: занимает обе строки слева (рядом с name+desc) */
.fx-tile .fx-tile-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 4px 12px -2px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.7);
  margin: 0;
  grid-column: 1;
  grid-row: 1 / span 2;
  align-self: center;
}
.fx-tile-name { grid-column: 2; grid-row: 1; }
.fx-tile-desc { grid-column: 2; grid-row: 2; margin-top: 2px; }
.fx-tile-arrow {
  position: relative;
  z-index: 2;
  font-size: 16px;
  color: rgba(255, 255, 255, 0.75);
  align-self: flex-end;
  margin-top: 8px;
  opacity: 0.75;
  transition: transform 220ms ease, opacity 220ms ease;
}
.fx-tile:hover .fx-tile-arrow { transform: translateX(3px); opacity: 1; }

/* — Цветовые темы плиток (тёмные градиенты с лёгкой прозрачностью —
   подсвет белой подложки страницы делает плитки чуть «воздушнее») — */
.fx-tile.tile-purple {
  background: linear-gradient(160deg, rgba(107, 33, 168, 0.88) 0%, rgba(168, 85, 247, 0.88) 100%);
}
.fx-tile.tile-purple .fx-tile-blob { background: radial-gradient(circle, #e9d5ff 0%, transparent 70%); }

.fx-tile.tile-amber {
  background: linear-gradient(160deg, rgba(180, 83, 9, 0.88) 0%, rgba(245, 158, 11, 0.88) 100%);
}
.fx-tile.tile-amber .fx-tile-blob { background: radial-gradient(circle, #fef3c7 0%, transparent 70%); }

.fx-tile.tile-rose {
  background: linear-gradient(160deg, rgba(159, 18, 57, 0.88) 0%, rgba(251, 113, 133, 0.88) 100%);
}
.fx-tile.tile-rose .fx-tile-blob { background: radial-gradient(circle, #ffe4e6 0%, transparent 70%); }

.fx-tile.tile-green {
  background: linear-gradient(160deg, rgba(20, 83, 45, 0.88) 0%, rgba(34, 197, 94, 0.88) 100%);
}
.fx-tile.tile-green .fx-tile-blob { background: radial-gradient(circle, #dcfce7 0%, transparent 70%); }

.fx-tile.tile-indigo {
  background: linear-gradient(160deg, rgba(49, 46, 129, 0.88) 0%, rgba(99, 102, 241, 0.88) 100%);
}
.fx-tile.tile-indigo .fx-tile-blob { background: radial-gradient(circle, #e0e7ff 0%, transparent 70%); }

.fx-tile.tile-teal {
  background: linear-gradient(160deg, rgba(19, 78, 74, 0.88) 0%, rgba(20, 184, 166, 0.88) 100%);
}
.fx-tile.tile-teal .fx-tile-blob { background: radial-gradient(circle, #ccfbf1 0%, transparent 70%); }

/* — Анимации — */
@keyframes fxFadeUp {
  0%   { opacity: 0; transform: translateY(14px) scale(0.98); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes fxFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%      { transform: translate(8px, -10px) scale(1.06); }
}
@keyframes fxShineSweep {
  0%   { left: -120%; }
  60%  { left: 120%; }
  100% { left: 120%; }
}
@keyframes fxIconBob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-4px); }
}

/* — На очень узких экранах (<340px) — крупнее текст — */
@media (max-width: 340px) {
  .fx-tile { padding: 14px 12px 12px; }
  .fx-tile-icon { width: 46px; height: 46px; }
  .fx-tile-icon img { width: 28px; height: 28px; }
  .fx-tile-name { font-size: 13px; }
  .fx-tile-desc { font-size: 11px; }
}

/* — На широких (планшет) — 3 колонки и крупнее hero — */
@media (min-width: 768px) {
  .fx-tiles-grid { grid-template-columns: repeat(3, 1fr); }
  .fx-hero-name { font-size: 22px; }
  .fx-hero-desc { font-size: 14px; }
}

/* ── Заголовок категории на главной ── */
.fx-cat-head {
  margin: 22px 0 12px 2px;
  display: flex;
  align-items: center;
}
.fx-cat-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.1px;
  position: relative;
  padding-left: 14px;
}
.fx-cat-label::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 18px;
  border-radius: 3px;
  background: var(--cat-accent, var(--primary));
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--cat-accent, var(--primary)) 18%, transparent);
}
.fx-cat-emoji {
  font-size: 16px;
  line-height: 1;
}

/* ── Кнопка «Все возможности» ── */
.fx-all-btn {
  width: 100%;
  margin-top: 22px;
  padding: 16px 20px;
  border-radius: 16px;
  border: 1.5px solid var(--border);
  background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.1px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  opacity: 0;
  animation: fxFadeUp 480ms cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
  animation-delay: var(--anim-delay, 0ms);
  transition: transform 200ms ease, box-shadow 200ms ease, border-color 200ms ease;
  box-shadow: 0 2px 8px -2px rgba(15, 23, 42, 0.05);
}
.fx-all-btn:active {
  transform: scale(0.98);
}
.fx-all-btn:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 14px -4px rgba(15, 118, 110, 0.2);
}
.fx-all-btn-arrow {
  font-size: 18px;
  color: var(--primary);
  transition: transform 200ms ease;
}
.fx-all-btn:hover .fx-all-btn-arrow { transform: translateX(4px); }

/* ════════════════════════════════════════════════════════════════════
   VIEW-FEATURES-ALL: детальный каталог возможностей
   ──────────────────────────────────────────────────────────────────── */
.fx-all-intro {
  background: linear-gradient(135deg, #0f766e 0%, #0ea5e9 100%);
  border-radius: 18px;
  padding: 22px 20px;
  margin-bottom: 18px;
  color: #fff;
  position: relative;
  overflow: hidden;
}
.fx-all-intro::before {
  content: '';
  position: absolute;
  top: -30px; right: -30px;
  width: 110px; height: 110px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 50%;
  filter: blur(2px);
}
.fx-all-intro-title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.4px;
  position: relative;
  z-index: 1;
}
.fx-all-intro-sub {
  font-size: 13px;
  margin-top: 6px;
  opacity: 0.92;
  position: relative;
  z-index: 1;
  line-height: 1.4;
}

.fx-all-section {
  margin-bottom: 22px;
}
.fx-all-section-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
  margin: 0 0 10px 4px;
  position: relative;
  padding-left: 14px;
}
.fx-all-section-head::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 20px;
  border-radius: 3px;
  background: var(--cat-accent, var(--primary));
}
.fx-all-section-emoji {
  font-size: 18px;
  line-height: 1;
}

.fx-all-row {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}
.fx-all-row:active {
  transform: scale(0.98);
}
.fx-all-row:hover {
  border-color: rgba(15, 118, 110, 0.4);
  box-shadow: 0 4px 12px -4px rgba(15, 23, 42, 0.08);
}

.fx-all-row-icon {
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  box-shadow: 0 4px 10px -3px rgba(15, 23, 42, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}
.fx-all-row-icon img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(15, 23, 42, 0.1));
}
/* цветные «фоны» иконок повторяют тему плитки */
.fx-all-row-icon.tile-purple { background: linear-gradient(135deg, #faf5ff, #f3e8ff); }
.fx-all-row-icon.tile-amber  { background: linear-gradient(135deg, #fffbeb, #fef3c7); }
.fx-all-row-icon.tile-rose   { background: linear-gradient(135deg, #fff1f2, #ffe4e6); }
.fx-all-row-icon.tile-green  { background: linear-gradient(135deg, #f0fdf4, #dcfce7); }
.fx-all-row-icon.tile-indigo { background: linear-gradient(135deg, #eef2ff, #e0e7ff); }
.fx-all-row-icon.tile-teal   { background: linear-gradient(135deg, #f0fdfa, #ccfbf1); }

.fx-all-row-body {
  flex: 1;
  min-width: 0;
}
.fx-all-row-name {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.2px;
  line-height: 1.25;
}
.fx-all-row-desc {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.4;
}
.fx-all-row-arrow {
  flex-shrink: 0;
  font-size: 20px;
  color: var(--text-muted);
  opacity: 0.5;
  font-weight: 300;
  align-self: center;
}

/* — Footer-карточка «Стартуйте бесплатно» — */
.fx-all-footer {
  margin-top: 22px;
  padding: 22px 20px;
  border-radius: 18px;
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  text-align: center;
  border: 1px solid rgba(251, 191, 36, 0.4);
}
.fx-all-footer-icon {
  font-size: 28px;
  line-height: 1;
  margin-bottom: 6px;
}
.fx-all-footer-title {
  font-size: 16px;
  font-weight: 800;
  color: #78350f;
  letter-spacing: -0.2px;
}
.fx-all-footer-desc {
  font-size: 12.5px;
  color: #92400e;
  line-height: 1.45;
  margin: 8px auto 14px;
  max-width: 360px;
}
.fx-all-footer-btn {
  background: #f59e0b;
  color: #fff;
  border: 0;
  padding: 11px 24px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px -4px rgba(245, 158, 11, 0.5);
  transition: transform 200ms ease, box-shadow 200ms ease;
}
.fx-all-footer-btn:active { transform: scale(0.96); }
.fx-all-footer-btn:hover { box-shadow: 0 6px 18px -4px rgba(245, 158, 11, 0.6); }

/* ===== Print document (красивая выписка для печати/PDF) =====
   Структура:
   - .print-doc по умолчанию display:none — документа на экране нет
   - Все .pd-* стили живут как обычные правила (не внутри @media print) —
     чтобы их можно было применять и при window.print(), и при on-screen
     preview-режиме (для Capacitor APK где window.print() недоступен)
   - @media print управляет тем что показывается при реальной печати
   - body.pd-preview-active включает on-screen preview overlay
*/
.print-doc { display: none; }

/* Шторка опций печати — список секций */
.print-opt-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 11px 12px; border-radius: 10px;
  background: var(--bg-subtle, #f8fafc);
  cursor: pointer; user-select: none;
  transition: background 150ms ease;
}
.print-opt-row:hover { background: #eef2f6; }
.print-opt-row input[type="checkbox"] {
  width: 18px; height: 18px; margin: 1px 0 0 0; flex-shrink: 0;
  accent-color: var(--primary, #0f766e);
}
.print-opt-row.locked { opacity: 0.7; cursor: not-allowed; }
.print-opt-row .print-opt-title { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.print-opt-row .print-opt-hint  { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* === .pd-* стили документа — переиспользуются в @media print И в .pd-preview-active === */

  /* Обложка */
  /* Обложка не форсит разрыв — иначе на странице 1 остаётся много пустого места.
     Контент течёт дальше; визуальная граница — небольшой margin-bottom + следующий h2 имеет border. */
  .pd-cover { padding-top: 4mm; margin-bottom: 6pt; page-break-inside: avoid; }
  .pd-cover-grid { margin-bottom: 6pt; }
  .pd-record-stamp { margin-top: 8pt; }
  .pd-brand-row {
    display: flex; align-items: center; justify-content: space-between;
    border-bottom: 1.5pt solid #0f766e;
    padding-bottom: 6pt; margin-bottom: 14pt;
  }
  .pd-brand {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 14pt; font-weight: 700; color: #0f766e;
    letter-spacing: 0.3pt;
  }
  .pd-brand-meta { font-size: 9pt; color: #6b7280; text-align: right; }
  .pd-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 28pt; font-weight: 700; color: #0f172a;
    margin: 14pt 0 4pt 0; line-height: 1.15; letter-spacing: -0.3pt;
  }
  .pd-subtitle { font-size: 12pt; color: #64748b; margin-bottom: 22pt; font-style: italic; }
  .pd-cover-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 12pt;
    margin-bottom: 18pt;
  }
  .pd-card {
    border: 0.75pt solid #cbd5e1; border-radius: 6pt;
    padding: 11pt 13pt; background: #f8fafc;
  }
  .pd-card-label {
    font-size: 8.5pt; font-weight: 700; color: #0f766e;
    text-transform: uppercase; letter-spacing: 0.6pt;
    margin-bottom: 6pt;
  }
  .pd-card-name { font-size: 14pt; font-weight: 700; color: #0f172a; margin-bottom: 4pt; }
  .pd-card-with-avatar { position: relative; padding-top: 14pt; }
  .pd-pet-avatar {
    width: 56pt; height: 56pt; border-radius: 50%;
    object-fit: cover; border: 1.5pt solid #fff;
    box-shadow: 0 1pt 4pt rgba(15,118,110,0.25);
    float: right; margin: -4pt -4pt 4pt 8pt;
    background: #f1f5f9;
  }
  /* Подпись врача + печать.
     Layout: 2 колонки (Подпись 1fr | Дата 110pt). Печать живёт ВНУТРИ
     `pd-sign-line` подписи как абсолютно позиционированный SVG, частично
     перекрывая правый край подписи — стандартное русское оформление. */
  .pd-sign-row { grid-template-columns: 1fr 110pt !important; gap: 22pt !important; align-items: end !important; }
  .pd-sign-box { position: relative; }
  /* Линия становится позиционирующим контейнером для подписи и печати */
  .pd-sign-box .pd-sign-line { position: relative; height: 36pt; }
  .pd-sign-img {
    position: absolute;
    bottom: -4pt;          /* центр-низ картинки касается линии */
    left: 50%;
    height: 38pt;
    max-width: 70%;
    object-fit: contain;
    transform: translateX(-60%) rotate(-4deg);
    pointer-events: none;
    /* Если файла нет — onerror скроет элемент, линия остаётся пустой */
  }
  .pd-stamp-box {
    position: absolute;
    right: -32pt;
    bottom: -34pt;          /* печать частично свисает ниже линии */
    z-index: 2;
    display: flex; align-items: flex-end; justify-content: center;
    pointer-events: none;
  }
  .pd-stamp {
    transform: rotate(-5deg);
    opacity: 0.92;
    filter: drop-shadow(0 1pt 2pt rgba(15,118,110,0.2));
  }
  /* Текст даты сразу над линией «Сформировано» */
  .pd-sign-date-text {
    position: absolute;
    bottom: 4pt;
    left: 0; right: 0;
    text-align: center;
    font-size: 10.5pt;
    color: #1f2937;
    font-weight: 500;
  }
  .pd-card-line { font-size: 10pt; color: #475569; margin-top: 2pt; line-height: 1.4; }
  .pd-card-line strong { color: #1f2937; font-weight: 600; }
  .pd-record-stamp {
    margin-top: 12pt; padding: 8pt 12pt;
    background: #ecfdf5; border-left: 2pt solid #0f766e;
    font-size: 10pt; color: #064e3b;
    border-radius: 0 4pt 4pt 0;
  }

  /* Секции */
  .pd-section { margin-top: 16pt; page-break-inside: avoid; }
  .pd-section h2 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 15pt; font-weight: 700; color: #0f766e;
    border-bottom: 1pt solid #0f766e;
    padding-bottom: 4pt; margin: 0 0 10pt 0;
  }
  .pd-prose { font-size: 10.5pt; line-height: 1.6; color: #1f2937; white-space: pre-wrap; }
  .pd-prose p { margin: 0 0 6pt 0; }

  /* Диагнозы */
  .pd-diag-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 8pt;
  }
  .pd-diag-block {
    border-radius: 6pt; overflow: hidden;
    border: 0.5pt solid #e5e7eb;
    page-break-inside: avoid;
  }
  .pd-diag-head {
    padding: 5pt 11pt; font-size: 9.5pt; font-weight: 700;
    color: #fff;
  }
  .pd-diag-body {
    padding: 8pt 11pt; background: #fafafa; font-size: 10pt; line-height: 1.5;
  }
  .pd-diag-body div + div { margin-top: 5pt; padding-top: 5pt; border-top: 0.5pt dashed #cbd5e1; }

  /* Таблицы (назначения, адерентность) */
  .pd-table {
    width: 100%; border-collapse: collapse; font-size: 9.5pt;
    margin-top: 4pt;
  }
  .pd-table th {
    background: #f0fdfa; color: #0f766e;
    padding: 6pt 8pt; text-align: left;
    font-weight: 700; border-bottom: 1pt solid #0f766e;
  }
  .pd-table td {
    padding: 6pt 8pt; border-bottom: 0.5pt solid #e5e7eb;
    vertical-align: top; line-height: 1.4;
  }
  .pd-table tr { page-break-inside: avoid; }
  .pd-table .pd-num {
    color: #6b7280; font-variant-numeric: tabular-nums;
    font-size: 9pt; text-align: center; width: 18pt;
  }
  .pd-instr { font-style: italic; color: #6b7280; font-size: 9pt; margin-top: 2pt; }

  /* Адерентность — bar */
  .pd-adh-cell { min-width: 60pt; }
  .pd-adh-bar {
    width: 100%; height: 7pt; background: #e5e7eb;
    border-radius: 99pt; overflow: hidden; margin-top: 3pt;
  }
  .pd-adh-fill { height: 100%; border-radius: 99pt; }
  .pd-adh-pct  { font-size: 9.5pt; font-weight: 700; }

  /* План диагностики (буллеты) */
  .pd-bullets { padding-left: 14pt; margin: 0; }
  .pd-bullets li { margin-bottom: 4pt; line-height: 1.5; font-size: 10pt; }
  .pd-bullets .pd-urgent {
    display: inline-block; margin-left: 6pt;
    background: #fee2e2; color: #991b1b;
    padding: 1pt 6pt; border-radius: 99pt;
    font-size: 8pt; font-weight: 700;
  }

  /* Дневник лечения — треды по дням */
  .pd-day { margin-bottom: 14pt; page-break-inside: avoid; }
  .pd-day-head {
    font-size: 11pt; font-weight: 700; color: #0f172a;
    border-bottom: 0.5pt solid #cbd5e1; padding-bottom: 3pt; margin-bottom: 7pt;
  }
  .pd-day-summary {
    margin-bottom: 7pt; padding: 7pt 10pt;
    background: #fffbeb; border-left: 2pt solid #f59e0b;
    font-size: 10pt; line-height: 1.5; color: #78350f;
    border-radius: 0 4pt 4pt 0;
  }
  .pd-msg {
    margin-bottom: 6pt; padding: 7pt 10pt;
    border-radius: 6pt; font-size: 10pt; line-height: 1.5;
    page-break-inside: avoid;
  }
  .pd-msg.owner { background: #eff6ff; border-left: 2pt solid #3b82f6; }
  .pd-msg.doctor { background: #f0fdf4; border-left: 2pt solid #16a34a; }
  .pd-msg.reply { margin-left: 14pt; }
  .pd-msg-meta { font-size: 8.5pt; color: #6b7280; font-weight: 600; margin-bottom: 3pt; text-transform: uppercase; letter-spacing: 0.3pt; }
  .pd-msg-text { color: #1f2937; white-space: pre-wrap; }
  .pd-msg-atts {
    display: flex; flex-wrap: wrap; gap: 4pt; margin-top: 5pt;
  }
  .pd-msg-atts img {
    width: 80px; height: 80px; object-fit: cover;
    border: 0.5pt solid #cbd5e1; border-radius: 4pt;
  }
  .pd-msg-atts .pd-att-pdf {
    width: 80px; height: 80px;
    display: flex; align-items: center; justify-content: center;
    background: #f1f5f9; border: 0.5pt solid #cbd5e1; border-radius: 4pt;
    font-size: 9pt; color: #475569; text-align: center; padding: 4pt;
  }

  /* Журнал изменений */
  .pd-change-row {
    display: grid; grid-template-columns: 70pt 60pt 1fr;
    gap: 8pt; padding: 5pt 0;
    border-bottom: 0.5pt solid #e5e7eb; font-size: 9.5pt; line-height: 1.4;
    page-break-inside: avoid;
  }
  .pd-change-date { color: #6b7280; font-variant-numeric: tabular-nums; }
  .pd-change-author {
    display: inline-block; padding: 1pt 6pt; border-radius: 99pt;
    font-size: 8pt; font-weight: 700; text-align: center;
    height: fit-content;
  }
  .pd-change-author.doc { background: #d1fae5; color: #065f46; }
  .pd-change-author.usr { background: #dbeafe; color: #1e40af; }
  .pd-change-text { color: #1f2937; }
  .pd-change-text em { color: #6b7280; font-style: italic; }

  /* Подпись */
  .pd-signature {
    margin-top: 32pt; padding-top: 12pt;
    border-top: 1pt solid #94a3b8;
    font-size: 10pt; color: #475569;
    page-break-inside: avoid;
  }
  .pd-sign-row {
    display: grid; grid-template-columns: 1fr 1fr; gap: 24pt;
    margin-top: 18pt;
  }
  .pd-sign-line {
    position: relative;
    border-bottom: 0.5pt solid #475569; height: 22pt;
  }
  .pd-sign-label {
    font-size: 8.5pt; color: #6b7280; margin-top: 3pt;
    text-transform: uppercase; letter-spacing: 0.5pt;
  }
  /* Домашний осмотр в выписке */
  .pd-he-disclaimer {
    margin-bottom: 10pt; padding: 6pt 10pt;
    background: #fffbeb; border: 0.5pt solid #f59e0b; border-radius: 4pt;
    font-size: 9pt; color: #92400e; line-height: 1.45; font-style: italic;
  }
  .pd-he-card {
    margin-bottom: 12pt; padding: 10pt 12pt;
    background: #f8fafc; border: 0.5pt solid #e2e8f0; border-radius: 4pt;
    page-break-inside: avoid;
  }
  .pd-he-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 8pt; padding-bottom: 4pt; border-bottom: 0.5pt solid #e2e8f0;
  }
  .pd-he-date { font-size: 10pt; font-weight: 600; color: #1e293b; }
  .pd-he-badge {
    font-size: 8.5pt; font-weight: 600; padding: 2pt 8pt; border-radius: 10pt;
  }
  .pd-he-badge-green { background: #dcfce7; color: #166534; }
  .pd-he-badge-yellow { background: #fef9c3; color: #854d0e; }
  .pd-he-badge-red { background: #fee2e2; color: #991b1b; }
  .pd-he-group { margin-bottom: 6pt; }
  .pd-he-group-title {
    font-size: 9pt; font-weight: 700; color: #0f766e; text-transform: uppercase;
    letter-spacing: 0.3pt; margin-bottom: 3pt;
  }
  .pd-he-table { width: 100%; border-collapse: collapse; font-size: 9.5pt; }
  .pd-he-table td { padding: 2pt 4pt; border-bottom: 0.25pt solid #f1f5f9; }
  .pd-he-label { color: #64748b; width: 40%; }
  .pd-he-value { color: #1e293b; font-weight: 500; }
  .pd-he-notes {
    margin-top: 6pt; padding: 4pt 8pt;
    background: #fff; border-radius: 3pt; border: 0.5pt solid #e2e8f0;
    font-size: 9pt; color: #475569; line-height: 1.4;
  }
  .pd-he-notes-label { font-weight: 600; color: #334155; }
  .pd-he-skin { margin-top: 6pt; }
  .pd-he-skin-item { font-size: 9pt; color: #475569; margin: 2pt 0; padding-left: 6pt; }

  .pd-disclaimer {
    margin-top: 18pt; padding: 8pt 12pt;
    background: #f8fafc; border-radius: 4pt;
    font-size: 8.5pt; color: #64748b; line-height: 1.45; font-style: italic;
  }

/* === On-screen preview-режим (используется на Capacitor APK где window.print() — no-op) === */
body.pd-preview-active > *:not(#printDocument):not(.loading-overlay) { display: none !important; }
body.pd-preview-active {
  background: #e2e8f0 !important;
  margin: 0 !important; padding: 0 !important;
  overflow-y: auto !important;
}
body.pd-preview-active .print-doc {
  display: block !important;
  max-width: 794px;
  margin: 0 auto 80px auto;
  padding: 18mm 16mm;
  background: #fff;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  font-family: 'Manrope', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-size: 10.5pt; line-height: 1.55; color: #1f2937;
}
#pdPreviewTopBar {
  position: fixed; top: 12px; left: 12px; right: 12px; z-index: 999999;
  display: flex; justify-content: space-between; gap: 12px;
  pointer-events: none;
}
#pdPreviewTopBar > button { pointer-events: auto; }
#pdPreviewClose, #pdPreviewPdf {
  background: #0f766e; color: #fff; border: none;
  padding: 10px 16px; border-radius: 24px; font-size: 14px; font-weight: 600;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25); cursor: pointer;
  white-space: nowrap;
}
#pdPreviewPdf { background: #2563eb; }
#pdPreviewPdf:disabled { background: #94a3b8; cursor: wait; }
#pdPreviewHint {
  position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 999999;
  background: rgba(15,23,42,0.92); color: #fff; padding: 10px 16px; border-radius: 12px;
  font-size: 13px; max-width: 92vw; text-align: center; line-height: 1.4;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  transition: opacity 0.4s ease;
}

/* === Реальная печать === */
@media print {
  body > *:not(#printDocument) { display: none !important; }
  html, body { background: #fff !important; margin: 0 !important; padding: 0 !important; }
  body.pd-preview-active { background: #fff !important; }
  body.pd-preview-active > *:not(#printDocument) { display: none !important; }
  #pdPreviewClose, #pdPreviewHint, #pdPreviewTopBar, #pdPreviewPdf { display: none !important; }

  @page {
    size: A4;
    margin: 18mm 16mm 22mm 16mm;
    @bottom-right {
      content: counter(page) " / " counter(pages);
      font-family: 'Manrope', system-ui, sans-serif;
      font-size: 9pt;
      color: #6b7280;
    }
  }

  .print-doc {
    display: block !important;
    font-family: 'Manrope', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
    font-size: 10.5pt;
    line-height: 1.55;
    color: #1f2937;
    background: #fff;
    max-width: none !important; margin: 0 !important; padding: 0 !important;
    box-shadow: none !important;
  }
}

/* ============================================
   Health Records (Vaccinations & Treatments)
   ============================================ */
.health-records-section {
  background: var(--card-bg, #ffffff);
  border-radius: var(--radius);
  padding: 14px 16px;
  border: 1px solid var(--border);
}
.health-records-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.health-section-icon {
  width: 22px;
  height: 22px;
  object-fit: contain;
  vertical-align: middle;
  margin-right: 2px;
}
.health-records-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text, #0f172a);
}
.health-records-add-btn {
  background: none;
  border: 1.5px solid var(--primary);
  color: var(--primary);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.health-records-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.health-record-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-subtle);
  border-radius: 6px;
}
.health-record-info {
  flex: 1;
  min-width: 0;
}
.health-record-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text, #0f172a);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.health-record-dates {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 3px;
}
.health-record-next {
  font-size: 12px;
  margin-top: 2px;
}
.health-record-next.soon {
  color: #d97706;
  font-weight: 600;
}
.health-record-next.overdue {
  color: var(--danger);
  font-weight: 600;
}
.health-record-next.ok {
  color: var(--success);
}
.health-record-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.health-record-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: var(--card-bg, #ffffff);
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.health-record-btn.danger { color: var(--danger); }
.health-records-empty {
  text-align: center;
  padding: 12px 0 4px;
  color: var(--text-muted);
  font-size: 13px;
}
.health-history-header {
  margin-top: 10px;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid var(--border);
}
.health-history-header:hover { background: var(--bg-subtle); }
.health-history-header.open { border-radius: 6px 6px 0 0; border-bottom-color: transparent; }
.health-history-body {
  display: none;
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 6px 6px;
  padding: 8px;
  background: var(--card-bg);
}
.health-history-body.open { display: flex; flex-direction: column; gap: 8px; }
.health-history-body .health-record-item { opacity: 0.65; }

/* Quick date buttons */
.hr-quick-dates {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.hr-quick-btn {
  background: var(--bg-subtle);
  border: 1.5px solid var(--border);
  color: var(--text-secondary);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}
.hr-quick-btn:hover, .hr-quick-btn.active {
  background: var(--primary-light, #eff6ff);
  border-color: var(--primary);
  color: var(--primary);
}

/* Home reminders */
.home-reminder-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card-bg, #ffffff);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s, transform 0.2s, opacity 0.2s;
  touch-action: pan-y;
  user-select: none;
  overflow: hidden;
  position: relative;
}
.home-reminder-card:last-child { margin-bottom: 0; }
.home-reminder-card:hover { background: var(--bg-subtle); }
.home-reminder-card.dismissing {
  transform: translateX(110%);
  opacity: 0;
}
.home-reminder-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.home-reminder-icon.vaccine { background: transparent; }
.home-reminder-icon.treatment { background: transparent; }
.home-reminder-body {
  flex: 1;
  min-width: 0;
}
.home-reminder-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text, #0f172a);
}
.home-reminder-sub {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}
.home-reminder-date {
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
  text-align: right;
}
.home-reminder-date.today { color: var(--danger); }
.home-reminder-date.soon  { color: #d97706; }
.home-reminder-date.ok    { color: var(--success); }
.reminders-skeleton {
  height: 60px;
  background: var(--bg-subtle);
  border-radius: var(--radius);
  animation: pulse 1.5s ease-in-out infinite;
}
.home-reminders-empty {
  text-align: center;
  padding: 20px 0;
  color: var(--text-muted);
  font-size: 14px;
}

/* ==== Home calendar (компактный месячный) ==== */
.home-cal {
  background: var(--card-bg, #ffffff);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  user-select: none;
}
.home-cal-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.home-cal-month {
  font-size: 14px; font-weight: 600; color: var(--text);
  text-transform: capitalize;
}
.home-cal-nav {
  width: 32px; height: 32px; border-radius: 8px; border: none;
  background: transparent; cursor: pointer; font-size: 16px;
  color: var(--text); display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.home-cal-nav:hover, .home-cal-nav:active { background: var(--bg-subtle); }
.home-cal-weekdays {
  display: grid; grid-template-columns: repeat(7, 1fr);
  font-size: 11px; color: var(--text-secondary);
  text-align: center; margin-bottom: 4px; font-weight: 500;
}
.home-cal-grid {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 2px; touch-action: pan-y;
}
.home-cal-cell {
  aspect-ratio: 1 / 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  font-size: 13px; color: var(--text);
  border-radius: 8px; cursor: pointer;
  position: relative;
  transition: background 0.12s;
}
.home-cal-cell.other-month { color: var(--text-muted); opacity: 0.4; }
.home-cal-cell.today {
  border: 2px solid var(--primary);
  border-radius: 50%;
  font-weight: 700;
}
.home-cal-cell.has-events { font-weight: 600; }
.home-cal-cell.has-events:active,
.home-cal-cell.has-events:hover { background: var(--bg-subtle); }
.home-cal-num { line-height: 1; }
.home-cal-dots {
  display: flex; gap: 2px; margin-top: 3px;
  height: 6px; align-items: center; justify-content: center;
}
.home-cal-dot {
  width: 5px; height: 5px; border-radius: 50%;
  display: inline-block;
}
.home-cal-dot.dot-vaccination { background: #0f766e; }
.home-cal-dot.dot-treatment { background: #f97316; }
.home-cal-dot.dot-investigation,
.home-cal-dot.dot-medication { background: #f5b800; }
.home-cal-dot.dot-consultation { background: #8b5cf6; }
.home-cal-dot.dot-overdue { background: #ef4444; }
.home-cal-more {
  font-size: 9px; color: var(--text-secondary);
  line-height: 1; margin-left: 1px;
}
.home-cal-legend {
  display: flex; flex-wrap: wrap; gap: 8px 12px;
  margin-top: 10px; padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 11px; color: var(--text-secondary);
}
.home-cal-legend-item { display: flex; align-items: center; gap: 4px; }

@media (min-width: 768px) {
  /* two-column layout: calendar left, reminders right */
  #homeRemindersWrap {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 0 20px;
    align-items: start;
  }
  #homeRemindersWrap > .section-header { grid-column: 1 / -1; grid-row: 1; }
  #homeCalendar { grid-row: 2; grid-column: 1; margin-top: 0 !important; }
  #homeRemindersList { grid-row: 2; grid-column: 2; }

  /* compact calendar */
  .home-cal { max-width: 380px; width: 380px; padding: 10px; }
  .home-cal-head { margin-bottom: 4px; }
  .home-cal-nav { width: 28px; height: 28px; }
  .home-cal-weekdays { margin-bottom: 2px; }
  .home-cal-grid { gap: 1px; }
  .home-cal-cell { aspect-ratio: auto; padding: 6px 0; }
  .home-cal-dots { margin-top: 2px; height: 5px; }
  .home-cal-dot { width: 4px; height: 4px; }
}

/* «Запланировать» блок в bottom-sheet'е дня */
.home-day-add {
  margin-top: 10px; padding-top: 14px;
  border-top: 1px dashed var(--border);
}
.home-day-add-hdr {
  font-size: 13px; font-weight: 600; color: var(--text-secondary);
  margin-bottom: 8px;
}
.home-day-add-btns {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
}
.home-day-add-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; border-radius: 10px;
  background: var(--bg-subtle); border: 1px solid var(--border);
  font-size: 14px; font-weight: 500; color: var(--text);
  cursor: pointer; transition: background 0.12s, border-color 0.12s;
}
.home-day-add-btn:hover, .home-day-add-btn:active {
  background: var(--card-bg); border-color: var(--primary);
}
.home-day-add-ic { font-size: 18px; line-height: 1; }
.home-day-pet-picker {
  margin-top: 10px; padding: 10px;
  background: var(--bg-subtle); border-radius: 10px;
}
.home-day-pet-picker-hdr {
  font-size: 12px; font-weight: 600; color: var(--text-secondary);
  margin-bottom: 6px;
}
.home-day-pet-row {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 8px 10px; margin-bottom: 6px;
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: 8px; cursor: pointer; font-size: 14px; color: var(--text);
  text-align: left;
}
.home-day-pet-row:last-child { margin-bottom: 0; }
.home-day-pet-row:hover, .home-day-pet-row:active { border-color: var(--primary); }
.home-day-pet-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--bg-subtle); display: flex; align-items: center;
  justify-content: center; font-size: 18px; overflow: hidden;
  flex-shrink: 0;
}
.home-day-pet-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* Health record bottom sheet */
.sheet-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1200;
  display: none;
}
.sheet-overlay.open { display: block; }
.bottom-sheet-panel {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--card-bg, #ffffff);
  border-radius: 20px 20px 0 0;
  padding: 8px 20px 36px;
  z-index: 1201;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(.4,0,.2,1);
  max-height: 92vh;
  overflow-y: auto;
}
.bottom-sheet-panel.open { transform: translateY(0); box-shadow: 0 -4px 24px rgba(0,0,0,0.15); }
.sheet-handle {
  width: 36px; height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 0 auto 16px;
}
.sheet-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text, #0f172a);
  margin-bottom: 18px;
  text-align: center;
}
/* Залипающая кнопка «назад» в верхнем-левом углу шторок с результатами —
   видна при скролле, чтобы не искать «Закрыть» внизу */
.sheet-back {
  position: sticky;
  top: 0;
  z-index: 6;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin-bottom: -36px;
  border: none;
  border-radius: 50%;
  background: var(--bg-subtle, #f1f5f9);
  color: var(--text, #0f172a);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}
.sheet-back:active { transform: scale(0.92); }

/* ─── WebRTC: индикатор качества + reconnect overlay + settings sheet ─── */
/* Круглая кнопка управления звонком (mic/cam/flip/speaker/pip/settings) */
.wrtc-btn-circle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 22px;
  cursor: pointer;
}
.wrtc-btn-circle:hover { background: rgba(255, 255, 255, 0.25); }
/* Кнопка динамика: иконка + подпись + явное активное состояние (громкая связь) */
.wrtc-spk-btn { display:flex; flex-direction:column; align-items:center; justify-content:center; gap:1px; font-size:20px; line-height:1; }
.wrtc-spk-btn .wrtc-spk-lbl { font-size:9px; font-weight:600; letter-spacing:.2px; opacity:.9; }
.wrtc-btn-circle.active { background:#22c55e; color:#fff; }
.wrtc-btn-circle.active:hover { background:#16a34a; }

.wrtc-quality {
  display:inline-flex; align-items:center; gap:4px;
  background:rgba(0,0,0,0.45); padding:4px 8px; border-radius:14px;
  color:#fff; font-size:11px; line-height:1; min-height:20px;
  pointer-events:none;
}
.wrtc-quality .q-bars { display:inline-flex; align-items:flex-end; gap:2px; height:14px; }
.wrtc-quality .q-bar {
  width:3px; height:var(--qh, 10px); border-radius:1px;
  background:rgba(255,255,255,0.25);
  transition: background 200ms ease, height 200ms ease;
}
.wrtc-quality .q-bars.qual-pulse .q-bar.on { animation: qualPulse 1.2s ease-in-out infinite; }
@keyframes qualPulse { 0%,100% { opacity:1; } 50% { opacity:0.55; } }

/* ───── Audio call view (как в Telegram) ───── */
.wrtc-audio-avatar {
  position:relative; z-index:2;
  width:180px; height:180px; border-radius:50%;
  display:flex; align-items:center; justify-content:center;
  overflow:hidden; box-shadow:0 0 40px rgba(0,0,0,0.5);
  border:3px solid rgba(255,255,255,0.15);
}
.wrtc-audio-avatar-video {
  width:100%; height:100%; object-fit:cover; display:block;
}
.wrtc-audio-pulse {
  position:absolute; inset:0; border-radius:50%;
  border:3px solid rgba(255,255,255,0.35);
  animation: wrtcAudioPulse 1.8s ease-out infinite;
  pointer-events:none;
}
@keyframes wrtcAudioPulse {
  0%   { transform: scale(1);    opacity: 0.8; }
  80%  { opacity: 0.05; }
  100% { transform: scale(1.55); opacity: 0; }
}

#wrtcReconnectOverlay[data-variant="degraded"] { background:rgba(250,204,21,0.18); }
#wrtcReconnectOverlay[data-variant="reconnecting"] { background:rgba(0,0,0,0.65); }
#wrtcReconnectOverlay[data-variant="lost"] { background:rgba(239,68,68,0.22); }

.wrtc-platform-warn {
  position:fixed; top:16px; left:50%; transform:translateX(-50%);
  max-width:360px; background:rgba(30,41,59,0.96); color:#fff;
  padding:12px 16px; border-radius:12px; font-size:13px; line-height:1.4;
  z-index:10000; box-shadow:0 8px 32px rgba(0,0,0,0.4); cursor:pointer;
}

#wrtcSettingsSheet .wrtc-row {
  display:flex; align-items:center; justify-content:space-between;
  padding:10px 0; border-bottom:1px solid rgba(255,255,255,0.08);
  font-size:14px;
}
#wrtcSettingsSheet .wrtc-row:last-child { border-bottom:0; }
#wrtcSettingsSheet .wrtc-row-col { flex-direction:column; align-items:stretch; gap:6px; }
#wrtcSettingsSheet .wrtc-row input[type="checkbox"] { width:42px; height:24px; appearance:none; background:#334155; border-radius:12px; position:relative; cursor:pointer; transition:background 200ms; }
#wrtcSettingsSheet .wrtc-row input[type="checkbox"]::before { content:''; position:absolute; top:2px; left:2px; width:20px; height:20px; border-radius:50%; background:#fff; transition:left 200ms; }
#wrtcSettingsSheet .wrtc-row input[type="checkbox"]:checked { background:#10b981; }
#wrtcSettingsSheet .wrtc-row input[type="checkbox"]:checked::before { left:20px; }
#wrtcSettingsSheet .wrtc-sel {
  width:100%; background:#0f172a; color:#fff; border:1px solid #334155;
  border-radius:8px; padding:8px 10px; font-size:13px;
}
#wrtcSettingsSheet .wrtc-preset-btn {
  flex:1 1 calc(50% - 8px); min-width:96px;
  padding:10px; border:1px solid #334155; border-radius:8px;
  background:#0f172a; color:#fff; font-size:13px; cursor:pointer;
  transition: background 200ms, border-color 200ms;
}
#wrtcSettingsSheet .wrtc-preset-btn.active { background:#0f766e; border-color:#14b8a6; }

/* admin WebRTC — те же стили для зеркальной разметки (для консистентности) */
.adwrtc-quality { display:inline-flex; align-items:center; gap:4px; background:rgba(0,0,0,0.45); padding:4px 8px; border-radius:14px; color:#fff; font-size:11px; line-height:1; min-height:20px; pointer-events:none; }
.adwrtc-quality .q-bars { display:inline-flex; align-items:flex-end; gap:2px; height:14px; }
.adwrtc-quality .q-bar { width:3px; height:var(--qh, 10px); border-radius:1px; background:rgba(255,255,255,0.25); transition: background 200ms, height 200ms; }
.adwrtc-quality .q-bars.qual-pulse .q-bar.on { animation: qualPulse 1.2s ease-in-out infinite; }

/* ═══════════════════════════════════════════════════
   Analysis source files (Phase 1 — исходники для врача)
   ═══════════════════════════════════════════════════ */

/* Manual mode — кнопка прикрепить + чипы превью */
.manual-source-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.manual-source-preview:empty { display: none; }

.manual-source-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  font-size: 13px;
  color: var(--text);
  max-width: 100%;
  overflow: hidden;
}
.manual-source-chip-icon { flex-shrink: 0; font-size: 16px; line-height: 1; }
.manual-source-chip-name {
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 160px;
}
.manual-source-chip-spin {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 2px;
  animation: manualChipSpin 1.2s steps(3) infinite;
}
@keyframes manualChipSpin {
  0%   { content: '.'; opacity: 0.4; }
  50%  { opacity: 1; }
  100% { opacity: 0.4; }
}
.manual-source-chip-remove {
  flex-shrink: 0;
  background: transparent;
  border: 0;
  padding: 2px 6px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  border-radius: 4px;
  transition: background 120ms, color 120ms;
  width: auto;
}
.manual-source-chip-remove:hover { background: rgba(239,68,68,0.1); color: var(--danger, #ef4444); }
.manual-source-chip.loading { opacity: 0.75; }
.manual-source-chip.error {
  background: #fef2f2;
  border-color: #fecaca;
  color: var(--danger, #ef4444);
}

.manual-attach-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 14px;
}
.manual-attach-btn span:first-child { font-size: 16px; line-height: 1; }

/* History detail — сетка превью исходников */
.source-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  margin-top: 8px;
}
.source-tile {
  position: relative;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  transition: border-color 120ms, transform 120ms;
}
.source-tile:hover { border-color: var(--primary, #0f766e); }
.source-tile img {
  width: 100%;
  aspect-ratio: 1;
  flex-shrink: 0;
  object-fit: cover;
  cursor: zoom-in;
  display: block;
}
.source-tile-pdf {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 100%;
  padding: 12px;
  text-decoration: none;
  color: var(--text);
  text-align: center;
}
.source-tile-pdf-icon {
  font-size: 40px;
  line-height: 1;
}
.source-tile-pdf-name {
  font-size: 11px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-word;
}

/* ═══════════════════════════════════════════════════
   History tabs + Dynamics chart (Phase 2)
   ═══════════════════════════════════════════════════ */
.history-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  background: var(--bg-subtle);
  padding: 4px;
  border-radius: 12px;
}
.history-tab {
  flex: 1;
  padding: 10px 12px;
  border: none;
  background: transparent;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 180ms, color 180ms, box-shadow 180ms;
}
.history-tab.active {
  background: #fff;
  color: var(--primary);
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}
.history-tab:hover:not(.active) { color: var(--text); }

#dynPetSection { margin-bottom: 12px; }

.dyn-chart-card {
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 16px;
  margin-top: 12px;
}
.dyn-chart-title {
  font-weight: 700;
  color: var(--text);
  font-size: 15px;
  margin-bottom: 4px;
}
.dyn-chart-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.dyn-chart-svg {
  width: 100%;
  height: 220px;
  display: block;
  overflow: visible;
}
.dyn-chart-svg .grid-line { stroke: var(--border-light); stroke-width: 1; }
.dyn-chart-svg .ref-band { fill: rgba(16,185,129,0.08); }
.dyn-chart-svg .ref-line { stroke: #10b981; stroke-width: 1; stroke-dasharray: 3 3; opacity: 0.6; }
.dyn-chart-svg .data-line { stroke: var(--primary); stroke-width: 2; fill: none; }
.dyn-chart-svg .axis-label { font-size: 10px; fill: var(--text-muted); font-family: inherit; }
.dyn-chart-svg .dp {
  cursor: pointer;
  transition: transform 160ms;
  transform-origin: center;
  transform-box: fill-box;
}
.dyn-chart-svg .dp:hover { transform: scale(1.4); }
.dyn-chart-svg .dp-normal { fill: #10b981; stroke: #fff; stroke-width: 2; }
.dyn-chart-svg .dp-warn { fill: #f59e0b; stroke: #fff; stroke-width: 2; }
.dyn-chart-svg .dp-crit { fill: #dc2626; stroke: #fff; stroke-width: 2; }
.dyn-chart-svg .dp-note { stroke: #4f46e5; stroke-width: 3; }

.dyn-tooltip {
  position: absolute;
  pointer-events: none;
  background: rgba(15, 23, 42, 0.94);
  color: #fff;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 11px;
  line-height: 1.4;
  box-shadow: 0 4px 14px rgba(0,0,0,0.2);
  z-index: 10;
  opacity: 0;
  transition: opacity 140ms;
  white-space: nowrap;
}
.dyn-tooltip.show { opacity: 1; }

.dyn-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 10px;
  font-size: 11px;
  color: var(--text-muted);
}
.dyn-legend-item { display: inline-flex; align-items: center; gap: 5px; }
.dyn-legend-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

.dyn-cat-timeline {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
}
.dyn-cat-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--bg-subtle);
  cursor: pointer;
  transition: background 140ms;
}
.dyn-cat-row:hover { background: #eef2ff; }
.dyn-cat-date { font-size: 11px; color: var(--text-muted); min-width: 72px; }
.dyn-cat-value { flex: 1; font-weight: 600; color: var(--text); font-size: 13px; }
.dyn-cat-badge {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}
.dyn-cat-badge.normal { background: #d1fae5; color: #065f46; }
.dyn-cat-badge.warn { background: #fef3c7; color: #92400e; }
.dyn-cat-badge.crit { background: #fee2e2; color: #991b1b; }

.dyn-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}
.dyn-empty-icon { font-size: 32px; margin-bottom: 8px; }

.dyn-domain-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 0 16px 12px 16px;
}
.dyn-domain-chip {
  appearance: none;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.dyn-domain-chip:hover { border-color: var(--primary); color: var(--primary); }
.dyn-domain-chip.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.dyn-matrix-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -14px;
  padding: 0 14px 4px 14px;
}
.dyn-matrix-table {
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
  min-width: 100%;
}
.dyn-matrix-table thead th {
  background: #f8fafc;
  font-weight: 600;
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.dyn-matrix-table .dyn-matrix-corner {
  position: sticky;
  left: 0;
  z-index: 3;
  background: #f8fafc;
  text-align: left;
  width: 140px;
  min-width: 140px;
  max-width: 140px;
  border-right: 1px solid var(--border);
  box-shadow: 3px 0 8px -2px rgba(0,0,0,0.12);
}
.dyn-matrix-table .dyn-matrix-date {
  text-align: center;
  min-width: 78px;
}
.dyn-date-mark { color: var(--primary); font-size: 11px; }
.dyn-matrix-row {
  cursor: pointer;
  transition: background 0.12s ease;
}
.dyn-matrix-row:hover { background: #f1f5f9; }
.dyn-matrix-row.active { background: #ecfdf5; }
.dyn-matrix-row.active .dyn-matrix-param {
  background: #ecfdf5;
  color: var(--primary);
}
.dyn-matrix-param {
  position: sticky;
  left: 0;
  z-index: 2;
  background: #fff;
  padding: 8px 10px;
  border-bottom: 1px solid #f1f5f9;
  border-right: 1px solid var(--border);
  width: 140px;
  min-width: 140px;
  max-width: 140px;
  box-shadow: 3px 0 8px -2px rgba(0,0,0,0.12);
  vertical-align: middle;
}
.dyn-matrix-row:hover .dyn-matrix-param { background: #f1f5f9; }
.dyn-matrix-param-name {
  font-weight: 600;
  color: var(--text);
  font-size: 13px;
  line-height: 1.25;
  overflow: hidden;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.dyn-matrix-param-full {
  font-size: 10.5px;
  color: var(--text-muted);
  margin-top: 1px;
  font-weight: 400;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dyn-matrix-param-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  font-weight: 400;
}
.dyn-matrix-cell {
  padding: 10px 6px;
  text-align: center;
  border-bottom: 1px solid #f1f5f9;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 15px;
  min-width: 78px;
  letter-spacing: -0.01em;
}
.dyn-matrix-cell.dp-normal { background: #f0fdf4; color: #14532d; }
.dyn-matrix-cell.dp-warn { background: #fffbeb; color: #92400e; font-weight: 600; }
.dyn-matrix-cell.dp-crit { background: #fef2f2; color: #991b1b; font-weight: 700; }
.dyn-matrix-cell.dp-empty { color: var(--text-muted); background: #fff; }

.doctor-cta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0 4px;
  padding: 14px 16px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(15,118,110,0.08), rgba(99,102,241,0.08));
  border: 1px solid rgba(15,118,110,0.18);
  cursor: pointer;
  transition: transform 160ms, box-shadow 160ms, background 160ms;
}
.doctor-cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(15,118,110,0.12);
  background: linear-gradient(135deg, rgba(15,118,110,0.12), rgba(99,102,241,0.12));
}
.doctor-cta:active { transform: translateY(0); }
.doctor-cta-icon {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.doctor-cta-body { flex: 1; min-width: 0; }
.doctor-cta-title {
  font-weight: 700;
  color: var(--text);
  font-size: 14px;
  margin-bottom: 2px;
}
.doctor-cta-sub {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.35;
}
.doctor-cta-arrow {
  flex-shrink: 0;
  font-size: 22px;
  color: var(--primary);
  font-weight: 700;
}

/* ===== Универсальный inline error-banner для всех bottom-sheet'ов ===== */
.sheet-error-banner,
.he-form-error { /* he-form-error — legacy alias, оставлен для backward compat */
  margin: 4px 0 14px;
  padding: 12px 14px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 10px;
  color: #991b1b;
  font-size: 13.5px;
  line-height: 1.4;
  font-weight: 500;
  animation: sheetErrorPulse 0.4s ease-out;
}
@keyframes sheetErrorPulse {
  0%   { opacity: 0; transform: translateY(-6px); }
  100% { opacity: 1; transform: translateY(0); }
}
/* Старый alias анимации */
@keyframes heErrorPulse {
  0%   { opacity: 0; transform: translateY(-6px); }
  100% { opacity: 1; transform: translateY(0); }
}
.he-mini-score {
  position: relative;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  margin-left: 8px;
}
.he-mini-score-svg { display: block; }
.he-mini-score-num {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}
.he-mini-score[data-level="green"]  .he-mini-score-num { color: #047857; }
.he-mini-score[data-level="yellow"] .he-mini-score-num { color: #b45309; }
.he-mini-score[data-level="red"]    .he-mini-score-num { color: #b91c1c; }
.he-mini-score[data-level="green"]  { --he-pulse-color: rgba(16, 185, 129, 0.55); }
.he-mini-score[data-level="yellow"] { --he-pulse-color: rgba(245, 158, 11, 0.55); }
.he-mini-score[data-level="red"]    { --he-pulse-color: rgba(239, 68, 68, 0.55); }
.he-mini-score-pulse .he-mini-score-svg {
  animation: heMiniScorePulse 0.9s ease-out;
}
@keyframes heMiniScorePulse {
  0%   { transform: scale(1); filter: drop-shadow(0 0 0 transparent); }
  40%  { transform: scale(1.12); filter: drop-shadow(0 0 6px var(--he-pulse-color, rgba(0,0,0,0.3))); }
  70%  { transform: scale(1.04); filter: drop-shadow(0 0 3px var(--he-pulse-color, rgba(0,0,0,0.3))); }
  100% { transform: scale(1); filter: drop-shadow(0 0 0 transparent); }
}

/* Скрытые карточки + кнопка раскрытия в health-records-list */
.he-list-hidden-item { display: none !important; }
.he-list-collapse-ctrl {
  width: 100%;
  margin-top: 6px;
  padding: 8px 12px;
  background: transparent;
  border: 1px dashed var(--border);
  border-radius: 10px;
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.he-list-collapse-ctrl:hover {
  background: rgba(15, 118, 110, 0.06);
  color: var(--primary);
  border-color: var(--primary);
}

.he-pills-score .he-pill {
  min-width: 36px;
  padding: 6px 10px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  text-align: center;
}
.he-section-title {
  margin: 32px 0 14px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  color: var(--primary);
  background: rgba(15, 118, 110, 0.07);
  border-left: 3px solid var(--primary);
  border-radius: 0 8px 8px 0;
}

/* Внутри домашнего осмотра — больше воздуха между параметрами */
#homeExamSheet .pet-form-group {
  margin-bottom: 22px;
}
#homeExamSheet .pet-form-group .he-guide.open {
  margin-bottom: 10px;
}
#homeExamSheet .pet-form-label {
  margin-bottom: 8px;
}
.he-hint {
  margin-top: 6px;
  font-size: 12.5px;
  line-height: 1.35;
  padding: 6px 10px;
  border-radius: 8px;
  display: none;
}
.he-hint.he-hint-normal,
.he-hint.he-hint-warning,
.he-hint.he-hint-critical { display: block; }
.he-hint.he-hint-normal {
  color: #166534;
  background: #f0fdf4;
  border-left: 3px solid #16a34a;
}
.he-hint.he-hint-warning {
  color: #92400e;
  background: #fffbeb;
  border-left: 3px solid #f59e0b;
}
.he-hint.he-hint-critical {
  color: #991b1b;
  background: #fef2f2;
  border-left: 3px solid #ef4444;
}

/* ===== Дерматология (новообразования) ===== */
.skin-findings-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.skin-finding-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
}
.skin-finding-chip-dot {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #0f766e;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.skin-finding-chip-info { flex: 1; min-width: 0; }
.skin-finding-chip-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
}
.skin-finding-chip-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}
.skin-finding-chip-del {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}
.skin-finding-chip-del:hover { background: #fee2e2; color: #991b1b; }

.skin-svg-container {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px;
  overflow: hidden;
}
.skin-svg-container svg.skin-silhouette {
  width: 100%;
  height: auto;
  display: block;
  touch-action: manipulation;
}
.skin-svg-container svg.skin-silhouette [data-zone]:hover {
  fill: rgba(15, 118, 110, 0.08);
  stroke: #0f766e;
}

/* 3D body-map (.bm3d-*) — стили инъектируются из public/js/body-map-3d.js (self-contained) */

/* ===== Просмотр видео/фото-инструкций в guide ===== */
.he-media-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 6px;
  padding: 3px 9px;
  background: rgba(15, 118, 110, 0.10);
  color: var(--primary);
  border: 1px solid rgba(15, 118, 110, 0.30);
  border-radius: 12px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  vertical-align: middle;
}
.he-media-btn:hover { background: rgba(15, 118, 110, 0.18); }

.exam-media-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 5000;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 20px;
}
.exam-media-overlay.open { display: flex; }
.exam-media-video,
.exam-media-image {
  max-width: 100%;
  max-height: 80vh;
  border-radius: 12px;
  background: #000;
}
.exam-media-image {
  touch-action: none;        /* блокируем нативный pinch — у нас свой */
  transform-origin: center center;
  transition: transform 0.2s ease-out;
  will-change: transform;
  user-select: none;
  -webkit-user-drag: none;
  cursor: zoom-in;
}
.exam-media-image.zooming {
  transition: none;          /* во время жеста — без сглаживания */
}
.exam-media-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
}
.exam-media-close:hover { background: rgba(255, 255, 255, 0.28); }
.exam-media-title {
  color: #fff;
  margin-bottom: 14px;
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  max-width: 90%;
}

/* ===== Результат осмотра — анимированный score (canvas blob a-la adrior/PawVital) ===== */
.he-result-sheet { padding-bottom: 24px; }

.he-result-pet-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  margin: 0 -20px 4px;
  background: var(--bg-subtle, #f8fafc);
  border-bottom: 1px solid var(--border, #e5e7eb);
  border-radius: 12px 12px 0 0;
}
.he-result-pet-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.he-result-pet-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.he-result-pet-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text, #0f172a);
  line-height: 1.2;
}
.he-result-pet-meta {
  font-size: 12px;
  color: var(--text-muted, #64748b);
  margin-top: 2px;
}

.he-result-hero {
  position: relative;
  width: 280px;
  height: 280px;
  margin: 4px auto 12px;
}
.he-result-blob {
  display: block;
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 8px 28px rgba(0,0,0,0.08));
}
.he-result-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.he-result-number {
  font-size: 88px;
  font-weight: 900;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -2px;
  color: #fff;
  /* Soft glow в цвет уровня — для читаемости поверх цветного blob */
  text-shadow:
    0 2px 8px var(--he-text-shadow, rgba(239, 68, 68, 0.55)),
    0 0 24px var(--he-text-shadow, rgba(239, 68, 68, 0.45)),
    0 1px 0 rgba(0, 0, 0, 0.10);
}
.he-result-sheet[data-level="green"]  .he-result-number { --he-text-shadow: rgba(22, 101, 52, 0.7); }
.he-result-sheet[data-level="yellow"] .he-result-number { --he-text-shadow: rgba(146, 64, 14, 0.7); }
.he-result-sheet[data-level="red"]    .he-result-number { --he-text-shadow: rgba(127, 29, 29, 0.7); }
.he-result-sub {
  margin-top: 2px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  opacity: 0.85;
}
.he-result-label {
  margin-top: 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.he-result-sheet[data-level="green"]  { --he-grad-from: #4ade80; --he-grad-to: #16a34a; }
.he-result-sheet[data-level="yellow"] { --he-grad-from: #fcd34d; --he-grad-to: #f59e0b; }
.he-result-sheet[data-level="red"]    { --he-grad-from: #fb923c; --he-grad-to: #ef4444; }

/* PDF-документ результата осмотра (html2canvas снимок) */
#heResultPdfDoc { font-family: system-ui, -apple-system, "Segoe UI", sans-serif; color: #1f2937; }
.he-pdf-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid #e5e7eb;
  padding-bottom: 14px;
  margin-bottom: 12px;
}
.he-pdf-title { font-size: 22px; font-weight: 800; color: #0f766e; }
.he-pdf-date  { font-size: 13px; color: #6b7280; font-weight: 500; }

/* Двухстрочный header в стиле выписки */
.he-pdf-toprow {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}
.he-pdf-brand {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: #9ca3af;
  text-transform: uppercase;
}
.he-pdf-bigtitle {
  font-size: 32px;
  font-weight: 800;
  color: #0f766e;
  line-height: 1.1;
  margin-bottom: 12px;
}
.he-pdf-hline {
  height: 3px;
  background: linear-gradient(90deg, #0f766e 0%, #14b8a6 60%, transparent 100%);
  border-radius: 2px;
  margin-bottom: 20px;
}
.he-pdf-pet { font-size: 14px; color: #374151; margin-bottom: 18px; font-weight: 600; }

/* Карточка питомца (как в выписке) */
.he-pdf-petcard {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: linear-gradient(135deg, #f0fdfa 0%, #f8fafc 100%);
  border: 1px solid #ccfbf1;
  border-radius: 14px;
  margin-bottom: 16px;
}
.he-pdf-petcard-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  flex-shrink: 0;
  overflow: hidden;
  background: #e0f2fe;
}
.he-pdf-petcard-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.he-pdf-petcard-name {
  font-size: 17px;
  font-weight: 700;
  color: #0f172a;
}
.he-pdf-petcard-meta {
  font-size: 13px;
  color: #475569;
  margin-top: 2px;
}

/* «Все показатели» в PDF */
.he-pdf-allparams { margin-top: 22px; }
.he-pdf-allparams-title { margin-bottom: 10px; color: #0f766e; }
.he-pdf-allparams-group {
  margin-bottom: 12px;
  padding: 10px 12px;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
}
.he-pdf-allparams-subtitle {
  font-size: 12.5px;
  font-weight: 700;
  color: #0f766e;
  margin-bottom: 6px;
  letter-spacing: 0.2px;
}
.he-pdf-allparams-table {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 16px;
}
.he-pdf-allparams-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-size: 12px;
  padding: 3px 0;
  border-bottom: 1px dashed #e5e7eb;
}
.he-pdf-allparams-lbl { color: #6b7280; }
.he-pdf-allparams-val { color: #1f2937; font-weight: 600; text-align: right; }

.he-pdf-notes { margin-top: 16px; }
.he-pdf-notes-text {
  padding: 10px 14px;
  background: #fefce8;
  border: 1px solid #fde68a;
  border-radius: 8px;
  font-size: 12.5px;
  line-height: 1.45;
  color: #422006;
  white-space: pre-wrap;
}

.he-pdf-skin { margin-top: 16px; }
.he-pdf-skin-item {
  padding: 10px 14px;
  background: #fdf2f8;
  border: 1px solid #fbcfe8;
  border-radius: 8px;
  margin-bottom: 6px;
}
.he-pdf-skin-head { font-size: 12.5px; font-weight: 700; color: #9d174d; }
.he-pdf-skin-comment { font-size: 12px; color: #374151; margin-top: 3px; }

.he-pdf-hero {
  display: flex;
  gap: 24px;
  align-items: center;
  padding: 20px;
  background: #f8fafc;
  border-radius: 16px;
  margin-bottom: 16px;
}
.he-pdf-blob { width: 200px; height: 200px; flex-shrink: 0; }
.he-pdf-blob svg { width: 100%; height: 100%; display: block; }
.he-pdf-score-block { flex: 1; }
.he-pdf-num {
  font-size: 72px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -2px;
}
.he-pdf-num-sub {
  font-size: 14px;
  color: #6b7280;
  margin-top: 4px;
}
.he-pdf-level {
  margin-top: 12px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.he-pdf-summary {
  margin-top: 6px;
  font-size: 15px;
  font-weight: 600;
  color: #111827;
}

.he-pdf-counts {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.he-pdf-pill {
  padding: 6px 14px;
  border-radius: 18px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid;
}
.he-pdf-pill-critical { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.he-pdf-pill-warning  { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.he-pdf-pill-mild     { background: #f0f9ff; color: #075985; border-color: #bae6fd; }

.he-pdf-all-ok {
  padding: 14px 16px;
  background: #f0fdf4;
  border-radius: 12px;
  color: #166534;
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 16px;
  text-align: center;
}

.he-pdf-section { margin-top: 16px; }
.he-pdf-section-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.he-pdf-section-critical .he-pdf-section-title { color: #b91c1c; }
.he-pdf-section-warning  .he-pdf-section-title { color: #b45309; }
.he-pdf-section-mild     .he-pdf-section-title { color: #075985; }

.he-pdf-card {
  padding: 12px 14px;
  border-radius: 10px;
  margin-bottom: 8px;
  border: 1px solid;
}
.he-pdf-card-critical { background: #fef2f2; border-color: #fecaca; }
.he-pdf-card-warning  { background: #fffbeb; border-color: #fde68a; }
.he-pdf-card-mild     { background: #f8fafc; border-color: #e5e7eb; }
.he-pdf-card-title {
  font-size: 13.5px;
  font-weight: 700;
  margin-bottom: 4px;
  color: #1f2937;
}
.he-pdf-card-text {
  font-size: 12.5px;
  line-height: 1.45;
  color: #374151;
}

.he-pdf-disclaimer {
  margin-top: 20px;
  padding: 10px 14px;
  background: #f9fafb;
  border-left: 3px solid #d1d5db;
  border-radius: 6px;
  font-size: 11px;
  color: #6b7280;
  line-height: 1.45;
}
.he-pdf-foot {
  margin-top: 16px;
  text-align: center;
  font-size: 10.5px;
  color: #9ca3af;
  font-style: italic;
}

/* Share-модалка для desktop */
.he-share-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 5500;
  padding: 20px;
}
.he-share-overlay.open { display: flex; }
.he-share-modal {
  background: #fff;
  border-radius: 16px;
  padding: 20px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}
.he-share-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.he-share-hint {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.he-share-textarea {
  width: 100%;
  font-size: 13px;
  line-height: 1.4;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f8fafc;
  color: var(--text-primary);
  resize: vertical;
  font-family: inherit;
  margin-bottom: 12px;
}
.he-share-buttons {
  display: flex;
  gap: 10px;
}

.he-result-sheet[data-level="green"]  .he-result-label { color: #16a34a; }
.he-result-sheet[data-level="yellow"] .he-result-label { color: #d97706; }
.he-result-sheet[data-level="red"]    .he-result-label { color: #dc2626; }

.he-result-summary {
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 10px;
}
.he-result-summary-sub {
  display: block;
  font-size: 13px;
  font-weight: 400;
  color: var(--text-muted);
  margin-top: 4px;
}

.he-result-counts {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.he-result-count-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 12.5px;
  font-weight: 600;
  border: 1px solid;
  opacity: 0;
  transform: translateY(8px);
  animation: heCountIn 0.4s 0.3s ease-out forwards;
}
.he-result-count-pill[data-level="critical"] { background:#fef2f2; color:#991b1b; border-color:#fecaca; }
.he-result-count-pill[data-level="warning"]  { background:#fffbeb; color:#92400e; border-color:#fde68a; }
.he-result-count-pill[data-level="mild"]     { background:#f0f9ff; color:#075985; border-color:#bae6fd; }

.he-result-advices {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.he-result-card {
  display: flex;
  gap: 10px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
  opacity: 0;
  transform: translateY(12px);
  animation: heCardIn 0.45s ease-out forwards;
}
.he-result-card[data-level="critical"] { background:#fef2f2; border-color:#fecaca; }
.he-result-card[data-level="warning"]  { background:#fffbeb; border-color:#fde68a; }
.he-result-card[data-level="mild"]     { background:#f8fafc; border-color:var(--border); }
.he-result-card-icon {
  font-size: 22px;
  flex-shrink: 0;
  line-height: 1.2;
}
.he-result-card-body { flex: 1; min-width: 0; }
.he-result-card-title {
  font-size: 13.5px;
  font-weight: 700;
  margin-bottom: 4px;
}
.he-result-card-text {
  font-size: 13px;
  line-height: 1.4;
  color: #374151;
}

.he-result-fulldata { margin-top: 18px; }
.he-result-fulldata:empty { display: none; }
.he-result-fulldata-section {
  margin-top: 12px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.he-result-fulldata-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: rgba(15, 118, 110, 0.06);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  color: var(--primary);
  cursor: pointer;
  user-select: none;
}
.he-result-fulldata-header::after {
  content: '\25BE';
  font-size: 12px;
  transition: transform 0.2s;
}
.he-result-fulldata-section.collapsed .he-result-fulldata-header::after { transform: rotate(-90deg); }
.he-result-fulldata-body { padding: 10px 14px 12px; }
.he-result-fulldata-section.collapsed .he-result-fulldata-body { display: none; }
.he-result-kv {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 0;
  font-size: 13.5px;
  border-bottom: 1px dashed var(--border);
}
.he-result-kv:last-child { border-bottom: none; }
.he-result-kv-label { color: var(--text-muted); }
.he-result-kv-value { color: var(--text-primary); font-weight: 500; text-align: right; }
.he-result-skin-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.he-result-skin-grid img {
  width: 86px;
  height: 86px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--border);
  cursor: pointer;
}

.he-result-disclaimer {
  margin-top: 14px;
  padding: 8px 12px;
  border-radius: 8px;
  background: #f8fafc;
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.4;
  border-left: 3px solid var(--border);
}

@keyframes heResultPulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.08); }
}
@keyframes heCountIn {
  to { opacity: 1; transform: translateY(0); }
}
@keyframes heCardIn {
  to { opacity: 1; transform: translateY(0); }
}
.he-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.he-pill {
  padding: 6px 12px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: var(--surface, #fff);
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  white-space: nowrap;
}
.he-pill.active {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}
.he-details-toggle {
  width: 100%;
  background: none;
  border: 1.5px dashed var(--border);
  border-radius: 10px;
  padding: 10px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  margin: 4px 0 14px;
  text-align: center;
}
.he-swatch {
  display: inline-block;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.18);
  vertical-align: middle;
  margin-right: 3px;
  flex-shrink: 0;
}
.he-guide-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text-secondary);
  font-size: 11px;
  cursor: pointer;
  padding: 2px 8px;
  margin-left: 6px;
  vertical-align: middle;
  opacity: 0.8;
  transition: opacity 0.15s;
}
.he-guide-btn:hover { opacity: 1; }
.he-guide {
  display: none;
  background: var(--bg-subtle, #f8fafc);
  border: 1px solid var(--border-light, #e5e7eb);
  border-radius: 12px;
  padding: 10px 12px;
  margin: 6px 0 8px;
}
.he-guide.open { display: block; }
.he-guide-title {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}
.he-guide-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  border-bottom: 1px solid var(--border-light, #e5e7eb);
}
.he-guide-row:last-child { border-bottom: none; }
.he-guide-color {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1.5px solid rgba(0,0,0,0.14);
  flex-shrink: 0;
}
.he-guide-name {
  font-weight: 600;
  font-size: 12px;
  color: var(--text-primary);
  min-width: 82px;
  flex-shrink: 0;
}
.he-guide-desc {
  color: var(--text-secondary);
  font-size: 11.5px;
  line-height: 1.35;
}
.he-guide-urgent { color: #dc2626; font-weight: 600; }
.he-guide-warn   { color: #d97706; font-weight: 600; }
.he-exam-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
}
.he-exam-card:last-child { border-bottom: none; }
.he-exam-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.he-exam-dot.good       { background: #10b981; }
.he-exam-dot.concerning { background: #f59e0b; }
.he-exam-dot.bad        { background: #ef4444; }
.he-exam-dot.none       { background: var(--border); }
.he-exam-info { flex: 1; min-width: 0; }
.he-exam-date { font-size: 13px; font-weight: 600; color: var(--text); }
.he-exam-label { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.he-exam-meta { font-size: 12px; color: var(--text-muted); white-space: nowrap; }

/* ===========================
   Виджет «Сегодня» (вкладка лечения)
   =========================== */
.tt-widget {
  background: linear-gradient(135deg, #ecfdf5 0%, #f0fdf4 100%);
  border: 1px solid #a7f3d0;
  border-radius: 16px;
  padding: 18px;
  margin-bottom: 16px;
  display: flex;
  gap: 16px;
  align-items: center;
}
.tt-widget.empty { background: var(--bg-subtle); border-color: var(--border); }
.tt-ring {
  position: relative;
  width: 96px;
  height: 96px;
  flex-shrink: 0;
}
.tt-ring svg { transform: rotate(-90deg); width: 100%; height: 100%; overflow: visible; }
.tt-ring-bg { stroke: rgba(148,163,184,0.18); fill: none; stroke-width: 9; }
.tt-ring-fg {
  fill: none;
  stroke-width: 9;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.9s cubic-bezier(0.4, 0, 0.2, 1);
}
.tt-ring-text {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  font-weight: 700;
}
.tt-ring-num { font-size: 20px; color: #047857; line-height: 1; }
.tt-ring-num.pop { animation: ttPop 0.5s ease-out; }
.tt-ring-of { font-size: 11px; color: var(--text-muted); font-weight: 500; margin-top: 2px; }
@keyframes ttPop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.25); color: #059669; }
  100% { transform: scale(1); }
}
.tt-pets {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  flex-direction: column;
  align-items: stretch;
  max-width: 90px;
}
.tt-pet {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background-color: #fff;
  background-size: cover;
  background-position: center;
  border: 3px solid #fff;
  box-shadow: 0 3px 10px rgba(15,118,110,0.22);
  flex-shrink: 0;
  align-self: center;
}
.tt-pet-named {
  /* Когда нет фото — оставляем компактный размер pill с именем */
  width: auto;
  height: auto;
  border-radius: 12px;
  background: linear-gradient(135deg, #d1fae5, #a7f3d0);
  color: #065f46;
  font-weight: 700;
  font-size: 11px;
  padding: 6px 10px;
  text-align: center;
  border: 1.5px solid #6ee7b7;
  box-shadow: 0 1px 3px rgba(15,118,110,0.12);
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: 0.2px;
  align-self: center;
}
.tt-info { flex: 1; min-width: 0; }
.tt-info-title { font-size: 13px; font-weight: 700; color: #065f46; margin-bottom: 4px; letter-spacing: 0.3px; }
.tt-info-next { font-size: 14px; color: var(--text); margin-bottom: 6px; line-height: 1.35; }
.tt-info-next .tt-drug { font-weight: 700; }
.tt-info-next .tt-eta { color: #059669; font-weight: 600; }
.tt-info-meta { font-size: 12px; color: var(--text-secondary); display: flex; gap: 12px; flex-wrap: wrap; }
.tt-info-meta .tt-streak { color: #c2410c; font-weight: 600; }
.tt-info-empty { font-size: 13px; color: var(--text-secondary); }
.tt-quick-give {
  margin-top: 8px;
  background: #059669;
  color: #fff;
  border: none;
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.tt-quick-give:active { transform: scale(0.97); }

/* Таймлайн на сегодня внутри карточки плана */
.tt-timeline {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.tt-timeline-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--bg-subtle);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
}
.tt-timeline-row:hover { background: rgba(16,185,129,0.06); }
.tt-timeline-row.given { background: rgba(16,185,129,0.10); }
.tt-timeline-row.skipped { background: rgba(239,68,68,0.07); opacity: 0.85; }
.tt-timeline-row.overdue { background: rgba(245,158,11,0.10); border: 1px dashed rgba(245,158,11,0.5); }
.tt-time { font-weight: 700; color: var(--text); min-width: 48px; }
.tt-status { font-size: 16px; }
.tt-name { flex: 1; min-width: 0; color: var(--text); }
.tt-name .tt-dose { color: var(--text-muted); font-size: 12px; }
.tt-timeline-row.given .tt-name { text-decoration: line-through; opacity: 0.7; }

@media (max-width: 480px) {
  .tt-widget { padding: 14px; gap: 12px; }
  .tt-ring { width: 80px; height: 80px; }
  .tt-ring-num { font-size: 17px; }
}

/* ── Doctor hub: «Ответы ветеринара» — заголовок + inline «+ Задать вопрос врачу» ─ */
.quick-action-titlerow {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px 12px;
}
.quick-action-titlerow h4 { margin: 0; }

/* Курсив + serif-шрифт (Playfair Display уже подгружен в <head>) —
   визуально отличается от обычного sans-serif заголовка, без фона/кнопки. */
.qa-ask-link {
  display: inline-block;
  font-family: 'Playfair Display', Georgia, serif;
  font-style: italic;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--primary);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: opacity 180ms ease;
}
.qa-ask-link:hover { opacity: 0.75; }
.qa-ask-link:active { opacity: 0.6; }

/* ── Skeleton для профиля во время загрузки данных ──────────────────────── */
/* Используется в onAuthChange: показываем main UI сразу, на элементах
   завязанных на профиль (имя, аватар, plan badge) висит .skeleton до тех
   пор пока loadUserData не вернётся. Снимается в updateUIWithUserData. */
.skeleton {
  background: linear-gradient(90deg, rgba(0,0,0,0.06) 0%, rgba(0,0,0,0.12) 50%, rgba(0,0,0,0.06) 100%) !important;
  background-size: 200% 100% !important;
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
  color: transparent !important;
  border-radius: 6px;
  user-select: none;
  pointer-events: none;
}
.skeleton > * { visibility: hidden !important; }
.skeleton::before, .skeleton::after { visibility: hidden !important; }
@keyframes skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Форма подтверждения зарубежного платежа в Настройках ───────────────── */
.ppf-label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin: 10px 0 4px;
  font-weight: 500;
}
.ppf-input {
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  box-sizing: border-box;
  font-family: inherit;
}
.ppf-input:focus {
  outline: none;
  border-color: var(--primary);
}
textarea.ppf-input { resize: vertical; min-height: 56px; }
