* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Тёплая бежево-персиковая палитра (светлая тема по умолчанию) */
  --accent: #E9A178;
  --accent-d: #D98A5E;
  --accent2: #D98A5E;
  --accent-text: #FFFFFF;
  --bg: #FBF7F2;
  --surface: #FFFFFF;
  --card: #FFFFFF;
  --surface2: #F3EADE;
  --text: #3D3530;
  --text2: #9B9088;
  --border: #EFE4D7;
  --progress-bg: #F0E4D6;
  --tag-bg: rgba(233,161,120,0.12);
  --tag-text: #D98A5E;
  --success: #9CC9B0;
  --nav-bg: #FFFFFF;
  --shadow: 0 6px 20px rgba(180,140,100,0.12);
  --radius: 20px;
  --radius-sm: 12px;
}

/* Альтернативные тёплые акценты */
body[data-accent="pink"]     { --accent:#E8A0B0; --accent-d:#D98598; --accent2:#D98598; --tag-bg:rgba(232,160,176,0.14); --tag-text:#D98598; }
body[data-accent="mint"]     { --accent:#9CC9B0; --accent-d:#7FB597; --accent2:#7FB597; --tag-bg:rgba(156,201,176,0.16); --tag-text:#7FB597; }
body[data-accent="lavender"] { --accent:#B6A8DC; --accent-d:#9D8CCB; --accent2:#9D8CCB; --tag-bg:rgba(182,168,220,0.16); --tag-text:#9D8CCB; }

body.dark {
  /* Тёплая тёмная тема */
  --bg: #241F1B;
  --surface: #2E2823;
  --card: #2E2823;
  --surface2: #38302A;
  --text: #F2EAE2;
  --text2: #A89C90;
  --border: rgba(255,255,255,0.07);
  --progress-bg: #3A322B;
  --tag-bg: rgba(233,161,120,0.18);
  --tag-text: var(--accent);
  --nav-bg: #1E1A17;
  --shadow: 0 6px 20px rgba(0,0,0,0.3);
}

html, body { height: 100%; background: var(--bg); transition: background 0.3s; }
body { font-family: -apple-system, 'SF Pro Display', 'Segoe UI', sans-serif; }

#app { display: flex; flex-direction: column; height: 100vh; max-width: 480px; margin: 0 auto; }

/* ── Шапка ── */
.header {
  background: var(--surface); padding: 14px 20px 12px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0; transition: background 0.3s, border 0.3s;
}
.header-title { font-size: 17px; font-weight: 700; color: var(--text); letter-spacing: -0.3px; }
.header-sub { font-size: 12px; color: var(--text2); margin-top: 1px; }
.header-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 14px; font-weight: 700; overflow: hidden; flex-shrink: 0;
}
.header-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ── Контент ── */
.content { flex: 1; overflow-y: auto; padding: 16px; scrollbar-width: none; }
.content::-webkit-scrollbar { display: none; }

/* ── Навигация ── */
.bottom-nav {
  background: var(--nav-bg); border-top: 1px solid var(--border);
  display: flex; padding: 8px 4px 10px; flex-shrink: 0;
  transition: background 0.3s, border 0.3s;
}
.nav-item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; gap: 3px; cursor: pointer; padding: 4px 0;
}
.nav-icon { font-size: 20px; line-height: 1; transition: transform 0.15s; }
.nav-label { font-size: 10px; color: var(--text2); font-weight: 500; }
.nav-item.active .nav-label { color: var(--accent); font-weight: 700; }
.nav-item.active .nav-icon { transform: scale(1.12); }

/* ── Экраны ── */
.screen { display: none; }
.screen.active { display: block; }

/* ── Карточки ── */
.card {
  background: var(--surface); border-radius: var(--radius);
  padding: 16px; margin-bottom: 12px;
  box-shadow: var(--shadow); border: 1px solid var(--border);
  transition: background 0.3s, border 0.3s;
}
.card-empty { text-align: center; color: var(--text2); font-size: 14px; padding: 24px 0; }

/* ── Объёмный прогресс-бар (Вариант B) ── */
.progress-b-wrap { margin: 10px 0 2px; }
.progress-b-track {
  height: 8px; border-radius: 99px; background: var(--progress-bg);
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.10), inset 0 -1px 0 rgba(255,255,255,0.12);
  overflow: hidden; position: relative;
}
.progress-b-fill {
  height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, #7C5CFC 0%, #A07EFD 50%, #C47CF4 100%);
  box-shadow: 0 3px 10px rgba(124,92,252,0.5), inset 0 1px 0 rgba(255,255,255,0.4);
  position: relative; overflow: hidden;
  transition: width 0.6s cubic-bezier(.4,0,.2,1);
}
.progress-b-fill::before {
  content: ''; position: absolute; top: 1px; left: 4px; right: 4px; height: 2px;
  background: rgba(255,255,255,0.5); border-radius: 99px;
}
.progress-b-fill::after {
  content: ''; position: absolute; top: 0; left: -60%; width: 40%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  animation: shimmer-b 2.5s infinite;
}
@keyframes shimmer-b { to { left: 160%; } }
.progress-b-meta { display: flex; align-items: baseline; justify-content: space-between; margin-top: 7px; }
.progress-b-pct { font-size: 13px; font-weight: 800; color: var(--accent); }
.progress-b-count { font-size: 12px; color: var(--text2); }

/* ── Кнопки ── */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 13px 20px; border-radius: var(--radius-sm);
  font-size: 15px; font-weight: 600; cursor: pointer; border: none;
  transition: opacity 0.15s, transform 0.1s; width: 100%;
}
.btn:active { transform: scale(0.97); opacity: 0.85; }
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; }
.btn-outline { background: transparent; border: 1.5px solid var(--border); color: var(--text); }
.btn-sm { padding: 8px 14px; font-size: 13px; width: auto; }

/* ── Чипы ── */
.chip {
  display: inline-flex; align-items: center;
  background: var(--tag-bg); color: var(--tag-text);
  font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 99px;
}

/* ── Секции ── */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.section-title { font-size: 16px; font-weight: 700; color: var(--text); }
.section-hint { font-size: 12px; color: var(--text2); margin-top: 3px; }
.section-action { font-size: 13px; color: var(--accent); font-weight: 500; cursor: pointer; }

/* ── Главная — мини-статистика ── */
.stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 16px; }
.stat-card {
  background: var(--surface); border-radius: var(--radius);
  padding: 12px 8px; text-align: center;
  box-shadow: var(--shadow); border: 1px solid var(--border);
  transition: background 0.3s, border 0.3s;
}
.stat-num { font-size: 22px; font-weight: 800; color: var(--text); }
.stat-label { font-size: 10px; color: var(--text2); margin-top: 3px; line-height: 1.3; }

/* ── Цели ── */
.goal-row { display: flex; align-items: flex-start; gap: 12px; }
.goal-icon {
  width: 40px; height: 40px; border-radius: 12px; background: var(--tag-bg);
  display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0;
}
.goal-title { font-size: 14px; font-weight: 700; color: var(--text); }
.goal-meta { font-size: 12px; color: var(--text2); margin-top: 2px; }

.subtasks { display: flex; flex-direction: column; gap: 7px; margin-top: 12px; border-top: 1px solid var(--border); padding-top: 12px; }
.subtask-label { font-size: 11px; font-weight: 600; color: var(--text2); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.subtask { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); }
.subtask.done span { text-decoration: line-through; color: var(--text2); }
.check {
  width: 18px; height: 18px; border-radius: 50%;
  border: 1.5px solid var(--border); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.check.done { background: linear-gradient(135deg, var(--accent), var(--accent2)); border-color: var(--accent); }
.check.done::after { content: '✓'; font-size: 11px; color: #fff; }

/* ── Задачи ── */
.task-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.task-item:last-child { border-bottom: none; }
.task-check {
  width: 22px; height: 22px; border-radius: 6px;
  border: 1.5px solid var(--border); flex-shrink: 0;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background 0.2s;
}
.task-check.done { background: var(--success); border-color: var(--success); }
.task-check.done::after { content: '✓'; font-size: 12px; color: #fff; font-weight: 700; }
.task-info { flex: 1; }
.task-title { font-size: 14px; font-weight: 500; color: var(--text); }
.task-title.done { text-decoration: line-through; color: var(--text2); }
.task-goal { font-size: 12px; color: var(--accent); margin-top: 2px; font-weight: 500; }
.task-del { flex-shrink: 0; cursor: pointer; font-size: 16px; opacity: 0.6; padding: 4px; }
.task-del:active { opacity: 1; }

/* ── Статистика ── */
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.stats-big-card {
  background: var(--surface); border-radius: var(--radius);
  padding: 18px; text-align: center;
  box-shadow: var(--shadow); border: 1px solid var(--border);
  transition: background 0.3s, border 0.3s;
}
.stats-big { font-size: 36px; font-weight: 900; color: var(--text); letter-spacing: -1px; }
.stats-desc { font-size: 12px; color: var(--text2); margin-top: 4px; line-height: 1.4; }

/* ── Объёмный вертикальный график ── */
.bar-chart-3d {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 5px; height: 110px; padding: 0 2px; margin: 14px 0 0;
}
.bar-col {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; gap: 5px; height: 100%; justify-content: flex-end;
}
.bar-pct { font-size: 10px; font-weight: 700; color: var(--accent); line-height: 1; }
.bar-col.today .bar-pct { color: var(--accent2); }
.bar-pct.empty-pct { color: var(--text2); font-weight: 600; }
.bar-3d {
  width: 100%; min-height: 6px; border-radius: 6px 6px 4px 4px;
  position: relative; overflow: hidden;
  background: linear-gradient(180deg, #A07EFD 0%, #7C5CFC 40%, #6242E8 100%);
  box-shadow: 0 4px 12px rgba(124,92,252,0.5), 0 2px 4px rgba(124,92,252,0.3), inset 0 1px 0 rgba(255,255,255,0.35);
  transition: transform 0.15s; cursor: pointer;
}
.bar-3d::before {
  content: ''; position: absolute; top: 4px; left: 3px; width: 3px;
  bottom: 4px; background: rgba(255,255,255,0.4); border-radius: 99px;
}
.bar-3d::after {
  content: ''; position: absolute; top: 0; left: -80%; width: 50%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
  animation: bar-shine 3s infinite;
}
@keyframes bar-shine { to { left: 160%; } }
.bar-col.today .bar-3d {
  background: linear-gradient(180deg, #C47CF4 0%, #9B6AFF 40%, #7C5CFC 100%);
  box-shadow: 0 6px 18px rgba(124,92,252,0.65), 0 2px 6px rgba(196,124,244,0.4), inset 0 1px 0 rgba(255,255,255,0.45);
}
.bar-3d.empty { background: var(--progress-bg); box-shadow: inset 0 2px 4px rgba(0,0,0,0.06); }
body.dark .bar-3d.empty { background: #2A2538; }
.bar-3d.empty::before, .bar-3d.empty::after { display: none; }
.bar-col:hover .bar-3d:not(.empty) { transform: scaleY(1.04) translateY(-1px); }
.bar-day { font-size: 11px; font-weight: 600; color: var(--text2); }
.bar-col.today .bar-day { color: var(--accent); font-weight: 700; }

/* ── Профиль ── */
.profile-header { text-align: center; padding: 10px 0 18px; }
.profile-avatar-wrap {
  width: 72px; height: 72px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  margin: 0 auto 12px; display: flex; align-items: center; justify-content: center;
  font-size: 28px; color: #fff; font-weight: 700; overflow: hidden;
}
.profile-avatar-wrap img { width: 100%; height: 100%; object-fit: cover; }
.profile-name { font-size: 18px; font-weight: 700; color: var(--text); }
.profile-username { font-size: 13px; color: var(--text2); margin-top: 3px; }

.sub-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; margin-bottom: 10px;
  box-shadow: var(--shadow); transition: background 0.3s, border 0.3s;
}
.sub-status-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.sub-status { font-size: 15px; font-weight: 700; color: var(--text); }
.badge-active { background: rgba(124,92,252,0.1); color: var(--accent); font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 99px; }
.badge-expired { background: rgba(255,59,48,0.1); color: #FF3B30; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 99px; }
.sub-until { font-size: 13px; color: var(--text2); margin-bottom: 12px; }

.settings-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; background: var(--surface); border-radius: var(--radius);
  margin-bottom: 8px; border: 1px solid var(--border); box-shadow: var(--shadow);
  cursor: pointer; transition: background 0.3s, border 0.3s;
}
.settings-left { display: flex; flex-direction: column; gap: 2px; }
.settings-label { font-size: 15px; font-weight: 500; color: var(--text); }
.settings-hint { font-size: 12px; color: var(--text2); }
.toggle { width: 44px; height: 26px; border-radius: 13px; background: var(--progress-bg); position: relative; transition: background 0.25s; flex-shrink: 0; }
.toggle.on { background: linear-gradient(90deg, var(--accent), var(--accent2)); }
.toggle-thumb { width: 20px; height: 20px; border-radius: 50%; background: #fff; position: absolute; top: 3px; left: 3px; transition: left 0.2s; box-shadow: 0 1px 3px rgba(0,0,0,0.2); }
.toggle.on .toggle-thumb { left: 21px; }

/* ── Paywall ── */
.paywall-hero { text-align: center; padding: 24px 0 8px; }
.paywall-emoji { font-size: 54px; }
.paywall-title { font-size: 24px; font-weight: 800; margin-top: 8px; color: var(--text); }
.paywall-sub { color: var(--text2); margin-top: 6px; line-height: 1.5; }
.paywall-benefits { list-style: none; padding: 0; margin: 18px 0; }
.paywall-benefits li { background: var(--surface); border-radius: 14px; padding: 14px 16px; margin-bottom: 8px; box-shadow: var(--shadow); color: var(--text); }
.paywall-note { text-align: center; font-size: 12px; color: var(--text2); margin-top: 10px; }
.plan-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.plan-item {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
  display: flex; align-items: center; justify-content: space-between; cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.plan-item.selected { border-color: var(--accent); background: var(--tag-bg); }
.plan-name { font-size: 15px; font-weight: 600; color: var(--text); }
.plan-price { font-size: 16px; font-weight: 800; color: var(--text); }
.plan-per { font-size: 12px; color: var(--text2); text-align: right; margin-top: 2px; }
.plan-badge { background: linear-gradient(90deg, var(--accent), var(--accent2)); color: #fff; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px; }

/* ── Модальные окна ── */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 100; }
.modal-overlay.show { display: block; }
.modal {
  display: none; position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px; background: var(--surface);
  border-radius: 20px 20px 0 0; padding: 20px; z-index: 101;
  max-height: 80vh; overflow-y: auto;
}
.modal.show { display: block; }
.modal-title { font-size: 17px; font-weight: 700; color: var(--text); margin-bottom: 16px; }
.form-field { margin-bottom: 14px; }
.form-label { font-size: 13px; color: var(--text2); margin-bottom: 6px; display: block; }
.form-input {
  width: 100%; padding: 12px 14px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--border); background: var(--surface2);
  font-size: 15px; color: var(--text); outline: none;
  transition: border-color 0.2s; font-family: inherit;
}
.form-input:focus { border-color: var(--accent); }
input.form-input[type="date"] { width: 100%; }

/* ───────────────────────────────────────────────────────────── */
/* Привычки — пастельные цвета карточек */
/* ───────────────────────────────────────────────────────────── */
.color-peach    { background: #FBE6D8; }
.color-pink     { background: #FBE0E6; }
.color-beige    { background: #F3EADE; }
.color-mint     { background: #DEF0E6; }
.color-lavender { background: #E8E2F5; }
.color-yellow   { background: #FBF0D2; }
body.dark .color-peach    { background: #4A3B30; }
body.dark .color-pink     { background: #4A3138; }
body.dark .color-beige    { background: #423a31; }
body.dark .color-mint     { background: #2F4339; }
body.dark .color-lavender { background: #3A3450; }
body.dark .color-yellow   { background: #4A4330; }

.color-row { display: flex; gap: 8px; flex-wrap: wrap; }
.color-dot { width: 28px; height: 28px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; }
.color-dot.sel { border-color: var(--text); }
.accent-peach    { background: #E9A178; }
.accent-pink     { background: #E8A0B0; }
.accent-mint     { background: #9CC9B0; }
.accent-lavender { background: #B6A8DC; }

/* ── Календарь-полоска недели ── */
.week-strip { display: flex; align-items: center; gap: 4px; padding: 8px 0 4px; }
.week-days { display: flex; gap: 6px; justify-content: space-between; flex: 1; }
.week-nav { width: 26px; text-align: center; font-size: 26px; line-height: 1; color: var(--text2); cursor: pointer; user-select: none; flex-shrink: 0; }
.day-cell { flex: 1; text-align: center; padding: 10px 0; border-radius: 16px; cursor: pointer; transition: background 0.15s; }
.day-cell .day-num { font-size: 17px; font-weight: 700; color: var(--text); }
.day-cell .day-wd { font-size: 11px; color: var(--text2); margin-top: 2px; }
.day-cell.sel { background: var(--accent); }
.day-cell.sel .day-num { color: #fff; }
.day-cell.sel .day-wd { color: rgba(255,255,255,0.85); }
.day-cell.today:not(.sel) .day-num { color: var(--accent); }
.selected-date { text-align: center; font-size: 13px; color: var(--text2); margin: 6px 0 16px; }

/* ── Периодичность (чипы), подвкладки, действия подзадач ── */
.freq-row { display: flex; gap: 8px; flex-wrap: wrap; }
.freq-chip { flex: 1; min-width: 88px; padding: 10px 8px; border-radius: 12px; border: 1px solid #eaddcf; background: #fff; color: var(--text); cursor: pointer; font-size: 14px; transition: all .15s; }
.freq-chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }
body.dark .freq-chip { background: var(--card); border-color: #3a322b; }
.sub-tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.sub-tab { flex: 1; padding: 10px; border-radius: 12px; border: none; background: var(--card); color: var(--text2); box-shadow: var(--shadow); cursor: pointer; font-size: 14px; font-weight: 600; }
.sub-tab.active { background: var(--accent); color: #fff; }
.subtask-act { cursor: pointer; padding: 0 4px; font-size: 14px; opacity: .7; }

/* ── Карточки привычек ── */
.habit-card {
  position: relative; display: flex; align-items: center; gap: 14px;
  padding: 16px; border-radius: var(--radius); margin-bottom: 12px;
  box-shadow: var(--shadow); overflow: hidden; user-select: none;
}
.habit-card.done { opacity: 0.65; }
.habit-emoji {
  width: 46px; height: 46px; border-radius: 50%; background: rgba(255,255,255,0.6);
  display: flex; align-items: center; justify-content: center; font-size: 22px; z-index: 1; flex-shrink: 0;
}
.habit-main { flex: 1; z-index: 1; min-width: 0; }
.habit-title { font-weight: 700; font-size: 16px; color: var(--text); }
.habit-freq { font-size: 12px; color: var(--text2); margin-top: 2px; }
.habit-right { z-index: 1; }
.streak { font-weight: 700; color: var(--text); }
.counter { display: flex; align-items: center; gap: 8px; }
.cnt-plus, .cnt-minus {
  width: 30px; height: 30px; border-radius: 50%; border: none;
  background: var(--accent); color: #fff; font-size: 18px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.cnt-val { font-weight: 700; min-width: 36px; text-align: center; color: var(--text); }
.habit-menu { z-index: 1; color: var(--text2); font-size: 20px; padding: 0 4px; cursor: pointer; }
.hold-fill { position: absolute; inset: 0; background: rgba(233,161,120,0.35); width: 0; z-index: 0; }
.habit-card.holding .hold-fill { width: 100%; transition: width 0.8s linear; }

/* ── Плавающая кнопка (FAB) ── */
.fab {
  position: fixed; right: 20px; bottom: 86px; width: 58px; height: 58px; border-radius: 50%;
  border: none; background: var(--accent); color: #fff; font-size: 28px;
  box-shadow: 0 8px 24px rgba(233,161,120,0.5); cursor: pointer; z-index: 50;
  display: flex; align-items: center; justify-content: center;
}

/* ── Сегментный переключатель ── */
.seg { display: flex; gap: 8px; }
.seg-btn { flex: 1; padding: 10px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; font-family: inherit; font-size: 14px; }
.seg-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ── Настройки (список-меню) ── */
.settings-group-title { font-size: 13px; color: var(--text2); margin: 18px 4px 8px; }
.settings-card { background: var(--card); border-radius: 16px; box-shadow: var(--shadow); padding: 4px 16px; margin-bottom: 4px; }
.settings-card .settings-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 0; background: none; border: none; box-shadow: none;
  border-radius: 0; margin-bottom: 0; cursor: pointer; color: var(--text); font-size: 15px;
}
.settings-value { color: var(--text2); }

/* ── Кнопка удаления ── */
.btn-danger { background: #E88A8A; color: #fff; border: none; }
