/* Ритм — планер. Тёмная и светлая темы следуют теме Telegram. */
:root {
  --bg: #0b0b10;
  --bg-2: #101017;
  --surface: #16161e;
  --surface-2: #1e1e28;
  --surface-3: #272733;
  --line: rgba(255, 255, 255, .06);
  --line-2: rgba(255, 255, 255, .1);
  --text: #f4f4f8;
  --text-2: #b9b9c6;
  --muted: #7c7c8e;
  --accent: #8b7cff;
  --accent-2: #5aa9ff;
  --accent-soft: rgba(139, 124, 255, .16);
  --good: #34d399;
  --warn: #fbbf24;
  --bad: #ff5c72;
  --grad: linear-gradient(135deg, #9b7cff 0%, #6c8bff 55%, #4fb2ff 100%);
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --r: 18px;
  --r-sm: 12px;
  --tab-h: 64px;
  --safe-b: max(env(safe-area-inset-bottom, 0px), var(--tg-safe-area-inset-bottom, 0px));
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);

  --c-violet: #8b7cff; --c-blue: #4da3ff; --c-teal: #2dd4bf; --c-green: #4ade80;
  --c-amber: #fbbf24; --c-orange: #fb923c; --c-rose: #fb7185; --c-pink: #f472b6;
}
body.light {
  --bg: #f3f3f7;
  --bg-2: #ececf2;
  --surface: #ffffff;
  --surface-2: #f2f2f7;
  --surface-3: #e7e7ee;
  --line: rgba(20, 20, 50, .07);
  --line-2: rgba(20, 20, 50, .12);
  --text: #121218;
  --text-2: #45455a;
  --muted: #8a8a9c;
  --accent: #6c5ce7;
  --accent-2: #3b8cff;
  --accent-soft: rgba(108, 92, 231, .12);
  --good: #10b981;
  --warn: #f59e0b;
  --bad: #ef4462;
  --grad: linear-gradient(135deg, #7c5cff 0%, #5b7cff 55%, #3aa0ff 100%);
  --shadow: 0 10px 30px rgba(40, 40, 90, .12);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); }
body {
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
  min-height: 100vh;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, textarea, select { font: inherit; color: var(--text); }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.hidden { display: none !important; }

#view {
  padding: 8px 16px calc(var(--tab-h) + var(--safe-b) + 96px);
  max-width: 640px;
  margin: 0 auto;
}
.enter { animation: enter .35s var(--ease) both; }
@keyframes enter { from { opacity: 0; transform: translateY(8px); } }

/* ---------- шапка ---------- */
.top { display: flex; align-items: center; gap: 10px; padding: 10px 0 6px; min-height: 52px; }
.top .grow { flex: 1; min-width: 0; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.title { font-size: 30px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; margin: 2px 0 0; }
.title .dim { color: var(--muted); font-weight: 700; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--line); color: var(--text-2);
  transition: transform .15s var(--ease), background .2s;
}
.icon-btn:active { transform: scale(.92); background: var(--surface-2); }
.pill-btn {
  height: 32px; padding: 0 12px; border-radius: 999px; font-size: 13px; font-weight: 600;
  background: var(--accent-soft); color: var(--accent);
}
.pill-btn:active { transform: scale(.96); }
.nav { display: flex; gap: 6px; }

/* ---------- кольцо прогресса ---------- */
.ring { position: relative; width: 56px; height: 56px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); stroke-width: 0; }
.ring .track { stroke: var(--surface-3); stroke-width: 6; fill: none; }
.ring .val { stroke: url(#rg); stroke-width: 6; fill: none; stroke-linecap: round; transition: stroke-dashoffset .8s var(--ease); }
.ring .lbl { position: absolute; inset: 0; display: grid; place-items: center; font-size: 13px; font-weight: 700; }
.ring.big { width: 92px; height: 92px; }
.ring.big .track, .ring.big .val { stroke-width: 8; }
.ring.big .lbl { font-size: 20px; font-weight: 800; }
.ring.full .lbl { color: var(--good); }

/* ---------- полоса недели ---------- */
.strip {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin: 10px 0 18px;
  touch-action: pan-y;
}
.strip .d {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 0 7px;
  border-radius: 14px; background: var(--surface); border: 1px solid var(--line);
  transition: transform .15s var(--ease), background .25s;
}
.strip .d:active { transform: scale(.94); }
.strip .wd { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; }
.strip .n { font-size: 17px; font-weight: 700; }
.strip .dots { height: 5px; display: flex; gap: 3px; }
.strip .dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--muted); opacity: .6; }
.strip .dots i.ok { background: var(--good); opacity: 1; }
.strip .d.today { border-color: var(--accent); }
.strip .d.today .wd { color: var(--accent); }
.strip .d.sel { background: var(--grad); border-color: transparent; color: #fff; box-shadow: 0 6px 18px rgba(108, 92, 231, .35); }
.strip .d.sel .wd { color: rgba(255, 255, 255, .8); }
.strip .d.sel .dots i { background: #fff; opacity: .85; }

/* ---------- секции и карточки ---------- */
.sec { margin: 22px 0 10px; display: flex; align-items: baseline; gap: 8px; }
.sec h3 { margin: 0; font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.sec .count { font-size: 13px; color: var(--muted); }
.sec .spacer { flex: 1; }
.sec .link { font-size: 13px; font-weight: 600; color: var(--accent); }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  overflow: hidden;
}
.card + .card { margin-top: 10px; }

/* сводка */
.summary { display: flex; align-items: center; gap: 14px; padding: 14px 16px; }
.summary .txt { flex: 1; min-width: 0; }
.summary b { font-size: 16px; display: block; }
.summary span { font-size: 13px; color: var(--muted); }
.bar { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: inherit; background: var(--grad); transition: width .8s var(--ease); }
.bar.thin { height: 5px; }

/* ---------- задачи ---------- */
.task {
  display: flex; align-items: flex-start; gap: 12px; padding: 13px 14px; position: relative;
  border-bottom: 1px solid var(--line); transition: opacity .3s, background .2s;
}
.task:last-child { border-bottom: 0; }
.task:active { background: var(--surface-2); }
.task .time { width: 44px; flex: none; font-size: 13px; font-weight: 700; color: var(--text-2); padding-top: 2px; font-variant-numeric: tabular-nums; }
.task .time.none { color: var(--muted); font-weight: 500; }
.task .body { flex: 1; min-width: 0; }
.task .t { font-size: 15.5px; font-weight: 550; word-wrap: break-word; transition: color .3s; }
.task .meta { display: flex; flex-wrap: wrap; gap: 6px 10px; margin-top: 4px; font-size: 12.5px; color: var(--muted); }
.task .meta span { display: inline-flex; align-items: center; gap: 4px; }
.task .meta svg { width: 13px; height: 13px; }
.task .flag { color: var(--bad); font-weight: 800; }
.task.done .t { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--muted); }
.task.done .time { opacity: .5; }
.task.now::before {
  content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--grad);
}
.check {
  width: 24px; height: 24px; flex: none; border-radius: 50%; border: 2px solid var(--line-2);
  display: grid; place-items: center; margin-top: -1px; position: relative;
  transition: background .25s var(--ease), border-color .25s, transform .2s var(--spring);
  --c: var(--accent);
}
.check::after { content: ""; position: absolute; inset: -10px; }
.check svg { width: 14px; height: 14px; stroke: #fff; stroke-width: 3; opacity: 0; transform: scale(.4); transition: all .25s var(--spring); }
.task.done .check, .check.on { background: var(--c); border-color: var(--c); }
.task.done .check svg, .check.on svg { opacity: 1; transform: scale(1); }
.task.imp .check { border-color: var(--bad); }
.pop { animation: pop .45s var(--spring); }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.3); } 100% { transform: scale(1); } }
.arrow-btn { font-size: 12px; font-weight: 700; color: var(--accent); background: var(--accent-soft); border-radius: 99px; padding: 5px 10px; flex: none; align-self: center; }

.quick { display: flex; align-items: center; gap: 12px; padding: 10px 14px; }
.quick .plus { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.quick .plus svg { width: 14px; height: 14px; stroke-width: 2.6; }
.quick input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; font-size: 15.5px; padding: 6px 0; }
.quick input::placeholder { color: var(--muted); }

/* ---------- цели ---------- */
.goal-chips { display: flex; gap: 10px; overflow-x: auto; margin: 0 -16px; padding: 2px 16px 6px; scrollbar-width: none; }
.goal-chips::-webkit-scrollbar { display: none; }
.gchip {
  flex: none; width: 168px; padding: 12px; border-radius: 16px; text-align: left;
  background: var(--surface); border: 1px solid var(--line); position: relative; overflow: hidden;
}
.gchip::before { content: ""; position: absolute; inset: 0; background: linear-gradient(135deg, var(--gc) 0%, transparent 70%); opacity: .14; }
.gchip > * { position: relative; }
.gchip .e { font-size: 22px; line-height: 1; }
.gchip .gt { font-size: 14px; font-weight: 650; margin: 8px 0 10px; height: 2.8em; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.gchip .bar i { background: var(--gc); }
.gchip .pct { font-size: 12px; color: var(--muted); margin-top: 6px; }
.gchip.add { display: grid; place-items: center; color: var(--accent); font-weight: 600; font-size: 14px; border-style: dashed; border-color: var(--line-2); background: transparent; }
.gchip.add::before { display: none; }

.goal {
  display: flex; gap: 14px; align-items: center; padding: 14px; text-align: left; width: 100%;
  border-bottom: 1px solid var(--line); transition: background .2s;
}
.goal:last-child { border-bottom: 0; }
.goal:active { background: var(--surface-2); }
.goal .em {
  width: 48px; height: 48px; border-radius: 15px; display: grid; place-items: center; font-size: 24px; flex: none;
  background: color-mix(in srgb, var(--gc) 18%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--gc) 30%, transparent);
}
.goal .gb { flex: 1; min-width: 0; }
.goal .gt { font-size: 16px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.goal .gs { font-size: 12.5px; color: var(--muted); margin: 3px 0 8px; display: flex; gap: 10px; flex-wrap: wrap; }
.goal .bar i { background: var(--gc); }
.goal .gp { font-size: 15px; font-weight: 800; color: var(--gc); width: 46px; text-align: right; font-variant-numeric: tabular-nums; }
.goal.isdone .gt { text-decoration: line-through; color: var(--muted); }

.seg { display: flex; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 4px; gap: 4px; margin: 6px 0 4px; }
.seg button { flex: 1; height: 34px; border-radius: 10px; font-size: 13.5px; font-weight: 600; color: var(--muted); transition: all .25s var(--ease); }
.seg button.on { background: var(--surface-3); color: var(--text); box-shadow: 0 1px 4px rgba(0, 0, 0, .15); }

/* герой цели */
.hero {
  border-radius: 24px; padding: 20px; position: relative; overflow: hidden; margin-top: 6px; color: #fff;
  background: linear-gradient(145deg, var(--gc) 0%, color-mix(in srgb, var(--gc) 55%, #0b0b20) 100%);
  box-shadow: 0 14px 34px color-mix(in srgb, var(--gc) 30%, transparent);
}
.hero::after {
  content: ""; position: absolute; width: 220px; height: 220px; right: -70px; top: -90px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, .28), transparent 65%);
}
.hero .row { display: flex; gap: 16px; align-items: center; position: relative; z-index: 1; }
.hero .he { font-size: 44px; line-height: 1; }
.hero .ht { font-size: 23px; font-weight: 800; letter-spacing: -.01em; margin: 12px 0 4px; position: relative; z-index: 1; }
.hero .hs { font-size: 13.5px; opacity: .85; position: relative; z-index: 1; display: flex; gap: 12px; flex-wrap: wrap; }
.hero .why { margin-top: 14px; padding: 12px 14px; border-radius: 14px; background: rgba(255, 255, 255, .14); font-size: 14px; line-height: 1.45; position: relative; z-index: 1; white-space: pre-wrap; }
.hero .why::before { content: "Зачем: "; font-weight: 700; }
.hero .ring .track { stroke: rgba(255, 255, 255, .25); }
.hero .ring .val { stroke: #fff; }
.hero .ring .lbl { color: #fff; }
.hero .grow { flex: 1; }

.slider-card { padding: 14px 16px; }
.slider-card .lbl { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.slider-card .lbl b { color: var(--text); }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 8px; border-radius: 99px; background: var(--surface-3); outline: none; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, .35); border: 0; }
input[type=range]::-moz-range-thumb { width: 24px; height: 24px; border-radius: 50%; background: #fff; border: 0; }

/* заметки */
.composer { padding: 12px 14px; display: flex; gap: 10px; align-items: flex-end; }
.composer textarea {
  flex: 1; background: none; border: 0; outline: 0; resize: none; min-height: 24px; max-height: 220px;
  font-size: 15px; line-height: 1.45; padding: 3px 0;
}
.composer textarea::placeholder { color: var(--muted); }
.send {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--grad); color: #fff; transition: transform .2s var(--spring), opacity .2s;
}
.send svg { width: 17px; height: 17px; stroke-width: 2.5; }
.send:disabled { opacity: .35; }
.send:active { transform: scale(.9); }
.timeline { position: relative; margin-top: 12px; padding-left: 18px; }
.timeline::before { content: ""; position: absolute; left: 5px; top: 8px; bottom: 8px; width: 2px; border-radius: 2px; background: var(--line-2); }
.note { position: relative; margin-bottom: 10px; padding: 12px 14px; text-align: left; width: 100%; display: block; }
.note::before {
  content: ""; position: absolute; left: -18px; top: 16px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--gc, var(--accent)); box-shadow: 0 0 0 3px var(--bg);
}
.note .nd { font-size: 12px; color: var(--muted); font-weight: 600; margin-bottom: 4px; }
.note .nt { font-size: 15px; line-height: 1.5; white-space: pre-wrap; word-wrap: break-word; }
.note .nt a { color: var(--accent); }

/* ---------- неделя ---------- */
.day-card { padding: 4px 0; }
.day-card.today { border-color: color-mix(in srgb, var(--accent) 60%, transparent); box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 40%, transparent); }
.day-card.past { opacity: .78; }
.dh { display: flex; align-items: center; gap: 10px; padding: 10px 14px 8px; }
.dh .dn {
  width: 40px; height: 40px; border-radius: 12px; background: var(--surface-2); display: grid; place-items: center; text-align: center;
  line-height: 1; flex: none;
}
.dh .dn b { font-size: 16px; display: block; }
.dh .dn small { font-size: 10px; font-weight: 700; color: var(--muted); text-transform: uppercase; }
.day-card.today .dh .dn { background: var(--grad); color: #fff; }
.day-card.today .dh .dn small { color: rgba(255, 255, 255, .8); }
.dh .dtx { flex: 1; min-width: 0; }
.dh .dtx b { font-size: 15px; }
.dh .dtx .bar { margin-top: 6px; max-width: 160px; }
.dh .dc { font-size: 13px; font-weight: 600; color: var(--muted); }
.mini { display: flex; align-items: center; gap: 10px; padding: 7px 14px; }
.mini .check { width: 20px; height: 20px; }
.mini .check svg { width: 12px; height: 12px; }
.mini .t { flex: 1; min-width: 0; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini .tm { font-size: 12.5px; color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.mini.done .t { color: var(--muted); text-decoration: line-through; }
.add-line { display: flex; align-items: center; gap: 8px; padding: 8px 14px 10px; font-size: 13.5px; color: var(--muted); font-weight: 600; }
.add-line svg { width: 15px; height: 15px; }
.free { padding: 2px 14px 12px; font-size: 13.5px; color: var(--muted); }

/* ---------- месяц ---------- */
.cal { padding: 10px 8px 12px; touch-action: pan-y; }
.cal .wds, .cal .grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal .wds div { text-align: center; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; padding-bottom: 8px; }
.cal .c {
  aspect-ratio: 1 / 1.05; margin: 2px; border-radius: 12px; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 4px; position: relative; transition: background .2s, transform .15s var(--ease);
}
.cal .c:active { transform: scale(.92); }
.cal .c .n { font-size: 15px; font-weight: 600; }
.cal .c.out { opacity: .3; }
.cal .c.we .n { color: var(--text-2); }
.cal .c .dots { display: flex; gap: 3px; height: 5px; }
.cal .c .dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--gc, var(--accent)); }
.cal .c.heat1 { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.cal .c.heat2 { background: color-mix(in srgb, var(--accent) 15%, transparent); }
.cal .c.heat3 { background: color-mix(in srgb, var(--accent) 24%, transparent); }
.cal .c.alldone .n::after { content: ""; position: absolute; top: 5px; right: 6px; width: 6px; height: 6px; border-radius: 50%; background: var(--good); }
.cal .c.today { box-shadow: inset 0 0 0 2px var(--accent); }
.cal .c.today .n { color: var(--accent); font-weight: 800; }
.cal .c.sel { background: var(--grad); color: #fff; }
.cal .c.sel .n { color: #fff; }
.cal .c.sel .dots i { background: #fff; }
.legend { display: flex; gap: 14px; justify-content: center; font-size: 12px; color: var(--muted); padding: 0 0 4px; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* ---------- пустые состояния ---------- */
.empty { text-align: center; padding: 28px 20px 24px; }
.empty .big { width: 72px; height: 72px; border-radius: 24px; margin: 0 auto 14px; display: grid; place-items: center; font-size: 34px; background: var(--accent-soft); }
.empty b { font-size: 17px; display: block; margin-bottom: 6px; }
.empty p { margin: 0 auto 16px; font-size: 14px; color: var(--muted); max-width: 300px; }
.empty .tips { text-align: left; max-width: 320px; margin: 0 auto 16px; display: grid; gap: 10px; }
.empty .tips div { display: flex; gap: 10px; font-size: 14px; color: var(--text-2); }
.btn {
  height: 50px; border-radius: 15px; padding: 0 20px; font-size: 16px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--grad); color: #fff; box-shadow: 0 8px 20px rgba(108, 92, 231, .3); transition: transform .15s var(--ease), opacity .2s;
}
.btn:active { transform: scale(.97); }
.btn.wide { width: 100%; }
.btn.ghost { background: var(--surface-2); color: var(--text); box-shadow: none; }
.btn.danger { background: transparent; color: var(--bad); box-shadow: none; }
.btn.good { background: linear-gradient(135deg, #34d399, #10b981); box-shadow: 0 8px 20px rgba(16, 185, 129, .3); }
.btn:disabled { opacity: .45; }
.actions { display: grid; gap: 10px; margin-top: 24px; }
.actions .two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.welcome { padding: 18px; position: relative; overflow: hidden; }
.welcome::before { content: ""; position: absolute; inset: 0; background: var(--grad); opacity: .12; }
.welcome > * { position: relative; }
.welcome b { font-size: 17px; }
.welcome p { margin: 6px 0 12px; color: var(--text-2); font-size: 14px; }
.welcome ul { margin: 0 0 14px; padding: 0; list-style: none; display: grid; gap: 8px; font-size: 14px; }
.welcome .x { position: absolute; top: 10px; right: 10px; width: 30px; height: 30px; display: grid; place-items: center; color: var(--muted); }

/* ---------- кнопка + и вкладки ---------- */
.fab {
  position: fixed; right: max(18px, calc(50% - 302px)); bottom: calc(var(--tab-h) + var(--safe-b) + 18px); z-index: 20;
  width: 58px; height: 58px; border-radius: 20px; display: grid; place-items: center; color: #fff;
  background: var(--grad); box-shadow: 0 12px 28px rgba(108, 92, 231, .45);
  transition: transform .25s var(--spring), opacity .2s;
}
.fab svg { width: 26px; height: 26px; stroke-width: 2.6; }
.fab:active { transform: scale(.9) rotate(90deg); }
.fab.hide { transform: scale(0); opacity: 0; pointer-events: none; }
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  height: calc(var(--tab-h) + var(--safe-b)); padding: 6px 10px var(--safe-b);
  display: flex; justify-content: center; gap: 4px;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(22px); backdrop-filter: saturate(180%) blur(22px);
  border-top: 1px solid var(--line);
}
.tab {
  flex: 1; max-width: 150px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 11px; font-weight: 600; color: var(--muted); border-radius: 14px; position: relative; transition: color .25s;
}
.tab svg { width: 23px; height: 23px; transition: transform .3s var(--spring); }
.tab.on { color: var(--accent); }
.tab.on svg { transform: translateY(-1px) scale(1.08); }
.tab.on::before { content: ""; position: absolute; top: 2px; width: 34px; height: 3px; border-radius: 3px; background: var(--grad); }

/* ---------- шторка ---------- */
.backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .5); opacity: 0; transition: opacity .3s; }
.backdrop.show { opacity: 1; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 51; max-width: 640px; margin: 0 auto;
  max-height: 92vh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--bg-2); border-radius: 26px 26px 0 0; padding: 8px 18px calc(22px + var(--safe-b));
  transform: translateY(100%); transition: transform .38s var(--ease);
  box-shadow: 0 -10px 40px rgba(0, 0, 0, .3);
}
body.light .sheet { background: var(--bg); }
.sheet.show { transform: none; }
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line-2); margin: 2px auto 12px; }
.sheet h2 { margin: 0 0 14px; font-size: 20px; font-weight: 800; display: flex; align-items: center; gap: 10px; }
.sheet h2 .grow { flex: 1; }
.big-input {
  width: 100%; border: 0; outline: 0; resize: none; background: var(--surface); border-radius: 16px; border: 1px solid var(--line);
  padding: 14px 16px; font-size: 18px; font-weight: 600; line-height: 1.35; min-height: 56px;
}
.big-input::placeholder { color: var(--muted); font-weight: 500; }
.big-input:focus, .field:focus { border-color: color-mix(in srgb, var(--accent) 60%, transparent); }
.row-lbl { font-size: 12.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); margin: 18px 0 8px; display: flex; align-items: center; gap: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; margin: 0 -18px; padding: 0 18px 2px; scrollbar-width: none; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip {
  height: 38px; padding: 0 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line);
  font-size: 14px; font-weight: 600; color: var(--text-2); display: inline-flex; align-items: center; gap: 6px; flex: none;
  transition: all .2s var(--ease); position: relative;
}
.chip:active { transform: scale(.95); }
.chip.on { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 55%, transparent); color: var(--accent); }
.chip input[type=date], .chip input[type=time] { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; }
.chip.wd { width: 42px; padding: 0; justify-content: center; }
.field {
  width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px;
  font-size: 15px; outline: 0; resize: none; line-height: 1.45;
}
textarea.field { min-height: 84px; }
.switch-row { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin-top: 10px; }
.switch-row .grow { flex: 1; }
.switch-row b { font-size: 15px; font-weight: 600; display: block; }
.switch-row small { color: var(--muted); font-size: 12.5px; }
.switch { width: 50px; height: 30px; border-radius: 99px; background: var(--surface-3); position: relative; flex: none; transition: background .25s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .25); transition: transform .3s var(--spring); }
.switch.on { background: var(--good); }
.switch.on::after { transform: translateX(20px); }
.time-input { background: var(--surface-2); border: 0; border-radius: 10px; padding: 6px 10px; font-size: 15px; font-weight: 700; color: var(--text); }
.swatches { display: grid; grid-template-columns: repeat(8, 1fr); justify-items: center; gap: 6px; }
.sw { width: 34px; height: 34px; border-radius: 50%; background: var(--gc); position: relative; transition: transform .2s var(--spring); }
.sw.on { transform: scale(1.1); box-shadow: 0 0 0 3px var(--bg-2), 0 0 0 5px var(--gc); }
.emoji-btn { width: 56px; height: 56px; border-radius: 16px; font-size: 30px; display: grid; place-items: center; flex: none; background: color-mix(in srgb, var(--gc) 18%, var(--surface)); border: 1px solid var(--line); }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; margin-top: 10px; background: var(--surface); border-radius: 16px; padding: 10px; border: 1px solid var(--line); }
.emoji-grid button { font-size: 24px; height: 40px; border-radius: 10px; }
.emoji-grid button.on { background: var(--accent-soft); }
.head-row { display: flex; gap: 10px; align-items: flex-start; }
.head-row .big-input { flex: 1; }
.period { display: flex; align-items: center; gap: 8px; margin-top: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 6px; }
.period .pl { flex: 1; text-align: center; font-weight: 650; font-size: 14.5px; }
.period button { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: var(--text-2); }
.period button:active { background: var(--surface-2); }
.hint { font-size: 13px; color: var(--muted); margin-top: 8px; line-height: 1.45; }
.sheet .actions { margin-top: 22px; }
select.field { -webkit-appearance: none; appearance: none; }

/* ---------- тост и конфетти ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tab-h) + var(--safe-b) + 90px); z-index: 60;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--surface-3); color: var(--text); border: 1px solid var(--line-2);
  padding: 10px 10px 10px 16px; border-radius: 14px; font-size: 14px; font-weight: 600; box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 12px; transition: all .3s var(--ease); max-width: calc(100vw - 32px);
}
.toast.show { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }
.toast button { color: var(--accent); font-weight: 700; padding: 4px 8px; }
.toast:not(.has-btn) { padding-right: 16px; }
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 70; width: 100%; height: 100%; }

.loading { display: grid; place-items: center; min-height: 70vh; color: var(--muted); }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--surface-3); border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.error-box { text-align: center; padding: 60px 24px; }
.error-box .big { font-size: 46px; margin-bottom: 12px; }
.error-box p { color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
