/* Помощник в Telegram (Mini App). Цвета — из темы Telegram (--tg-theme-*, их ставит telegram-web-app.js);
   запасные --fb-* — для просмотра в обычном браузере. */

:root {
  --fb-bg: #efeff4;
  --fb-card: #ffffff;
  --fb-text: #000000;
  --fb-hint: #8e8e93;
  --fb-sep: rgba(60, 60, 67, 0.18);
}

@media (prefers-color-scheme: dark) {
  :root {
    --fb-bg: #000000;
    --fb-card: #1c1c1e;
    --fb-text: #ffffff;
    --fb-hint: #8d8d93;
    --fb-sep: rgba(84, 84, 88, 0.6);
  }
}

:root {
  --bg: var(--tg-theme-secondary-bg-color, var(--fb-bg));
  --card: var(--tg-theme-section-bg-color, var(--tg-theme-bg-color, var(--fb-card)));
  --text: var(--tg-theme-text-color, var(--fb-text));
  --hint: var(--tg-theme-hint-color, var(--fb-hint));
  --sub: var(--tg-theme-subtitle-text-color, var(--hint));
  --head: var(--tg-theme-section-header-text-color, var(--hint));
  --sep: var(--tg-theme-section-separator-color, var(--fb-sep));
  --accent: var(--tg-theme-accent-text-color, var(--tg-theme-link-color, #2481cc));
  --bad: var(--tg-theme-destructive-text-color, #e53935);
  --warn: #e08a00;
  --good: #2e9d4a;
  --button: var(--tg-theme-button-color, #2481cc);
  --button-text: var(--tg-theme-button-text-color, #ffffff);
  --radius: 12px;
}

* {
  box-sizing: border-box;
}

/* iOS ждёт второго касания (двойное — зум) и задерживает быстрые повторные нажатия: кнопкам это не нужно */
button,
input,
textarea,
select {
  touch-action: manipulation;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.35 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  -webkit-tap-highlight-color: transparent;
}

main {
  max-width: 640px;
  margin: 0 auto;
  padding: 8px 16px calc(32px + env(safe-area-inset-bottom));
}

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

.center {
  text-align: center;
}

.loading {
  margin: 30vh 16px 0;
}

/* ─── шапка экрана ─── */

header.top {
  margin: 8px 4px 20px;
}

header.top h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.2;
  font-weight: 700;
}

header.top p {
  margin: 2px 0 0;
  color: var(--hint);
  font-size: 15px;
}

/* ─── группы и строки ─── */

.group {
  margin: 0 0 24px;
}

.group > h2 {
  margin: 0 16px 6px;
  color: var(--head);
  font-size: 13px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

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

.row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 46px;
  padding: 10px 16px;
}

.row + .row::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  left: 16px;
  height: 1px;
  background: var(--sep);
  transform: scaleY(0.5);
  transform-origin: top;
}

.row.with-icon + .row::before,
.row + .row.with-icon::before {
  left: 56px;
}

.row.tap {
  cursor: pointer;
  user-select: none;
}

.row.tap:active {
  background: var(--sep);
}

.icon {
  flex: none;
  width: 28px;
  font-size: 22px;
  line-height: 1;
  text-align: center;
}

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

.title {
  overflow-wrap: anywhere;
}

.subtitle {
  margin-top: 2px;
  color: var(--sub);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.subtitle.warn {
  color: var(--warn);
}

.subtitle.good {
  color: var(--good);
}

.subtitle.bad {
  color: var(--bad);
}

.after {
  flex: none;
  color: var(--hint);
  font-size: 15px;
}

.chev {
  flex: none;
  margin-left: -4px;
  color: var(--hint);
  font-size: 24px;
  line-height: 1;
}

.foot {
  margin: 8px 16px 0;
  color: var(--hint);
  font-size: 13px;
}

/* ─── сообщения и кнопки ─── */

.notice {
  margin: 0 0 20px;
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--card);
  border-left: 4px solid var(--warn);
}

.notice.bad {
  border-left-color: var(--bad);
}

.btn {
  display: block;
  width: 100%;
  padding: 13px 16px;
  border: 0;
  border-radius: var(--radius);
  background: var(--button);
  color: var(--button-text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.btn:active {
  opacity: 0.8;
}

.btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.btn.plain {
  background: var(--card);
  color: var(--accent);
  font-weight: 500;
}

.btn.small {
  display: inline-block;
  width: auto;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 15px;
}

/* кнопки в ряд, поровну */
.actions {
  display: grid;
  grid-auto-columns: minmax(0, 1fr);
  grid-auto-flow: column;
  gap: 8px;
  margin: 8px 0 0;
}

.group > .actions:first-child,
main > .actions {
  margin: 0 0 24px;
}

/* время слева в строке плана: 7:20 */
.lead {
  flex: none;
  min-width: 44px;
  color: var(--hint);
  font-variant-numeric: tabular-nums;
}

/* строка с полем и кнопкой */
.row.form {
  gap: 10px;
}

input.time {
  flex: 1;
  min-width: 0;
  padding: 7px 10px;
  border: 1px solid var(--sep);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 17px;
  font-variant-numeric: tabular-nums;
}

/* свёрнутый разбор ответа источника */
details.more {
  margin: 0 0 24px;
  padding: 12px 16px;
}

details.more summary {
  color: var(--accent);
  cursor: pointer;
}

details.more pre {
  margin: 10px 0 0;
  color: var(--sub);
  font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  max-width: calc(100% - 32px);
  padding: 10px 16px;
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.82);
  color: #ffffff;
  font-size: 15px;
  transform: translateX(-50%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.toast.show {
  opacity: 1;
}

/* своя команда в списке матчей и в таблице */
.me {
  font-weight: 600;
}

.notice.plain {
  border-left-color: var(--sep);
}

/* строка-пояснение над первой группой (дата матчей дня) */
.foot.lead-in {
  margin: -12px 16px 12px;
}

/* галочка у выбранного варианта */
.check {
  flex: none;
  width: 20px;
  color: var(--accent);
  font-weight: 600;
  text-align: center;
}

/* поле текста: описание своей темы, код */
input.text,
textarea.text {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--sep);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  resize: vertical;
}

.row.form.col {
  flex-direction: column;
  align-items: stretch;
}

.row.form.col .btn {
  align-self: flex-end;
}

.after .btn.small + .btn.small {
  margin-left: 6px;
}

/* NS, «Свой поезд»: недавние станции кнопками; поезд ровно в искомое время — время цветом */
.row.picks {
  flex-wrap: wrap;
  gap: 8px;
  min-height: 0;
}

.row.exact .lead {
  color: var(--accent);
  font-weight: 700;
}

/* ─── финансы ─── */

/* месяцы — в ряд, с прокруткой, если их много */
.chips {
  display: flex;
  gap: 8px;
  margin: 0 0 16px;
  overflow-x: auto;
}

.chips .btn.small {
  flex: none;
}

/* плитки «Доход / Расход / Остаток» */
.tiles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.tile {
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--card);
}

.tile .k,
.tile .n {
  color: var(--hint);
  font-size: 12px;
}

.tile .v {
  margin: 2px 0;
  font-size: 17px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.tile .v.good {
  color: var(--good);
}

.tile .v.bad {
  color: var(--bad);
}

/* полоска доли: сумма категории от самой большой, доля дохода, день месяца */
progress.bar {
  display: block;
  width: 100%;
  height: 6px;
  margin: 4px 0 4px;
  border: 0;
  border-radius: 3px;
  background: var(--sep);
  appearance: none;
  -webkit-appearance: none;
}

progress.bar::-webkit-progress-bar {
  border-radius: 3px;
  background: var(--sep);
}

progress.bar::-webkit-progress-value {
  border-radius: 3px;
  background: var(--accent);
}

progress.bar::-moz-progress-bar {
  border-radius: 3px;
  background: var(--accent);
}

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

.after .btn.small {
  padding: 5px 10px;
}

/* скрыто глазами, слышно экранному диктору («Загружаю…» под скелетоном) */
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ─── скелетон: силуэт экрана, пока данные в пути ─── */

.sk {
  display: block;
  border-radius: 6px;
  background: var(--sep);
  animation: sk-pulse 1.4s ease-in-out infinite;
}

.sk-head {
  width: 30%;
  height: 12px;
  margin: 4px 16px 10px;
}

.sk-line {
  width: 70%;
  height: 14px;
}

.row:nth-child(2n) .sk-line {
  width: 50%;
}

.sk-icon {
  width: 36px;
  height: 36px;
  margin-bottom: 6px;
  border-radius: 10px;
}

@keyframes sk-pulse {
  50% {
    opacity: 0.45;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sk {
    animation: none;
  }
}

/* ─── главный экран: плитки разделов ─── */

.launcher {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 16px;
}

@media (min-width: 520px) {
  .launcher {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.launch {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-height: 116px;
  padding: 14px 8px 12px;
  border: 0;
  border-radius: 16px;
  background: var(--card);
  color: var(--text);
  font: inherit;
  text-align: center;
  cursor: pointer;
  transition: transform 0.12s ease;
  -webkit-user-select: none;
  user-select: none;
}

.launch:active {
  transform: scale(0.96);
}

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

.launch-icon {
  margin-bottom: 2px;
  font-size: 34px;
  line-height: 1.1;
}

.launch-title {
  max-width: 100%;
  overflow: hidden;
  font-size: 14px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.launch-sub {
  display: -webkit-box;
  max-width: 100%;
  overflow: hidden;
  color: var(--hint);
  font-size: 11.5px;
  line-height: 1.3;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.launch.warn .launch-sub {
  color: var(--warn);
}

.launch.failed .launch-sub {
  color: var(--bad);
}

/* раздел живёт в чате: значок приглушён, нажатие только подсказывает */
.launch.off .launch-icon {
  opacity: 0.55;
}

.launch-dot {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warn);
}

.launch.failed .launch-dot {
  background: var(--bad);
}

@media (prefers-reduced-motion: reduce) {
  .launch {
    transition: none;
  }
}

/* ─── дизайн: карточка дня, библиотека, демо ─── */

.meta {
  color: var(--hint);
  font-size: 13px;
}

p.meta {
  margin: 0;
}

.hero,
.shot-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: var(--radius);
  background: var(--card);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.hero:active,
.shot-card:active {
  opacity: 0.85;
}

.hero-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 16px 14px;
}

.hero-title {
  font-size: 19px;
  font-weight: 700;
  line-height: 1.25;
}

.shot {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: var(--sep);
}

.hero .shot {
  aspect-ratio: 4 / 3;
}

.shot.none {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

@media (min-width: 520px) {
  .gallery {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.shot-title {
  padding: 8px 10px 0;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.25;
}

.shot-card .meta {
  padding: 2px 10px 10px;
  font-size: 12px;
}

.card-head {
  margin: -8px 4px 16px;
}

.card-head h2 {
  margin: 2px 0;
  font-size: 22px;
  line-height: 1.25;
}

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

.demo iframe {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  border: 0;
}

.demo + .actions {
  margin: 8px 0 24px;
}

.prose {
  margin: 0;
  padding: 12px 16px;
  line-height: 1.45;
}

ul.prose {
  padding-left: 34px;
}

ul.prose li + li {
  margin-top: 6px;
}

/* ─── фитнес: кольца недели, календарь, переключатель, вес ─── */

:root {
  --gym: #ff9500; /* оранжевый и бирюзовый различимы и при дальтонизме */
  --home: #30b0c7;
}

@media (prefers-color-scheme: dark) {
  :root {
    --gym: #ff9f0a;
    --home: #40c8e0;
  }
}

.legend::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--hint);
  vertical-align: 1px;
}

.legend.gym::before {
  background: var(--gym);
}

.legend.home::before {
  background: var(--home);
}

.week {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 16px;
}

.rings {
  flex: none;
  width: 112px;
  height: 112px;
}

.ring-track,
.ring-fill {
  fill: none;
}

.ring-track.gym {
  stroke: var(--gym);
  opacity: 0.18;
}

.ring-track.home {
  stroke: var(--home);
  opacity: 0.18;
}

.ring-fill {
  stroke-linecap: round;
  animation: ring-in 0.8s ease-out;
}

.ring-fill.gym {
  stroke: var(--gym);
}

.ring-fill.home {
  stroke: var(--home);
}

@keyframes ring-in {
  from {
    stroke-dasharray: 0 1000;
  }
}

.week-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  font-size: 15px;
}

.week-big {
  margin-bottom: 2px;
  font-size: 26px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* календарь: 7 дней + итог недели */
.cal-head {
  display: flex;
  align-items: center;
  padding: 8px 8px 0;
}

.cal-title {
  flex: 1;
  font-size: 17px;
  font-weight: 600;
  text-align: center;
}

.cal-nav {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--accent);
  font: inherit;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.cal-nav:disabled {
  color: var(--sep);
  cursor: default;
}

.cal {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr)) minmax(0, 0.8fr);
  gap: 4px 2px;
  padding: 4px 8px 8px;
  touch-action: pan-y;
}

.cal-wd {
  padding: 4px 0;
  color: var(--hint);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}

.cal-wd.weekend {
  opacity: 0.6;
}

.day {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: none;
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.day .dot {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  max-width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  transition: transform 0.12s ease;
}

.day:active .dot {
  transform: scale(0.9);
}

.day.weekend .dot {
  color: var(--hint);
}

.day.gym .dot {
  background: var(--gym);
  color: #ffffff;
  font-weight: 600;
}

.day.home .dot {
  background: var(--home);
  color: #ffffff;
  font-weight: 600;
}

/* отдых: число приглушено и подчёркнуто чёрточкой */
.day.rest .dot {
  color: var(--hint);
}

.day.rest .dot::after {
  content: "";
  position: absolute;
  bottom: 5px;
  width: 10px;
  height: 2px;
  border-radius: 1px;
  background: var(--hint);
}

.day.today .dot {
  box-shadow: inset 0 0 0 2px var(--accent);
  font-weight: 700;
}

.day.gym.today .dot,
.day.home.today .dot {
  box-shadow: inset 0 0 0 2px var(--card), 0 0 0 2px var(--accent);
}

.day.picked {
  background: var(--sep);
}

.day.future {
  cursor: default;
  opacity: 0.35;
}

.cal-sum {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--hint);
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.cal-sum.done {
  color: var(--good);
}

.cal-sum.done::after {
  content: "✓";
  margin-left: 1px;
  font-size: 12px;
}

.cal-legend {
  display: flex;
  justify-content: center;
  gap: 16px;
  padding: 0 16px 12px;
  color: var(--hint);
  font-size: 13px;
}

/* переключатель как UISegmentedControl: выбранный сегмент — цветом своей отметки */
.segmented {
  display: grid;
  grid-auto-columns: minmax(0, 1fr);
  grid-auto-flow: column;
  gap: 2px;
  padding: 2px;
  border-radius: 10px;
  background: rgba(118, 118, 128, 0.16);
}

.segmented button {
  padding: 9px 4px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.segmented button.on {
  background: var(--card);
  box-shadow: 0 0 0 0.5px var(--sep), 0 1px 3px rgba(0, 0, 0, 0.14);
  font-weight: 600;
}

.segmented button.on.gym {
  background: var(--gym);
  color: #ffffff;
}

.segmented button.on.home {
  background: var(--home);
  color: #ffffff;
}

.tile progress.bar {
  margin: 6px 0 2px;
}

.spark {
  display: block;
  width: 72px;
  height: 28px;
}

.spark polyline {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* вес: большое число, слайдер с шагом ±0,1 */
.weigh {
  padding: 18px 16px 16px;
}

.weight-line {
  display: flex;
  align-items: center;
  gap: 12px;
}

.weight-big {
  flex: 1;
  min-width: 0;
  text-align: center;
}

.weight-num {
  font-size: 48px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.weight-big .unit {
  color: var(--hint);
  font-size: 22px;
  font-weight: 600;
}

.slider {
  display: block;
  width: 100%;
  height: 36px;
  margin: 14px 0 0;
  accent-color: var(--button);
}

/* края окна слайдера: «79 кг … 86 кг» */
.slider-scale {
  display: flex;
  justify-content: space-between;
  color: var(--hint);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.step {
  flex: none;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  background: rgba(118, 118, 128, 0.16);
  color: var(--accent);
  font: inherit;
  font-size: 26px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.step:active {
  background: rgba(118, 118, 128, 0.32);
}

.weight-changes {
  margin: 0 0 24px;
}

.chart-box {
  padding: 8px 6px 4px;
}

.chart {
  display: block;
  width: 100%;
  height: auto;
}

.chart .grid {
  stroke: var(--sep);
  stroke-width: 1;
}

.chart .axis {
  fill: var(--hint);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.chart .axis.end {
  text-anchor: end;
}

.chart .pt {
  fill: var(--hint);
  opacity: 0.55;
}

.chart .trend {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart .last {
  fill: var(--accent);
  stroke: var(--card);
  stroke-width: 2;
}

@media (prefers-reduced-motion: reduce) {
  .ring-fill {
    animation: none;
  }

  .day .dot,
  .segmented button {
    transition: none;
  }
}

/* ─── Витрина: главное на экране — крупно, как в виджетах чата (табло матча, поезда, выход из дома) ───── */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 7px;
  background: rgba(118, 118, 128, 0.14);
  color: var(--hint);
  font-size: 13px;
  font-weight: 700;
  line-height: 18px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.chip.good {
  background: rgba(46, 157, 74, 0.14);
  color: var(--good);
}

.chip.warn {
  background: rgba(224, 138, 0, 0.15);
  color: var(--warn);
}

.chip.bad {
  background: rgba(229, 57, 53, 0.13);
  color: var(--bad);
}

.chip.accent {
  background: rgba(36, 129, 204, 0.13);
  color: var(--accent);
}

.chip.live {
  background: #e53935;
  color: #ffffff;
}

.pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
  50% {
    opacity: 0.3;
  }
}

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

.feature + .card,
.widget + .card,
.sky + .card {
  margin-top: 8px;
}

/* Витрина раздела: подпись сверху, главное крупно, ниже — плашками */

.kicker {
  color: var(--hint);
  font-size: 13px;
}

.headline {
  margin-top: 2px;
  font-size: 26px;
  font-weight: 800;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.feature .sub {
  margin-top: 2px;
  color: var(--hint);
  font-size: 15px;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.feature + .actions,
.feature + .group,
.feature + section {
  margin-top: 16px;
}

/* Виджет чата на экране (ui.js: widget): та же страница, что бот шлёт в сообщении, в рамке. Фон места под рамку —
   в цвет самой страницы: пока она грузится, вместо белой вспышки — её силуэт. */

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

.widget-road {
  background: #003082;
}

.widget-match,
.widget-lineup {
  background: #1a2029;
}

.widget iframe {
  display: block;
  width: 100%;
  border: 0;
}

.widget + .widget,
.widget + .actions,
.widget + .foot {
  margin-top: 8px;
}

.widget + .group,
.widget + section {
  margin-top: 16px;
}

.crest {
  --c: #8e8e93;
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--c);
  color: #ffffff;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.crest.light {
  color: #1c1c1e;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.16);
}

.crest.small {
  width: 28px;
  height: 28px;
  font-size: 9px;
  letter-spacing: 0;
}

.crest.long {
  font-size: 12px;
  letter-spacing: -0.02em;
}

.crest.small.long {
  font-size: 7.5px;
}

.rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 26px;
  border-radius: 8px;
  background: rgba(118, 118, 128, 0.12);
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.rank.cl {
  background: rgba(36, 129, 204, 0.16);
  color: #2481cc;
}

.rank.el {
  background: rgba(236, 112, 0, 0.16);
  color: #d96800;
}

.rank.ecl {
  background: rgba(46, 157, 74, 0.15);
  color: var(--good);
}

.rank.down {
  background: rgba(229, 57, 53, 0.14);
  color: var(--bad);
}

.row.mine {
  background: rgba(220, 5, 45, 0.07);
}

/* «Утро»: шаги плана — прошедшие бледнее, следующий отмечен */

.row.past .title,
.row.past .lead {
  color: var(--hint);
}

.row.next {
  box-shadow: inset 3px 0 0 var(--accent);
}

.row.next .lead {
  color: var(--accent);
  font-weight: 600;
}

/* «Погода»: моменты на улице плитками — небо и температура крупно */

.sky {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 8px;
}

.sky-item {
  padding: 12px 8px 11px;
  border-radius: var(--radius);
  background: var(--card);
  text-align: center;
}

.sky-icon {
  font-size: 34px;
  line-height: 1.15;
}

.sky-temp {
  margin-top: 4px;
  font-size: 28px;
  font-weight: 800;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.sky-label {
  margin-top: 3px;
  font-size: 14px;
  font-weight: 600;
}

.sky-meta {
  margin-top: 2px;
  color: var(--hint);
  font-size: 12px;
  line-height: 1.3;
}

@media (prefers-reduced-motion: reduce) {
  .pulse {
    animation: none;
  }
}

/* ─── «Финансы»: остаток крупно, доход и расход половинками, полосы темпа, 50/30/20 и подушки ─────────── */

.fin-big {
  margin: 2px 0 6px;
  font-size: 44px;
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

.fin-big.good {
  color: var(--good);
}

.fin-big.bad {
  color: var(--bad);
}

.fin-delta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
}

.fin-base {
  color: var(--hint);
  font-size: 13px;
}

.duo {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.fin-kpi {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 12px 14px;
}

.fin-mid {
  font-size: 24px;
  font-weight: 750;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.fin-kpi .spark-box {
  align-self: stretch;
  margin-top: auto;
}

.spark-box {
  position: relative;
  height: 34px;
  margin-top: 8px;
}

.spark-box.big {
  height: 52px;
  margin: 12px 0 2px;
}

.spark-box svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.spark-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.spark-area {
  fill: var(--accent);
  fill-opacity: 0.1;
}

.spark-zero {
  fill: none;
  stroke: var(--hint);
  stroke-width: 1;
  stroke-dasharray: 3 3;
}

.spark-dot {
  position: absolute;
  width: 8px;
  height: 8px;
  margin: -4px 0 0 -4px;
  border: 2px solid var(--card);
  border-radius: 50%;
  background: var(--accent);
}

.row.col {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

.legend-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  color: var(--hint);
  font-size: 12px;
}

.legend-row span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.key {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

.key.spent,
.key.essential {
  background: var(--accent);
}

.key.forecast {
  background: rgba(36, 129, 204, 0.25);
}

.key.prev,
.key.regular {
  width: 3px;
  height: 12px;
  border-radius: 1px;
  background: var(--text);
}

.key.zone {
  background: rgba(46, 157, 74, 0.25);
}

.bullet,
.stack,
.gauge {
  position: relative;
  height: 18px;
  border-radius: 9px;
  background: rgba(118, 118, 128, 0.14);
  overflow: hidden;
}

.bullet i {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: var(--w);
  border-radius: 9px;
}

.bullet-forecast {
  background: rgba(36, 129, 204, 0.25);
}

.bullet-spent {
  background: var(--accent);
}

.bullet i.bullet-prev,
.gauge-mark {
  left: var(--x);
  width: 3px;
  margin-left: -1.5px;
  border-radius: 1px;
  background: var(--text);
}

.stack {
  display: flex;
  overflow: visible;
}

.seg {
  width: var(--w);
  height: 100%;
}

.seg:first-child {
  border-radius: 9px 0 0 9px;
}

.seg:last-of-type {
  border-radius: 0 9px 9px 0;
}

.seg.needs,
.dot.needs {
  background: #3a86ff;
}

.seg.wants,
.dot.wants {
  background: #ff9f1c;
}

.seg.unsorted,
.dot.unsorted {
  background: #9aa0a6;
}

.seg.savings,
.dot.savings {
  background: var(--good);
}

.goal {
  position: absolute;
  top: -3px;
  bottom: -3px;
  width: 2px;
  margin-left: -1px;
  background: var(--text);
  opacity: 0.55;
}

.goal.g50 {
  left: 50%;
}

.goal.g80 {
  left: 80%;
}

.stack-scale {
  position: relative;
  height: 14px;
  color: var(--hint);
  font-size: 11px;
}

.stack-scale span:first-child {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.stack-scale span:last-child {
  position: absolute;
  left: 80%;
  transform: translateX(-50%);
}

.gauge-scale {
  display: flex;
  justify-content: space-between;
  margin-top: -4px;
}

.gauge-scale span,
.gauge-scale span:first-child,
.gauge-scale span:last-child {
  position: static;
  transform: none;
}

.gauge {
  overflow: visible;
}

.gauge-zone {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  right: 0;
  border-radius: 0 9px 9px 0;
  background: rgba(46, 157, 74, 0.25);
}

.gauge-mark {
  position: absolute;
  top: -3px;
  bottom: -3px;
}

.gauge-mark.essential {
  background: var(--accent);
}

.gauge-mark b {
  position: absolute;
  bottom: 100%;
  left: 50%;
  margin-bottom: 2px;
  transform: translateX(-50%);
  color: var(--text);
  font-size: 11px;
  white-space: nowrap;
}

.gauge-mark.essential b {
  top: 100%;
  bottom: auto;
  margin: 2px 0 0;
  color: var(--accent);
}

.dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.after-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  text-align: right;
}

.cbar {
  display: block;
  height: 6px;
  margin: 4px 0 3px;
  border-radius: 3px;
  background: rgba(118, 118, 128, 0.14);
  overflow: hidden;
}

.cbar i {
  display: block;
  width: var(--w);
  height: 100%;
  border-radius: 3px;
  background: var(--accent);
}

/* «Операции»: активные фильтры чипами сверху (не уезжают при прокрутке), варианты со счётчиками, список по дням */

.filters {
  position: sticky;
  top: 0;
  z-index: 2;
  margin: 0 -16px 16px;
  padding: 8px 16px 10px;
  background: var(--bg);
  box-shadow: 0 0.5px 0 var(--sep);
}

.filter-count {
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.filter-count .count {
  display: inline-block;
  min-width: 1ch;
  border-radius: 4px;
  transition: background 0.6s ease, color 0.6s ease;
}

.filter-count .count.flash {
  color: var(--accent);
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  margin-top: 6px;
}

.fchip,
.fclear,
.opt {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 32px;
  padding: 4px 12px;
  border: 0;
  border-radius: 16px;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

.fchip {
  background: var(--button);
  color: var(--button-text);
}

.fchip .k {
  opacity: 0.75;
}

.fchip .x {
  margin-left: 2px;
  font-size: 17px;
  line-height: 1;
}

.fclear {
  background: none;
  color: var(--accent);
}

.opts {
  display: flex;
  gap: 6px;
  padding-bottom: 2px;
  overflow-x: auto;
  scrollbar-width: none;
}

.opt {
  flex: none;
  background: var(--card);
  color: var(--text);
}

.opt.on {
  background: var(--button);
  color: var(--button-text);
}

.opt .n {
  color: var(--hint);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.opt.on .n {
  color: inherit;
  opacity: 0.75;
}

.opt:disabled {
  opacity: 0.4;
}

.ava {
  --c: #8e8e93;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--c);
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
}

b.good {
  color: var(--good);
}

.ava.emoji {
  font-size: 16px;
}

.row.cat .icon {
  align-self: flex-start;
  margin-top: 2px;
}

.cat-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.cat-top b {
  flex: none;
  font-variant-numeric: tabular-nums;
}

.cat-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 8px;
  color: var(--sub);
  font-size: 13px;
}

.spark-dot.forecast {
  border-color: var(--accent);
  background: var(--card);
}

.subtitle .why {
  color: var(--text);
}

/* «⏰ Напоминания»: форма — плашки в несколько строк и подписи над ними; под каждым напоминанием в списке — его
   кнопки, без черты между ними и самим напоминанием */

.rem-form {
  display: grid;
  gap: 8px;
}

.rem-label {
  margin: 8px 16px 0;
  color: var(--head);
  font-size: 13px;
}

.chips.wrap {
  flex-wrap: wrap;
  margin: 0;
  overflow: visible;
}

.row.form .segmented {
  flex: 1;
}

.feature .sub.rem-next {
  overflow-wrap: anywhere;
}

.row.acts {
  flex-wrap: wrap;
  gap: 6px;
  min-height: 0;
  padding: 0 16px 12px 56px;
}

.row + .row.acts::before {
  display: none;
}

/* ─── ядро на нескольких людей: «＋ Добавить», переключатели каталога ─── */

/* плитка «＋ Добавить» — последней в сетке: пунктир, значок цветом ссылки */
.launch.add {
  background: transparent;
  border: 1.5px dashed var(--sep);
}

.launch.add .launch-icon {
  color: var(--accent);
  font-weight: 300;
}

/* зазор между кнопками одной группы */
.gap {
  height: 8px;
}

/* переключатель «включён / выключен», как в настройках iOS */
.switch {
  position: relative;
  flex: none;
  width: 51px;
  height: 31px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--sep);
  cursor: pointer;
  transition: background 0.18s ease;
}

.switch.on {
  background: var(--good);
}

.switch:disabled {
  opacity: 0.45;
  cursor: default;
}

.switch .knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: transform 0.18s ease;
}

.switch.on .knob {
  transform: translateX(20px);
}

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

@media (prefers-reduced-motion: reduce) {
  .switch,
  .switch .knob {
    transition: none;
  }
}
