/* Ежедневник — Telegram Mini App, liquid glass v2 */

:root {
  --bg: #0b0b0d;
  --text: #f2f2f4;
  --muted: rgba(242, 242, 244, .58);
  --faint: rgba(242, 242, 244, .32);
  --line: rgba(255, 255, 255, .08);
  --glass-a: .085;         /* верх стекла */
  --glass-b: .025;         /* низ стекла */
  --edge-a: .42;           /* яркая кромка-блик */
  --edge-b: .05;
  --shadow: rgba(0, 0, 0, .6);
  --sheen: .09;
  --accent: #f4f4f5;       /* светлый графит вместо цветного акцента */
  --accent-2: #b4b4bb;
  --accent-3: #7c7c85;
  --on-accent: #0b0b0d;
  --ok: #e4e4e7;
  --warn: #d9b56a;
  --danger: #f07a7d;
  --blob-1: #3a3a42;
  --blob-2: #2c2c33;
  --blob-3: #45454d;
  --blob-4: #26262c;
  --blob-o: .55;
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --smooth: cubic-bezier(.22, .9, .25, 1);
  --safe-bottom: max(env(safe-area-inset-bottom), var(--tg-safe-area-inset-bottom, 0px));
  --safe-top: var(--tg-content-safe-area-inset-top, 0px);
  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #eceffd;
  --text: #121530;
  --muted: rgba(18, 21, 48, .6);
  --faint: rgba(18, 21, 48, .36);
  --line: rgba(18, 21, 48, .08);
  --glass-a: .82;
  --glass-b: .45;
  --edge-a: 1;
  --edge-b: .35;
  --shadow: rgba(40, 46, 110, .16);
  --sheen: .5;
  --accent: #6b4dff;
  --accent-2: #0aa6f0;
  --accent-3: #f2479a;
  --ok: #10b981;
  --blob-1: #a08bff;
  --blob-2: #6fd8ff;
  --blob-3: #ff9fcd;
  --blob-4: #ffd27a;
  --blob-o: .7;
  color-scheme: light;
}

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

/* ===================== живой фон ===================== */

.aurora { position: fixed; inset: 0; overflow: hidden; z-index: 0; pointer-events: none; }
.aurora::before {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(90% 55% at 20% -5%, rgba(255, 255, 255, .07), transparent 70%),
    radial-gradient(70% 50% at 100% 100%, rgba(255, 255, 255, .04), transparent 70%);
}
/* зерно — делает стекло «материальным» */
.aurora::after {
  content: ""; position: absolute; inset: -50%; opacity: .07; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
.blob {
  position: absolute; width: 62vmax; height: 62vmax; border-radius: 50%;
  filter: blur(64px); opacity: var(--blob-o); mix-blend-mode: screen; will-change: transform;
}
[data-theme="light"] .blob { mix-blend-mode: multiply; }
.b1 { background: var(--blob-1); top: -22vmax; left: -18vmax; animation: d1 22s ease-in-out infinite alternate; }
.b2 { background: var(--blob-2); top: 18vh; right: -30vmax; animation: d2 27s ease-in-out infinite alternate; }
.b3 { background: var(--blob-3); bottom: -28vmax; left: -14vmax; animation: d3 31s ease-in-out infinite alternate; }
.b4 { background: var(--blob-4); bottom: 6vh; right: -22vmax; width: 42vmax; height: 42vmax; opacity: calc(var(--blob-o) * .55); animation: d2 24s ease-in-out infinite alternate-reverse; }
@keyframes d1 { to { transform: translate(14vmax, 10vmax) scale(1.18) rotate(30deg); } }
@keyframes d2 { to { transform: translate(-12vmax, 14vmax) scale(.86) rotate(-20deg); } }
@keyframes d3 { to { transform: translate(10vmax, -16vmax) scale(1.12); } }

/* пузырьки, всплывающие сквозь стекло */
.bubble {
  position: absolute; bottom: -80px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, .55), rgba(255, 255, 255, .06) 45%, transparent 70%);
  box-shadow: inset 0 0 12px rgba(255, 255, 255, .18);
  animation: rise linear infinite; opacity: .25;
}
@keyframes rise {
  0% { transform: translate(0, 0) scale(.7); opacity: 0; }
  10% { opacity: .22; }
  50% { transform: translate(18px, -55vh) scale(1); }
  100% { transform: translate(-12px, -112vh) scale(.85); opacity: 0; }
}

/* ===================== стекло ===================== */

.glass {
  position: relative; isolation: isolate;
  background: linear-gradient(135deg, rgba(255, 255, 255, var(--glass-a)), rgba(255, 255, 255, var(--glass-b)));
  -webkit-backdrop-filter: blur(28px) saturate(190%);
  backdrop-filter: blur(28px) saturate(190%);
  border-radius: 24px;
  box-shadow:
    0 22px 44px -18px var(--shadow),
    0 2px 6px -2px rgba(0, 0, 0, .12),
    inset 0 1px 0 rgba(255, 255, 255, calc(var(--edge-a) * .7)),
    inset 0 -12px 24px -14px rgba(255, 255, 255, .12);
}
/* кромка-блик: светлая сверху-слева, гаснет к центру и снова вспыхивает снизу-справа */
.glass::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none; z-index: -1;
  background: linear-gradient(135deg,
    rgba(255, 255, 255, var(--edge-a)) 0%, rgba(255, 255, 255, var(--edge-b)) 32%,
    rgba(255, 255, 255, var(--edge-b)) 65%, rgba(255, 255, 255, calc(var(--edge-a) * .55)) 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
}
/* блик на изогнутой поверхности */
.glass::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: -1;
  background: radial-gradient(140% 70% at 8% -20%, rgba(255, 255, 255, var(--sheen)), transparent 50%);
}

/* ===================== каркас ===================== */

.top {
  position: sticky; top: 0; z-index: 4;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 12px;
  padding: calc(16px + var(--safe-top)) 18px 10px;
  transition: padding .35s var(--smooth);
}
.top::before {
  content: ""; position: absolute; inset: 0; z-index: -1; opacity: 0; transition: opacity .35s;
  background: linear-gradient(180deg, color-mix(in srgb, var(--bg) 70%, transparent), color-mix(in srgb, var(--bg) 25%, transparent));
  -webkit-backdrop-filter: blur(24px) saturate(180%); backdrop-filter: blur(24px) saturate(180%);
  border-bottom: 1px solid var(--line);
}
body.scrolled .top { padding-top: calc(10px + var(--safe-top)); }
body.scrolled .top::before { opacity: 1; }
.top-sub { color: var(--muted); font-size: 13px; font-weight: 600; letter-spacing: .2px; transition: all .35s var(--smooth); }
.top-sub::first-letter { text-transform: uppercase; }
.top-title {
  margin: 2px 0 0; font-size: 30px; line-height: 1.08; font-weight: 800; letter-spacing: -.8px;
  transform-origin: left bottom; transition: transform .35s var(--smooth);
}
body.scrolled .top-title { transform: scale(.7); margin-bottom: -8px; }
body.scrolled .top-sub { opacity: 0; height: 0; }
.title-grad { color: var(--muted); }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; flex: none; transition: transform .4s var(--spring); }
.icon-btn:active { transform: scale(.88) rotate(-30deg); }
.icon-btn svg { width: 21px; height: 21px; }

.view { position: relative; z-index: 1; padding: 8px 16px calc(130px + var(--safe-bottom)); }
.view.enter-right { animation: slideL .45s var(--smooth); }
.view.enter-left { animation: slideR .45s var(--smooth); }
@keyframes slideL { from { opacity: 0; transform: translateX(26px); } }
@keyframes slideR { from { opacity: 0; transform: translateX(-26px); } }

/* каскадное появление (кроме тихих перерисовок после отметки задачи) */
.rise { animation: riseIn .6s var(--smooth) both; animation-delay: calc(var(--i, 0) * 45ms); }
.view.soft .rise, .view.soft .progress i, .view.soft .dots i, .view.soft .bars .stack { animation: none; }
@keyframes riseIn { from { opacity: 0; transform: translateY(18px) scale(.97); } }

.section-title {
  display: flex; align-items: center; gap: 8px; margin: 24px 4px 10px;
  font-size: 12.5px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: 1px;
}
.section-title .count {
  margin-left: auto; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px; display: grid; place-items: center;
  font-size: 11.5px; background: var(--line); color: var(--text);
}

/* ===================== таббар ===================== */

.tabbar {
  position: fixed; z-index: 6; left: 14px; right: 14px; bottom: calc(12px + var(--safe-bottom));
  display: grid; grid-template-columns: 1fr 1fr auto 1fr 1fr; align-items: center;
  height: 70px; padding: 0 8px; border-radius: 35px;
  animation: barIn .7s var(--spring) both .1s;
}
@keyframes barIn { from { transform: translateY(120%); } }
.tab-glow {
  position: absolute; top: 7px; left: 0; width: 64px; height: 56px; border-radius: 26px; z-index: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, .22), rgba(255, 255, 255, .06));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), inset 0 -6px 12px -6px rgba(255, 255, 255, .25), 0 6px 16px -6px rgba(0, 0, 0, .35);
  transition: transform .55s var(--spring), width .4s var(--smooth);
}
[data-theme="light"] .tab-glow { background: linear-gradient(135deg, #fff, rgba(255, 255, 255, .7)); }
.tab {
  position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: 10.5px; font-weight: 700; color: var(--faint); padding: 9px 0; transition: color .3s;
}
.tab svg { width: 24px; height: 24px; transition: transform .45s var(--spring); }
.tab.active { color: var(--text); }
.tab.active svg { transform: translateY(-1px) scale(1.12); }
.tab:active svg { transform: scale(.85); }
.tab-add {
  position: relative; z-index: 1; width: 58px; height: 58px; margin: 0 6px; border-radius: 50%; display: grid; place-items: center; color: var(--on-accent);
  background: linear-gradient(180deg, #fafafa, #c9c9cf);
  box-shadow: 0 10px 24px -8px rgba(255, 255, 255, .35), inset 0 1.5px 0 #fff, inset 0 -8px 16px rgba(0, 0, 0, .12);
  transition: transform .4s var(--spring);
}
.tab-add::before {
  content: ""; position: absolute; inset: -4px; border-radius: 50%; z-index: -1;
  background: conic-gradient(from 0deg, rgba(255, 255, 255, .5), rgba(255, 255, 255, .05), rgba(255, 255, 255, .35), rgba(255, 255, 255, .05), rgba(255, 255, 255, .5));
  filter: blur(8px); opacity: .45; animation: spin 6s linear infinite;
}
.tab-add svg { width: 27px; height: 27px; stroke-width: 2.5; transition: transform .4s var(--spring); }
.tab-add:active { transform: scale(.88); }
.tab-add:active svg { transform: rotate(90deg); }

/* ===================== иконки категорий ===================== */

.badge {
  width: 38px; height: 38px; flex: none; border-radius: 13px; display: grid; place-items: center; color: #e8e8ec;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .1), inset 0 1px 0 rgba(255, 255, 255, .22), 0 6px 14px -8px rgba(0, 0, 0, .8);
  background: linear-gradient(145deg, var(--c1), var(--c2));
}
.badge svg { width: 19px; height: 19px; stroke-width: 2.1; }
.badge.sm { width: 26px; height: 26px; border-radius: 9px; }
.badge.sm svg { width: 14px; height: 14px; }
.badge { --c1: #3a3a41; --c2: #232328; }

/* ===================== главная ===================== */

.hero { display: flex; align-items: center; gap: 18px; padding: 18px; }
.ring { position: relative; width: 92px; height: 92px; flex: none; }
.ring svg { width: 92px; height: 92px; transform: rotate(-90deg); overflow: visible; }
.ring .track { stroke: var(--line); stroke-width: 10; }
.ring .bar { stroke: url(#ringGrad); stroke-width: 10; filter: drop-shadow(0 0 6px rgba(255, 255, 255, .35)); transition: stroke-dashoffset 1.3s var(--smooth); }
.ring-label { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 800; font-size: 21px; letter-spacing: -.5px; }
.hero-text b { display: block; font-size: 19px; font-weight: 800; letter-spacing: -.3px; }
.hero-text span { color: var(--muted); font-size: 13.5px; font-weight: 500; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.pill {
  display: inline-flex; align-items: center; gap: 5px; padding: 5px 11px; border-radius: 99px;
  font-size: 12px; font-weight: 700; background: rgba(255, 255, 255, .1); box-shadow: inset 0 0 0 1px var(--line);
}
[data-theme="light"] .pill { background: rgba(255, 255, 255, .7); }

.quick { display: flex; align-items: center; gap: 8px; margin-top: 12px; padding: 6px 6px 6px 18px; border-radius: 22px; transition: transform .3s var(--spring), box-shadow .3s; }
.quick:focus-within { transform: scale(1.015); box-shadow: 0 0 0 1.5px rgba(255, 255, 255, .35), 0 22px 44px -18px var(--shadow); }
.quick input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; padding: 11px 0; font-size: 15px; font-weight: 500; }
.quick input::placeholder { color: var(--faint); }
.send {
  width: 42px; height: 42px; border-radius: 15px; display: grid; place-items: center; color: var(--on-accent); flex: none;
  background: linear-gradient(180deg, #fafafa, #c9c9cf); box-shadow: inset 0 1px 0 #fff;
  transition: transform .35s var(--spring);
}
.send:active { transform: scale(.85) translateX(3px); }
.send svg { width: 20px; height: 20px; stroke-width: 2.3; }

.chips-row { display: flex; gap: 10px; overflow-x: auto; margin: -14px -16px -22px; padding: 14px 16px 28px; scrollbar-width: none; }
.chips-row::-webkit-scrollbar { display: none; }
.dl-chip { flex: none; width: 176px; padding: 13px 14px; border-radius: 20px; text-align: left; transition: transform .3s var(--spring); }
.dl-chip:active { transform: scale(.95); }
.dl-chip b { display: block; font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dl-chip span { font-size: 12px; font-weight: 700; color: var(--muted); }
.dl-chip.hot span { color: var(--danger); }
.dl-chip.soon span { color: var(--warn); }
.dl-chip.hot { animation: pulseHot 2.4s ease-in-out infinite; }
@keyframes pulseHot { 50% { box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--danger) 40%, transparent), 0 22px 44px -18px var(--shadow); } }

/* ===================== задачи ===================== */

.list { display: flex; flex-direction: column; gap: 10px; }
.task { border-radius: 22px; touch-action: pan-y; transition: transform .3s var(--spring), opacity .3s; }
.task:active:not(.dragging) { transform: scale(.985); }
.task-inner {
  position: relative; z-index: 1; display: flex; align-items: center; gap: 12px; padding: 12px 14px 12px 12px;
  border-radius: inherit; transition: transform .45s var(--spring);
}
.task.dragging .task-inner { transition: none; }
.swipe-bg {
  position: absolute; inset: 0; z-index: 0; border-radius: inherit; display: flex; align-items: center; padding: 0 22px;
  font-size: 13px; font-weight: 800; color: var(--text); opacity: 0; transition: opacity .15s;
}
.swipe-bg.done { background: linear-gradient(90deg, rgba(255, 255, 255, .22), transparent 75%); }
.swipe-bg.later { justify-content: flex-end; background: linear-gradient(270deg, rgba(255, 255, 255, .14), transparent 75%); }
.check {
  position: relative; width: 28px; height: 28px; flex: none; border-radius: 50%; display: grid; place-items: center;
  box-shadow: inset 0 0 0 2px var(--faint); transition: box-shadow .3s, background .3s, transform .45s var(--spring);
}
.check svg { width: 16px; height: 16px; stroke-width: 3; color: var(--on-accent); stroke-dasharray: 24; stroke-dashoffset: 24; transition: stroke-dashoffset .4s var(--smooth) .1s; }
.check::after { content: ""; position: absolute; inset: -2px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .8); opacity: 0; transform: scale(.6); }
.task.done .check { box-shadow: none; background: linear-gradient(180deg, #fafafa, #c9c9cf); }
.task.done .check svg { stroke-dashoffset: 0; }
.task.completing .check { transform: scale(1.25); }
.task.completing .check::after { animation: burst .6s var(--smooth) forwards; }
@keyframes burst { 0% { opacity: .9; transform: scale(.8); } 100% { opacity: 0; transform: scale(2.4); } }
.task.completing .task-title { opacity: .45; }
.task-body { flex: 1; min-width: 0; text-align: left; }
.task-title { font-size: 15.5px; font-weight: 700; line-height: 1.3; word-break: break-word; transition: opacity .3s; position: relative; display: inline; }
.task.done .task-title { opacity: .45; text-decoration: line-through; text-decoration-thickness: 2px; text-decoration-color: color-mix(in srgb, var(--text) 50%, transparent); }
.task-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin-top: 5px; font-size: 12px; color: var(--muted); font-weight: 600; }
.tag { display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px; border-radius: 8px; background: var(--line); }
.tag.time { color: var(--text); background: rgba(255, 255, 255, .13); font-weight: 800; }
.tag.hot { color: var(--danger); background: color-mix(in srgb, var(--danger) 16%, transparent); }
.tag.dl { color: var(--text); }
.task-note { margin-top: 5px; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task.prio:not(.done) .task-inner::before {
  content: ""; position: absolute; left: 0; top: 16px; bottom: 16px; width: 3.5px; border-radius: 4px;
  background: var(--text); box-shadow: 0 0 10px rgba(255, 255, 255, .5);
}
.task.done .badge { filter: grayscale(.8); opacity: .5; }
.task.leaving { animation: leave .45s var(--smooth) forwards; }
@keyframes leave { to { opacity: 0; transform: translateX(40px) scale(.96); } }

/* конфетти */
.confetti { position: fixed; z-index: 30; pointer-events: none; width: 8px; height: 8px; border-radius: 2px; animation: pop-out .9s var(--smooth) forwards; }
@keyframes pop-out {
  0% { transform: translate(0, 0) rotate(0) scale(1); opacity: 1; }
  100% { transform: translate(var(--x), var(--y)) rotate(var(--r)) scale(.4); opacity: 0; }
}

.empty { padding: 30px 18px; text-align: center; color: var(--muted); font-weight: 500; }
.empty .big { font-size: 46px; margin-bottom: 8px; display: inline-block; animation: float 3.5s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-8px) rotate(-6deg); } }
.empty b { display: block; color: var(--text); font-size: 17px; font-weight: 800; margin-bottom: 4px; }

/* ===================== кнопки ===================== */

.btn {
  position: relative; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 48px; padding: 0 18px; border-radius: 17px; font-weight: 750; font-size: 15px;
  transition: transform .35s var(--spring), opacity .2s;
}
.btn:active { transform: scale(.95); }
.btn.primary {
  color: var(--on-accent); background: linear-gradient(180deg, #fafafa, #c9c9cf);
  box-shadow: 0 12px 24px -12px rgba(255, 255, 255, .3), inset 0 1px 0 #fff;
}
.btn.primary::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 40%; left: -60%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .7), transparent);
  animation: sweep 3.8s ease-in-out infinite;
}
@keyframes sweep { 60%, 100% { left: 130%; } }
.btn.ghost { background: rgba(255, 255, 255, .09); box-shadow: inset 0 0 0 1px var(--line), inset 0 1px 0 rgba(255, 255, 255, .15); }
[data-theme="light"] .btn.ghost { background: rgba(255, 255, 255, .7); }
.btn.danger { color: var(--danger); background: color-mix(in srgb, var(--danger) 13%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--danger) 25%, transparent); }
.btn.block { width: 100%; }
.btn.small { height: 34px; padding: 0 12px; border-radius: 12px; font-size: 13px; }
.btn[disabled] { opacity: .6; pointer-events: none; }
.wide-btn { width: 100%; margin-top: 16px; }
.ai-btn { color: var(--text); }
.ai-btn .spark { display: inline-block; animation: twinkle 2s ease-in-out infinite; }
@keyframes twinkle { 50% { transform: scale(1.3) rotate(20deg); filter: brightness(1.4); } }

/* ===================== календарь ===================== */

.cal { padding: 14px 12px 12px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; padding: 0 4px 12px; }
.cal-head b { font-size: 17px; font-weight: 800; }
.cal-nav { width: 38px; height: 38px; border-radius: 13px; display: grid; place-items: center; background: var(--line); transition: transform .35s var(--spring); }
.cal-nav:active { transform: scale(.85); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-grid.slide-l { animation: slideL .4s var(--smooth); }
.cal-grid.slide-r { animation: slideR .4s var(--smooth); }
.cal-wd { text-align: center; font-size: 11px; font-weight: 800; color: var(--faint); padding-bottom: 6px; }
.cal-day {
  position: relative; aspect-ratio: 1 / 1.08; border-radius: 15px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 4px; font-weight: 700; font-size: 15px; transition: transform .35s var(--spring);
}
.cal-day:active { transform: scale(.88); }
.cal-day.past { color: var(--faint); }
.cal-day.today { box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .55); }
.cal-day.sel { color: var(--on-accent); background: linear-gradient(180deg, #fafafa, #c9c9cf); box-shadow: 0 8px 18px -8px rgba(255, 255, 255, .35), inset 0 1px 0 #fff; animation: popIn .45s var(--spring); }
@keyframes popIn { from { transform: scale(.7); } }
.cal-dots { display: flex; gap: 2px; height: 5px; }
.cal-dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--accent-3); }
.cal-dots i.ok { background: var(--ok); }
.cal-day.sel .cal-dots i { background: var(--on-accent); }

/* ===================== сегменты ===================== */

.segments { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); padding: 5px; border-radius: 18px; }
.seg-glow {
  position: absolute; top: 5px; bottom: 5px; left: 5px; width: calc((100% - 10px) / 3); border-radius: 13px; z-index: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, .22), rgba(255, 255, 255, .07));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .4), 0 4px 12px -4px rgba(0, 0, 0, .3);
  transition: transform .5s var(--spring);
}
[data-theme="light"] .seg-glow { background: #fff; }
.segments button { position: relative; z-index: 1; height: 38px; font-size: 13.5px; font-weight: 750; color: var(--muted); transition: color .3s; }
.segments button.on { color: var(--text); }

/* ===================== цели ===================== */

.card { padding: 16px; }
.dl-card { display: block; width: 100%; text-align: left; transition: transform .3s var(--spring); }
.dl-card:active { transform: scale(.97); }
.dl-card .row { display: flex; align-items: center; gap: 12px; }
.dl-card .row > div { flex: 1; min-width: 0; }
.dl-card b { display: block; font-size: 15.5px; font-weight: 800; }
.dl-when { font-size: 12.5px; font-weight: 800; white-space: nowrap; padding: 5px 10px; border-radius: 10px; background: var(--line); }
.dl-when.hot { color: var(--danger); background: color-mix(in srgb, var(--danger) 16%, transparent); }
.dl-when.soon { color: var(--warn); }
.dl-when.calm { color: var(--muted); }
.progress { height: 9px; margin-top: 14px; border-radius: 9px; background: var(--line); overflow: hidden; }
.progress i { display: block; height: 100%; border-radius: 9px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); animation: grow 1.2s var(--smooth) both .2s; transform-origin: left; }
.progress.hot i { background: linear-gradient(90deg, color-mix(in srgb, var(--danger) 55%, #888), var(--danger)); }
@keyframes grow { from { transform: scaleX(0); } }
.sub { margin-top: 7px; font-size: 12.5px; color: var(--muted); font-weight: 500; }

.habit .row { display: flex; align-items: center; gap: 12px; }
.flame {
  position: relative; width: 56px; height: 56px; flex: none; border-radius: 18px; display: grid; place-items: center; text-align: center;
  background: linear-gradient(160deg, rgba(255, 255, 255, .12), rgba(255, 255, 255, .03)); box-shadow: inset 0 0 0 1px var(--line), inset 0 1px 0 rgba(255, 255, 255, .2);
}
.flame em { display: block; font-style: normal; font-size: 20px; font-weight: 800; line-height: 1; }
.flame span { display: inline-block; font-size: 15px; animation: flicker 1.6s ease-in-out infinite; transform-origin: bottom center; }
@keyframes flicker { 25% { transform: scale(1.12) rotate(-5deg); } 50% { transform: scale(.95) rotate(3deg); } 75% { transform: scale(1.08) rotate(-2deg); } }
.habit .info { flex: 1; min-width: 0; }
.habit .info b { display: block; font-size: 15.5px; font-weight: 800; }
.dots { display: flex; gap: 4px; margin-top: 14px; }
.dots i { flex: 1; height: 9px; border-radius: 5px; background: var(--line); animation: riseIn .5s var(--smooth) both; animation-delay: calc(var(--d) * 30ms + 200ms); }
.dots i.y { background: #e4e4e7; box-shadow: 0 0 6px rgba(255, 255, 255, .35); }
.dots i.n { background: color-mix(in srgb, var(--danger) 40%, transparent); }
.habit.paused { opacity: .55; filter: saturate(.4); }
.switch { position: relative; width: 52px; height: 31px; flex: none; border-radius: 99px; background: var(--line); box-shadow: inset 0 1px 3px rgba(0, 0, 0, .2); transition: background .3s; }
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 25px; height: 25px; border-radius: 50%;
  background: linear-gradient(180deg, #fafafa, #d4d4d8); box-shadow: 0 3px 8px rgba(0, 0, 0, .4); transition: transform .45s var(--spring);
}
.switch.on { background: rgba(255, 255, 255, .42); }
.switch.on::after { transform: translateX(21px); }

.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { padding: 15px; }
.stat b { display: block; font-size: 28px; font-weight: 800; letter-spacing: -.8px; }
.stat > span { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.stat b { display: flex; align-items: center; gap: 6px; }
.bars { display: flex; align-items: flex-end; gap: 8px; height: 150px; padding-top: 10px; }
.bars .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 7px; height: 100%; justify-content: flex-end; }
.bars .stack { position: relative; width: 100%; max-width: 32px; border-radius: 11px; background: var(--line); overflow: hidden; min-height: 8px; animation: growY 1s var(--spring) both; animation-delay: calc(var(--d) * 60ms); transform-origin: bottom; }
@keyframes growY { from { transform: scaleY(0); } }
.bars .stack i { position: absolute; left: 0; right: 0; bottom: 0; background: linear-gradient(0deg, var(--accent), var(--accent-2)); box-shadow: 0 0 10px rgba(255, 255, 255, .25); }
.bars .col span { font-size: 11px; color: var(--faint); font-weight: 800; }
.bars .col.today span { color: var(--text); }

/* ===================== идеи ===================== */

.idea { display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 14px; }
.idea .ico { width: 38px; height: 38px; flex: none; border-radius: 13px; display: grid; place-items: center; font-size: 19px; background: linear-gradient(145deg, rgba(255, 255, 255, .2), rgba(255, 255, 255, .05)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3); }
.idea p { flex: 1; margin: 0; font-weight: 700; }
.idea .actions { display: flex; gap: 6px; flex: none; }
.ai-idea { padding: 15px 16px; }
.ai-idea b { display: block; font-size: 15.5px; font-weight: 800; }
.ai-idea p { margin: 5px 0 12px; color: var(--muted); font-size: 13.5px; font-weight: 500; }
.ai-idea .actions { display: flex; gap: 8px; }

/* ===================== нижний лист ===================== */

.sheet-wrap { position: fixed; inset: 0; z-index: 10; pointer-events: none; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(3, 4, 18, .5); opacity: 0; transition: opacity .35s; -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 92vh; overflow-y: auto; overscroll-behavior: contain;
  padding: 8px 18px calc(24px + var(--safe-bottom)); border-radius: 32px 32px 0 0;
  transform: translateY(105%); transition: transform .55s var(--spring);
  background: linear-gradient(160deg, rgba(255, 255, 255, .92), rgba(240, 242, 255, .86));
  -webkit-backdrop-filter: blur(40px) saturate(190%); backdrop-filter: blur(40px) saturate(190%);
}
[data-theme="dark"] .sheet { background: linear-gradient(165deg, rgba(38, 38, 43, .86), rgba(16, 16, 19, .94)); }
.sheet.dragging { transition: none; }
.sheet-wrap.open { pointer-events: auto; }
.sheet-wrap.open .sheet-backdrop { opacity: 1; }
.sheet-wrap.open .sheet { transform: translateY(var(--drag, 0px)); }
.sheet-handle { width: 42px; height: 5px; border-radius: 5px; background: var(--faint); margin: 2px auto 16px; }
.sheet h2 { margin: 0 0 16px; font-size: 24px; font-weight: 800; letter-spacing: -.5px; }
.sheet .rise { animation-duration: .5s; }

.field { margin-bottom: 18px; }
.field > label { display: block; margin: 0 2px 8px; font-size: 12px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .8px; }
.input {
  width: 100%; padding: 14px 15px; border-radius: 17px; outline: 0; resize: none; border: 0;
  background: rgba(255, 255, 255, .08); box-shadow: inset 0 0 0 1px var(--line); transition: box-shadow .25s, background .25s;
}
[data-theme="light"] .input { background: rgba(255, 255, 255, .8); }
.input:focus { box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .55), 0 0 0 4px rgba(255, 255, 255, .06); }
.input.title { font-size: 19px; font-weight: 800; }
.input::placeholder { color: var(--faint); font-weight: 500; }
.row2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
/* iOS рисует поля даты и времени со своей минимальной шириной и вылезает из сетки */
input[type="date"].input, input[type="time"].input {
  -webkit-appearance: none; appearance: none; display: block; min-width: 0; max-width: 100%;
  height: 50px; line-height: 22px; text-align: left; font-weight: 600;
}
.input::-webkit-date-and-time-value { text-align: left; margin: 0; }
.input::-webkit-calendar-picker-indicator { filter: invert(1); opacity: .55; }
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 8px 13px; border-radius: 99px; font-size: 13.5px; font-weight: 700;
  background: rgba(255, 255, 255, .08); box-shadow: inset 0 0 0 1px var(--line); transition: transform .35s var(--spring), background .25s, color .25s;
}
[data-theme="light"] .chip { background: rgba(255, 255, 255, .75); }
.chip:active { transform: scale(.92); }
.chip .badge.sm { margin-left: -5px; }
.chip.on { color: var(--on-accent); background: linear-gradient(180deg, #fafafa, #c9c9cf); box-shadow: 0 6px 14px -8px rgba(255, 255, 255, .4), inset 0 1px 0 #fff; animation: popIn .35s var(--spring); }
.chip.wd { width: 42px; padding: 9px 0; justify-content: center; }
.toggles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.toggle {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 12px 12px 15px; border-radius: 17px;
  background: rgba(255, 255, 255, .08); box-shadow: inset 0 0 0 1px var(--line); font-weight: 700; font-size: 14px; white-space: nowrap;
}
[data-theme="light"] .toggle { background: rgba(255, 255, 255, .75); }
.toggle .switch { transform: scale(.85); margin-right: -4px; }
.stepper { display: inline-flex; align-items: center; gap: 14px; margin-top: 12px; }
.stepper button { width: 38px; height: 38px; border-radius: 13px; background: var(--line); font-size: 20px; font-weight: 700; transition: transform .3s var(--spring); }
.stepper button:active { transform: scale(.85); }
.sheet-actions { display: flex; gap: 10px; margin-top: 10px; }
.sheet-actions .btn { flex: 1; }
.hidden { display: none !important; }
.ai-text { white-space: pre-wrap; line-height: 1.7; font-size: 15px; font-weight: 500; }
.muted { color: var(--muted); }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 2px; border-bottom: 1px solid var(--line); }
.set-row:last-child { border-bottom: 0; }
.set-row span { font-weight: 700; }
.set-row small { display: block; color: var(--muted); font-weight: 500; font-size: 12px; margin-top: 2px; }
.set-row .input { width: auto; padding: 9px 11px; border-radius: 13px; }

/* ===================== тост и загрузка ===================== */

.toast {
  position: fixed; z-index: 20; left: 50%; bottom: calc(100px + var(--safe-bottom)); transform: translate(-50%, 40px) scale(.9);
  display: flex; align-items: center; gap: 14px; padding: 13px 18px; border-radius: 20px; max-width: calc(100% - 32px);
  font-weight: 700; font-size: 14px; opacity: 0; pointer-events: none; transition: all .5s var(--spring);
}
[data-theme="dark"] .toast { background: linear-gradient(150deg, rgba(52, 52, 58, .9), rgba(24, 24, 28, .94)); }
.toast.show { opacity: 1; transform: translate(-50%, 0) scale(1); pointer-events: auto; }
.toast button { color: var(--text); font-weight: 800; text-decoration: underline; text-underline-offset: 3px; }

.skeleton {
  height: 66px; border-radius: 22px; position: relative; overflow: hidden;
  background: linear-gradient(100deg, rgba(255, 255, 255, .04) 30%, rgba(255, 255, 255, .13) 50%, rgba(255, 255, 255, .04) 70%);
  background-size: 300% 100%; animation: shimmer 1.3s infinite linear;
}
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid var(--line); border-top-color: var(--text); animation: spin .8s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }

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