/* PKM Mini App — тихий нативний вигляд у кольорах теми Telegram.
 *
 * Візуальна мова:
 * - Кольори — лише тема Telegram (--tg-theme-*, їх ставить telegram-web-app.js):
 *   сторінка — bg_color, картки й групи — secondary_bg_color, тонкі
 *   роздільники — section_separator_color. Текстові відтінки (--muted,
 *   --accent, --danger, --ok, --warn) і фон головної кнопки app.js
 *   підтягує під тему до контрасту AA (≥ 4.5:1); тут — фолбек, який уже
 *   тягне їх у бік кольору тексту (це лише підвищує контраст).
 * - Шрифт системний. Шкала 13/15/17/22, вага 400/600: 17 — основний текст,
 *   15 — другорядний і кнопки, 13 — мета й заголовки секцій, 22 — заголовки.
 * - Відступи кратні 4; радіуси 12 (групи, картки) і 10 (кнопки, поля, чипи).
 * - Без емодзі й важких тіней: іконки — тонкі inline SVG (aria-hidden),
 *   область — приглушена крапка. Колір несе стан (прострочено, зроблено,
 *   «іде зараз»), а не прикрашає.
 * - Дотики ≥ 44 px (малим кнопкам — невидиме розширення). Рухи 150–250 мс;
 *   prefers-reduced-motion їх вимикає.
 * - Жодних inline-стилів (CSP style-src 'self'): стани — класами.
 */

/* ── Токени ─────────────────────────────────────────────────────────────── */

:root {
  --fb-bg: #ffffff;
  --fb-card: #f1f1f4;
  --fb-text: #000000;
  --fb-hint: #8e8e93;
  --fb-link: #007aff;
  --fb-button: #007aff;
  --fb-button-text: #ffffff;
  --fb-danger: #e5372f;
  color-scheme: light dark;
}

/* Світла чи темна — за Telegram, а не за ОС: на Android нічний режим Telegram
 * не залежить від системного. data-scheme ставить app.js, лише коли тема
 * справді прийшла (є bg_color); color-scheme — щоб нативні поля дати й часу,
 * select і пошук (їхні іконки, вибирачі) були тієї ж схеми, що й сторінка.
 * Без Telegram (чи без теми) — як ОС. */
@media (prefers-color-scheme: dark) {
  :root:not([data-scheme]) {
    --fb-bg: #000000;
    --fb-card: #1c1c1e;
    --fb-text: #ffffff;
    --fb-hint: #8e8e93;
    --fb-link: #3e9bff;
    --fb-button: #2f80ed;
    --fb-button-text: #ffffff;
    --fb-danger: #ff5a52;
  }
}

:root[data-scheme="light"] {
  color-scheme: light;
}

:root[data-scheme="dark"] {
  --fb-bg: #000000;
  --fb-card: #1c1c1e;
  --fb-text: #ffffff;
  --fb-hint: #8e8e93;
  --fb-link: #3e9bff;
  --fb-button: #2f80ed;
  --fb-button-text: #ffffff;
  --fb-danger: #ff5a52;
  color-scheme: dark;
}

:root {
  --bg: var(--tg-theme-bg-color, var(--fb-bg));
  --card: var(--tg-theme-secondary-bg-color, var(--fb-card));
  --text: var(--tg-theme-text-color, var(--fb-text));
  --hint: var(--tg-theme-hint-color, var(--fb-hint));
  --link: var(--tg-theme-link-color, var(--fb-link));
  --button: var(--tg-theme-button-color, var(--fb-button));
  --button-text: var(--tg-theme-button-text-color, var(--fb-button-text));

  /* Фолбек без color-mix (старий webview); з ним — блок @supports нижче. */
  --muted: var(--hint);
  --accent: var(--tg-theme-accent-text-color, var(--link));
  --danger: var(--tg-theme-destructive-text-color, var(--fb-danger));
  --section-header: var(--tg-theme-section-header-text-color, var(--hint));
  --ok: #2f8a4c;
  --warn: #a8640f;
  --sep: rgba(128, 128, 128, 0.3);
  --fill: rgba(128, 128, 128, 0.12);
  --press: rgba(128, 128, 128, 0.1);
  --tint: rgba(0, 122, 255, 0.12);
  --ok-tint: rgba(47, 138, 76, 0.13);
  --warn-tint: rgba(168, 100, 15, 0.13);
  --danger-tint: rgba(229, 55, 47, 0.12);

  /* Області — приглушені, лише як підказка поруч із назвою. */
  --area-personal: #6fa283;
  --area-crypto: #8d80c4;
  --area-marketing: #c99a5e;
  --area-other: #9a9aa1;

  --r-card: 12px;
  --r-ctl: 10px;
  --tabbar-h: 56px;
  --safe-bottom: max(env(safe-area-inset-bottom, 0px), var(--tg-safe-area-inset-bottom, 0px));
  --ease: cubic-bezier(0.25, 0.8, 0.25, 1);

  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
}

@supports (color: color-mix(in srgb, red 50%, blue)) {
  :root {
    --muted: color-mix(in srgb, var(--hint) 72%, var(--text));
    --accent: color-mix(in srgb, var(--tg-theme-accent-text-color, var(--link)) 88%, var(--text));
    --danger: color-mix(in srgb, var(--tg-theme-destructive-text-color, var(--fb-danger)) 85%, var(--text));
    --section-header: color-mix(in srgb, var(--tg-theme-section-header-text-color, var(--hint)) 72%, var(--text));
    --ok: color-mix(in srgb, #34a853 70%, var(--text));
    --warn: color-mix(in srgb, #e0912b 65%, var(--text));
    --sep: var(--tg-theme-section-separator-color, color-mix(in srgb, var(--text) 14%, transparent));
    --fill: color-mix(in srgb, var(--text) 7%, transparent);
    --press: color-mix(in srgb, var(--text) 6%, transparent);
    --tint: color-mix(in srgb, var(--accent) 13%, transparent);
    --ok-tint: color-mix(in srgb, var(--ok) 14%, transparent);
    --warn-tint: color-mix(in srgb, var(--warn) 14%, transparent);
    --danger-tint: color-mix(in srgb, var(--danger) 12%, transparent);
  }
}

/* ── Основа ─────────────────────────────────────────────────────────────── */

*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  -webkit-tap-highlight-color: transparent;
}

html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: var(--tg-viewport-stable-height, 100vh);
  background: var(--bg);
  color: var(--text);
  font-size: 17px;
  line-height: 22px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-wrap: break-word;
}

html.sheet-open body {
  overflow: hidden;
}

p,
h1,
h2,
h3 {
  margin: 0;
}

a {
  color: var(--accent);
}

[hx-get],
[hx-post],
[role="button"] {
  cursor: pointer;
  /* Довге натискання на рядок — не меню посилання iOS. */
  -webkit-touch-callout: none;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  -webkit-appearance: none;
  appearance: none;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.ic {
  flex: none;
  width: 20px;
  height: 20px;
}

.ic-s {
  flex: none;
  width: 16px;
  height: 16px;
}

.screen-host {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 16px calc(var(--tabbar-h) + var(--safe-bottom) + 32px);
}

.screen.enter {
  animation: enter 0.18s var(--ease);
}

/* ── Заголовок екрана ───────────────────────────────────────────────────── */

.screen-head {
  padding: 16px 0 0;
}

.screen-head h1 {
  font-size: 22px;
  line-height: 28px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.screen-head .sub {
  margin-top: 4px;
  color: var(--muted);
  font-size: 15px;
  line-height: 20px;
}

.screen-head .sub::first-letter {
  text-transform: uppercase;
}

/* ── Секції й групи ─────────────────────────────────────────────────────── */

.section {
  margin-top: 24px;
}

.section.tight {
  margin-top: 12px;
}

/* Порожня група «Задач» лишається в DOM ціллю для OOB-лічильника. */
.section[hidden] {
  display: none;
}

.section-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0 16px 8px;
  color: var(--section-header);
  font-size: 13px;
  line-height: 18px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.section-title.danger {
  color: var(--danger);
}

.section-title .count {
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}

.section-title .aside {
  margin-left: auto;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

.aside.danger {
  color: var(--danger);
}

.section-empty {
  margin: 0 16px;
  color: var(--muted);
  font-size: 15px;
  line-height: 20px;
}

.group {
  overflow: hidden;
  border-radius: var(--r-card);
  background: var(--card);
}

/* Згортна секція («Зроблено нещодавно»). */
details.section > summary {
  cursor: pointer;
  list-style: none;
}

details.section > summary::-webkit-details-marker {
  display: none;
}

details.section > summary .fold {
  align-self: center;
  width: 14px;
  height: 14px;
  transition: transform 0.2s var(--ease);
}

details.section[open] > summary .fold {
  transform: rotate(180deg);
}

/* ── Рядки ──────────────────────────────────────────────────────────────── */

.row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 12px 16px;
  color: inherit;
  text-decoration: none;
}

/* Тонкий роздільник від початку тексту до краю, як у списках iOS. */
.row + .row::before,
.row + .more::before,
.row + .empty::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  left: 16px;
  height: 1px;
  background: var(--sep);
}

.row.task + .row::before {
  left: 62px;
}

/* Після «Готово» — [Скасувати] рядком нижче, від початку тексту: збоку вона
   стискала б назву задачі до двох слів. */
.row.task {
  flex-wrap: wrap;
  row-gap: 8px;
}

.row.task > .row-after {
  flex-basis: 100%;
  padding-left: 46px;
}

@media (min-resolution: 2dppx) {
  .row + .row::before,
  .row + .more::before,
  .row + .empty::before,
  .fields > * + *::before {
    transform: scaleY(0.5);
    transform-origin: 0 0;
  }
}

a.row:active,
.row-main:active,
.tl-main:active,
.rs-main:active,
.hero-title:active,
.sugg-item:active {
  background: var(--press);
}

a.row:focus-visible {
  outline-offset: -2px;
}

/* Зона натискання — уся висота рядка й трохи вбік: палець не мусить цілитись. */
.row-main {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  margin: -12px -8px;
  padding: 12px 8px;
  border-radius: var(--r-ctl);
  color: inherit;
  text-decoration: none;
}

a.row > .row-main {
  margin: 0;
  padding: 0;
}

.row-main:focus-visible,
.tl-main:focus-visible,
.rs-main:focus-visible {
  outline-offset: -2px;
}

.row-title {
  display: -webkit-box;
  overflow: hidden;
  font-size: 17px;
  line-height: 22px;
  overflow-wrap: anywhere;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.row-sub {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  font-size: 15px;
  line-height: 20px;
  overflow-wrap: anywhere;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* Мета-рядок «Ідея · Крипто · вчора 21:10». Крапка-роздільник стоїть перед
   кожним пунктом, а смуга 14 px ліворуч обрізана: так рядок, що переніс,
   не починається з «·». */
.meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  margin-left: -14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 18px;
  -webkit-clip-path: inset(0 0 0 14px);
  clip-path: inset(0 0 0 14px);
}

.meta > span {
  display: inline-flex;
  align-items: center;
}

.meta > span::before {
  content: "·";
  flex: none;
  width: 14px;
  color: var(--muted);
  font-weight: 400;
  text-align: center;
}

.meta .ic-s {
  width: 13px;
  height: 13px;
  margin-right: 4px;
}

.meta .kind {
  font-weight: 600;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 18px;
}

.chev {
  flex: none;
  width: 16px;
  height: 16px;
  color: var(--hint);
}

.dot {
  display: inline-block;
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--area, var(--hint));
}

.area .dot {
  margin-right: 6px;
}

.a-personal { --area: var(--area-personal); }
.a-crypto { --area: var(--area-crypto); }
.a-marketing { --area: var(--area-marketing); }
.a-other { --area: var(--area-other); }

.st-done,
.st-confirmed { color: var(--ok); }
.st-testing,
.st-in_progress { color: var(--warn); }
.st-rejected { color: var(--danger); }
.st-archived,
.st-cancelled,
.st-inconclusive { color: var(--muted); }

.by-ai { color: var(--accent); }
.warn { color: var(--warn); }
.prio { color: var(--warn); font-weight: 600; }

.is-closed .row-title,
.card-title.is-closed {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

/* ── Чекбокс «готово» ──────────────────────────────────────────────────── */

/* Кнопка 44×44, видимий лише кружок 22 px усередині. */
.check {
  position: relative;
  display: grid;
  flex: none;
  place-items: center;
  width: 44px;
  height: 44px;
  margin: -12px 0 -12px -10px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: transparent;
  cursor: pointer;
}

.check::before {
  content: "";
  position: absolute;
  top: 11px;
  left: 11px;
  width: 22px;
  height: 22px;
  border: 1.5px solid var(--muted);
  border-radius: 50%;
  transition: background 0.15s, border-color 0.15s, transform 0.12s var(--ease);
}

.check .tick {
  position: relative;
  width: 14px;
  height: 14px;
  stroke-width: 2.6;
}

.check:active::before {
  transform: scale(0.88);
}

/* Миттєвий відгук: поки сервер відповідає, кружок уже зелений. */
.check.is-on,
.check.htmx-request {
  color: #fff;
}

.check.is-on::before,
.check.htmx-request::before {
  border-color: var(--ok);
  background: var(--ok);
}

.is-overdue .check:not(.is-on)::before {
  border-color: var(--danger);
}

.is-overdue .when {
  color: var(--danger);
  font-weight: 600;
}

.row-after {
  display: flex;
  flex: none;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 18px;
}

.moved {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--ok);
  font-weight: 600;
}

.undo {
  position: relative;
  min-height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--r-ctl);
  background: var(--tint);
  color: var(--accent);
  font-size: 15px;
  line-height: 20px;
  font-weight: 600;
  cursor: pointer;
}

/* Невидиме розширення до 44 px для малих кнопок. */
.undo::after,
.btn-small::after,
.chip::after {
  content: "";
  position: absolute;
  inset: -6px 0;
}

/* ── Найближчий мітинг ─────────────────────────────────────────────────── */

.hero {
  display: flex;
  flex-direction: column;
  margin-top: 16px;
  padding: 16px;
  border-radius: var(--r-card);
  background: var(--card);
}

.hero-kicker {
  display: flex;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
  line-height: 18px;
}

.hero-count {
  margin-top: 4px;
  color: var(--accent);
  font-size: 22px;
  line-height: 28px;
  font-weight: 600;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

.hero-count::first-letter {
  text-transform: uppercase;
}

.hero.live .hero-kicker,
.hero.live .hero-count {
  color: var(--danger);
}

.live-dot {
  width: 8px;
  height: 8px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--danger);
  animation: pulse 1.6s ease-in-out infinite;
}

.hero-title {
  display: block;
  margin: 8px -8px 0;
  padding: 0 8px;
  border-radius: var(--r-ctl);
  color: var(--text);
  font-size: 17px;
  line-height: 22px;
  font-weight: 600;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.hero-meta {
  margin-top: 4px;
  font-size: 15px;
  line-height: 20px;
}

.hero-join {
  margin-top: 16px;
}

.hero-none {
  display: none;
}

/* ── План дня ──────────────────────────────────────────────────────────── */

.timeline {
  padding: 4px 0;
}

.tl-item {
  display: grid;
  grid-template-columns: 56px 20px minmax(0, 1fr);
  padding-right: 16px;
}

.tl-time {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  padding-top: 12px;
  font-size: 15px;
  line-height: 20px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.tl-end {
  color: var(--muted);
  font-size: 13px;
  line-height: 18px;
  font-weight: 400;
}

.tl-rail {
  position: relative;
}

.tl-rail::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1px;
  background: var(--sep);
}

.timeline > .tl-item:first-child .tl-rail::before,
.timeline > .tl-now:first-child + .tl-item .tl-rail::before {
  top: 20px;
}

.timeline > .tl-item:last-child .tl-rail::before,
.timeline > .tl-item:has(+ .tl-now:last-child) .tl-rail::before {
  bottom: auto;
  height: 20px;
}

.tl-dot {
  position: absolute;
  top: 18px;
  left: 50%;
  width: 9px;
  height: 9px;
  margin-left: -4px;
  border-radius: 50%;
  background: var(--accent);
}

.tl-dot.k-task {
  border: 1.5px solid var(--muted);
  background: var(--card);
}

.tl-item.live .tl-dot {
  background: var(--danger);
  animation: pulse 1.6s ease-in-out infinite;
}

.tl-item.is-overdue .tl-dot {
  border-color: var(--danger);
}

.tl-item.past > .tl-time,
.tl-item.past .row-title {
  color: var(--muted);
}

.tl-item.past .tl-dot:not(.k-task) {
  background: var(--hint);
}

.tl-item.is-overdue > .tl-time {
  color: var(--danger);
}

.tl-body {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 4px 12px;
  min-width: 0;
  padding: 12px 0 12px 8px;
}

.tl-body .check {
  margin: -11px -2px -11px -10px;
}

.tl-main {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  margin: -12px -8px;
  padding: 12px 8px;
  border-radius: var(--r-ctl);
  color: inherit;
  text-decoration: none;
}

.live-label {
  color: var(--danger);
  font-weight: 600;
}

.join {
  display: inline-flex;
  flex-basis: 100%;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  color: var(--accent);
  font-size: 15px;
  line-height: 20px;
  font-weight: 600;
  text-decoration: none;
}

.tl-item.task .join,
.tl-item.task .row-after {
  margin-left: 44px;
}

.tl-item .row-after {
  flex-basis: 100%;
}

/* «Зараз»: тонка лінія через план і час у колонці годин. */
.tl-now {
  position: relative;
  height: 1px;
  margin: 0 16px 0 66px;
  background: var(--danger);
}

.tl-now::before {
  content: "";
  position: absolute;
  top: -3px;
  left: -4px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--danger);
}

.tl-now span {
  position: absolute;
  top: -9px;
  left: -66px;
  width: 56px;
  color: var(--danger);
  font-size: 13px;
  line-height: 18px;
  font-weight: 600;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ── Порожні стани ─────────────────────────────────────────────────────── */

.calm {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 24px;
  padding: 32px 16px 8px;
  text-align: center;
}

.calm-icon {
  width: 32px;
  height: 32px;
  margin-bottom: 12px;
  color: var(--hint);
}

.calm-title {
  font-size: 17px;
  line-height: 22px;
  font-weight: 600;
}

.calm-text {
  max-width: 320px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 15px;
  line-height: 20px;
}

.empty {
  padding: 16px;
}

.empty-title {
  font-size: 17px;
  line-height: 22px;
}

.empty-text {
  color: var(--muted);
  font-size: 15px;
  line-height: 20px;
}

.empty-title + .empty-text {
  margin-top: 4px;
}

/* ── Спливло з памʼяті ─────────────────────────────────────────────────── */

.resurface {
  padding: 16px;
  border-radius: var(--r-card);
  background: var(--card);
}

.rs-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: -8px;
  padding: 8px;
  border-radius: var(--r-ctl);
  color: inherit;
  text-decoration: none;
}

.rs-title {
  font-size: 17px;
  line-height: 22px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.rs-text {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  font-size: 15px;
  line-height: 20px;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
}

.rs-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.rs-actions .btn {
  padding: 0 4px;
}

.rs-actions .btn-plain {
  background: var(--fill);
}

.rs-flash {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 15px;
  line-height: 20px;
}

.rs-flash .ic-s {
  color: var(--ok);
}

.rs-flash + .btn {
  margin-top: 8px;
}

/* ── Гіпотези ──────────────────────────────────────────────────────────── */

.row.hyp {
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
}

.row.hyp > .row-main {
  margin-bottom: 0;
  padding-bottom: 0;
}

.verdicts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.vbtn {
  min-height: 44px;
  padding: 0 4px;
  border: 0;
  border-radius: var(--r-ctl);
  background: var(--fill);
  color: var(--text);
  font-size: 15px;
  line-height: 20px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s var(--ease);
}

.vbtn:active { transform: scale(0.97); }
.vbtn.good { color: var(--ok); }
.vbtn.bad { color: var(--danger); }
.vbtn.later { color: var(--accent); }

.verdict-done {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ok);
  font-size: 15px;
  line-height: 20px;
  font-weight: 600;
}

/* ── Кнопки ────────────────────────────────────────────────────────────── */

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: var(--r-ctl);
  font-size: 15px;
  line-height: 20px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.12s var(--ease), opacity 0.15s;
}

.btn .ic {
  width: 18px;
  height: 18px;
}

.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--button); color: var(--button-text); }
.btn-secondary { background: var(--tint); color: var(--accent); }
.btn-plain { padding: 0 12px; background: transparent; color: var(--accent); }
.btn-quiet { color: var(--muted); }
.btn-block { display: flex; width: 100%; }

.btn-small {
  position: relative;
  flex: none;
  min-height: 36px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--r-ctl);
  background: var(--button);
  color: var(--button-text);
  font-size: 15px;
  line-height: 20px;
  font-weight: 600;
  cursor: pointer;
}

/* Кнопка-іконка: 44×44, видимий кружок 32 px. */
.icon-btn {
  position: relative;
  display: grid;
  flex: none;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--muted);
  cursor: pointer;
}

.icon-btn::before {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  background: var(--fill);
  transition: transform 0.12s var(--ease);
}

.icon-btn:active::before { transform: scale(0.9); }
.icon-btn .ic { position: relative; width: 18px; height: 18px; }
.icon-btn.good { color: var(--ok); }
.icon-btn.good::before { background: var(--ok-tint); }
.icon-btn.bad { color: var(--danger); }
.icon-btn.bad::before { background: var(--danger-tint); }
.icon-btn.send { color: var(--button-text); }
.icon-btn.send::before { inset: 4px; background: var(--button); }

/* Поки йде запит: кнопка тьмяніє і не приймає повторних натискань. */
.btn.htmx-request,
.btn-small.htmx-request,
.vbtn.htmx-request,
.undo.htmx-request,
.icon-btn.htmx-request,
.sugg-item.htmx-request,
button[disabled] {
  opacity: 0.55;
  pointer-events: none;
}

.btn.htmx-request::after {
  content: "";
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ── «База»: пошук і фільтри ───────────────────────────────────────────── */

.filters {
  position: sticky;
  top: 0;
  z-index: 5;
  margin: 12px -16px 0;
  padding: 4px 16px 8px;
  background: var(--bg);
}

.search-row {
  display: flex;
  gap: 8px;
}

.search {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 8px;
  min-width: 0;
  height: 44px;
  padding: 0 12px;
  border-radius: var(--r-ctl);
  background: var(--card);
  color: var(--muted);
}

.search:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.search .ic {
  width: 18px;
  height: 18px;
}

.search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 17px;
}

.search input::-webkit-search-decoration {
  -webkit-appearance: none;
}

input::placeholder,
textarea::placeholder {
  color: var(--muted);
  opacity: 1;
}

.search-spin {
  visibility: hidden;
}

.filters.htmx-request .search-spin {
  visibility: visible;
}

.type-select {
  position: relative;
  display: flex;
  flex: none;
  width: 128px;
}

.type-select select {
  width: 100%;
  height: 44px;
  padding: 0 32px 0 12px;
  border: 0;
  border-radius: var(--r-ctl);
  background: var(--card);
  color: var(--text);
  font-size: 15px;
  text-overflow: ellipsis;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.type-select .ic-s {
  position: absolute;
  top: 14px;
  right: 10px;
  color: var(--muted);
  pointer-events: none;
}

/* Вибрано тип — та сама «увімкнена» мова, що й у чипа. */
.type-select:has(option:checked:not([value=""])) select {
  background: var(--button);
  color: var(--button-text);
}

.type-select:has(option:checked:not([value=""])) .ic-s {
  color: var(--button-text);
}

.chips {
  display: flex;
  gap: 8px;
  margin: 4px -16px 0;
  padding: 6px 16px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.chips::-webkit-scrollbar {
  display: none;
}

.chip {
  position: relative;
  flex: none;
}

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

.chip span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: var(--r-ctl);
  background: var(--card);
  color: var(--text);
  font-size: 15px;
  line-height: 20px;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.chip .dot {
  width: 7px;
  height: 7px;
}

.chip .ic-s {
  width: 15px;
  height: 15px;
}

.chip input:checked + span {
  background: var(--button);
  color: var(--button-text);
}

.chip input:checked + span .dot {
  box-shadow: 0 0 0 1.5px var(--button-text);
}

.chip input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.feed {
  margin-top: 4px;
  transition: opacity 0.15s;
}

/* Поки шукаємо — стрічка тьмяніє (із затримкою: швидкий пошук не блимає). */
.feed.htmx-request {
  opacity: 0.5;
  transition-delay: 0.15s;
}

.more {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 52px;
}

.spinner {
  display: inline-block;
  flex: none;
  width: 18px;
  height: 18px;
  border: 2px solid var(--fill);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ── Панель картки ─────────────────────────────────────────────────────── */

.sheet {
  position: fixed;
  inset: 0;
  z-index: 40;
  padding: 0 16px calc(32px + var(--safe-bottom));
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--bg);
  visibility: hidden;
  transform: translateX(100%);
  transition: transform 0.24s var(--ease), visibility 0s linear 0.24s;
  -webkit-overflow-scrolling: touch;
}

.sheet.open {
  visibility: visible;
  transform: none;
  transition: transform 0.24s var(--ease);
}

.sheet.is-loading > .card:not(.skeleton) {
  opacity: 0.5;
  transition: opacity 0.15s 0.12s;
}

.card {
  max-width: 680px;
  margin: 0 auto;
  padding-top: 8px;
}

.card-top {
  display: flex;
  align-items: center;
  min-height: 32px;
}

.back-btn {
  display: none;
  align-items: center;
  gap: 4px;
  min-height: 44px;
  margin-left: -8px;
  padding: 0 8px;
  border: 0;
  background: none;
  color: var(--accent);
  font-size: 17px;
  cursor: pointer;
}

.no-tg-back .back-btn {
  display: inline-flex;
}

.card-id {
  margin-left: auto;
  color: var(--muted);
  font-size: 13px;
  line-height: 18px;
  font-variant-numeric: tabular-nums;
}

.card-kicker {
  margin-top: 4px;
}

.card-title {
  margin-top: 4px;
  font-size: 22px;
  line-height: 28px;
  font-weight: 600;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

.card-title:focus {
  outline: none;
}

.card-when {
  margin-top: 4px;
  color: var(--accent);
  font-size: 15px;
  line-height: 20px;
}

.card-when .rep {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  vertical-align: top;
}

.card-text {
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: var(--r-card);
  background: var(--card);
  font-size: 17px;
  line-height: 24px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.card-tags {
  margin-top: 12px;
}

.card-actions {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.flash {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  margin-top: 8px;
  padding: 6px 6px 6px 16px;
  border-radius: var(--r-ctl);
  background: var(--tint);
  color: var(--accent);
  font-size: 15px;
  line-height: 20px;
  animation: enter 0.2s var(--ease);
}

.flash-error {
  background: var(--danger-tint);
  color: var(--danger);
}

/* Поля картки: підпис ліворуч, значення-перемикач праворуч. */
.fields > .field-row,
.fields > .field-note {
  position: relative;
}

.fields .field-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 0 16px;
}

.fields > * + *::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  left: 16px;
  height: 1px;
  background: var(--sep);
}

.field-label {
  flex: none;
}

.field-value {
  min-width: 0;
  padding: 12px 0;
  color: var(--muted);
  text-align: right;
  overflow-wrap: anywhere;
}

.fields .field-row.stacked {
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  padding-top: 12px;
  padding-bottom: 12px;
}

.fields .field-row.stacked .field-label {
  color: var(--muted);
  font-size: 13px;
  line-height: 18px;
}

.fields .field-row.stacked .field-value {
  padding: 0;
  color: var(--text);
  text-align: left;
}

.fields.small .field-label,
.fields.small .field-value {
  font-size: 15px;
  line-height: 20px;
}

.field-note {
  margin: 0;
  padding: 0 16px 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 18px;
}

.fields > .field-note::before {
  display: none;
}

.links > .field-note {
  padding: 0 16px 8px;
}

.select {
  position: relative;
  display: flex;
  flex: 1 1 auto;
  justify-content: flex-end;
  min-width: 0;
}

.select select {
  max-width: 100%;
  padding: 12px 22px 12px 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 17px;
  text-align: right;
  text-align-last: right;
  text-overflow: ellipsis;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.select .ic-s {
  position: absolute;
  top: 50%;
  right: 0;
  margin-top: -8px;
  color: var(--hint);
  pointer-events: none;
}

.select select:focus-visible {
  outline: none;
  color: var(--accent);
}

.field-row:has(select:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.fields .field-row.when-row {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  padding-top: 12px;
  padding-bottom: 12px;
}

.when-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.when-head .field-value {
  padding: 0;
}

.when-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.when-form input,
.title-form input {
  min-width: 0;
  height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--r-ctl);
  background: var(--bg);
  font-size: 17px;
}

.when-form input[type="date"] {
  flex: 1 1 150px;
}

.when-form input[type="time"] {
  flex: 0 0 112px;
  width: 112px;
}

.when-form .btn-small {
  flex: 1 1 auto;
  min-height: 44px;
}

.title-form .btn-small {
  min-height: 44px;
}

.when-form .icon-btn {
  margin-right: -6px;
}

details.title-edit {
  display: block;
}

details.title-edit > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  list-style: none;
  cursor: pointer;
}

details.title-edit > summary::-webkit-details-marker {
  display: none;
}

details.title-edit > summary .field-value {
  color: var(--accent);
}

.title-form {
  display: flex;
  gap: 8px;
  padding-bottom: 12px;
}

.title-form input[type="text"] {
  flex: 1;
}

/* Звʼязки */
.rel {
  color: var(--accent);
  font-weight: 600;
}

.link-actions {
  display: flex;
  flex: none;
  margin-right: -8px;
}

/* ── «Спитати» ─────────────────────────────────────────────────────────── */

.ask-form {
  margin-top: 16px;
}

.modes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.mode {
  position: relative;
  display: flex;
}

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

.mode span {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 8px 12px;
  border-radius: var(--r-ctl);
  background: var(--card);
  font-size: 15px;
  line-height: 20px;
  text-align: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.mode input:checked + span {
  background: var(--button);
  color: var(--button-text);
  font-weight: 600;
}

.mode input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.ask-box {
  margin-top: 12px;
  padding: 12px 16px;
  border-radius: var(--r-card);
  background: var(--card);
}

.ask-box:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.ask-box textarea {
  display: block;
  width: 100%;
  min-height: 88px;
  max-height: 40vh;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 17px;
  line-height: 24px;
  resize: none;
}

.ask-form .btn-block {
  margin-top: 12px;
}

.hint {
  margin: 8px 16px 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 18px;
}

.ask-current > .thinking,
.ask-current > .answer-card,
.ask-current > .msg {
  margin-top: 24px;
}

.thinking,
.answer-card {
  padding: 16px;
  border-radius: var(--r-card);
  background: var(--card);
  animation: enter 0.2s var(--ease);
}

/* Опитування кожні 2 с перемальовує блок — без повторної анімації появи. */
.thinking + .thinking,
.ask-current > .thinking {
  animation: none;
}

.thinking-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.thinking-title {
  font-size: 17px;
  line-height: 22px;
  font-weight: 600;
}

.thinking-time {
  margin-left: auto;
  color: var(--muted);
  font-size: 13px;
  line-height: 18px;
  font-variant-numeric: tabular-nums;
}

.bar {
  height: 4px;
  margin-top: 12px;
  overflow: hidden;
  border-radius: 2px;
  background: var(--fill);
}

.bar i {
  display: block;
  height: 100%;
  border-radius: 2px;
  background: var(--accent);
  transform-origin: 0 50%;
  animation: grow 2s linear forwards;
}

/* Кожен крок — десята частка звичних ~30 с; блок оновлюється раз на 2 с. */
.bar.p0 { --from: 0.03; --to: 0.1; }
.bar.p1 { --from: 0.1; --to: 0.2; }
.bar.p2 { --from: 0.2; --to: 0.3; }
.bar.p3 { --from: 0.3; --to: 0.4; }
.bar.p4 { --from: 0.4; --to: 0.5; }
.bar.p5 { --from: 0.5; --to: 0.6; }
.bar.p6 { --from: 0.6; --to: 0.7; }
.bar.p7 { --from: 0.7; --to: 0.8; }
.bar.p8 { --from: 0.8; --to: 0.88; }
.bar.p9 { --from: 0.88; --to: 0.92; }
.bar.slow i { animation: grow 2s linear forwards, pulse 1.6s ease-in-out infinite; }

.thinking-q {
  margin-top: 12px;
  color: var(--muted);
  font-size: 15px;
  line-height: 20px;
}

.mode-tag {
  display: inline-block;
  margin-right: 8px;
  padding: 0 8px;
  border-radius: 6px;
  background: var(--tint);
  color: var(--accent);
  font-size: 13px;
  line-height: 20px;
  font-weight: 600;
}

.thinking .hint {
  margin: 8px 0 0;
}

.answer-head {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--sep);
}

.answer-q {
  color: var(--muted);
  font-size: 15px;
  line-height: 20px;
  font-weight: 600;
}

/* Відповідь — як текст для читання: абзаци, розділи, списки. */
.answer {
  font-size: 17px;
  line-height: 24px;
  overflow-wrap: anywhere;
}

.answer > :first-child {
  margin-top: 12px;
}

.answer h3 {
  margin: 20px 0 4px;
  font-size: 17px;
  line-height: 22px;
  font-weight: 600;
}

.answer p {
  margin: 8px 0 0;
}

.answer h3 + p,
.answer h3 + ul,
.answer h3 + ol {
  margin-top: 4px;
}

.answer ul,
.answer ol {
  margin: 8px 0 0;
  padding-left: 24px;
}

.answer li + li {
  margin-top: 4px;
}

.answer li::marker {
  color: var(--muted);
}

.answer ol li::marker {
  font-variant-numeric: tabular-nums;
}

.answer li.sub {
  margin-left: 16px;
  list-style-type: circle;
}

.answer b {
  font-weight: 600;
}

.answer code {
  padding: 0 4px;
  border-radius: 6px;
  background: var(--fill);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 15px;
}

/* #id — чип-посилання на картку. */
.ref {
  position: relative;
  display: inline-block;
  margin: 0 1px;
  padding: 0 4px;
  border-radius: 6px;
  background: var(--tint);
  color: var(--accent);
  font-size: 15px;
  line-height: 20px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-decoration: none;
  white-space: nowrap;
}

.ref::after {
  content: "";
  position: absolute;
  inset: -8px -4px;
}

.ref:active {
  background: color-mix(in srgb, var(--accent) 24%, transparent);
}

.sugg {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 20px;
}

.sugg-head {
  color: var(--section-header);
  font-size: 13px;
  line-height: 18px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.sugg-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 52px;
  padding: 8px 12px;
  border: 0;
  border-radius: var(--r-ctl);
  background: var(--bg);
  color: var(--text);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.sugg-ic {
  display: grid;
  flex: none;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--tint);
  color: var(--accent);
}

.sugg-ic .ic {
  width: 18px;
  height: 18px;
}

.sugg-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.sugg-label {
  color: var(--accent);
  font-size: 15px;
  line-height: 20px;
  font-weight: 600;
}

.sugg-title {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  line-height: 18px;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.sugg-item.is-done .sugg-ic {
  background: var(--ok-tint);
  color: var(--ok);
}

.sugg-item.is-done .sugg-label {
  color: var(--ok);
}

.sugg .hint {
  margin: 0;
}

.sugg .msg {
  margin: 0;
}

.followup {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 16px;
}

.followup input {
  flex: 1;
  min-width: 0;
  height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--r-ctl);
  background: var(--bg);
  font-size: 17px;
}

.followup .icon-btn {
  margin-right: -6px;
}

.answer-foot {
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 18px;
}

.msg {
  padding: 12px 16px;
  border-radius: var(--r-ctl);
  background: var(--card);
  font-size: 15px;
  line-height: 20px;
  animation: enter 0.2s var(--ease);
}

.msg-error { background: var(--danger-tint); color: var(--danger); }
.msg-warn { margin-top: 16px; background: var(--warn-tint); color: var(--warn); }
.msg-ok { background: var(--ok-tint); color: var(--ok); }

.sheet > .msg {
  margin-top: 24px;
}

.foot {
  margin-top: 32px;
  color: var(--muted);
  font-size: 13px;
  line-height: 18px;
  text-align: center;
}

/* ── Нижня навігація ───────────────────────────────────────────────────── */

.tabbar {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 30;
  display: flex;
  justify-content: space-around;
  padding: 4px 8px calc(4px + var(--safe-bottom));
  background: var(--bg);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
}

.tabbar::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 1px;
  background: var(--sep);
}

@media (min-resolution: 2dppx) {
  .tabbar::before {
    transform: scaleY(0.5);
    transform-origin: 0 0;
  }
}

@supports (color: color-mix(in srgb, red 50%, blue)) {
  .tabbar {
    background: color-mix(in srgb, var(--bg) 90%, transparent);
  }
}

.tab {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  max-width: 120px;
  min-height: 48px;
  padding: 0;
  border: 0;
  border-radius: var(--r-ctl);
  background: none;
  color: var(--muted);
  font-size: 13px;
  line-height: 16px;
  cursor: pointer;
}

.tab svg {
  width: 24px;
  height: 24px;
  transition: transform 0.15s var(--ease);
}

.tab:active svg {
  transform: scale(0.9);
}

.tab[aria-current="page"] {
  color: var(--accent);
}

.tab[aria-current="page"] svg .f {
  fill: currentColor;
  fill-opacity: 0.16;
}

.tab:focus-visible {
  outline-offset: -2px;
}

/* ── Службове: заглушка, тост, прогрес, скелети ────────────────────────── */

.notice {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
}

.notice[hidden],
.toast[hidden] {
  display: none;
}

.notice-box {
  max-width: 320px;
  text-align: center;
}

.notice-icon {
  width: 48px;
  height: 48px;
  color: var(--accent);
}

.notice h1 {
  margin-top: 16px;
  font-size: 22px;
  line-height: 28px;
  font-weight: 600;
}

.notice p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 15px;
  line-height: 20px;
}

.toast {
  position: fixed;
  right: 16px;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 16px);
  left: 16px;
  z-index: 70;
  max-width: 420px;
  margin: 0 auto;
  padding: 12px 16px;
  border-radius: var(--r-card);
  background: var(--text);
  color: var(--bg);
  font-size: 15px;
  line-height: 20px;
  text-align: center;
  animation: enter 0.2s var(--ease);
}

/* Тонка смужка вгорі, поки вантажиться вкладка (html.is-loading — app.js). */
.progress {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 80;
  height: 2px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}

.progress i {
  display: block;
  width: 40%;
  height: 100%;
  background: var(--accent);
  animation: slide 1.1s var(--ease) infinite;
}

html.is-loading .progress {
  opacity: 1;
  transition-delay: 0.12s;
}

.skeleton {
  padding-top: 16px;
}

.sk {
  border-radius: var(--r-ctl);
  background: var(--card);
  animation: shimmer 1.4s ease-in-out infinite;
}

.sk + .sk,
.sk + .sk-group {
  margin-top: 12px;
}

.sk-title { width: 40%; height: 28px; }
.sk-sub { width: 64%; height: 16px; margin-top: 8px; }
.sk-hero { height: 136px; border-radius: var(--r-card); margin-top: 16px; }
.sk-head { width: 28%; height: 12px; margin-top: 24px; margin-left: 16px; }
.sk-kicker { width: 36%; height: 14px; margin-top: 16px; }
.sk-ctitle { width: 88%; height: 24px; }
.sk-ctitle.short { width: 56%; }
.sk-text { height: 96px; border-radius: var(--r-card); margin-top: 16px; }
.sk-btn { height: 44px; margin-top: 16px; }

.sk-group {
  padding: 4px 16px;
  border-radius: var(--r-card);
  background: var(--card);
}

.sk-group .sk {
  height: 12px;
  margin: 20px 0;
  background: var(--fill);
}

.sk-group .sk:nth-child(2n) { width: 72%; }
.sk-group .sk:nth-child(3n) { width: 56%; }

@keyframes shimmer { 50% { opacity: 0.55; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: 0.35; } }
@keyframes enter {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}
@keyframes grow {
  from { transform: scaleX(var(--from, 0)); }
  to { transform: scaleX(var(--to, 1)); }
}
@keyframes slide {
  from { transform: translateX(-100%); }
  to { transform: translateX(250%); }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
  }
}

/* Telegram Desktop і широкий webview: колонка по центру, фільтри без «вильоту». */
@media (min-width: 720px) {
  .filters {
    margin-right: 0;
    margin-left: 0;
    padding-right: 0;
    padding-left: 0;
  }

  .chips {
    margin-right: 0;
    margin-left: 0;
    padding-right: 0;
    padding-left: 0;
  }
}
