/* =========================================================
   Розв'язання: форма завдання, аркуш із розв'язком, історія,
   картка реквізитів в оплаті. Доповнює app.css.

   «Clay»: аркуш і картки випирають із поверхні, поле для фото,
   текст і чат вдавлені всередину, номери кроків — кольорові кульки,
   відповідь — жовта пластилінова плитка.
   ========================================================= */

/* Верхня панель на телефоні: баланс в один рядок, назва бренду ховається на найвужчих екранах */
.balance-chip { white-space: nowrap; }
@media (max-width: 480px) {
  .app-top { gap: 8px; padding-inline: 12px; }
}
@media (max-width: 400px) {
  .app-top .brand__name { display: none; }
}

/* ---------- Нове завдання ----------
   Композер як у месенджері: фото й текст в одному вдавленому полі, кнопка «Розв’язати» праворуч унизу.
   Налаштування — під ним, компактними рядками. Праворуч підказки. */
.solve { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: clamp(20px, 3vw, 32px); align-items: start; max-width: 1200px; }
.solve__main { display: grid; gap: 16px; min-width: 0; }
.solve__hello { display: grid; gap: 2px; margin-bottom: 4px; }
.solve__hi { font-weight: 800; color: var(--ink-3); }
.solve__title { font-family: var(--font-display); font-weight: 1000; font-size: clamp(1.6rem, 1.1rem + 1.8vw, 2.4rem); letter-spacing: -0.03em; line-height: 1.08; }

.composer {
  position: relative;
  display: grid;
  padding: 14px;
  border-radius: var(--r-xl);
  background: var(--surface);
  box-shadow: var(--lift);
  transition: box-shadow 200ms ease;
}
.composer:focus-within { box-shadow: var(--lift), 0 0 0 3px var(--blue-line); }
.drop--over { box-shadow: var(--lift), 0 0 0 3px var(--blue); }
.drop--over .drop__empty { background: var(--blue-tint); }

/* Три великі способи додати фото */
.drop__empty { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding: 10px; border-radius: var(--r-l); box-shadow: var(--press-s); transition: background-color 160ms ease; }
.pick {
  display: grid; justify-items: center; gap: 4px; text-align: center;
  padding: 18px 10px 16px; border-radius: var(--r-l);
  background: var(--surface); box-shadow: var(--lift-s);
  cursor: pointer;
  transition: transform 220ms var(--ease-snap), box-shadow 200ms ease;
}
@media (hover: hover) { label.pick:hover { transform: translateY(-3px); } }
label.pick:active { box-shadow: var(--press-s); transform: none; }
.pick b { font-weight: 900; font-size: 0.95rem; }
.pick > span:last-child { font-size: 0.8rem; font-weight: 650; color: var(--ink-3); }
.pick__ball { display: grid; place-items: center; width: 52px; height: 52px; margin-bottom: 6px; border-radius: 50%; background: var(--c, var(--surface-2)); color: var(--ink); box-shadow: var(--clay), 4px 6px 12px var(--lo); }
.pick__ball svg { width: 24px; height: 24px; }
.pick--camera { --c: var(--marker); }
.pick--gallery { --c: var(--blue-tint); }
.pick--paste { --c: var(--surface-2); cursor: default; background: transparent; box-shadow: none; }
.pick--paste .pick__ball { box-shadow: var(--press-s); color: var(--ink-3); }
/* На комп’ютері камери немає — лишаємо два способи */
@media (hover: hover) and (pointer: fine) {
  .pick--camera, .composer__tool--camera { display: none; }
  .drop__empty { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (hover: none), (pointer: coarse) { .pick--paste { display: none; } .drop__empty { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 12px; padding: 4px 4px 10px; }
.shot { position: relative; aspect-ratio: 3 / 4; border-radius: var(--r-m); overflow: hidden; background: var(--surface-2); box-shadow: var(--lift-s); }
.shot img { width: 100%; height: 100%; object-fit: cover; }
.shot__n { position: absolute; left: 8px; top: 8px; display: grid; place-items: center; min-width: 24px; height: 24px; padding: 0 7px; border-radius: var(--r-pill); background: var(--blue); color: #fff; font-size: 0.76rem; font-weight: 900; box-shadow: var(--clay); }
.shot__del { position: absolute; right: 6px; top: 6px; display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 50%; background: rgba(46, 41, 37, 0.72); color: #fff; }
.shot__del svg { width: 16px; height: 16px; }
@media (hover: hover) { .shot__del:hover { background: var(--danger); } }
.shot__state { position: absolute; inset: 0; display: grid; place-items: center; padding: 10px; background: color-mix(in srgb, var(--surface) 78%, transparent); color: var(--blue-deep); text-align: center; }
.shot__state--error { background: color-mix(in srgb, var(--surface) 94%, var(--red-pen)); color: var(--danger); font-size: 0.76rem; font-weight: 800; line-height: 1.35; }
.shot--add { background: var(--surface); box-shadow: var(--press-s); }
.shot--add label { display: grid; place-content: center; justify-items: center; gap: 6px; height: 100%; color: var(--ink-3); font-weight: 800; font-size: 0.84rem; cursor: pointer; }
.shot--add svg { width: 24px; height: 24px; }
@media (hover: hover) { .shot--add:hover label { color: var(--blue-deep); } }

.composer__input {
  width: 100%; min-height: 84px; max-height: 40vh;
  margin-top: 10px; padding: 12px 14px;
  border: 0; border-radius: var(--r-l);
  background: transparent;
  font-size: 1.04rem; font-weight: 600; line-height: 1.5;
  resize: none; field-sizing: content;
}
.composer__input:focus { outline: none; }
.composer__input::placeholder { color: #9a8e82; font-weight: 550; }
.composer__bar { display: flex; align-items: center; gap: 6px; padding: 6px 2px 0; border-top: 1px solid var(--line); }
.composer__tool { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; color: var(--ink-2); cursor: pointer; transition: box-shadow 200ms ease, color 150ms ease; }
.composer__tool svg { width: 21px; height: 21px; }
@media (hover: hover) { .composer__tool:hover { color: var(--blue-deep); box-shadow: var(--lift-s); } }
.composer__tool:active { box-shadow: var(--press-s); }
.composer__send { margin-left: auto; --btn-h: 48px; padding: 0 24px; font-size: 1rem; }
.composer__send svg { width: 19px; height: 19px; }

.solve__cost { padding: 0 12px; font-size: 0.86rem; color: var(--ink-3); font-weight: 700; }
.solve__cost b { color: var(--ink); font-weight: 900; }
.solve__cost:empty { display: none; }
.demo-flag { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: var(--r-pill); background: var(--warn-tint); color: var(--warn); font-size: 0.74rem; font-weight: 850; }

/* Приклади — одним рядком, що гортається вбік */
.solve__main .examples { flex-wrap: nowrap; overflow-x: auto; margin-inline: -10px; padding: 6px 10px 14px; scrollbar-width: none; -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); }
.solve__main .examples::-webkit-scrollbar { display: none; }
.solve__main .examples > * { flex: none; white-space: nowrap; }
.examples { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.examples__list { display: contents; }
.examples__label { font-size: 0.84rem; color: var(--ink-3); font-weight: 800; margin-right: 2px; }
.examples__chip {
  padding: 7px 14px; border-radius: var(--r-pill);
  border: 0; background: var(--surface); box-shadow: var(--lift-s);
  font-size: 0.84rem; font-weight: 700; color: var(--ink-2); text-align: left;
  transition: box-shadow 180ms ease, color 150ms ease, background-color 150ms ease;
}
@media (hover: hover) { .examples__chip:hover { color: var(--blue-deep); background: var(--blue-tint); } }
.examples__chip:active { box-shadow: var(--press-s); }

/* Налаштування */
.opts { display: grid; gap: 18px; margin-top: 6px; padding: clamp(16px, 2.4vw, 24px); border-radius: var(--r-xl); box-shadow: var(--press-s); }
.opts__row { display: grid; grid-template-columns: minmax(0, 1fr) 200px; gap: 18px; align-items: start; }
@media (max-width: 1500px) { .opts__row { grid-template-columns: 1fr; } .solve__grade { max-width: 280px; } }
.opt { border: 0; margin: 0; padding: 0; min-width: 0; display: grid; gap: 10px; }
.opt__label { padding: 0; font-size: 0.78rem; font-weight: 900; letter-spacing: 0.07em; text-transform: uppercase; color: var(--ink-3); }
.subjects { display: flex; flex-wrap: wrap; gap: 8px; }
.subj {
  display: inline-flex; align-items: center; gap: 7px;
  min-height: 40px; padding: 0 15px;
  border: 0; border-radius: var(--r-pill);
  background: var(--surface); box-shadow: var(--lift-s);
  font-weight: 750; font-size: 0.9rem;
  transition: box-shadow 180ms ease, background-color 150ms ease, color 150ms ease, transform 160ms var(--ease-out);
}
.subj span { font-size: 1.05em; }
@media (hover: hover) { .subj:hover { color: var(--blue-deep); } }
.subj:active { transform: scale(0.97); }
.subj[aria-pressed="true"] { background: var(--blue); color: #fff; box-shadow: var(--clay), 4px 6px 12px var(--lo); }
/* Режими — сегментований перемикач */
.modes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; padding: 6px; border-radius: var(--r-l); background: var(--surface); box-shadow: var(--lift-s); }
.mode {
  display: grid; justify-items: center; gap: 2px; text-align: center;
  padding: 9px 6px; border-radius: var(--r-m);
  border: 0; background: transparent;
  transition: box-shadow 180ms ease, background-color 150ms ease, color 150ms ease;
}
.mode__icon { font-size: 1.15rem; line-height: 1.2; }
.mode__name { font-weight: 850; font-size: 0.84rem; line-height: 1.2; }
@media (hover: hover) { .mode:hover .mode__name { color: var(--blue-deep); } }
.mode[aria-pressed="true"] { background: var(--blue); color: #fff; box-shadow: var(--clay), 3px 4px 10px var(--lo); }
.mode[aria-pressed="true"] .mode__name { color: #fff; }
.solve__grade select { min-height: 56px; border-radius: var(--r-l); appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236f645a' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; background-size: 18px; padding-right: 42px; font-weight: 800; box-shadow: var(--lift-s); }
.solve__grade select:focus { box-shadow: var(--lift-s), 0 0 0 3px var(--blue-line); }

/* Праворуч — підказки */
.solve__side { display: grid; gap: 18px; position: sticky; top: 92px; }
.side-card { padding: 20px 22px; border-radius: var(--r-xl); background: var(--surface); box-shadow: var(--lift-s); }
.side-card__title { display: flex; align-items: center; gap: 10px; font-weight: 900; font-size: 1rem; }
.side-card__title svg { width: 20px; height: 20px; color: var(--blue); }
.tips__list { display: grid; gap: 12px; margin-top: 14px; padding: 0; list-style: none; counter-reset: tip; font-size: 0.88rem; color: var(--ink-2); font-weight: 600; line-height: 1.5; }
.tips__list li { position: relative; padding-left: 34px; counter-increment: tip; }
.tips__list li::before { content: counter(tip); position: absolute; left: 0; top: 0; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--marker); color: var(--ink); font-size: 0.76rem; font-weight: 900; box-shadow: var(--clay); }
.tips__list b { color: var(--ink); font-weight: 850; }
.mode-help { display: grid; gap: 10px; margin-top: 14px; font-size: 0.86rem; color: var(--ink-2); font-weight: 600; line-height: 1.45; }
.mode-help li { display: flex; gap: 10px; }
.mode-help b { color: var(--ink); font-weight: 850; }

@media (max-width: 1180px) {
  .solve { grid-template-columns: 1fr; }
  .solve__side { position: static; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
}
@media (max-width: 640px) {
  .solve__title { font-size: 1.6rem; }
  .composer { padding: 10px; border-radius: var(--r-l); }
  .drop__empty { gap: 8px; padding: 8px; }
  .pick { padding: 14px 6px 12px; }
  .pick__ball { width: 46px; height: 46px; }
  .pick > span:last-child { display: none; }
  .composer__send { padding: 0 18px; }
  .opts { padding: 14px; }
  .opts__row { grid-template-columns: 1fr; }
  .modes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .subjects { flex-wrap: nowrap; overflow-x: auto; margin-inline: -14px; padding: 4px 14px 14px; scrollbar-width: none; }
  .subj { flex: none; }
  .examples { flex-wrap: nowrap; overflow-x: auto; margin-inline: -14px; padding: 4px 14px 12px; scrollbar-width: none; }
  .examples__chip { flex: none; white-space: nowrap; }
}

/* ---------- Завдання й розв'язок ---------- */
.task { max-width: 1180px; }
.task__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.task__back { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 16px 0 5px; border-radius: var(--r-pill); background: var(--surface); box-shadow: var(--lift-s); color: var(--ink); font-weight: 850; font-size: 0.92rem; text-decoration: none; max-width: 100%; }
.task__back > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task__back svg { width: 18px; height: 18px; }
/* Кулька кольору зошита, з якого прийшли */
.task__back-ball { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--c, var(--surface-2)); font-size: 1rem; box-shadow: var(--clay); }
@media (max-width: 760px) { .task__new { display: none; } .task__head { flex-wrap: nowrap; } .task__back { min-width: 0; } .task__actions { flex: none; flex-wrap: nowrap; } }
@media (hover: hover) { .task__back:hover { color: var(--blue-deep); } }
.task__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.task__actions svg { width: 17px; height: 17px; }
.task__title-row { margin-bottom: 18px; }
.task__title { font-family: var(--font-display); font-weight: 950; font-size: clamp(1.35rem, 1rem + 1.4vw, 2rem); letter-spacing: -0.03em; line-height: 1.15; text-wrap: balance; }
.task__meta { margin-top: 6px; color: var(--ink-3); font-size: 0.9rem; font-weight: 650; }
.task__grid { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 24px; align-items: start; }

/* Умова — жовта пластилінова картка */
.cond {
  position: sticky; top: 84px;
  padding: 18px; border-radius: var(--r-l);
  background: var(--marker-soft);
  box-shadow: var(--clay), 8px 10px 22px var(--lo), -6px -6px 16px var(--hi);
}
.cond__label { font-size: 1.35rem; color: var(--ink-2); line-height: 1; margin-bottom: 10px; }
.cond__photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.cond__photo { display: block; padding: 0; border: 0; border-radius: var(--r-s); overflow: hidden; background: #fff; aspect-ratio: 3 / 4; cursor: zoom-in; box-shadow: 3px 4px 10px rgba(110, 90, 40, 0.25); }
.cond__photo img { width: 100%; height: 100%; object-fit: cover; transition: transform 300ms var(--ease-out); }
@media (hover: hover) { .cond__photo:hover img { transform: scale(1.04); } }
.cond__photos:has(.cond__photo:only-child) { grid-template-columns: 1fr; }
.cond__photos:has(.cond__photo:only-child) .cond__photo { aspect-ratio: auto; max-height: 420px; }
.cond__photos:has(.cond__photo:only-child) .cond__photo img { height: auto; max-height: 420px; object-fit: contain; }
.cond__text { margin-top: 12px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 0.95rem; font-weight: 600; line-height: 1.55; }
.cond__photos + .cond__text { padding-top: 12px; border-top: 1px solid rgba(110, 90, 40, 0.18); }

dialog.modal.photo-view { width: min(1000px, calc(100% - 24px)); background: var(--board); padding: 0; }
.photo-view img { display: block; width: 100%; max-height: calc(100dvh - 48px); object-fit: contain; }
.photo-view .modal__close { background: rgba(255, 255, 255, 0.92); color: var(--ink); z-index: 1; }

/* Аркуш із розв'язком — велика опукла плитка */
.sheet {
  position: relative; min-width: 0;
  padding: clamp(20px, 3vw, 36px) clamp(18px, 3vw, 40px) clamp(20px, 3vw, 32px);
  border-radius: var(--r-xl);
  background: var(--surface);
  box-shadow: var(--lift);
}
.sheet__body { min-height: 260px; }

/* Текст розв'язку */
.sol { font-size: 1.02rem; font-weight: 550; line-height: 1.7; overflow-wrap: break-word; }
.sol > :first-child { margin-top: 0; }
.sol p, .sol ul, .sol ol, .sol blockquote, .sol pre, .sol .sol-table, .sol hr { margin: 0 0 14px; }
.sol h1, .sol h2 { font-family: var(--font-display); font-weight: 950; letter-spacing: -0.025em; line-height: 1.2; margin: 26px 0 12px; }
.sol h1 { font-size: 1.45rem; }
.sol h2 { font-size: 1.2rem; }
.sol h2.task-h { display: inline-block; padding: 4px 14px 5px; border-radius: var(--r-pill); background: var(--board); color: #fff; font-size: 1.02rem; box-shadow: var(--clay), 4px 6px 12px var(--lo); }
.sol h3, .sol h4 { font-weight: 900; font-size: 1.04rem; margin: 22px 0 8px; }
.sol .step-h { display: flex; align-items: flex-start; gap: 10px; }
/* Номер кроку — бузкова кулька */
.step-h__n {
  flex: none; display: grid; place-items: center;
  width: 30px; height: 30px; margin-top: -2px;
  border-radius: 50%; background: var(--blue);
  color: #fff; font-family: var(--font-body); font-size: 0.92rem; font-weight: 1000; line-height: 1;
  box-shadow: inset -2px -3px 6px rgba(0, 0, 0, 0.2), inset 2px 3px 6px rgba(255, 255, 255, 0.4), 3px 4px 8px var(--lo);
}
.sol ul, .sol ol { padding-left: 1.4em; }
.sol li + li { margin-top: 4px; }
.sol li::marker { color: var(--blue); font-weight: 900; }
.sol strong { font-weight: 850; }
.sol a { color: var(--blue-deep); font-weight: 750; text-decoration-color: var(--blue-line); text-underline-offset: 3px; }
.sol code { padding: 1px 7px; border-radius: 8px; background: var(--surface-2); box-shadow: inset 1px 1px 3px var(--lo); font-family: var(--font-mono); font-size: 0.88em; }
/* Код — вдавлена ямка */
.sol pre { padding: 14px 18px; border-radius: var(--r-m); background: var(--surface); box-shadow: var(--press-s); color: var(--ink); font-family: var(--font-mono); overflow-x: auto; }
.sol pre code { padding: 0; background: none; box-shadow: none; color: inherit; font-size: 0.86rem; line-height: 1.6; }
.sol hr { height: 6px; border: 0; border-radius: var(--r-pill); box-shadow: var(--press-s); }
.sol blockquote { padding: 12px 18px; border-radius: var(--r-m); color: var(--ink-2); background: var(--surface); box-shadow: var(--press-s); }
.sol blockquote p:last-child { margin-bottom: 0; }
.sol blockquote.tip { background: var(--ok-tint); color: var(--mint-ink); box-shadow: var(--clay); font-weight: 650; }
.sol .sol-table { overflow-x: auto; padding: 4px; }
.sol table { border-collapse: separate; border-spacing: 0; min-width: 50%; font-size: 0.95rem; background: var(--surface); border-radius: var(--r-s); box-shadow: var(--press-s); overflow: hidden; }
.sol th, .sol td { padding: 8px 14px; border-bottom: 1px solid var(--line); text-align: left; }
.sol tr:last-child td { border-bottom: 0; }
.sol th { background: var(--surface-2); font-weight: 850; }
.sol .math-p { overflow-x: auto; overflow-y: hidden; padding: 2px 0; }
.sol .katex { font-size: 1.12em; }
.sol .katex-display { margin: 0.4em 0; }
/* Відповідь — жовта пластилінова плитка */
.sol p.answer {
  position: relative;
  display: block; width: fit-content; max-width: 100%;
  margin: 20px 0 18px; padding: 12px 20px 13px;
  border-radius: var(--r-m);
  background: var(--marker);
  color: var(--ink);
  box-shadow: var(--clay), 6px 8px 16px var(--lo), -5px -5px 12px var(--hi);
  font-size: 1.06rem; font-weight: 750;
}
.sol p.answer strong { font-weight: 1000; }
.sol p.answer .katex-display { margin: 0.2em 0 0; }

.caret { display: inline-block; width: 9px; height: 1.15em; margin-left: 2px; vertical-align: -0.2em; border-radius: var(--r-pill); background: var(--blue); animation: caret 0.9s steps(2) infinite; }
@keyframes caret { 50% { opacity: 0; } }

.thinking { display: grid; justify-items: center; gap: 12px; padding: 48px 12px; text-align: center; }
.thinking__pencil { width: 64px; height: 64px; }
.thinking__text { font-family: var(--font-hand); font-size: 1.6rem; color: var(--ink-2); min-height: 1.3em; }
.thinking__lines { display: grid; gap: 12px; width: min(360px, 90%); margin-top: 6px; }
.thinking__lines i { display: block; height: 12px; border-radius: var(--r-pill); background: linear-gradient(100deg, var(--surface-2) 20%, var(--surface) 40%, var(--surface-2) 60%) 0 0 / 300% 100%; box-shadow: inset 2px 2px 4px var(--lo), inset -2px -2px 4px var(--hi); animation: shimmer 1.4s linear infinite; }
.thinking__lines i:nth-child(2) { width: 82%; }
.thinking__lines i:nth-child(3) { width: 64%; }
@media (prefers-reduced-motion: no-preference) {
  .thinking__pencil { animation: scribble 1.2s ease-in-out infinite; transform-origin: 20% 80%; }
}
@keyframes scribble { 0%, 100% { transform: translate(0, 0) rotate(0); } 25% { transform: translate(6px, -2px) rotate(4deg); } 50% { transform: translate(12px, 1px) rotate(-2deg); } 75% { transform: translate(5px, 2px) rotate(3deg); } }

.failed { display: grid; justify-items: start; gap: 10px; padding: 24px 0; }
.failed__title { font-family: var(--font-hand); font-size: 1.8rem; color: var(--danger); line-height: 1; }
.failed p:not(.failed__title) { color: var(--ink-2); max-width: 52ch; }
.failed__actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }

/* Уточнення: питання — бузкова кулька, відповідь — опукла плитка */
.thread { display: grid; gap: 16px; margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--line); }
.msg { max-width: 100%; }
.msg--q { justify-self: end; max-width: min(560px, 90%); padding: 11px 18px; border-radius: 22px 22px 6px 22px; background: var(--blue); color: #fff; font-weight: 650; box-shadow: var(--clay), 4px 6px 12px var(--lo); }
.msg--q p { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg--a { padding: 16px 20px; border-radius: 22px 22px 22px 6px; background: var(--surface); box-shadow: var(--lift-s); }
.msg--a.sol > :last-child { margin-bottom: 0; }
.msg--wait { justify-self: start; padding: 12px 18px; }
.dots { display: inline-flex; gap: 5px; }
.dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); animation: dot 1.2s ease-in-out infinite; }
.dots i:nth-child(2) { animation-delay: 0.15s; }
.dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes dot { 0%, 60%, 100% { transform: translateY(0); opacity: 0.4; } 30% { transform: translateY(-5px); opacity: 1; } }

.ask { display: grid; gap: 12px; margin-top: 28px; padding-top: 22px; border-top: 1px solid var(--line); }
.ask__label { font-size: 1.35rem; color: var(--blue-deep); line-height: 1; }
.ask__quick { display: flex; flex-wrap: wrap; gap: 8px; }
.ask__row { display: flex; gap: 10px; align-items: flex-end; }
.ask__input { min-height: 52px; resize: none; border-radius: var(--r-l); box-shadow: var(--press); }
.ask__input:focus { box-shadow: var(--press-s), 0 0 0 3px var(--blue-line); }
.ask__send { --btn-h: 52px; width: 52px; padding: 0; flex: none; border-radius: 50%; }
.ask__send svg { width: 22px; height: 22px; }
.ask__left { font-size: 0.82rem; color: var(--ink-3); font-weight: 650; }
.ask__limit { margin-top: 24px; padding: 14px 18px; border-radius: var(--r-m); background: var(--surface); box-shadow: var(--press-s); color: var(--ink-2); font-size: 0.92rem; font-weight: 650; }

@media (max-width: 960px) {
  .task__grid { grid-template-columns: 1fr; }
  .cond { position: static; transform: none; }
  .cond__photos:has(.cond__photo:only-child) .cond__photo { max-height: 300px; }
  .cond__photos:has(.cond__photo:only-child) .cond__photo img { max-height: 300px; }
}
@media (max-width: 520px) {
  .task__actions .btn span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .task__actions .btn { padding: 0 11px; }
  .sheet { border-radius: var(--r-l); }
  .sol { font-size: 0.98rem; }
  .ask__quick { flex-wrap: nowrap; overflow-x: auto; margin-inline: -18px; padding: 4px 18px 12px; scrollbar-width: none; }
  .ask__quick .examples__chip { flex: none; white-space: nowrap; }
}

/* ---------- Історія ---------- */
.history { max-width: 1100px; }
.history__bar { position: sticky; top: 76px; z-index: 5; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin: 0 -8px; padding: 8px; border-radius: var(--r-pill); background: color-mix(in srgb, var(--surface) 90%, transparent); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.history__search { position: relative; flex: 1 1 280px; }
.history__search svg { position: absolute; left: 18px; top: 50%; translate: 0 -50%; width: 19px; height: 19px; color: var(--ink-3); pointer-events: none; }
.history__search .input { min-height: 52px; padding-left: 48px; padding-right: 44px; border-radius: var(--r-pill); }
.history__kbd { position: absolute; right: 14px; top: 50%; translate: 0 -50%; padding: 1px 8px; border-radius: 8px; box-shadow: var(--lift-s); font: 800 0.78rem/1.5 var(--font-body); color: var(--ink-3); pointer-events: none; }
.history__search:focus-within .history__kbd { display: none; }
@media (hover: none), (pointer: coarse) { .history__kbd { display: none; } }
/* На телефоні нове завдання — кнопка-камера в нижній панелі */
@media (max-width: 860px) { .history__bar { top: 62px; } .history__bar > .btn { display: none; } }
.history__count { margin: 10px 4px 0; font-size: 0.86rem; font-weight: 750; color: var(--ink-3); }
.history__count:empty { display: none; }
.history__filters { margin: 10px -8px 8px; flex-wrap: nowrap; overflow-x: auto; padding: 8px 8px 14px; scrollbar-width: none; }
.history__filters button { flex: none; border-radius: var(--r-pill); }
.task-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 440px), 1fr)); gap: 14px 18px; }
.task-group { grid-column: 1 / -1; padding: 14px 6px 0; }
.task-group:first-child { padding-top: 0; }
.task-group h2 { font-size: 0.78rem; font-weight: 900; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.task-card {
  display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 16px; align-items: center;
  padding: 12px 18px 12px 12px; border-radius: var(--r-l);
  background: var(--surface); box-shadow: var(--lift-s);
  text-decoration: none;
  transition: transform 200ms var(--ease-out), box-shadow 200ms ease;
}
@media (hover: hover) { .task-card:hover { box-shadow: var(--lift); transform: translateY(-2px); } }
.task-card:active { box-shadow: var(--press-s); transform: none; }
.task-card__thumb { width: 64px; height: 64px; border-radius: var(--r-m); object-fit: cover; background: var(--surface-2); box-shadow: var(--press-s); }
.task-card__thumb--text { display: grid; place-items: center; font-size: 1.6rem; background: var(--marker-soft); box-shadow: var(--clay); }
.task-card__body { display: grid; gap: 2px; min-width: 0; }
.task-card__top { display: flex; gap: 10px; font-size: 0.8rem; color: var(--ink-3); font-weight: 700; }
.task-card__subject { color: var(--blue-deep); font-weight: 850; }
.task-card__title { font-weight: 850; font-size: 1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-card__preview { font-size: 0.86rem; color: var(--ink-2); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-card__status .tag svg { width: 14px; height: 14px; }
.task-list .empty { grid-column: 1 / -1; }
@media (max-width: 520px) {
  .task-card { grid-template-columns: 52px minmax(0, 1fr); gap: 12px; }
  .task-card__thumb { width: 52px; height: 52px; }
  .task-card__status { grid-column: 2; }
  .history__bar .btn { flex: 1 1 100%; }
}

/* ---------- Оплата: картка реквізитів — бузкова пластилінова плитка ---------- */
.pay-card {
  position: relative; overflow: hidden;
  display: grid; gap: 4px;
  margin-bottom: 16px; padding: 18px 20px 16px;
  border-radius: var(--r-l);
  background:
    radial-gradient(120% 90% at 100% 0%, rgba(255, 211, 110, 0.32), transparent 55%),
    linear-gradient(135deg, var(--blue), var(--blue-deep) 75%);
  color: #fff;
  box-shadow: var(--clay), 8px 12px 24px var(--lo), -6px -6px 16px var(--hi);
}
.pay-card::after { content: ""; position: absolute; right: -40px; bottom: -60px; width: 180px; height: 180px; border-radius: 50%; background: rgba(255, 255, 255, 0.08); box-shadow: inset 6px 8px 18px rgba(255, 255, 255, 0.1); }
.pay-card__top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.pay-card__chip { width: 38px; height: 28px; border-radius: 9px; background: var(--marker); box-shadow: inset -2px -3px 5px rgba(0, 0, 0, 0.18), inset 2px 3px 5px rgba(255, 255, 255, 0.5); }
.pay-card__kind { font-size: 0.74rem; font-weight: 850; letter-spacing: 0.06em; text-transform: uppercase; color: rgba(255, 255, 255, 0.82); }
.pay-card__sum { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.pay-card__sum span { font-size: 0.86rem; font-weight: 650; color: rgba(255, 255, 255, 0.82); }
.pay-card__sum b { font-family: var(--font-display); font-weight: 1000; font-size: 1.7rem; letter-spacing: -0.03em; }
.pay-card__iban { font-family: var(--font-mono); font-size: clamp(0.86rem, 0.7rem + 0.8vw, 1.06rem); letter-spacing: 0.04em; overflow-wrap: anywhere; }
.pay-card__holder { font-weight: 850; font-size: 0.95rem; }
.pay-card__code { font-size: 0.82rem; font-weight: 650; color: rgba(255, 255, 255, 0.85); }
.pay-card__code b { padding: 1px 8px; border-radius: var(--r-pill); background: var(--marker); color: var(--ink); font-size: 0.9rem; font-weight: 900; }
/* Оплата лише через застосунок банку: сума й кнопка */
.pay-app__sum { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 12px; padding: 14px 20px; border-radius: var(--r-l); background: var(--surface); box-shadow: var(--press-s); }
.pay-app__sum span { font-size: 0.95rem; color: var(--ink-2); font-weight: 700; }
.pay-app__sum b { font-family: var(--font-display); font-weight: 1000; font-size: 1.9rem; letter-spacing: -0.03em; }
.iban-req__all { margin: 4px 14px 14px; }
.iban-req__all.is-copied { color: var(--ok); box-shadow: var(--press-s); }
.req-row--purpose .req-row__value { font-weight: 850; }
