/* ═══════════ ПОЛЮСА v3 · дизайн поверх Framework7 ═══════════ */
:root {
  --bg: #0D0B12;
  --bg-elev: #16131D;
  --card: #1E1A28;
  --field: #252031;
  --stroke: #2E2840;
  --stroke-strong: #453D5C;
  --text: #F4F1FA;
  --text2: #A79FB8;
  --text3: #6B6478;
  --her: #FF6B4A;
  --her-glow: #FFA95C;
  --her-dim: #3A1F22;
  --his: #5B7EFF;
  --his-glow: #6BD0FF;
  --his-dim: #1D2240;
  --us: #C45CFF;
  --us-dim: #2E1F3E;
  --ok: #4ADE80;
  --gold: #FFD166;
  --danger: #FF5C7A;
  --grad-her: linear-gradient(90deg, #FF6B4A, #FFA95C);
  --grad-his: linear-gradient(90deg, #5B7EFF, #6BD0FF);
  --grad-us: linear-gradient(90deg, #FF6B4A, #C45CFF);
  --grad-full: linear-gradient(90deg, #FF6B4A, #C45CFF, #5B7EFF);
  --spring: cubic-bezier(0.32, 0.72, 0, 1);
  --disc: var(--her);
  --disc-dim: var(--her-dim);
  --disc-glow: var(--her-glow);

  /* Framework7: перекраска в наши токены */
  --f7-font-family: 'Onest', -apple-system, sans-serif;
  --f7-theme-color: #FF6B4A;
  --f7-theme-color-rgb: 255, 107, 74;
  --f7-page-bg-color: var(--bg);
  --f7-bars-bg-color: rgba(22, 19, 29, 0.92);
  --f7-bars-translucent-opacity: 0.92;
  --f7-toolbar-bg-color: rgba(22, 19, 29, 0.92);
  --f7-toolbar-border-color: var(--stroke);
  --f7-toolbar-height: 56px;
  --f7-tabbar-link-active-color: #F4F1FA;
  --f7-tabbar-link-inactive-color: #6B6478;
  --f7-tabbar-icons-height: 56px;
  --f7-tabbar-label-font-size: 11px;
  --f7-tabbar-label-font-weight: 500;
  --f7-popup-bg-color: var(--bg);
  --f7-sheet-bg-color: var(--bg-elev);
  --f7-sheet-border-radius: 24px;
  --f7-toast-bg-color: var(--field);
  --f7-toast-text-color: var(--text);
  --f7-toast-border-radius: 999px;
  --f7-toast-font-size: 14px;
}

html, body { background: var(--bg); }

#app, .view-main, .page { background: var(--bg); }

* { -webkit-tap-highlight-color: transparent; }
/* Атрибут hidden должен побеждать любой display из классов (как в normalize.css) */
[hidden] { display: none !important; }
/* Наши блоки считают padding внутри ширины — иначе width:100% даёт вылет */
.card, .set-row, .settings, .stat, .stats-row, .seg, .btn, .wrap { box-sizing: border-box; }
body {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
/* Сброс системного вида кнопок — иначе Safari красит их в белый */
button {
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  font-family: inherit;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

h1 { font-family: 'Unbounded', sans-serif; font-weight: 500; font-size: 24px; margin: 0; }

/* Контентная колонка внутри вкладок */
.wrap {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(var(--f7-safe-area-top) + 20px) 24px 32px;
}
/* Контент вкладок не должен прятаться под плавающую капсулу (64px + 10px отрыв) */
.tabs .page-content {
  padding-top: 0;
  padding-bottom: calc(64px + 10px + var(--f7-safe-area-bottom) + 20px);
}
/* Сброс лишней типографики F7 внутри нашего контента */
.wrap h1 { margin: 0; }

/* Контент въезжает с той стороны, откуда пришли */
.tab.tab-active > .wrap { animation: tabIn 0.42s var(--spring); }
@keyframes tabIn {
  from { opacity: 0; transform: translateX(calc(var(--slide-dir, 1) * 26px)); }
  to { opacity: 1; transform: translateX(0); }
}

/* ═══════════ Таб-бар: плавающая стеклянная капсула (тренд iOS 26) ═══════════ */
.toolbar-bottom {
  left: 16px;
  right: 16px;
  bottom: calc(var(--f7-safe-area-bottom) + 10px);
  width: auto;
  max-width: 528px;
  margin: 0 auto;
  height: 64px;
  border-radius: 999px;
  background: rgba(22, 19, 29, 0.78);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  backdrop-filter: blur(24px) saturate(160%);
  border: 1px solid var(--stroke);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}
.toolbar-bottom:before, .toolbar-bottom:after { display: none; } /* хэйрлайн F7 */
/* border-box: рамка капсулы не должна съедать высоту внутренностей */
.toolbar-bottom, .toolbar-bottom .toolbar-inner { box-sizing: border-box; }
.toolbar-bottom .toolbar-inner {
  height: 100%;
  padding: 5px;
  position: relative;
  display: flex;
  align-items: stretch;
}

/* Скользящая пилюля-индикатор: едет за активным табом.
   Высота — через top/bottom, чтобы всегда совпадать с табом без магических чисел */
.tab-indicator {
  position: absolute;
  top: 5px; bottom: 5px; left: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(255, 107, 74, 0.22), rgba(196, 92, 255, 0.2));
  box-shadow:
    inset 0 0 0 1px rgba(196, 92, 255, 0.38),
    0 4px 18px rgba(196, 92, 255, 0.22);
  transition: transform 0.52s var(--spring), width 0.52s var(--spring);
  pointer-events: none;
  z-index: 0;
}
.tab-indicator.no-anim { transition: none; }

.tabbar .tab-link {
  flex: 1;
  margin: 0 3px;
  height: auto;
  align-self: stretch;
  border-radius: 999px;
  position: relative;
  z-index: 1;
  background: transparent;
  box-shadow: none;
  transition: color 0.24s ease;
}
.tabbar .tab-link svg {
  width: 23px; height: 23px; margin-bottom: 1px;
  transition: transform 0.4s var(--spring);
}
/* Подписи стали длиннее — не дают им ломаться */
.tabbar .tabbar-label {
  font-size: 10px;
  white-space: nowrap;
  letter-spacing: -0.01em;
}
.tabbar .tab-link.tab-link-active { color: var(--text); background: transparent; }
.tabbar .tab-link.tab-link-active .tabbar-label { font-weight: 600; }
.tabbar .tab-link.tab-link-active svg { animation: iconPop 0.44s var(--spring); }
@keyframes iconPop {
  0% { transform: scale(0.82) translateY(2px); }
  55% { transform: scale(1.14) translateY(-2px); }
  100% { transform: scale(1) translateY(0); }
}
.tabbar .tab-link:active svg { transform: scale(0.9); }

/* ═══════════ Общие элементы (перенос из v2) ═══════════ */
.wordmark {
  font-family: 'Unbounded', sans-serif;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.24em;
  background: var(--grad-full);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.btn {
  display: flex; align-items: center; justify-content: center;
  min-height: 52px; width: 100%;
  border: none;
  border-radius: 999px;
  font-family: inherit;
  font-size: 16px; font-weight: 600;
  color: var(--bg);
  background: var(--grad-us);
  transition: transform 0.18s var(--spring), opacity 0.2s;
}
.btn:active { transform: scale(0.96); }
.btn:disabled { opacity: 0.35; }
.btn-us { background: var(--grad-us); }
.btn-her { background: var(--grad-her); }
.btn-his { background: var(--grad-his); }
.btn-quiet { background: var(--field); color: var(--text); border: 1px solid var(--stroke); }

/* Перебиваем .card Framework7 полностью: его margin/shadow/фон не нужны */
.card {
  background: var(--card);
  border-radius: 16px;
  padding: 16px 18px;
  margin: 0 0 12px;
  box-shadow: none;
  border: none;
  position: static;
  overflow: visible;
  color: var(--text);
}
.tag {
  display: inline-block;
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.08em;
  padding: 5px 12px;
  border-radius: 999px;
  width: fit-content;
}
.tag-us { color: var(--us); background: rgba(196, 92, 255, 0.12); }
.tag-gold { color: var(--gold); background: rgba(255, 209, 102, 0.1); }

.bar { height: 6px; border-radius: 999px; background: var(--field); overflow: hidden; }
.bar-fill {
  height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--gold), var(--her));
  transition: width 0.8s var(--spring);
}
.fill-season { background: var(--grad-us); }

.avatar {
  width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Unbounded', sans-serif; font-weight: 600; font-size: 15px;
  color: var(--bg);
  background: linear-gradient(135deg, var(--her), var(--her-glow));
  flex-shrink: 0;
}
.av-his, .avatar.av-his { background: linear-gradient(135deg, var(--his), var(--his-glow)); }
.av-her { background: linear-gradient(135deg, var(--her), var(--her-glow)) !important; }
.av-big { width: 56px; height: 56px; font-size: 18px; }
.av-xl { width: 84px; height: 84px; font-size: 30px; }

.sec-title { font-size: 16px; font-weight: 600; margin: 8px 0 12px; color: var(--text); }

.vhead {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 18px;
}
.vsub { font-size: 13px; font-weight: 500; color: var(--text3); margin: 4px 0 0; }
.accent-his { color: var(--his); }
.partner-head { justify-content: flex-start; gap: 14px; }

/* Я — Сегодня */
.rank-card { margin-bottom: 20px; }
.rank-row { display: flex; justify-content: space-between; margin-bottom: 10px; }
.rank-name { font-size: 15px; font-weight: 600; }
.rank-xp { font-size: 13px; font-weight: 500; color: var(--gold); }

.ch-card {
  border: 1px solid transparent;
  transition: transform 0.18s var(--spring);
  width: 100%; text-align: left;
  display: block;
  font-family: inherit;
  color: var(--text);
}
button.ch-card { background: var(--card); }
.ch-card:active { transform: scale(0.98); }
.ch-card.live { border-color: color-mix(in srgb, var(--disc) 35%, transparent); }
.ch-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.ch-chip {
  font-size: 11px; font-weight: 600; letter-spacing: 0.06em;
  padding: 4px 10px; border-radius: 999px;
  color: var(--disc);
  background: color-mix(in srgb, var(--disc) 14%, transparent);
}
.ch-xp { font-family: 'Unbounded', sans-serif; font-weight: 600; font-size: 13px; color: var(--gold); }
.ch-xp.done { color: var(--ok); }
.ch-title { font-size: 16px; font-weight: 600; line-height: 1.32; margin-bottom: 8px; }
.ch-title.muted { color: var(--text3); }
.ch-meta { font-size: 13px; font-weight: 500; color: var(--text2); }
.ch-meta.hot { color: var(--disc-glow); }
.ch-meta.dim { color: var(--text3); }

/* Мы */
.duel-card {
  background: linear-gradient(105deg, var(--her-dim), var(--card) 50%, var(--his-dim));
  border: 1px solid var(--stroke-strong);
  border-radius: 20px;
  padding: 20px;
}
.duel-vs { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.duel-side { display: flex; flex-direction: column; gap: 6px; }
.duel-side.right { align-items: flex-end; }
.duel-side .avatar { width: 52px; height: 52px; font-size: 17px; }
.duel-name { font-size: 13px; font-weight: 600; }
.duel-score { font-family: 'Unbounded', sans-serif; font-weight: 600; font-size: 28px; }
.score-her { color: var(--her); }
.score-his { color: var(--his); }
.duel-mid { font-family: 'Unbounded', sans-serif; font-weight: 600; font-size: 14px; color: var(--text3); }
.stake {
  font-size: 13px; font-weight: 500; line-height: 1.4;
  color: var(--gold);
  background: rgba(13, 11, 18, 0.5);
  border-radius: 12px;
  padding: 10px 14px;
}

.quiet-card { display: flex; align-items: center; gap: 14px; }
.quiet-info { flex: 1; }
.quiet-title { font-size: 15px; font-weight: 600; }
.quiet-sub { font-size: 13px; color: var(--text2); margin: 4px 0 10px; }
.mini-btn {
  font-family: inherit;
  font-size: 13px; font-weight: 600;
  color: var(--us);
  background: none;
  border: 1px solid color-mix(in srgb, var(--us) 50%, transparent);
  border-radius: 999px;
  padding: 8px 16px;
  transition: transform 0.15s, opacity 0.2s;
}
.mini-btn:active { transform: scale(0.95); }
.mini-btn.confirmed { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); pointer-events: none; }
.quiet-streak { display: flex; flex-direction: column; align-items: center; }
.streak-num { font-family: 'Unbounded', sans-serif; font-weight: 600; font-size: 24px; color: var(--us); }
.streak-label { font-size: 11px; font-weight: 500; color: var(--text3); }

.exp-card { background: var(--us-dim); border: 1px solid rgba(196, 92, 255, 0.35); }
.exp-title { font-family: 'Unbounded', sans-serif; font-weight: 500; font-size: 17px; margin: 8px 0 6px; }
.exp-desc { font-size: 13px; line-height: 1.4; color: var(--text2); margin: 0; }

/* Ты */
.w-card .ch-title { margin-bottom: 4px; }
.w-meta { font-size: 12px; font-weight: 500; color: var(--text3); margin-bottom: 12px; }
.w-reacts { display: flex; gap: 8px; }
.react {
  width: 44px; height: 36px; border-radius: 999px;
  background: var(--field);
  border: none;
  display: flex; align-items: center; justify-content: center;
  color: var(--text3);
  transition: transform 0.15s var(--spring), background 0.2s, color 0.2s;
}
.react svg { width: 18px; height: 18px; }
.react:active { transform: scale(0.88); }
.react.on {
  color: var(--her);
  background: rgba(255, 107, 74, 0.16);
  box-shadow: inset 0 0 0 1px rgba(255, 107, 74, 0.5);
}

.ritual-card {
  background: linear-gradient(120deg, var(--us-dim), var(--her-dim));
  border: 1px solid rgba(196, 92, 255, 0.4);
  border-radius: 20px;
  padding: 20px;
  display: flex; flex-direction: column; gap: 10px;
}
.ritual-title { font-family: 'Unbounded', sans-serif; font-weight: 500; font-size: 18px; line-height: 1.3; }
.ritual-desc { font-size: 13px; line-height: 1.38; color: var(--text2); margin: 0; }
.ritual-card .btn { margin-top: 6px; }
.ritual-card.sent { opacity: 0.75; }

/* Сезон */
.season-bar { height: 8px; margin-bottom: 18px; }
.week-row { display: flex; align-items: center; gap: 14px; padding: 12px 0; }
.week-dot {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  border: 1.5px solid var(--stroke);
  background: var(--field);
}
.week-dot.done { background: rgba(74, 222, 128, 0.18); border-color: var(--ok); }
.week-dot.current { background: var(--grad-us); border-color: transparent; }
.week-name { font-size: 15px; font-weight: 600; }
.week-name.dim { color: var(--text3); }
.week-theme { font-size: 13px; color: var(--text3); margin-top: 2px; }
.week-theme.hot { color: var(--her-glow); }

.exit-card {
  background: linear-gradient(120deg, var(--her-dim), var(--us-dim));
  border: 1.5px solid rgba(196, 92, 255, 0.5);
  border-radius: 20px;
  padding: 20px;
  margin-top: 8px;
}
.exit-title { font-family: 'Unbounded', sans-serif; font-weight: 500; font-size: 19px; margin: 8px 0 6px; }


/* ═══════════ Деталь испытания (попап F7) ═══════════ */
.detail-page { background: var(--bg); }
.d-wrap {
  display: flex; flex-direction: column; align-items: center;
  min-height: 100%;
  padding-top: calc(var(--f7-safe-area-top) + 16px);
}
.d-nav {
  display: flex; justify-content: space-between; align-items: center;
  width: 100%; margin-bottom: 20px;
}
.d-back {
  width: 44px; height: 44px; margin-left: -10px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text2);
}
.d-back svg { width: 26px; height: 26px; }
#d-disc { color: var(--disc); background: color-mix(in srgb, var(--disc) 14%, transparent); }
.d-dots { color: var(--text2); font-weight: 600; width: 34px; text-align: right; }

.d-ring-wrap { position: relative; width: 272px; height: 272px; margin: 8px 0 24px; flex-shrink: 0; }
.d-ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-track { fill: none; stroke: var(--field); stroke-width: 4; }
.ring-prog {
  fill: none;
  stroke: var(--disc);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 854.5;
  stroke-dashoffset: 854.5;
  transition: stroke-dashoffset 1s linear;
  filter: drop-shadow(0 0 6px color-mix(in srgb, var(--disc) 60%, transparent));
}
.d-ring-inner {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  background: radial-gradient(circle at center, color-mix(in srgb, var(--disc-dim) 85%, transparent) 0%, transparent 68%);
  border-radius: 50%;
}
.d-ring-label { font-size: 12px; font-weight: 500; letter-spacing: 0.08em; color: var(--disc-glow); }
.d-timer { font-family: 'Unbounded', sans-serif; font-weight: 600; font-size: 44px; font-variant-numeric: tabular-nums; color: var(--text); }
.d-rec { font-size: 13px; font-weight: 500; color: var(--ok); }

.d-info { text-align: center; margin-bottom: 8px; }
.d-info h2 { font-family: 'Unbounded', sans-serif; font-weight: 500; font-size: 20px; line-height: 1.35; margin: 0 0 10px; color: var(--text); }
.d-info p { font-size: 14px; line-height: 1.45; color: var(--text2); max-width: 320px; margin: 0 auto; }

.d-actions {
  margin-top: auto; width: 100%;
  display: flex; flex-direction: column; gap: 12px;
  padding: 20px 0 calc(var(--f7-safe-area-bottom) + 12px);
}
#d-main { background: var(--grad-her); }
.d-row { display: flex; gap: 12px; }
.d-row .btn { flex: 1; }

/* ═══════════ Шторка (F7 sheet) ═══════════ */
#sheet-ritual {
  height: auto;
  border-radius: 24px 24px 0 0;
  --f7-sheet-bg-color: var(--bg-elev);
}
.sheet-modal-inner {
  padding: 10px 20px calc(var(--f7-safe-area-bottom) + 20px);
  display: flex; flex-direction: column; gap: 14px;
}
.sheet-grip { width: 40px; height: 4px; border-radius: 999px; background: var(--stroke-strong); margin: 0 auto 4px; }
.sheet-title { font-family: 'Unbounded', sans-serif; font-weight: 500; font-size: 17px; color: var(--text); }
#sheet-text {
  background: var(--field);
  border: 1px solid var(--stroke);
  border-radius: 14px;
  color: var(--text);
  font-family: inherit; font-size: 16px;
  padding: 14px;
  resize: none;
  outline: none;
  width: 100%;
  box-sizing: border-box;
  -webkit-user-select: text;
  user-select: text;
}
#sheet-text:focus { border-color: var(--us); }

/* ═══════════ Регистрация и гейт (кастомные оверлеи) ═══════════ */
#auth, #gate {
  position: fixed; inset: 0; z-index: 12000;
  background: var(--bg);
  display: flex; flex-direction: column;
  padding: calc(var(--f7-safe-area-top) + 16px) 24px calc(var(--f7-safe-area-bottom) + 24px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
#auth[hidden], #gate[hidden] { display: none; }

.auth-glow {
  position: absolute; inset: -20% -20% auto;
  height: 70%;
  background:
    radial-gradient(circle at 12% 12%, rgba(255, 107, 74, 0.18), transparent 45%),
    radial-gradient(circle at 88% 4%, rgba(91, 126, 255, 0.16), transparent 45%);
  pointer-events: none;
}

.auth-top {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  min-height: 44px;
  margin-bottom: 12px;
  flex-shrink: 0;
}
.auth-back {
  width: 40px; height: 40px; margin-left: -10px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text2);
  flex-shrink: 0;
}
.auth-back[hidden] { display: none; }
.auth-back svg { width: 24px; height: 24px; }
.auth-back:active { transform: scale(0.9); }
.auth-steps { display: flex; gap: 6px; flex: 1; }
.auth-steps i {
  flex: 1; height: 3px; border-radius: 999px;
  background: var(--field);
  transition: background 0.35s var(--spring);
}
.auth-steps i.on { background: var(--grad-us); }

/* Шаг — колонка на всю высоту */
.auth-step {
  position: relative;
  flex: 1;
  display: flex; flex-direction: column;
  animation: tabIn 0.4s var(--spring);
}
.auth-step[hidden] { display: none; }
.auth-head { margin-bottom: 22px; }
.auth-title { font-size: 28px; line-height: 1.22; margin: 0 0 12px; color: var(--text); }
.auth-sub { font-size: 15px; line-height: 1.45; color: var(--text2); margin: 0; }
.auth-actions {
  margin-top: auto;
  padding-top: 20px;
  display: flex; flex-direction: column; gap: 6px;
  flex-shrink: 0;
}
.link-btn {
  font-family: inherit; font-size: 14px; font-weight: 500;
  color: var(--text2);
  padding: 14px;
  border-radius: 999px;
}
.link-btn:active { color: var(--text); }

/* Шаг 0 — приветствие */
.auth-hero {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; text-align: center;
}
.auth-icon { border-radius: 22px; box-shadow: 0 14px 44px rgba(0, 0, 0, 0.6); margin-bottom: 4px; }
.auth-hero .auth-title { font-size: 34px; }
.auth-hero .auth-sub { max-width: 300px; }

/* Шаг 1 — имя */
.name-preview { display: flex; justify-content: center; padding: 8px 0 26px; }
.name-preview .av-xl {
  background: var(--field);
  color: var(--text3);
  transition: background 0.4s var(--spring), color 0.3s;
}
.name-preview .av-xl.filled { color: var(--bg); }

.field-wrap { margin-bottom: 12px; }
/* input.field — специфичность выше, чем у сброса Framework7 для input[type=text] */
input.field, textarea.field, .field {
  width: 100%;
  background: var(--field);
  border: 1px solid var(--stroke);
  border-radius: 16px;
  color: var(--text);
  font-family: inherit; font-size: 17px; font-weight: 500;
  padding: 17px 18px;
  outline: none;
  box-sizing: border-box;
  -webkit-user-select: text; user-select: text;
  transition: border-color 0.2s;
}
.field::placeholder { color: var(--text3); font-weight: 400; }
input.field:focus, .field:focus { border-color: var(--us); }
input.field-phone, .field-phone {
  font-family: 'Unbounded', sans-serif; font-weight: 500; font-size: 19px;
  letter-spacing: 0.02em;
}
.auth-legal {
  font-size: 12px; line-height: 1.45; color: var(--text3);
  text-align: center; margin: 8px 4px 0;
}
.inline-link {
  font-family: inherit; font-size: inherit; font-weight: 600;
  color: var(--us);
  text-decoration: underline;
  padding: 0;
}
.dev-hint {
  font-size: 12px; line-height: 1.4;
  color: var(--gold);
  background: rgba(255, 209, 102, 0.1);
  border: 1px dashed rgba(255, 209, 102, 0.4);
  border-radius: 12px;
  padding: 10px 14px;
  text-align: center;
}
input.field-code, .field-code {
  text-align: center;
  font-family: 'Unbounded', sans-serif; font-weight: 600; font-size: 22px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

/* Шаг 3 — пара */
.seg {
  display: flex; gap: 4px;
  background: var(--field);
  border-radius: 999px;
  padding: 4px;
  margin-bottom: 18px;
}
.seg-item {
  flex: 1;
  font-family: inherit; font-size: 14px; font-weight: 600;
  color: var(--text3);
  padding: 11px 8px;
  border-radius: 999px;
  transition: background 0.3s var(--spring), color 0.2s;
}
.seg-item.seg-on { background: var(--card); color: var(--text); box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35); }

.pair-pane[hidden] { display: none; }
.code-card {
  background: linear-gradient(120deg, var(--her-dim), var(--us-dim));
  border: 1px solid rgba(196, 92, 255, 0.4);
  border-radius: 20px;
  padding: 22px 20px;
  text-align: center;
  margin-bottom: 12px;
}
.code-label { font-size: 11px; font-weight: 600; letter-spacing: 0.1em; color: var(--us); }
.code-value {
  font-family: 'Unbounded', sans-serif; font-weight: 600; font-size: 32px;
  letter-spacing: 0.16em;
  color: var(--text);
  margin: 10px 0 6px;
}
.code-hint { font-size: 12px; color: var(--text3); }
.code-card-sm { padding: 16px 18px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.code-card-sm .code-value { font-size: 24px; margin: 4px 0 0; }

.ob-cards { display: flex; flex-direction: column; gap: 14px; }
.pole-card {
  text-align: left;
  font-family: inherit;
  border-radius: 20px;
  padding: 20px;
  border: 1.5px solid transparent;
  transition: transform 0.2s var(--spring), border-color 0.25s, box-shadow 0.25s;
}
.pole-card:active { transform: scale(0.975); }
.pole-her { background: var(--her-dim); border-color: rgba(255, 107, 74, 0.4); color: var(--her); }
.pole-his { background: var(--his-dim); border-color: rgba(91, 126, 255, 0.4); color: var(--his); }
.pole-card.selected.pole-her { border-color: var(--her); box-shadow: 0 0 32px rgba(255, 107, 74, 0.25); }
.pole-card.selected.pole-his { border-color: var(--his); box-shadow: 0 0 32px rgba(91, 126, 255, 0.25); }
.pole-top { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.pole-glyph {
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
}
.pole-glyph svg { width: 26px; height: 26px; }
.pole-name { font-family: 'Unbounded', sans-serif; font-weight: 500; font-size: 19px; color: var(--text); }
.pole-desc { font-size: 14px; line-height: 1.42; color: var(--text2); margin: 0 0 12px; }
.pole-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.pole-chips span {
  font-size: 12px; font-weight: 500;
  padding: 6px 12px; border-radius: 999px;
  border: 1px solid currentColor;
}

.gate-glow {
  position: absolute; inset: -20%;
  background:
    radial-gradient(circle at 15% 90%, rgba(255, 107, 74, 0.22), transparent 45%),
    radial-gradient(circle at 90% 8%, rgba(91, 126, 255, 0.2), transparent 45%);
  pointer-events: none;
}
.gate-body {
  position: relative;
  margin: auto;
  display: flex; flex-direction: column; align-items: center;
  gap: 14px;
  text-align: center;
  max-width: 360px;
}
.gate-icon { border-radius: 20px; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6); }
.gate-title { font-size: 26px; line-height: 1.25; color: var(--text); }
.gate-sub { font-size: 15px; line-height: 1.45; color: var(--text2); margin: 0; }
.gate-steps {
  list-style: none;
  display: flex; flex-direction: column; gap: 12px;
  margin: 10px 0 14px; padding: 0;
  width: 100%;
  text-align: left;
}
.gate-steps li {
  display: flex; align-items: center; gap: 12px;
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: 14px;
  padding: 14px 16px;
  font-size: 14px; line-height: 1.35; color: var(--text2);
}
.gate-steps b { color: var(--text); }
.gate-num {
  flex-shrink: 0;
  width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Unbounded', sans-serif; font-weight: 600; font-size: 12px;
  color: var(--bg);
  background: var(--grad-us);
}

/* ═══════════ Аватар-картинка ═══════════ */
.avatar.has-img { background: var(--field) !important; color: transparent; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 50%; }

/* Ширину задаём явно: кнопка иначе растягивается на всю колонку и значок камеры уезжает */
.avatar-edit {
  position: relative;
  display: block;
  width: 84px; height: 84px;
  flex-shrink: 0;
  align-self: center;
}
.avatar-edit:active { transform: scale(0.96); }
.avatar-cam {
  position: absolute; right: 0; bottom: 4px;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--grad-us);
  border: 2.5px solid var(--bg);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
}
.avatar-cam svg { width: 15px; height: 15px; }

.sheet-sub { font-size: 14px; line-height: 1.45; color: var(--text2); margin: -4px 0 4px; }
#sheet-avatar .auth-legal { margin-top: 2px; }

/* ═══════════ Ожидание генерации ═══════════ */
#av-progress {
  position: fixed; inset: 0; z-index: 13500;
  background: rgba(13, 11, 18, 0.94);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  display: flex; align-items: center; justify-content: center;
}
#av-progress[hidden] { display: none; }
.avp-inner { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; padding: 0 32px; }
.avp-ring {
  width: 108px; height: 108px; border-radius: 50%;
  border: 2px solid var(--stroke);
  position: relative;
  margin-bottom: 10px;
}
.avp-orb {
  position: absolute; inset: -2px;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: var(--her);
  border-right-color: var(--us);
  animation: avpSpin 1.1s linear infinite;
}
@keyframes avpSpin { to { transform: rotate(360deg); } }
.avp-title { font-family: 'Unbounded', sans-serif; font-weight: 500; font-size: 19px; }
.avp-sub { font-size: 14px; color: var(--text2); min-height: 20px; }

/* ═══════════ Всплывающие плашки (тосты) ═══════════ */
#toaster {
  position: fixed;
  left: 16px; right: 16px;
  bottom: calc(64px + 10px + var(--f7-safe-area-bottom) + 14px);
  max-width: 528px;
  margin: 0 auto;
  z-index: 14000;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.toast-x {
  display: flex; align-items: center; gap: 12px;
  background: rgba(30, 26, 40, 0.92);
  -webkit-backdrop-filter: blur(22px) saturate(170%);
  backdrop-filter: blur(22px) saturate(170%);
  border: 1px solid var(--stroke-strong);
  border-radius: 18px;
  padding: 13px 16px;
  box-shadow: 0 14px 44px rgba(0, 0, 0, 0.6);
  color: var(--text);
  font-size: 14.5px; line-height: 1.35; font-weight: 500;
  pointer-events: auto;
  opacity: 0;
  transform: translateY(20px) scale(0.96);
  transition: opacity 0.28s ease, transform 0.44s var(--spring);
}
.toast-x.in { opacity: 1; transform: none; }
.toast-x.out { opacity: 0; transform: translateY(-10px) scale(0.98); }
.toast-ico {
  width: 30px; height: 30px; border-radius: 50%;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
}
.toast-ico svg { width: 16px; height: 16px; }
.toast-text { flex: 1; min-width: 0; }

/* ═══════════ Колокол в шапке ═══════════ */
.head-actions { display: flex; align-items: center; gap: 10px; }
.bell {
  position: relative;
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  color: var(--text2);
  background: var(--card);
  transition: transform 0.15s var(--spring), color 0.2s;
}
.bell svg { width: 22px; height: 22px; }
.bell:active { transform: scale(0.9); }
.bell.has-unread { color: var(--text); }
.bell-badge {
  position: absolute; top: -1px; right: -1px;
  min-width: 18px; height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--grad-us);
  color: var(--bg);
  font-family: 'Unbounded', sans-serif; font-weight: 600; font-size: 10px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 2px var(--bg);
  animation: badgePop 0.4s var(--spring);
}
@keyframes badgePop { from { transform: scale(0); } to { transform: scale(1); } }

/* ═══════════ Экран уведомлений ═══════════ */
.notif-page { background: var(--bg); }
.n-wrap { padding-top: calc(var(--f7-safe-area-top) + 16px); }
.n-title { font-family: 'Unbounded', sans-serif; font-weight: 500; font-size: 19px; }
.n-readall {
  font-family: inherit; font-size: 13px; font-weight: 600;
  color: var(--us);
  padding: 8px 0;
}
.n-readall:disabled { color: var(--text3); }

.n-day {
  font-size: 11px; font-weight: 600; letter-spacing: 0.08em;
  color: var(--text3);
  margin: 18px 0 10px 2px;
}
.n-day:first-child { margin-top: 6px; }

.n-item {
  display: flex; align-items: flex-start; gap: 12px;
  width: 100%;
  text-align: left;
  padding: 14px;
  border-radius: 16px;
  margin-bottom: 8px;
  background: transparent;
  transition: transform 0.15s var(--spring), background 0.25s;
}
.n-item:active { transform: scale(0.985); }
.n-item.unread { background: var(--card); }

/* аватар события: круг в цвете типа + мини-глиф */
.n-ava {
  position: relative;
  width: 42px; height: 42px; border-radius: 50%;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Unbounded', sans-serif; font-weight: 600; font-size: 15px;
  color: var(--bg);
}
.n-ava svg { width: 20px; height: 20px; }
.n-glyph {
  position: absolute; right: -3px; bottom: -3px;
  width: 19px; height: 19px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--bg);
}
.n-glyph svg { width: 11px; height: 11px; color: #fff; }

.n-body { flex: 1; min-width: 0; padding-top: 1px; }
.n-head { font-size: 15px; line-height: 1.3; color: var(--text); }
.n-head b { font-weight: 600; }
.n-sub { font-size: 13px; line-height: 1.35; color: var(--text2); margin-top: 3px; }
.n-time { font-size: 12px; color: var(--text3); margin-top: 5px; }
.n-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--us);
  flex-shrink: 0;
  margin-top: 16px;
}

.n-empty {
  display: flex; flex-direction: column; align-items: center;
  text-align: center;
  padding: 80px 24px;
  gap: 10px;
}
.n-empty-glyph {
  width: 76px; height: 76px; border-radius: 50%;
  background: var(--card);
  display: flex; align-items: center; justify-content: center;
  color: var(--text3);
  margin-bottom: 6px;
}
.n-empty-glyph svg { width: 34px; height: 34px; }
.n-empty-title { font-family: 'Unbounded', sans-serif; font-weight: 500; font-size: 18px; }
.n-empty-sub { font-size: 14px; line-height: 1.45; color: var(--text3); max-width: 260px; margin: 0; }

/* ═══════════ Прогресс: плитки статистики ═══════════ */
.stats-row { display: flex; gap: 10px; margin-bottom: 20px; }
.stat {
  flex: 1;
  background: var(--card);
  border-radius: 16px;
  padding: 14px 10px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.stat-num {
  font-family: 'Unbounded', sans-serif; font-weight: 600; font-size: 22px;
  color: var(--text);
}
.stat-label { font-size: 11px; font-weight: 500; color: var(--text3); text-align: center; }

/* ═══════════ Профиль ═══════════ */
.profile-hero {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 8px 0 24px;
  text-align: center;
}
.profile-hero .av-xl { margin-bottom: 6px; box-shadow: 0 10px 34px rgba(0, 0, 0, 0.5); }
.profile-hero h1 { font-size: 26px; }

.partner-card { display: flex; align-items: center; gap: 14px; }
.partner-info { flex: 1; }
.partner-name { font-size: 16px; font-weight: 600; }
.partner-sub { font-size: 13px; color: var(--text2); margin-top: 2px; }

.settings { background: var(--card); border-radius: 16px; overflow: hidden; }
.set-row {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%;
  padding: 16px 18px;
  font-family: inherit; font-size: 15px; font-weight: 500;
  color: var(--text);
  background: none;
  border: none;
  border-bottom: 1px solid var(--stroke);
  transition: background 0.15s;
}
.set-row:last-child { border-bottom: none; }
.set-row:active { background: var(--field); }
.set-row .chev { color: var(--text3); font-size: 20px; line-height: 1; }
.set-value { color: var(--text3); font-weight: 500; }
.settings-danger { margin-top: 20px; }
.set-row.danger { color: var(--danger); }

/* Переключатель в стиле системы */
.toggle {
  width: 50px; height: 30px;
  border-radius: 999px;
  background: var(--field);
  border: 1px solid var(--stroke);
  padding: 0;
  position: relative;
  flex-shrink: 0;
  transition: background 0.3s var(--spring), border-color 0.3s;
}
.toggle i {
  position: absolute; top: 2px; left: 2px;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--text3);
  transition: transform 0.32s var(--spring), background 0.3s;
}
.toggle[aria-checked="true"] { background: var(--grad-us); border-color: transparent; }
.toggle[aria-checked="true"] i { transform: translateX(20px); background: #fff; }
.toggle:active i { width: 27px; }

.version { text-align: center; font-size: 11px; color: var(--text3); opacity: 0.7; padding: 20px 0 8px; }

/* Виброотклик iOS: прозрачный системный switch поверх кнопки — палец попадает
   в него, Taptic Engine щёлкает. НЕЛЬЗЯ ставить appearance:none, pointer-events:none
   или прятать — иначе нативная отрисовка исчезает и вибрации не будет. */
.haptic-switch {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  border: 0;
  opacity: 0;
  clip-path: inset(0 round 999px);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

@keyframes floatUp {
  0% { opacity: 0; transform: translateY(6px); }
  20% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-28px); }
}
.xp-float {
  position: fixed;
  font-family: 'Unbounded', sans-serif; font-weight: 600; font-size: 15px;
  color: var(--gold);
  animation: floatUp 1.1s ease forwards;
  pointer-events: none;
  z-index: 13000;
}

/* ═══════════ Онбординг: диагностика → программа ═══════════ */
.onb-card {
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: 22px;
  padding: 22px 20px;
  display: flex; flex-direction: column; gap: 12px;
  box-sizing: border-box;
}
.onb-step {
  font-size: 11px; font-weight: 700; letter-spacing: 0.1em;
  color: var(--us);
}
.onb-title { font-family: 'Unbounded', sans-serif; font-weight: 500; font-size: 21px; line-height: 1.25; }
.onb-text { font-size: 14px; line-height: 1.5; color: var(--text2); }
.onb-card .btn { margin-top: 4px; }

/* баннер чек-ина */
.banner {
  display: flex; align-items: center; gap: 12px;
  width: 100%; box-sizing: border-box; text-align: left;
  background: var(--us-dim);
  border: 1px solid color-mix(in srgb, var(--us) 40%, transparent);
  border-radius: 18px;
  padding: 14px 16px;
  font-family: inherit; color: var(--text);
  transition: transform 0.15s var(--spring);
}
.banner:active { transform: scale(0.985); }
.banner-dot {
  width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0;
  background: var(--us);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--us) 22%, transparent);
}
.banner-body { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.banner-body b { font-size: 15px; font-weight: 600; }
.banner-body i { font-style: normal; font-size: 12.5px; color: var(--text2); }

/* ═══════════ Шаг дня ═══════════ */
.step-card {
  display: flex; flex-direction: column; gap: 12px;
  padding: 16px 18px 12px;
  box-sizing: border-box;
  transition: opacity 0.25s;
}
.step-card.is-done { opacity: 0.5; }
.step-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.step-area {
  font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--tint);
}
.step-week { font-size: 11.5px; color: var(--text3); }
.step-main { display: flex; align-items: flex-start; gap: 14px; }
.step-box {
  width: 28px; height: 28px; border-radius: 10px;
  border: 2px solid var(--stroke-strong);
  background: transparent;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; color: #fff;
  transition: background 0.25s, border-color 0.25s, transform 0.15s var(--spring);
}
.step-box:active { transform: scale(0.9); }
.step-card.is-done .step-box { background: var(--grad-us); border-color: transparent; }
.step-body { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.step-text { font-size: 16px; line-height: 1.35; font-weight: 500; }
.step-card.is-done .step-text { text-decoration: line-through; }
.step-meta { font-size: 12.5px; color: var(--text3); }
.step-open {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; box-sizing: border-box;
  background: transparent; border: 0; border-top: 1px solid var(--stroke);
  padding: 11px 0 3px; margin-top: 2px;
  font-family: inherit; font-size: 13.5px; font-weight: 500; color: var(--text2);
}
.step-open:active { color: var(--text); }
.step-open .chev { color: var(--text3); font-size: 17px; }

.all-done { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 34px 20px; text-align: center; }
.all-done-mark {
  width: 56px; height: 56px; border-radius: 50%;
  background: color-mix(in srgb, var(--ok) 16%, transparent);
  display: flex; align-items: center; justify-content: center;
}
.all-done-mark svg { width: 28px; height: 28px; color: var(--ok); }
.all-done-title { font-family: 'Unbounded', sans-serif; font-weight: 500; font-size: 18px; }
.all-done-sub { font-size: 13.5px; line-height: 1.45; color: var(--text2); max-width: 260px; }

/* ═══════════ Партнёр на «Сегодня» ═══════════ */
.pt-card { display: flex; flex-direction: column; gap: 14px; padding: 18px; }
.pt-head { display: flex; align-items: center; gap: 13px; }
.pt-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pt-name { font-size: 16px; font-weight: 600; }
.pt-sub { font-size: 12.5px; color: var(--text2); }
.pt-track {
  border-left: 2px solid var(--tint);
  padding: 2px 0 2px 12px;
  display: flex; flex-direction: column; gap: 3px;
}
.pt-track + .pt-track { margin-top: 12px; }
.pt-track-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.pt-track-top span { font-size: 11px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--tint); }
.pt-track-top b { font-size: 11.5px; font-weight: 500; color: var(--text3); }
.pt-track-week { font-size: 14.5px; font-weight: 500; }
.pt-last { font-size: 12.5px; line-height: 1.4; color: var(--text2); }
.pt-cheer { align-self: flex-start; }

/* ═══════════ Программа ═══════════ */
.track-card { display: flex; flex-direction: column; gap: 10px; padding: 18px; box-sizing: border-box; }
.track-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.track-area { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--tint); }
.track-week { font-family: 'Unbounded', sans-serif; font-size: 13px; color: var(--text3); }
.track-title { font-family: 'Unbounded', sans-serif; font-weight: 500; font-size: 18px; line-height: 1.3; }
.track-how { font-size: 13px; line-height: 1.5; color: var(--text2); }
.track-meta { font-size: 12px; color: var(--text3); }
.track-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.track-actions .mini-btn { width: auto; flex: 0 0 auto; }
.pt-cheer { width: auto; }
.mini-go { color: var(--us); border-color: color-mix(in srgb, var(--us) 45%, transparent); }
.track-fin { font-size: 12.5px; color: var(--ok); align-self: center; }

.avail-card {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; box-sizing: border-box; text-align: left;
  padding: 16px 18px;
  border-left: 3px solid var(--tint);
  transition: transform 0.15s var(--spring);
}
.avail-card:active { transform: scale(0.985); }
.avail-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.avail-name { font-size: 16px; font-weight: 600; }
.avail-sub { font-size: 12.5px; color: var(--text3); }

/* ═══════════ Прогресс ═══════════ */
.index-card { display: flex; flex-direction: column; gap: 10px; padding: 20px; box-sizing: border-box; }
.index-label { font-size: 11px; font-weight: 700; letter-spacing: 0.1em; color: var(--text3); }
.index-row { display: flex; align-items: baseline; gap: 12px; }
.index-value { font-family: 'Unbounded', sans-serif; font-weight: 600; font-size: 46px; line-height: 1; }
.index-delta { font-size: 14px; font-weight: 600; }
.index-delta.up { color: var(--ok); }
.index-delta.down { color: var(--her); }
.index-delta.flat { color: var(--text3); }
.index-bar { height: 8px; border-radius: 99px; background: var(--field); overflow: hidden; }
.index-bar i { display: block; height: 100%; border-radius: 99px; background: var(--grad-full); transition: width 0.6s var(--spring); }
.index-note { font-size: 12.5px; line-height: 1.45; color: var(--text3); }

.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat {
  background: var(--card); border: 1px solid var(--stroke); border-radius: 18px;
  padding: 16px; box-sizing: border-box;
  display: flex; flex-direction: column; gap: 3px;
}
.stat-num { font-family: 'Unbounded', sans-serif; font-weight: 600; font-size: 26px; line-height: 1; }
.stat-cap { font-size: 12px; color: var(--text3); }

.ametric { display: flex; flex-direction: column; gap: 9px; padding: 16px 18px; box-sizing: border-box; }
.am-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.am-name { font-size: 15px; font-weight: 600; }
.am-score { font-family: 'Unbounded', sans-serif; font-weight: 600; font-size: 20px; display: flex; align-items: baseline; gap: 6px; }
.am-delta { font-family: 'Onest', sans-serif; font-style: normal; font-size: 12.5px; font-weight: 600; }
.am-delta.up { color: var(--ok); }
.am-delta.down { color: var(--her); }
.ametric .bar-fill { background: var(--tint); }
.am-sub { font-size: 12.5px; line-height: 1.45; color: var(--text2); }
.am-sub b { color: var(--tint); }
.am-week { font-size: 12px; color: var(--text3); }

.heat { display: grid; grid-template-columns: repeat(14, 1fr); gap: 5px; }
.hc { display: block; aspect-ratio: 1; border-radius: 5px; background: var(--field); }
.hc-1 { background: color-mix(in srgb, var(--us) 35%, var(--field)); }
.hc-2 { background: color-mix(in srgb, var(--us) 65%, var(--field)); }
.hc-3 { background: var(--us); }
.heat-legend { display: flex; justify-content: space-between; margin-top: 10px; font-size: 11px; color: var(--text3); }

.spark { width: 100%; height: 90px; display: block; }
.hist-rows { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.hist-row { display: flex; justify-content: space-between; font-size: 13px; color: var(--text2); }
.hist-row b { font-family: 'Unbounded', sans-serif; font-weight: 500; color: var(--text); }

/* ═══════════ Попап шага ═══════════ */
/* .d-wrap центрирует по горизонтали — содержимое попапов растягиваем явно */
#popup-step .d-wrap > *, #popup-map .d-wrap > *, #popup-survey .d-wrap > * { width: 100%; }
#popup-step .d-wrap, #popup-map .d-wrap, #popup-survey .d-wrap { gap: 14px; }
.sp-crumb { font-size: 12px; font-weight: 600; letter-spacing: 0.05em; color: var(--text3); }
.sp-title { font-family: 'Unbounded', sans-serif; font-weight: 500; font-size: 24px; line-height: 1.25; }
.sp-meta { display: flex; flex-wrap: wrap; gap: 8px; }
#popup-step .d-actions { margin-top: auto; padding-top: 24px; }
.sp-chip {
  font-size: 12px; font-weight: 500; color: var(--text2);
  background: var(--field); border: 1px solid var(--stroke);
  border-radius: 999px; padding: 6px 12px;
}
.sp-h { font-size: 12px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--text3); margin-top: 12px; }
.sp-how { display: flex; flex-direction: column; gap: 12px; counter-reset: sp; padding: 0; margin: 0; list-style: none; }
.sp-how li {
  position: relative; padding-left: 34px;
  font-size: 15px; line-height: 1.5; color: var(--text);
  counter-increment: sp;
}
.sp-how li::before {
  content: counter(sp);
  position: absolute; left: 0; top: -1px;
  width: 24px; height: 24px; border-radius: 8px;
  background: var(--field); border: 1px solid var(--stroke);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; color: var(--text2);
}
.sp-done { background: var(--field); border-radius: 16px; padding: 14px 16px; display: flex; flex-direction: column; gap: 5px; }
.sp-done-cap { font-size: 10.5px; font-weight: 700; letter-spacing: 0.09em; color: var(--text3); }
.sp-done-text { font-size: 14.5px; line-height: 1.4; }
.sp-focus { font-size: 14px; line-height: 1.55; color: var(--text2); }

/* ═══════════ Карта программы ═══════════ */
.mp-sub { font-size: 13.5px; line-height: 1.5; color: var(--text2); }
.wk { display: flex; gap: 14px; padding: 14px 0; border-top: 1px solid var(--stroke); }
.wk:first-child { border-top: 0; }
.wk-num {
  width: 30px; height: 30px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Unbounded', sans-serif; font-size: 13px; font-weight: 500;
  background: var(--field); color: var(--text3);
  border: 1px solid var(--stroke);
}
.wk-body { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.wk-title { font-size: 16px; font-weight: 600; }
.wk-focus { font-size: 13px; line-height: 1.5; color: var(--text2); }
.wk-how { font-size: 13px; line-height: 1.5; color: var(--text); background: var(--field); border-radius: 12px; padding: 10px 12px; }
.wk-past .wk-num { background: color-mix(in srgb, var(--tint) 20%, transparent); color: var(--tint); border-color: transparent; }
.wk-past .wk-title, .wk-past .wk-focus { opacity: 0.55; }
.wk-now { margin: 0 -14px; padding: 16px 14px; background: var(--card); border-radius: 18px; border-top-color: transparent; }
.wk-now + .wk { border-top-color: transparent; }
.wk-now .wk-num { background: var(--tint); color: #12101A; border-color: transparent; }
.wk-now .wk-title { color: var(--tint); }

/* ═══════════ Диагностика ═══════════ */
.sv-bar { flex: 1; height: 4px; border-radius: 99px; background: var(--field); overflow: hidden; margin: 0 14px; }
.sv-bar i { display: block; height: 100%; background: var(--grad-us); border-radius: 99px; transition: width 0.35s var(--spring); }
.sv-count { font-size: 12px; color: var(--text3); font-variant-numeric: tabular-nums; }
.sv-area { font-size: 11px; font-weight: 700; letter-spacing: 0.09em; }
.sv-q { font-family: 'Unbounded', sans-serif; font-weight: 500; font-size: 25px; line-height: 1.3; margin-top: 10px; }
.sv-opts { display: flex; flex-direction: column; gap: 9px; margin-top: 22px; }
.sv-opt {
  display: flex; align-items: center; gap: 13px;
  width: 100%; box-sizing: border-box; text-align: left;
  background: var(--card); border: 1px solid var(--stroke);
  border-radius: 16px; padding: 16px 18px;
  font-family: inherit; font-size: 15.5px; color: var(--text);
  transition: border-color 0.2s, background 0.2s, transform 0.14s var(--spring);
}
.sv-opt:active { transform: scale(0.985); }
.sv-opt.on { border-color: var(--us); background: var(--us-dim); }
.sv-opt-dot {
  width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0;
  border: 2px solid var(--stroke-strong);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.sv-opt.on .sv-opt-dot { border-color: var(--us); box-shadow: inset 0 0 0 4px var(--us); }
.sv-res-cap { font-size: 11px; font-weight: 700; letter-spacing: 0.1em; color: var(--us); }
#sv-result .ametric { margin-bottom: 10px; }

/* ═══════════ Тело и весы ═══════════ */
.body-empty { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 26px 20px; text-align: center; box-sizing: border-box; }
.be-glyph { width: 54px; height: 54px; border-radius: 16px; background: var(--field);
  display: flex; align-items: center; justify-content: center; }
.be-glyph svg { width: 28px; height: 28px; color: var(--us); }
.be-title { font-family: 'Unbounded', sans-serif; font-weight: 500; font-size: 19px; }
.be-sub { font-size: 13.5px; line-height: 1.5; color: var(--text2); }
.body-empty .btn { width: 100%; margin-top: 4px; }
.be-legal { font-size: 11.5px; line-height: 1.45; color: var(--text3); }

.verdict { display: flex; flex-direction: column; gap: 7px; padding: 18px;
  border-left: 3px solid var(--tone); box-sizing: border-box; }
.vd-cap { font-size: 10.5px; font-weight: 700; letter-spacing: 0.1em; color: var(--text3); }
.vd-title { font-family: 'Unbounded', sans-serif; font-weight: 500; font-size: 19px;
  line-height: 1.3; color: var(--tone); }
.vd-note { font-size: 13.5px; line-height: 1.5; color: var(--text2); }

.body-card { display: flex; flex-direction: column; gap: 14px; padding: 18px; box-sizing: border-box; }
.bc-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.bc-cap { font-size: 10.5px; font-weight: 700; letter-spacing: 0.1em; color: var(--text3); }
.bc-when { font-size: 12px; color: var(--text3); }
.comp { display: flex; flex-direction: column; }
.comp-row { display: grid; grid-template-columns: 1fr auto auto; align-items: baseline; gap: 12px;
  padding: 9px 0; border-top: 1px solid var(--stroke); }
.comp-row:first-child { border-top: 0; }
.comp-name { font-size: 14px; color: var(--text2); }
.comp-val { font-family: 'Unbounded', sans-serif; font-weight: 500; font-size: 17px; }
.comp-val i { font-family: 'Onest', sans-serif; font-style: normal; font-size: 11px;
  color: var(--text3); margin-left: 3px; }
.comp-rate { font-size: 12px; font-weight: 600; min-width: 104px; text-align: right;
  font-variant-numeric: tabular-nums; }
.comp-rate.good { color: var(--ok); }
.comp-rate.warn { color: var(--gold); }
.comp-rate.noise { color: var(--text3); font-weight: 500; }
.comp-rate i { font-style: normal; font-weight: 500; opacity: 0.75; }
.spark-body { height: 96px; }
.bc-legend { display: flex; justify-content: space-between; font-size: 11px; color: var(--text3); }

.proto { padding: 0; box-sizing: border-box; }
.proto-sum { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 16px 18px; font-size: 14px; font-weight: 500; cursor: pointer; list-style: none; }
.proto-sum::-webkit-details-marker { display: none; }
.proto[open] .proto-sum .chev { transform: rotate(90deg); }
.proto-sum .chev { color: var(--text3); font-size: 17px; transition: transform 0.2s var(--spring); }
.proto-list { margin: 0; padding: 0 18px 6px 40px; display: flex; flex-direction: column; gap: 9px; }
.proto-list li { font-size: 13.5px; line-height: 1.45; color: var(--text2); }
.proto .be-legal { padding: 0 18px 16px; }
.body-actions { display: flex; gap: 8px; }
.body-actions .mini-btn { width: auto; }

.wg-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.wg-f { display: flex; flex-direction: column; gap: 6px; }
.wg-f span { font-size: 12px; color: var(--text2); }
.wg-f input.field { width: 100%; box-sizing: border-box; }

.sheet-when { font-size: 12px; line-height: 1.45; color: var(--us); }

/* ═══════════ Интеграции ═══════════ */
.integr { display: flex; flex-direction: column; gap: 12px; padding: 18px; box-sizing: border-box; }
.integr-head { display: flex; align-items: center; gap: 13px; flex-wrap: wrap; }
.integr-ico { width: 44px; height: 44px; border-radius: 14px; flex-shrink: 0;
  background: color-mix(in srgb, var(--tint) 14%, transparent);
  display: flex; align-items: center; justify-content: center; }
.integr-ico svg { width: 24px; height: 24px; color: var(--tint); }
.integr-id { display: flex; flex-direction: column; gap: 2px; flex: 1 1 auto; min-width: 110px; }
.integr-name { font-size: 16px; font-weight: 600; }
.integr-kind { font-size: 12px; color: var(--text3); }
.integr-state { font-size: 11px; font-weight: 600; letter-spacing: 0.02em;
  padding: 5px 10px; border-radius: 999px; white-space: nowrap; margin-left: auto;
  background: var(--field); color: var(--text3); }
.integr-state.st-on { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.integr-state.st-blocked { background: color-mix(in srgb, var(--gold) 14%, transparent); color: var(--gold); }
.integr-about { font-size: 13.5px; line-height: 1.5; color: var(--text2); }
.integr-note { font-size: 12.5px; line-height: 1.45; color: var(--text3); }
.integr-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.integr-actions .mini-btn { width: auto; flex: 0 0 auto; }
.mini-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
#val-integrations { display: inline-flex; align-items: center; gap: 4px; }

/* ═══════════ Регулярность подъёма ═══════════ */
.wake-card { display: flex; flex-direction: column; gap: 10px; padding: 18px; box-sizing: border-box; }
.wake-row { display: flex; align-items: baseline; gap: 12px; }
.wake-time { font-family: 'Unbounded', sans-serif; font-weight: 600; font-size: 32px; line-height: 1; }
.wake-spread { font-size: 14px; font-weight: 600; color: var(--text2); }
.wake-note { font-size: 13px; line-height: 1.5; color: var(--text2); }
.comp-base { display: block; font-style: normal; font-size: 11.5px; color: var(--text3); margin-top: 2px; }
.comp-row { align-items: center; }

/* ═══════════ Фирменные 3D-иллюстрации ═══════════
   Рендерятся на прозрачном фоне, поэтому ложатся и на карточку, и на фон.
   Лёгкое свечение под объектом связывает их с тёмной подложкой. */
.illu {
  display: block;
  height: auto;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  filter: drop-shadow(0 12px 24px rgba(0, 0, 0, 0.45));
}
.illu-onb { width: 150px; margin: -6px auto 2px; }
.illu-empty { width: 132px; margin: 0 auto 2px; }
.illu-done { width: 140px; margin: 0 auto -4px; }
/* на приветствии иллюстрация заменяет иконку приложения — снимаем её оформление */
.illu-hero {
  width: 188px; margin: 0 auto;
  border-radius: 0; box-shadow: none; background: none;
  filter: drop-shadow(0 18px 40px rgba(0, 0, 0, 0.6));
}

/* карточка трека: иллюстрация в углу, текст её обтекает */
.track-card { position: relative; overflow: hidden; }
/* иллюстрация встаёт под шапкой: строка «область · неделя» остаётся во всю ширину */
.illu-track {
  position: absolute; top: 44px; right: 14px;
  width: 78px; opacity: 0.95;
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.5));
}
.track-card .track-title, .track-card .track-how { padding-right: 86px; }
.track-card .track-week { white-space: nowrap; }
.illu-avail { width: 46px; flex-shrink: 0; }
.avail-card { gap: 14px; }

@media (prefers-reduced-motion: no-preference) {
  .illu-hero { animation: illuFloat 5.5s ease-in-out infinite; }
}
@keyframes illuFloat {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-9px); }
}

/* ═══════════ Сводка: плитки и состояние источников ═══════════ */
.tile {
  display: flex; flex-direction: column; gap: 5px; align-items: flex-start;
  width: 100%; box-sizing: border-box; text-align: left; padding: 18px;
  transition: transform 0.15s var(--spring);
}
.tile:active { transform: scale(0.985); }
.tile-name { font-size: 12.5px; color: var(--text3); }
.tile-value { font-family: 'Unbounded', sans-serif; font-weight: 600; font-size: 34px; line-height: 1; }
.tile-value i { font-family: 'Onest', sans-serif; font-style: normal; font-size: 14px;
  color: var(--text3); margin-left: 5px; }
.tile-note { font-size: 12.5px; font-weight: 600; }
.tile-note.good { color: var(--ok); }
.tile-note.warn { color: var(--gold); }
.tile-note.noise { color: var(--text3); font-weight: 500; }

.srcrow {
  display: flex; flex-direction: column; gap: 6px; align-items: stretch;
  width: 100%; box-sizing: border-box; text-align: left; padding: 16px 18px;
  transition: transform 0.15s var(--spring);
}
.srcrow:active { transform: scale(0.99); }
.srcrow-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.srcrow-name { font-size: 15.5px; font-weight: 600; }
.srcrow-note { font-size: 13px; line-height: 1.4; color: var(--text2); }
.srcrow-meta { font-size: 11.5px; color: var(--text3); }
.integr-state.st-err { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger); }
.integr-state.st-off { background: var(--field); color: var(--text3); }

/* ═══════════ Журнал сырых записей ═══════════ */
.logrow {
  display: grid; grid-template-columns: 62px auto 1fr; align-items: baseline; gap: 12px;
  padding: 11px 0; border-top: 1px solid var(--stroke);
}
.logrow:first-child { border-top: 0; }
.logrow.off { opacity: 0.45; }
.log-when { font-size: 12px; color: var(--text3); font-variant-numeric: tabular-nums; }
.log-main { font-family: 'Unbounded', sans-serif; font-weight: 500; font-size: 15px; }
.log-bits { font-size: 12px; color: var(--text2); text-align: right; }
.log-wait { padding: 28px 0; text-align: center; font-size: 14px; color: var(--text3); }

/* ═══════════ Замеры лентой ═══════════ */
.ms-card { display: flex; flex-direction: column; gap: 12px; padding: 18px; box-sizing: border-box; }
.ms-list { display: flex; flex-direction: column; }
.ms-row { display: grid; grid-template-columns: 1fr auto 92px; align-items: baseline; gap: 12px;
  padding: 10px 0; border-top: 1px solid var(--stroke); }
.ms-row:first-child { border-top: 0; }
.ms-name { font-size: 14px; color: var(--text2); }
.ms-main .ms-name { color: var(--text); font-weight: 500; }
.ms-val { font-family: 'Unbounded', sans-serif; font-weight: 500; font-size: 17px; }
.ms-val b { font-family: 'Onest', sans-serif; font-weight: 400; font-size: 11px;
  color: var(--text3); margin-left: 3px; }
.ms-delta { text-align: right; font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.ms-delta i { font-style: normal; }
.ms-up { color: var(--his); }
.ms-down { color: var(--her); }
.ms-flat { color: var(--text3); font-weight: 500; }

/* Ввод: длинный список, поэтому шторка прокручивается */
.ms-sheet { max-height: 86vh; overflow-y: auto; -webkit-overflow-scrolling: touch; }
#ms-fields { display: flex; flex-direction: column; gap: 16px; }
.ms-field { display: flex; flex-direction: column; gap: 6px; }
.ms-field-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.ms-field-top b { font-size: 15px; font-weight: 600; }
.ms-field-top i { font-style: normal; font-size: 12px; color: var(--text3); }
.ms-field input.field { width: 100%; box-sizing: border-box; }
.ms-hint { font-size: 12px; line-height: 1.4; color: var(--text3); }
