/* ══════════════════════════════════════════════════════════════
   Мои задачи — Telegram Mini App
   Палитра берётся из темы Telegram, фолбэки — для обычного браузера.
   ══════════════════════════════════════════════════════════════ */

:root {
  --bg:        var(--tg-theme-secondary-bg-color, #eef1f6);
  --surface:   var(--tg-theme-bg-color, #ffffff);
  --text:      var(--tg-theme-text-color, #0f1720);
  --hint:      var(--tg-theme-hint-color, #8a94a2);
  --accent:    var(--tg-theme-button-color, #2f8fff);
  --on-accent: var(--tg-theme-button-text-color, #ffffff);
  --danger:    var(--tg-theme-destructive-text-color, #e5484d);

  --grad-a: var(--accent);
  --grad-b: #2ed3a3;

  --p0: #58b8ff;   /* не срочно */
  --p1: #f5b544;   /* обычная   */
  --p2: #ff5f6d;   /* срочно    */

  --line:   color-mix(in srgb, var(--hint) 22%, transparent);
  --sunken: color-mix(in srgb, var(--hint) 12%, transparent);
  --tint:   color-mix(in srgb, var(--accent) 12%, transparent);

  --r-sm: 12px;
  --r-md: 16px;
  --r-lg: 22px;

  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px rgba(16, 24, 40, .06);
  --ease: cubic-bezier(.22, 1, .36, 1);

  --safe-bottom: max(env(safe-area-inset-bottom), 10px);
}

/* Фолбэк тёмной темы для отладки вне Telegram */
@media (prefers-color-scheme: dark) {
  :root {
    --bg:      var(--tg-theme-secondary-bg-color, #12161c);
    --surface: var(--tg-theme-bg-color, #1b2129);
    --text:    var(--tg-theme-text-color, #f2f5f8);
    --hint:    var(--tg-theme-hint-color, #7d8794);
    --shadow:  0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* Классы с явным display перебивают атрибут hidden — чиним разом. */
[hidden] { display: none !important; }

button, .segmented__item, .hero__title, .task__title {
  -webkit-user-select: none;
  user-select: none;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overscroll-behavior-y: none;
}

body {
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text",
        "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; color: inherit; }
button { border: 0; background: none; cursor: pointer; }
h1, h2, p, ul { margin: 0; }
ul { list-style: none; padding: 0; }

.app {
  min-height: 100%;
  padding-bottom: calc(84px + var(--safe-bottom));
}

/* ── Шапка ─────────────────────────────────────────────────── */

.hero {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 12px 12px 0;
  padding: 20px;
  border-radius: var(--r-lg);
  background:
    radial-gradient(120% 140% at 100% 0%, var(--tint), transparent 60%),
    var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.hero__text { flex: 1; min-width: 0; }

.hero__date {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .02em;
  color: var(--hint);
}

.hero__title {
  margin: 2px 0 4px;
  font-size: 27px;
  font-weight: 700;
  letter-spacing: -.02em;
  line-height: 1.15;
}

.hero__sub { font-size: 14px; color: var(--hint); }
.hero__sub b { color: var(--text); font-weight: 600; }

/* Кольцо прогресса */
.ring { position: relative; width: 72px; height: 72px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }

.ring circle {
  fill: none;
  stroke-width: 7;
  stroke-linecap: round;
}

.ring__track { stroke: var(--sunken); }

.ring__value {
  stroke: url(#ringGrad);
  stroke-dasharray: 188.5;
  stroke-dashoffset: 188.5;
  transition: stroke-dashoffset .7s var(--ease);
}

.ring__label {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -.03em;
}

.ring__label i { font-style: normal; font-size: 11px; opacity: .55; }

.ring.is-full .ring__label { color: var(--grad-b); }

/* ── Сегменты ──────────────────────────────────────────────── */

.segmented {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 14px 12px 10px;
  padding: 3px;
  border-radius: 13px;
  background: var(--sunken);
}

.segmented__thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: calc((100% - 6px) / 3);
  height: calc(100% - 6px);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(16, 24, 40, .12);
  transition: transform .32s var(--ease);
}

.segmented__item {
  position: relative;
  z-index: 1;
  padding: 8px 4px;
  font-size: 14px;
  font-weight: 600;
  color: var(--hint);
  transition: color .2s;
}

.segmented__item.is-active { color: var(--text); }

/* ── Экраны ────────────────────────────────────────────────── */

.content { padding: 0 12px; }
.view { display: none; }
.view.is-active { display: block; animation: fade .28s var(--ease); }

@keyframes fade {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

/* ── Переключатель дня ─────────────────────────────────────── */

.daybar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
}

.daybar__nav {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: transform .15s var(--ease), opacity .2s;
}

.daybar__nav:active { transform: scale(.9); }
.daybar__nav svg { width: 19px; height: 19px; fill: none; stroke: var(--text);
                   stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

.daybar__label {
  flex: 1;
  height: 38px;
  border-radius: 19px;
  background: var(--surface);
  box-shadow: var(--shadow);
  font-size: 14.5px;
  font-weight: 600;
  transition: transform .15s var(--ease);
}

.daybar__label:active { transform: scale(.98); }
.daybar__label.is-away { background: var(--accent); color: var(--on-accent); }

/* ── Плашка переноса ───────────────────────────────────────── */

.banner {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin-bottom: 12px;
  padding: 13px 15px;
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: left;
  animation: fade .3s var(--ease);
  transition: transform .15s var(--ease);
}

.banner:active { transform: scale(.985); }
.banner__icon { font-size: 20px; }
.banner__text { flex: 1; min-width: 0; display: block; }
.banner__text b { display: block; font-size: 14.5px; font-weight: 600; }
.banner__text i { font-style: normal; font-size: 12.5px; color: var(--hint); }
.banner__arrow { color: var(--accent); font-weight: 700; }

/* ── Список задач ──────────────────────────────────────────── */

.tasks { display: flex; flex-direction: column; gap: 8px; }

.task {
  --p: var(--p1);
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 12px 13px 15px;
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: pop .34s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 26ms);
  transition: transform .16s var(--ease), opacity .25s;
}

.task--p0 { --p: var(--p0); }
.task--p1 { --p: var(--p1); }
.task--p2 { --p: var(--p2); }

.task::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--p);
  transition: opacity .3s;
}

.task.is-done::before { opacity: .25; }
.task.is-pressed { transform: scale(.985); }

@keyframes pop {
  from { opacity: 0; transform: translateY(10px) scale(.98); }
  to   { opacity: 1; transform: none; }
}

.task.is-leaving {
  opacity: 0;
  transform: translateX(-24px) scale(.96);
}

/* Чекбокс */
.check {
  flex: none;
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 2px solid var(--line);
  transition: background .25s var(--ease), border-color .25s var(--ease);
}

.check svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: var(--on-accent);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 22;
  stroke-dashoffset: 22;
  transition: stroke-dashoffset .3s var(--ease) .05s;
}

.task.is-done .check {
  background: var(--p);
  border-color: var(--p);
  animation: bump .34s var(--ease);
}

.task.is-done .check svg { stroke-dashoffset: 0; }

@keyframes bump {
  0%   { transform: scale(1); }
  45%  { transform: scale(1.28); }
  100% { transform: scale(1); }
}

.task__title {
  flex: 1;
  min-width: 0;
  font-size: 15.5px;
  line-height: 1.35;
  word-break: break-word;
  transition: opacity .25s, color .25s;
}

.task__title span {
  background-image: linear-gradient(currentColor, currentColor);
  background-repeat: no-repeat;
  background-size: 0% 1.5px;
  background-position: 0 62%;
  transition: background-size .32s var(--ease);
}

.task.is-done .task__title { color: var(--hint); }
.task.is-done .task__title span { background-size: 100% 1.5px; }

.task__more {
  flex: none;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--hint);
  transition: background .2s;
}

.task__more:active { background: var(--sunken); }
.task__more svg { width: 17px; height: 17px; fill: currentColor; }

/* ── Пустой экран ──────────────────────────────────────────── */

.empty {
  padding: 42px 24px 30px;
  text-align: center;
  animation: fade .35s var(--ease);
}

.empty__art { width: 108px; margin: 0 auto 16px; opacity: .9; }

.empty__art svg {
  width: 100%;
  fill: none;
  stroke: var(--hint);
  stroke-width: 3.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: .55;
}

.empty__art .empty__badge { fill: var(--accent); stroke: none; }
.empty__art .empty__check { stroke: var(--on-accent); opacity: 1; }

.empty h2 { font-size: 17px; font-weight: 650; margin-bottom: 6px; }
.empty p  { font-size: 14px; color: var(--hint); }

/* ── Инструменты дня ───────────────────────────────────────── */

.daytools { display: flex; justify-content: center; margin-top: 14px; }

.chip {
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: transform .15s var(--ease);
}

.chip:active { transform: scale(.95); }
.chip--ghost { color: var(--hint); background: var(--sunken); box-shadow: none; }

/* ── Карточки статистики ───────────────────────────────────── */

.cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.card {
  padding: 15px;
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow);
  animation: pop .3s var(--ease) both;
}

.card:nth-child(2) { animation-delay: .04s; }
.card:nth-child(3) { animation-delay: .08s; }
.card:nth-child(4) { animation-delay: .12s; }

.card__icon { font-size: 18px; }
.card b { display: block; margin-top: 6px; font-size: 25px; font-weight: 700; letter-spacing: -.02em; }
.card i { font-style: normal; font-size: 12.5px; color: var(--hint); }

.card--streak b {
  background: linear-gradient(120deg, var(--p2), var(--p1));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ── Панели ────────────────────────────────────────────────── */

.panel {
  margin-bottom: 12px;
  padding: 16px;
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.panel__head h2 { font-size: 16px; font-weight: 650; }
.panel__hint { margin: -6px 0 14px; font-size: 13px; color: var(--hint); }
.panel__foot { margin-top: 12px; font-size: 12.5px; color: var(--hint); text-align: center; }

.switch { display: flex; padding: 3px; border-radius: 10px; background: var(--sunken); }

.switch__item {
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--hint);
  transition: background .2s, color .2s;
}

.switch__item.is-active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(16,24,40,.12); }

/* ── График ────────────────────────────────────────────────── */

.chart {
  display: flex;
  align-items: stretch;
  gap: 4px;
  height: 132px;
  padding-top: 6px;
}

.bar {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.bar__stack {
  position: relative;
  width: 100%;
  max-width: 26px;
  flex: 1;
  min-height: 0;
  border-radius: 7px;
  background: var(--sunken);
  overflow: hidden;
}

.bar__fill {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 0;
  border-radius: 7px;
  background: linear-gradient(180deg, var(--grad-b), var(--grad-a));
  transition: height .6s var(--ease);
}

.bar--empty .bar__stack { opacity: .55; }
.bar--full .bar__fill { background: linear-gradient(180deg, #4ade80, var(--grad-b)); }

.bar__label { font-size: 10.5px; color: var(--hint); white-space: nowrap; }
.bar--today .bar__label { color: var(--accent); font-weight: 700; }
.chart--month .bar__label { display: none; }
.chart--month .bar__stack { border-radius: 4px; }
.chart--month .bar__fill { border-radius: 4px; }

/* ── Индикатор «всего» ─────────────────────────────────────── */

.meter__bar {
  height: 10px;
  border-radius: 999px;
  background: var(--sunken);
  overflow: hidden;
}

.meter__bar span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--grad-a), var(--grad-b));
  transition: width .7s var(--ease);
}

.meter__legend {
  display: flex;
  justify-content: space-between;
  margin-top: 9px;
  font-size: 13px;
  color: var(--hint);
}

.meter__legend b { color: var(--text); }

/* ── Степпер и переключатель ───────────────────────────────── */

.stepper {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px;
  border-radius: 14px;
  background: var(--sunken);
  transition: opacity .25s;
}

.stepper.is-off { opacity: .4; pointer-events: none; }

.stepper__btn {
  width: 42px;
  height: 38px;
  border-radius: 10px;
  background: var(--surface);
  font-size: 20px;
  font-weight: 500;
  box-shadow: 0 1px 3px rgba(16,24,40,.1);
  transition: transform .15s var(--ease);
}

.stepper__btn:active { transform: scale(.9); }

.stepper__value {
  flex: 1;
  text-align: center;
  font-size: 17px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.toggle input { position: absolute; opacity: 0; pointer-events: none; }

.toggle__track {
  display: block;
  width: 50px;
  height: 30px;
  padding: 3px;
  border-radius: 999px;
  background: var(--sunken);
  transition: background .28s var(--ease);
}

.toggle__knob {
  display: block;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(16,24,40,.25);
  transition: transform .28s var(--ease);
}

.toggle input:checked + .toggle__track { background: var(--accent); }
.toggle input:checked + .toggle__track .toggle__knob { transform: translateX(20px); }

.footnote { padding: 4px 6px 10px; font-size: 12.5px; color: var(--hint); text-align: center; }

/* ── Строка добавления ─────────────────────────────────────── */

.composer {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 12px var(--safe-bottom);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-top: 1px solid var(--line);
  transform: translateY(0);
  transition: transform .3s var(--ease), opacity .25s;
}

.composer.is-hidden { transform: translateY(130%); opacity: 0; pointer-events: none; }

.composer__prio {
  display: flex;
  gap: 7px;
  padding: 0 3px;
  align-items: center;
}

.prio {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  opacity: .28;
  transition: opacity .2s, transform .2s var(--ease);
}

.prio--0 { background: var(--p0); }
.prio--1 { background: var(--p1); }
.prio--2 { background: var(--p2); }
.prio.is-active { opacity: 1; transform: scale(1.5); }

.composer__input {
  flex: 1;
  min-width: 0;
  height: 42px;
  padding: 0 15px;
  border: 0;
  border-radius: 21px;
  background: var(--surface);
  box-shadow: var(--shadow);
  outline: none;
  font-size: 15.5px;
}

.composer__input::placeholder { color: var(--hint); }

.composer__send {
  width: 42px;
  height: 42px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 35%, transparent);
  transition: transform .16s var(--ease), opacity .2s;
}

.composer__send:active { transform: scale(.88); }
.composer__send:disabled { opacity: .45; box-shadow: none; }
.composer__send svg { width: 21px; height: 21px; fill: none; stroke: var(--on-accent);
                      stroke-width: 2.6; stroke-linecap: round; }

/* ── Нижнее меню задачи ────────────────────────────────────── */

.sheet { position: fixed; inset: 0; z-index: 40; }

.sheet__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 12, 18, .45);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: fadeIn .25s var(--ease);
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.sheet__body {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 10px 16px calc(16px + var(--safe-bottom));
  border-radius: 24px 24px 0 0;
  background: var(--bg);
  animation: slideUp .34s var(--ease);
}

@keyframes slideUp { from { transform: translateY(100%); } to { transform: none; } }

.sheet.is-closing .sheet__body { animation: slideDown .24s var(--ease) forwards; }
.sheet.is-closing .sheet__backdrop { animation: fadeIn .24s var(--ease) reverse forwards; }

@keyframes slideDown { to { transform: translateY(100%); } }

.sheet__grip {
  width: 38px;
  height: 4px;
  margin: 0 auto 14px;
  border-radius: 2px;
  background: var(--line);
}

.sheet__title {
  width: 100%;
  padding: 13px 15px;
  border: 0;
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow);
  font-size: 16px;
  outline: none;
  margin-bottom: 10px;
}

.sheet__prio { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin-bottom: 10px; }

.pbtn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 11px 4px;
  border-radius: var(--r-sm);
  background: var(--surface);
  box-shadow: var(--shadow);
  font-size: 12px;
  color: var(--hint);
  transition: transform .15s var(--ease), color .2s;
}

.pbtn i { width: 11px; height: 11px; border-radius: 50%; opacity: .4; transition: opacity .2s, transform .2s var(--ease); }
.pbtn--0 i { background: var(--p0); }
.pbtn--1 i { background: var(--p1); }
.pbtn--2 i { background: var(--p2); }
.pbtn:active { transform: scale(.95); }
.pbtn.is-active { color: var(--text); font-weight: 600; }
.pbtn.is-active i { opacity: 1; transform: scale(1.35); }

.sheet__actions {
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 10px;
}

.row-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 15px;
  font-size: 15.5px;
  text-align: left;
  transition: background .18s;
}

.row-btn + .row-btn { border-top: 1px solid var(--line); }
.row-btn:active { background: var(--sunken); }
.row-btn--danger { color: var(--danger); }

.sheet__save {
  width: 100%;
  height: 48px;
  border-radius: var(--r-md);
  background: var(--accent);
  color: var(--on-accent);
  font-size: 16px;
  font-weight: 600;
  transition: transform .15s var(--ease);
}

.sheet__save:active { transform: scale(.98); }

/* ── Тост ──────────────────────────────────────────────────── */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(78px + var(--safe-bottom));
  z-index: 50;
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(20, 26, 34, .93);
  color: #fff;
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  transform: translate(-50%, 12px);
  pointer-events: none;
  transition: opacity .25s var(--ease), transform .25s var(--ease);
}

.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* ── Конфетти ──────────────────────────────────────────────── */

.confetti {
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
}

/* ── Скелетон загрузки ─────────────────────────────────────── */

.skeleton {
  height: 52px;
  border-radius: var(--r-md);
  background: linear-gradient(100deg, var(--sunken) 30%, var(--line) 50%, var(--sunken) 70%);
  background-size: 220% 100%;
  animation: shimmer 1.25s linear infinite;
}

@keyframes shimmer { from { background-position: 140% 0; } to { background-position: -40% 0; } }

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

/* ══════════════════════════════════════════════════════════════
   Агент: чат, подсказки, голосовой ввод
   ══════════════════════════════════════════════════════════════ */

.segmented { grid-template-columns: repeat(4, 1fr); }
.segmented__thumb { width: calc((100% - 6px) / 4); }
.segmented__item { font-size: 13px; }
.segmented.is-3col { grid-template-columns: repeat(3, 1fr); }
.segmented.is-3col .segmented__thumb { width: calc((100% - 6px) / 3); }
.segmented.is-3col .segmented__item { font-size: 14px; }

.chat { display: flex; flex-direction: column; gap: 8px; padding-bottom: 4px; }

.msg {
  max-width: 84%;
  padding: 11px 14px;
  border-radius: 18px;
  font-size: 15px;
  line-height: 1.42;
  white-space: pre-wrap;
  word-break: break-word;
  animation: pop .3s var(--ease) both;
}

.msg--user {
  align-self: flex-end;
  background: var(--accent);
  color: var(--on-accent);
  border-bottom-right-radius: 6px;
}

.msg--bot {
  align-self: flex-start;
  background: var(--surface);
  box-shadow: var(--shadow);
  border-bottom-left-radius: 6px;
}

.msg--error { color: var(--danger); }

.msg--tool {
  align-self: flex-start;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--sunken);
  color: var(--hint);
  font-size: 12px;
  box-shadow: none;
}

.typing { display: flex; gap: 4px; align-items: center; padding: 14px 16px; }

.typing i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--hint);
  animation: blink 1.3s infinite;
}

.typing i:nth-child(2) { animation-delay: .18s; }
.typing i:nth-child(3) { animation-delay: .36s; }

@keyframes blink {
  0%, 60%, 100% { opacity: .28; transform: translateY(0); }
  30%           { opacity: 1;   transform: translateY(-3px); }
}

/* Подсказки */
.hints { display: flex; flex-wrap: wrap; gap: 7px; padding: 14px 0 4px; animation: fade .3s var(--ease); }

.hints__head { width: 100%; margin-bottom: 6px; text-align: center; }
.hints__spark { display: block; font-size: 26px; margin-bottom: 6px; }
.hints__head b { display: block; font-size: 16px; font-weight: 650; }
.hints__head i { display: block; margin-top: 3px; font-style: normal; font-size: 13px; color: var(--hint); }

.hint {
  padding: 9px 14px;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow);
  font-size: 13.5px;
  transition: transform .15s var(--ease);
}

.hint:active { transform: scale(.95); }

.chat__clear {
  display: block;
  margin: 16px auto 0;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--sunken);
  color: var(--hint);
  font-size: 13px;
}

/* Композер агента */
.composer--agent { gap: 8px; }

.composer__mic {
  width: 42px;
  height: 42px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: transform .16s var(--ease), background .2s;
}

.composer__mic svg { width: 20px; height: 20px; fill: none; stroke: var(--text);
                     stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.composer__mic:active { transform: scale(.9); }
.composer__mic.is-off { opacity: .35; }

.composer__mic.is-recording {
  background: var(--p2);
  animation: pulse 1.4s ease-in-out infinite;
}

.composer__mic.is-recording svg { stroke: #fff; }

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--p2) 55%, transparent); }
  50%      { box-shadow: 0 0 0 12px transparent; }
}

.composer__mic.is-busy svg { opacity: .4; }

/* Индикатор записи поверх поля ввода */
.reclabel {
  position: absolute;
  left: 50%;
  bottom: calc(64px + var(--safe-bottom));
  transform: translateX(-50%);
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--p2);
  color: #fff;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  animation: fade .2s var(--ease);
}

/* ══════════════════════════════════════════════════════════════
   Время у задач и выбор языка
   ══════════════════════════════════════════════════════════════ */

.task__time {
  display: inline-block;
  margin-right: 7px;
  padding: 2px 7px;
  border-radius: 7px;
  background: color-mix(in srgb, var(--p) 16%, transparent);
  color: var(--p);
  font-size: 12.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: .01em;
  vertical-align: 1px;
  transition: opacity .25s, background .25s;
}

.task.is-done .task__time {
  background: var(--sunken);
  color: var(--hint);
}

/* Поле времени в меню задачи */
.sheet__time {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  padding: 10px 14px;
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.sheet__time-icon { font-size: 17px; opacity: .75; }

.sheet__time-input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: none;
  outline: none;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

/* Убираем нативную иконку часов — ряд и так читается */
.sheet__time-input::-webkit-calendar-picker-indicator { opacity: .45; }
.sheet__time-input::-webkit-datetime-edit { color: var(--text); }
.sheet__time-input:invalid { color: var(--hint); }

.sheet__time-clear {
  width: 26px;
  height: 26px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--sunken);
  color: var(--hint);
  font-size: 17px;
  line-height: 1;
  transition: transform .15s var(--ease);
}

.sheet__time-clear:active { transform: scale(.88); }

/* Переключатель языка — те же сегменты, но во всю ширину */
.switch--wide { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.switch--wide .switch__item { padding: 10px 8px; font-size: 14px; }

/* ── Подписка ─────────────────────────────────────────────────── */

.badge {
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--sunken);
  color: var(--hint);
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.badge.is-paid   { background: color-mix(in srgb, var(--grad-b) 20%, transparent); color: var(--grad-b); }
.badge.is-trial  { background: color-mix(in srgb, var(--p1) 20%, transparent);     color: var(--p1); }
.badge.is-off    { background: color-mix(in srgb, var(--p2) 18%, transparent);     color: var(--p2); }

.subqr { margin: 4px 0 14px; text-align: center; }

.subqr__img {
  width: 190px;
  max-width: 70%;
  aspect-ratio: 1;
  padding: 10px;
  border-radius: var(--r-md);
  background: #fff;               /* QR читается только на светлом фоне */
  object-fit: contain;
}

.subqr__hint { margin-top: 10px; font-size: 13px; color: var(--hint); }

.paywall {
  padding: 34px 24px;
  text-align: center;
  animation: fade .3s var(--ease);
}

.paywall__lock { display: block; font-size: 34px; margin-bottom: 12px; }
.paywall h2 { font-size: 18px; font-weight: 650; margin-bottom: 8px; }
.paywall p  { font-size: 14px; color: var(--hint); margin-bottom: 18px; }

.paywall__btn {
  padding: 12px 26px;
  border-radius: var(--r-md);
  background: var(--accent);
  color: var(--on-accent);
  font-size: 15.5px;
  font-weight: 600;
  transition: transform .15s var(--ease);
}

.paywall__btn:active { transform: scale(.96); }
