/* Life Assistant 3.0 — final beta interface layer.
   tokens.css is the only palette source; this file only composes components. */

html, body { background: var(--bg); }
body {
  background: var(--main-bg);
  transition: background .45s ease, color .35s ease;
}
.app-shell { position: relative; min-width: 1000px; min-height: 660px; background: var(--main-bg); overflow: clip; }

/* Desktop sidebar */
.desktop-sidebar {
  width: var(--sidebar);
  gap: 0;
  padding: 0;
  border-right: 1px solid var(--card-brd);
  background: var(--sb-bg);
  backdrop-filter: none;
}
.sidebar-head { padding: 14px 12px 11px; border-bottom: 1px solid var(--card-brd); }
.brand { gap: 8px; padding: 0; }
.brand-mark {
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  border-radius: 8px;
  background: var(--ac-g);
  box-shadow: var(--sha);
  font-size: 13px;
}
.brand-copy { min-width: 0; }
.brand strong { font-size: 13px; font-weight: 700; letter-spacing: -.2px; }
.brand small { margin-top: 1px; font-size: 9px; color: var(--muted); }

.mode-pill {
  position: relative;
  display: flex;
  padding: 2px;
  border: 0;
  border-radius: 8px;
  background: var(--mp-bg);
  isolation: isolate;
}
.desktop-mode-pill { width: 100%; margin-top: 11px; }
.mobile-mode-pill { display: none; }
.mp-slider {
  position: absolute;
  z-index: 0;
  top: 2px;
  bottom: 2px;
  left: 2px;
  width: calc(50% - 2px);
  border-radius: 6px;
  background: var(--mp-slider);
  transition: left .38s cubic-bezier(.34,1.56,.64,1), width .38s cubic-bezier(.34,1.56,.64,1), background .45s ease;
}
.mode-pill[data-active="work"] .mp-slider { left: 50%; }
.workspace-button {
  position: relative;
  z-index: 1;
  min-width: 0;
  min-height: 26px;
  flex: 1;
  justify-content: center;
  gap: 5px;
  padding: 5px 0;
  border: 0;
  border-radius: 6px;
  background: transparent !important;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  transition: color .2s ease, transform .15s ease;
}
.workspace-button svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.workspace-button.active { color: var(--ac); }
.workspace-button:active { transform: scale(.96); }

.side-nav {
  display: block;
  flex: 1;
  min-height: 0;
  padding: 9px 8px 12px;
  overflow: auto;
  scrollbar-width: thin;
}
.nav-section-title {
  display: block;
  padding: 9px 8px 4px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
}
.nav-button {
  position: relative;
  min-height: 30px;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  transition: background .15s ease, color .15s ease, transform .15s ease;
}
.nav-button svg { width: 16px; height: 16px; }
.nav-button:hover { background: var(--surface2); color: var(--text); }
.nav-button.active { background: var(--nav-act); color: var(--ac); }
.nav-button.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 3px;
  height: 14px;
  border-radius: 0 3px 3px 0;
  background: var(--ac-g);
  transform: translateY(-50%);
}
.nav-button:active { transform: scale(.98); }

.sidebar-footer { gap: 8px; padding: 9px 10px 10px; border-top: 1px solid var(--card-brd); }
.primary-action {
  min-height: 34px;
  border-radius: 8px;
  background: var(--ac-g);
  box-shadow: var(--sha);
  font-size: 11px;
}
.sync-pill {
  min-height: 28px;
  justify-content: flex-start;
  gap: 7px;
  padding: 5px 8px;
  border-radius: 7px;
  background: var(--surface2);
  font-size: 9px;
}
.sync-dot { width: 6px; height: 6px; flex: 0 0 6px; border-radius: 50%; background: var(--green); animation: final-pulse 2s infinite; }
.sidebar-profile { display: grid; grid-template-columns: 26px 1fr 26px; align-items: center; gap: 7px; }
.profile-avatar { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; background: var(--ac-g); color: white; font-size: 8px; font-weight: 800; }
.profile-copy { min-width: 0; display: grid; gap: 1px; }
.profile-copy strong { overflow: hidden; color: var(--text); font-size: 10px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.profile-copy small { color: var(--muted); font-size: 8px; }
.theme-icon-button {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--theme-ico-brd);
  border-radius: 7px;
  background: var(--theme-ico-bg);
  color: var(--muted);
  cursor: pointer;
  transition: transform .2s ease, color .2s ease, background .2s ease;
}
.theme-icon-button svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.theme-icon-button:hover { color: var(--ac); transform: scale(1.1); }

/* Desktop topbar */
.main-area { margin-left: var(--sidebar); background: var(--main-bg); }
.topbar {
  min-height: var(--topbar);
  gap: 8px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--card-brd);
  background: color-mix(in srgb, var(--main-bg), transparent 4%);
  backdrop-filter: blur(16px);
}
.greeting-row { min-width: 190px; display: flex; align-items: center; gap: 8px; }
.greeting-icon { width: 28px; height: 28px; flex: 0 0 28px; display: grid; place-items: center; border-radius: 8px; background: var(--ac-s); }
.greeting-icon svg { width: 16px; height: 16px; }
.greeting-copy { min-width: 0; display: grid; gap: 1px; }
.greeting-copy strong { overflow: hidden; color: var(--text); font-size: 16px; font-weight: 700; letter-spacing: -.3px; text-overflow: ellipsis; white-space: nowrap; }
.greeting-copy small { overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.search-box { max-width: 300px; margin-left: auto; border-radius: 9px; background: var(--card-bg); }
.search-box input { min-height: 36px; }
.topbar .icon-button { width: 36px; height: 36px; border-radius: 9px; background: var(--card-bg); }
.mobile-theme-button { display: none; }
#desktop-add { color: white; }
.content { padding: 16px 18px 90px; }

/* Final dashboard */
.final-hero-card {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  min-height: 150px;
  overflow: hidden;
  padding: 18px;
  border-radius: 14px;
  background: var(--ac-g);
  box-shadow: var(--sha);
  color: white;
}
.final-hero-card::before {
  content: "";
  position: absolute;
  z-index: -1;
  right: -56px;
  top: -72px;
  width: 190px;
  height: 190px;
  border-radius: 50%;
  background: rgba(255,255,255,.07);
}
.final-hero-label { margin: 0 0 6px; color: rgba(255,255,255,.62); font-size: 9px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.final-hero-copy h1 { max-width: 720px; margin: 0; color: white; font-size: clamp(24px, 3.6vw, 38px); font-weight: 800; letter-spacing: -.8px; line-height: 1.08; }
.final-hero-description { max-width: 680px; margin: 8px 0 0; color: rgba(255,255,255,.74); font-size: 12px; line-height: 1.5; }
.final-hero-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 13px; }
.final-hero-button { min-height: 32px; padding: 0 11px; border-radius: 8px; background: white; color: var(--ac); font-size: 10px; }
.final-hero-button.secondary { background: rgba(255,255,255,.16); color: white; }
.final-hero-stat { min-width: 150px; display: grid; justify-items: end; gap: 2px; }
.final-hero-stat > span { color: rgba(255,255,255,.62); font-size: 9px; font-weight: 700; text-transform: uppercase; }
.final-hero-stat > strong { color: white; font-size: 44px; font-weight: 800; letter-spacing: -2px; line-height: 1; }
.final-hero-chips { max-width: 240px; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 5px; margin-top: 8px; }
.final-hero-chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 7px; border-radius: 20px; background: rgba(255,255,255,.16); color: white; font-size: 8px; font-weight: 700; }
.final-hero-chip svg { width: 8px; height: 8px; fill: currentColor; }

.final-metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.final-metric-card {
  position: relative;
  min-width: 0;
  min-height: 105px;
  padding: 11px;
  overflow: hidden;
  border: 1px solid var(--card-brd);
  border-radius: 10px;
  background: var(--card-bg);
  color: var(--text);
  box-shadow: var(--sh1);
  text-align: left;
  cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.final-metric-card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--ac), transparent 68%); box-shadow: var(--sha); }
.final-metric-card:active { transform: scale(.97); }
.final-metric-top { display: flex; align-items: start; justify-content: space-between; gap: 7px; }
.final-metric-icon { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 7px; background: var(--ac-s); color: var(--ac); }
.final-metric-icon svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.final-metric-badge { padding: 3px 6px; border-radius: 20px; background: var(--ac-s); color: var(--ac); font-size: 7px; font-weight: 700; }
.final-metric-card > strong { display: block; margin-top: 7px; font-size: 17px; font-weight: 700; letter-spacing: -.2px; }
.final-metric-label { display: block; margin-top: 2px; color: var(--muted); font-size: 9px; }
.final-metric-progress { position: absolute; left: 11px; right: 11px; bottom: 8px; height: 3px; overflow: hidden; border-radius: 3px; background: var(--surface2); }
.final-metric-progress > span { display: block; width: var(--metric-progress, 0%); height: 100%; border-radius: inherit; background: var(--ac-g); animation: metric-width 1.2s ease-out both; }

.final-lower-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 8px; margin-top: 8px; }
.final-lower-card { min-width: 0; padding: 13px; border: 1px solid var(--card-brd); border-radius: 10px; background: var(--card-bg); box-shadow: var(--sh1); }
.final-lower-card .today-section-head { margin-bottom: 9px; }
.final-lower-card .today-section-head h3 { font-size: 12px; }
.final-lower-card .today-section-head p { font-size: 9px; }
.final-task-list { gap: 5px; }
.final-task-list .list-item { min-height: 38px; padding: 7px 8px; border-radius: 7px; }
.final-task-list .list-item-title { font-size: 10px; }
.final-task-list .list-item-meta { font-size: 8px; }
.final-summary-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.final-summary-list .today-signal { min-height: 65px; padding: 9px; border-radius: 8px; background: var(--surface2); }
.final-summary-list .today-signal strong { font-size: 18px; }
.final-summary-list .today-signal span { font-size: 8px; }
.today-project-row { border-radius: 8px; }

/* Shared component polish */
.button, .icon-button, .primary-action, .quick-action, .nav-button, .workspace-button, .mobile-nav-button, .mobile-fab { user-select: none; }
.button:active, .icon-button:active, .primary-action:active, .quick-action:active { transform: scale(.97); }
.task-check { width: 13px; height: 13px; flex: 0 0 13px; border-width: 1.5px; }
.task-check.done { background: linear-gradient(135deg, var(--green), color-mix(in srgb, var(--green), white 35%)); box-shadow: 0 2px 8px color-mix(in srgb, var(--green), transparent 70%); }
.progress-track { height: 4px; }
.progress-fill { background: var(--ac-g); }
.empty-icon svg, .food-image svg, .wardrobe-photo svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* Mode/theme transition overlay */
.interface-overlay {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity .28s ease;
}
.interface-overlay.active { opacity: 1; }
.interface-overlay.leaving { transition-duration: .38s; }
.interface-overlay-icon { width: 72px; height: 72px; display: grid; place-items: center; color: white; opacity: 0; transform: scale(.25); transition: opacity .26s ease, transform .26s cubic-bezier(.34,1.56,.64,1); }
.interface-overlay-icon svg { width: 56px; height: 56px; fill: none; stroke: currentColor; stroke-width: 1.4; }
.interface-overlay.active .interface-overlay-icon { opacity: 1; transform: scale(1); }
.interface-overlay.leaving .interface-overlay-icon { opacity: 0; transform: scale(1.6); transition: opacity .3s ease, transform .3s ease; }

/* Stagger and view motion */
.content > * { animation: final-view-in .28s ease-out both; }
.stagger-item { opacity: 0; transform: translateY(14px); animation: final-stagger-in .3s ease-out forwards; }
.stagger-item:nth-child(1) { animation-delay: 0ms; }
.stagger-item:nth-child(2) { animation-delay: 45ms; }
.stagger-item:nth-child(3) { animation-delay: 90ms; }
.stagger-item:nth-child(4) { animation-delay: 135ms; }
.stagger-item:nth-child(5) { animation-delay: 180ms; }
.stagger-item:nth-child(6) { animation-delay: 225ms; }
.stagger-item:nth-child(n+7) { animation-delay: 270ms; }
@keyframes final-view-in { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }
@keyframes final-stagger-in { to { opacity: 1; transform: none; } }
@keyframes metric-width { from { width: 0; } }
@keyframes final-pulse { 50% { opacity: .4; transform: scale(.75); } }

/* Mobile PWA */
@media (max-width: 820px) {
  .app-shell { min-width: 0; min-height: 100dvh; overflow: visible; }
  .desktop-sidebar { display: none; }
  .main-area { margin-left: 0; }
  .topbar {
    display: flex;
    min-height: calc(40px + var(--safe-top));
    gap: 6px;
    padding: calc(8px + var(--safe-top)) calc(12px + var(--safe-right)) 8px calc(12px + var(--safe-left));
  }
  .greeting-row { min-width: 0; flex: 1 1 auto; gap: 6px; }
  .greeting-icon { width: 22px; height: 22px; flex-basis: 22px; border-radius: 6px; }
  .greeting-icon svg { width: 14px; height: 14px; }
  .greeting-copy strong { font-size: 13px; }
  .greeting-copy small { font-size: 9px; }
  .mobile-mode-pill { width: 52px; flex: 0 0 52px; display: flex; }
  .mobile-mode-pill .workspace-button { min-height: 24px; padding: 4px 7px; }
  .mobile-mode-pill .workspace-button span { display: none; }
  .mobile-mode-pill .workspace-button svg { width: 12px; height: 12px; }
  .mobile-theme-button { width: 24px; height: 24px; flex: 0 0 24px; display: grid; border-radius: 6px; }
  .mobile-theme-button svg { width: 13px; height: 13px; }
  #notifications-button, #sync-button, .mobile-search-button { display: none; }
  .search-box { position: fixed; left: 10px; right: 10px; top: calc(48px + var(--safe-top)); z-index: 30; display: none; width: auto; max-width: none; margin: 0; }
  .topbar.search-open .search-box { display: flex; }
  .content { padding: 8px 10px calc(72px + var(--safe-bottom)); }
  .offline-banner, .security-banner, .update-banner, .sync-status-bar { margin: 8px 10px 0; }
  .sync-status-bar { min-height: 44px; }
  .final-hero-card { grid-template-columns: minmax(0, 1fr) auto; min-height: 128px; padding: 12px; border-radius: 13px; }
  .final-hero-copy h1 { font-size: 20px; letter-spacing: -.7px; }
  .final-hero-description { display: none; }
  .final-hero-actions { margin-top: 9px; }
  .final-hero-button { min-height: 28px; }
  .final-hero-stat { min-width: 90px; }
  .final-hero-stat > strong { font-size: 26px; letter-spacing: -1px; }
  .final-hero-chips { max-width: 115px; gap: 4px; }
  .final-hero-chip { padding: 3px 5px; font-size: 7px; }
  .final-metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin-top: 6px; }
  .final-metric-card { min-height: 90px; padding: 9px; border-radius: 10px; }
  .final-metric-card > strong { margin-top: 5px; font-size: 16px; }
  .final-metric-progress { left: 9px; right: 9px; bottom: 7px; }
  .final-lower-grid { grid-template-columns: 1fr; gap: 6px; margin-top: 6px; }
  .final-lower-card { padding: 10px; }
  .mobile-nav {
    left: 0;
    right: 0;
    bottom: 0;
    min-height: calc(56px + var(--safe-bottom));
    padding: 0 8px var(--safe-bottom);
    border: 0;
    border-top: 1px solid var(--card-brd);
    border-radius: 0;
    background: color-mix(in srgb, var(--card-bg), transparent 4%);
    box-shadow: 0 -8px 24px color-mix(in srgb, var(--text), transparent 94%);
  }
  .mobile-nav-button { min-height: 56px; height: 56px; border-radius: 0; font-size: 8px; transition: color .2s ease, transform .2s ease; }
  .mobile-nav-button svg { width: 18px; height: 18px; }
  .mobile-nav-button.active { background: transparent; color: var(--ac); transform: translateY(-2px); }
  .mobile-fab {
    bottom: calc(28px + var(--safe-bottom));
    width: 36px;
    height: 36px;
    border: 3px solid var(--card-bg);
    background: var(--ac-g);
    box-shadow: var(--sha);
    font-size: 20px;
  }
  .interface-overlay-icon { width: 58px; height: 58px; }
  .interface-overlay-icon svg { width: 44px; height: 44px; }
}

@media (max-width: 430px) {
  .final-hero-card { grid-template-columns: 1fr; }
  .final-hero-stat { grid-template-columns: auto auto; align-items: center; justify-items: start; }
  .final-hero-stat > span { align-self: end; }
  .final-hero-chips { grid-column: 1 / -1; max-width: none; justify-content: flex-start; }
  .final-summary-list { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0ms !important; transition-duration: .01ms !important; }
  .content > *, .stagger-item { opacity: 1; transform: none; }
}

/* ═══════════════════════════════════════════════════════════════════
   Dashboard — новые компоненты (концепт)
   ═══════════════════════════════════════════════════════════════════ */

/* ── Привычки горизонтальный скролл ─────────────────────────────── */
.dashboard-habits-section {
  margin-top: 10px;
}
.habits-h-scroll {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 4px 0 10px;
  scrollbar-width: none;
}
.habits-h-scroll::-webkit-scrollbar { display: none; }
.habit-h-card {
  flex-shrink: 0;
  width: 130px;
  padding: 11px 12px;
  border: 1px solid var(--card-brd);
  border-radius: 13px;
  background: var(--card-bg);
  box-shadow: var(--sh1);
  text-align: left;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
}
.habit-h-card:hover { transform: translateY(-2px); box-shadow: var(--sh2); }
.habit-h-card:active { transform: scale(.96); }
.habit-h-card.done { border-color: color-mix(in srgb, var(--ac), transparent 70%); }
.habit-h-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.habit-h-name { font-size: 11px; font-weight: 600; color: var(--text); }
.habit-h-streak { display: flex; align-items: center; gap: 2px; font-size: 10px; font-weight: 600; color: var(--amber, #D97706); }
.habit-h-streak svg { width: 10px; height: 10px; fill: currentColor; }
.habit-h-dots { display: block; margin-bottom: 7px; }
.habit-h-dots svg circle { transition: fill .2s cubic-bezier(.34,1.56,.64,1), stroke .2s ease; }
.habit-h-bar { height: 3px; border-radius: 3px; background: var(--surface-soft); overflow: hidden; }
.habit-h-fill { height: 100%; border-radius: 3px; background: var(--ac-g); transition: width 1s ease-out; }

/* ── Нижняя тройка: кольца / спайдер / AI ──────────────────────── */
.dashboard-bottom-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
}
@media (max-width: 900px) {
  .dashboard-bottom-row { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .dashboard-bottom-row { grid-template-columns: 1fr; }
}

/* ── Кольца прогресса целей ──────────────────────────────────────── */
.dashboard-rings-section,
.dashboard-spider-section,
.dashboard-ai-section {
  padding: 13px;
  border: 1px solid var(--card-brd);
  border-radius: 12px;
  background: var(--card-bg);
  box-shadow: var(--sh1);
}
.goal-rings-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 10px;
  align-items: center;
}
.goal-ring-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}
.goal-ring-wrap svg { overflow: visible; }
.goal-ring-label {
  font-size: 10px;
  color: var(--muted);
  font-weight: 500;
  text-align: center;
  max-width: 68px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Спайдерчарт ────────────────────────────────────────────────── */
.dashboard-spider-section { display: flex; flex-direction: column; align-items: center; }
.dashboard-spider-section .today-section-head { width: 100%; }
.dashboard-spider-section svg { margin-top: 6px; overflow: visible; }

/* ── AI-подсказка ───────────────────────────────────────────────── */
.ai-hint-top {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 9px;
}
.ai-hint-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--ac);
  flex-shrink: 0;
  animation: ai-pulse 2s infinite;
}
@keyframes ai-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: .35; transform: scale(.65); }
}
.ai-hint-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--ac);
}
.ai-hint-text {
  font-size: 12px;
  line-height: 1.6;
  color: var(--text2, var(--muted));
  margin: 0 0 12px;
}
.ai-hint-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.ai-hint-chip {
  padding: 5px 11px;
  border-radius: 20px;
  background: var(--surface-soft);
  color: var(--text);
  font-size: 11px;
  font-weight: 500;
  border: 1px solid var(--card-brd);
  cursor: pointer;
  transition: all .15s ease;
}
.ai-hint-chip:hover { background: var(--ac-s); color: var(--ac); border-color: var(--ac); }
.ai-hint-chip:active { transform: scale(.95); }

/* ── Анимация overlay при смене режима ──────────────────────────── */
.mode-overlay {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s ease;
}
.mode-overlay.active { opacity: 1; pointer-events: auto; }
.mode-overlay-icon {
  font-size: 48px; color: #fff;
  opacity: 0; transform: scale(.3);
  transition: all .28s cubic-bezier(.34,1.56,.64,1);
}
.mode-overlay.active .mode-overlay-icon { opacity: 1; transform: scale(1); }

/* ── Стиль кнопки темы в topbar (десктоп) ──────────────────────── */
#desktop-theme-button, #theme-button {
  transition: background .2s ease, color .2s ease, border-color .2s ease;
}
#desktop-theme-button:hover, #theme-button:hover {
  background: var(--ac-s);
  color: var(--ac);
  border-color: var(--ac);
}

/* ── Reduced motion ─────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .habit-h-fill, .ring-arc, .spider-poly,
  .stagger-item, .final-metric-progress > span { animation: none !important; transition: none !important; }
}

/* ═══════════════════════════════════════════════════════════════════
   АУДИТ ИСПРАВЛЕНИЯ — багфиксы
   ═══════════════════════════════════════════════════════════════════ */

/* ── Спорт: кнопки и текст не влезают на мобильном ─────────────── */
@media (max-width: 600px) {
  /* Заголовок страницы — кнопки переносятся вертикально */
  .page-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }
  .page-actions .button {
    flex: 1 1 calc(50% - 6px);
    min-width: 0;
    font-size: 11px;
    padding: 0 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Спорт живая тренировка — подходы */
  .sport-live-set {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .sport-live-set .button {
    width: 100%;
    justify-content: center;
  }

  /* Упражнения в списке */
  .sport-exercise-row {
    flex-wrap: wrap;
    gap: 8px;
  }
  .sport-exercise-row > div:last-child {
    flex: 1 1 100%;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
  }

  /* relation-strip — не обрезать текст */
  .relation-strip {
    flex-wrap: wrap;
  }
  .relation-item {
    flex: 1 1 calc(50% - 6px);
    min-width: 120px;
  }
}

/* ── Спорт: длинные названия упражнений ────────────────────────── */
.sport-live-exercise h2 {
  word-break: break-word;
  overflow-wrap: break-word;
}

/* ── Модальный редактор — кнопки формы не обрезаются ───────────── */
.editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
@media (max-width: 480px) {
  .editor-actions {
    flex-direction: column;
  }
  .editor-actions .button {
    width: 100%;
    justify-content: center;
  }
}

/* ── Мобильная навигация — текст не обрезается ──────────────────── */
.mobile-nav-button span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 56px;
}

/* ── Исправление countup-анимации ──────────────────────────────── */
.countup {
  display: block;
}

/* ── Hero card — второй декоративный круг ──────────────────────── */
.final-hero-card::after {
  content: "";
  position: absolute;
  z-index: -1;
  left: -30px;
  bottom: -40px;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: rgba(255,255,255,.05);
}

/* ── Метрики — hover glow по цвету акцента ─────────────────────── */
.final-metric-card:hover {
  box-shadow: 0 6px 24px color-mix(in srgb, var(--ac), transparent 65%);
}

/* ── Мобильный bottom nav — FAB выступает ──────────────────────── */
@media (max-width: 820px) {
  .mobile-fab {
    position: relative;
    z-index: 2;
  }

  /* Исправление overflow в разделе Спорт на мобильном */
  .sport-live-sets {
    grid-template-columns: 1fr;
  }

  /* Кнопки в шапке страницы на мобильном */
  .page-head .page-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
  }
}

/* ── Notification banner — убираем лишний отступ ───────────────── */
.security-banner {
  font-size: 12px;
  padding: 8px 16px;
}

/* ── Исправление z-index для overlay анимации режимов ──────────── */
.interface-overlay {
  pointer-events: none;
}
.interface-overlay.active {
  pointer-events: auto;
}
