:root {
  color-scheme: dark;
  --bg: #070a0f;
  --bg-wash: #0a0f18;
  --surface: #0f141c;
  --card: #121923;
  --card-inner: #161d28;
  --input-bg: #0a0e14;
  --border: #263041;
  --divider: #1c2534;
  --text: #f0f4fc;
  --muted: #8e9bb4;
  --accent: #6f9df5;
  --accent-bright: #8cb4ff;
  --accent-dim: #2f4568;
  --accent-glow: rgba(111, 157, 245, 0.22);
  --success: #5ed69a;
  --warn: #ebc04d;
  --danger: #ff9494;
  --radius: 16px;
  --radius-sm: 11px;
  --radius-pill: 999px;
  --shadow-inset: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  --shadow-card: var(--shadow-inset), 0 4px 28px rgba(0, 0, 0, 0.38);
  --shadow-nav: 0 -8px 40px rgba(0, 0, 0, 0.55);
  --ease-out: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  /* Минимум 16px в полях — иначе iOS/Telegram WebView зумирует весь вид при фокусе */
  --input-font-size: 16px;
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
  max-height: 100dvh;
  /* Telegram / iOS: иначе цепочка height:% → 0, контент в #app-root не виден */
  min-height: var(--life-vh, 100dvh);
  min-height: -webkit-fill-available;
  overflow: hidden;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-bottom: max(
    120px,
    min(50vh, 420px),
    calc(88px + env(safe-area-inset-bottom, 0))
  );
  scroll-padding-top: env(safe-area-inset-top, 0);
}

/* Поля ввода: большой «воздух» снизу при программной прокрутке к фокусу */
input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):not([type="button"]):not([type="submit"]):not([type="reset"]),
textarea,
select {
  scroll-margin-top: 12px;
  scroll-margin-bottom: min(48vh, 360px);
}

body {
  margin: 0;
  font-family: var(--font);
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 120% 80% at 50% -30%, rgba(111, 157, 245, 0.13), transparent 55%),
    radial-gradient(ellipse 90% 50% at 100% 0%, rgba(94, 214, 154, 0.05), transparent 50%),
    linear-gradient(180deg, var(--bg-wash) 0%, var(--bg) 42%);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  /* Снижает «двойной тап = зум» на части устройств */
  touch-action: manipulation;
  /* Один скролл внутри #app-root — иначе на iOS / Telegram window.scroll не поднимает поле над клавиатурой */
  height: 100%;
  max-height: 100dvh;
  min-height: var(--life-vh, 100dvh);
  min-height: -webkit-fill-available;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

::selection {
  background: rgba(111, 157, 245, 0.35);
  color: var(--text);
}

.shell {
  max-width: 720px;
  margin: 0 auto;
  padding: 14px 16px 0;
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box;
}

/* Ошибка входа до отрисовки ленты (шапка внутри ленты) */
.auth-boot-error {
  position: relative;
  z-index: 45;
  margin: 0 0 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: rgba(180, 60, 60, 0.2);
  border: 1px solid rgba(255, 150, 150, 0.35);
  color: #ffc9c9;
  font-size: 14px;
  line-height: 1.4;
}

/* Шапка «Мой день» на ленте — в общем скролле #app-root */
.hero-frame--scroll {
  flex-shrink: 0;
  margin-bottom: 16px;
  border-radius: var(--radius);
  overflow: hidden;
}

.app-shell {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Контент не зависит от flex-цепочки родителей (в TG WebView она давала высоту 0) */
.app-root {
  position: fixed;
  z-index: 10;
  top: env(safe-area-inset-top, 0px);
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
  padding: 14px 16px 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scroll-padding-top: 10px;
  scroll-padding-bottom: max(100px, min(42vh, 380px));
  padding-bottom: calc(92px + env(safe-area-inset-bottom, 0));
}

.shell:has(#authBootError:not([hidden])) .app-root {
  top: calc(env(safe-area-inset-top, 0px) + 52px);
}

/* Старые WebView без :has() — класс ставит main.js при fail() */
body.life-boot-error .app-root {
  top: calc(env(safe-area-inset-top, 0px) + 56px);
}

/* Панель логов при ?life_debug=1 — см. debug-client.js */
.life-client-log {
  position: fixed;
  z-index: 100;
  left: 8px;
  right: 8px;
  bottom: calc(88px + env(safe-area-inset-bottom, 0px));
  max-height: 32vh;
  margin: 0;
  padding: 8px 10px;
  overflow: auto;
  font-size: 10px;
  line-height: 1.35;
  white-space: pre-wrap;
  word-break: break-word;
  color: #c8d4e8;
  background: rgba(0, 0, 0, 0.78);
  border: 1px solid rgba(111, 157, 245, 0.35);
  border-radius: var(--radius-sm);
  pointer-events: none;
}

/* Bottom navigation */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: flex;
  gap: 5px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0));
  max-width: 720px;
  margin: 0 auto;
  background: rgba(7, 10, 15, 0.72);
  -webkit-backdrop-filter: blur(18px) saturate(1.35);
  backdrop-filter: blur(18px) saturate(1.35);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: var(--shadow-nav);
}

.bottom-nav__link {
  flex: 1;
  text-align: center;
  padding: 9px 2px;
  border-radius: var(--radius-sm);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--muted);
  text-decoration: none;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  line-height: 1.25;
  transition:
    color 0.18s var(--ease-out),
    background 0.18s var(--ease-out),
    border-color 0.18s var(--ease-out),
    box-shadow 0.18s var(--ease-out),
    transform 0.12s var(--ease-out);
}

.bottom-nav__link.is-active {
  color: var(--text);
  border-color: rgba(111, 157, 245, 0.42);
  background: linear-gradient(165deg, rgba(111, 157, 245, 0.16) 0%, rgba(18, 25, 35, 0.95) 100%);
  box-shadow: 0 0 0 1px rgba(111, 157, 245, 0.12), var(--shadow-inset);
}

.bottom-nav__link:active {
  transform: scale(0.97);
  opacity: 0.95;
}

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

/* Multi-page content — запас снизу, чтобы было куда прокрутить над клавиатурой */
.page-inner {
  padding-bottom: max(32px, min(32vh, 280px));
}

.page-title {
  margin: 0 0 10px;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.page-lead {
  margin: 0 0 20px;
  max-width: 40rem;
}

.subcard {
  margin-bottom: 12px;
}

.subcard h3 {
  margin: 0 0 10px;
  font-size: 16px;
  font-weight: 700;
}

.grid-form {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  align-items: start;
}

.grid-form .btn-primary {
  grid-column: 1 / -1;
  justify-self: start;
}

textarea,
select.input,
input.input {
  width: 100%;
  background: var(--input-bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: var(--input-font-size);
  font-family: inherit;
  transition:
    border-color 0.15s var(--ease-out),
    box-shadow 0.15s var(--ease-out);
}

textarea:focus-visible,
select.input:focus-visible,
input.input:focus-visible {
  outline: none;
  border-color: rgba(111, 157, 245, 0.55);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

textarea {
  resize: vertical;
  min-height: 56px;
}

/* Food / recipes */
.food-add-recipe-strip .btn-primary {
  width: 100%;
}

.food-add-recipe-strip__hint {
  margin: 10px 0 0;
  line-height: 1.4;
}

.food-catalog-details {
  margin-top: 12px;
}

.food-catalog-details > summary {
  list-style: none;
  cursor: pointer;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 6px 12px;
  align-items: center;
  padding: 6px 0 12px;
}

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

.food-catalog-summary__head {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 10px;
  min-width: 0;
}

.food-catalog-summary__count {
  font-size: 13px;
  font-weight: 600;
}

.food-catalog-summary__hint {
  grid-column: 1 / -1;
  grid-row: 2;
  margin: 0;
  font-size: 12px;
  line-height: 1.35;
}

.food-catalog-summary__chev {
  grid-column: 2;
  grid-row: 1;
  width: 9px;
  height: 9px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 0.2s var(--ease-out);
}

.food-catalog-details[open] .food-catalog-summary__chev {
  transform: rotate(225deg);
}

.food-catalog-details__body {
  padding-bottom: 4px;
}

.recipe-add-block--in-catalog {
  margin-bottom: 0;
}

.food-catalog-scroll {
  max-height: min(58vh, 480px);
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 12px 4px 8px 0;
  margin-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.food-catalog-scroll .recipe-catalog-section:first-of-type {
  margin-top: 0;
}

.recipe-add-block .btn-add-recipe-toggle {
  width: 100%;
}

.recipe-form-panel {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.recipe-form-heading {
  margin: 0 0 12px;
  font-size: 16px;
  font-weight: 700;
}

.field-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

.field-label--full {
  grid-column: 1 / -1;
}

.field-label span {
  font-weight: 600;
}

.recipe-form-grid {
  margin-bottom: 8px;
}

.recipe-kbju-hint {
  margin: 0 0 10px;
  line-height: 1.45;
}

.recipe-ing-label {
  margin: 12px 0 8px;
}

.ing-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 8px;
}

.ingredient-row {
  display: grid;
  grid-template-columns: 1fr 5.5rem auto;
  gap: 8px;
  align-items: center;
}

.ingredient-row .ing-name,
.ingredient-row .ing-grams {
  min-width: 0;
}

.ingredient-row .ing-remove {
  padding: 8px 10px;
  font-size: 18px;
  line-height: 1;
}

.btn-add-ing {
  margin-bottom: 16px;
}

.recipe-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.recipe-catalog-section {
  margin-top: 16px;
}

.recipe-catalog-section:first-of-type {
  margin-top: 8px;
}

.recipe-catalog__cat {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.recipe-catalog-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.recipe-catalog-item {
  padding: 12px 0;
  border-bottom: 1px solid var(--divider);
}

.recipe-catalog-item:last-child {
  border-bottom: 0;
}

.recipe-catalog-item__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 2px;
}

.recipe-catalog-item__title {
  font-weight: 600;
  font-size: 15px;
  min-width: 0;
}

.recipe-catalog-edit {
  flex-shrink: 0;
  font-size: 12px;
  padding: 4px 10px;
}

.recipe-catalog-item__meta,
.recipe-catalog-item__ing {
  margin: 4px 0 0;
}

.empty-catalog {
  margin: 8px 0 0;
}

.schedule-meal-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.schedule-meal-form .input-time {
  max-width: 140px;
}

.schedule-meal-form .input-date {
  max-width: 100%;
}

.schedule-day-hint {
  margin: 10px 0 0;
}

.recipe-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 200px;
  overflow-y: auto;
  padding: 4px 0;
}

.recipe-chip {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  max-width: 100%;
}

.recipe-chip.is-selected {
  border-color: rgba(111, 157, 245, 0.55);
  background: rgba(111, 157, 245, 0.14);
  color: var(--text);
  box-shadow: 0 0 0 1px rgba(111, 157, 245, 0.12);
}

.recipe-chip:active {
  opacity: 0.92;
}

.meal-recipe-hint {
  margin: 0;
}

/* Tasks page */
.task-add-row {
  align-items: center;
}

.task-add-row input[type="text"] {
  flex: 1;
  min-width: 0;
}

.task-backlog-list {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
}

.task-backlog-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  width: 100%;
  padding: 14px 16px;
  margin-bottom: 8px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  font: inherit;
  transition:
    background 0.15s var(--ease-out),
    border-color 0.15s var(--ease-out),
    transform 0.12s var(--ease-out);
}

.task-backlog-item:active {
  background: rgba(111, 157, 245, 0.1);
  border-color: rgba(111, 157, 245, 0.25);
  transform: scale(0.99);
}

.task-backlog-item__title {
  font-weight: 600;
  font-size: 15px;
}

.field-label--inline {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.field-label--inline span {
  flex-shrink: 0;
}

.field-label--inline input[type="date"] {
  flex: 0 1 auto;
  max-width: 100%;
}

.tasks--scheduled .task-line {
  align-items: stretch;
  width: 100%;
}

.tasks--scheduled .task-scheduled-hit {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  padding: 6px 4px;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  color: inherit;
  text-align: left;
}

.tasks--scheduled .task-scheduled-hit:active {
  background: rgba(111, 157, 245, 0.1);
}

.task-time-badge {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  min-width: 3.2rem;
}

.task-title-text {
  flex: 1;
  min-width: 0;
  font-weight: 600;
}

.task-edit-hint {
  width: 100%;
  margin-left: 0;
}

.task-daily-option {
  margin: 12px 0 0;
}

.task-line--daily {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 8px;
  margin-bottom: 8px;
}

.task-line--daily .task-backlog-item {
  flex: 1;
  min-width: 0;
  margin-bottom: 0;
}

.task-daily-del {
  flex-shrink: 0;
  align-self: center;
}

.task-rec-badge {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent-bright);
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(111, 157, 245, 0.12);
  border: 1px solid rgba(111, 157, 245, 0.35);
}

.task-new-mode {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.task-new-mode__opt {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
  color: var(--muted);
}

.task-new-mode__opt input {
  flex-shrink: 0;
}

.task-weekdays-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--card-inner);
}

.task-wd-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text);
}

.task-sch-week {
  grid-column: 1 / -1;
  margin-top: 4px;
}

.task-sch-week .task-new-mode__opt {
  margin-top: 6px;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 12px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0));
}

.modal[hidden] {
  display: none !important;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 7, 12, 0.72);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.modal__card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  max-height: min(90dvh, 520px);
  overflow-y: auto;
  margin-top: auto;
}

.modal__title {
  margin: 0 0 8px;
  font-size: 18px;
}

.modal__task-title {
  margin: 0 0 14px;
  font-size: 15px;
  line-height: 1.4;
  word-break: break-word;
}

.modal-form {
  margin-bottom: 8px;
}

.modal-hint {
  margin: 0 0 14px;
}

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

@media (min-width: 480px) {
  .modal {
    align-items: center;
  }

  .modal__card {
    margin-top: 0;
  }
}

.recipe-list,
.plain {
  list-style: none;
  padding: 0;
  margin: 10px 0 0;
}

.recipe-list li,
.plain li {
  padding: 8px 0;
  border-bottom: 1px solid var(--divider);
  font-size: 14px;
}

.recipe-list li:last-child,
.plain li:last-child {
  border-bottom: 0;
}

/* Home timeline */
.live-now,
.live-next {
  margin-bottom: 12px;
}

.live-now h3,
.live-next h3 {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.live-title {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 700;
}

.timeline-recipe-open {
  display: block;
  width: 100%;
  max-width: 100%;
  padding: 0;
  margin: 0;
  border: none;
  background: none;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  text-decoration: underline dotted rgba(111, 157, 245, 0.45);
  text-underline-offset: 3px;
}

.timeline-recipe-open:hover {
  color: var(--accent-bright);
}

.timeline-recipe-open:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.timeline-recipe-open--live {
  display: inline;
  width: auto;
  font-size: 18px;
  font-weight: 700;
  vertical-align: baseline;
}

.timeline-heading {
  margin: 20px 0 10px;
  font-size: 15px;
  font-weight: 700;
}

.timeline-rail {
  list-style: none;
  padding: 0;
  margin: 0;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  background: rgba(0, 0, 0, 0.15);
}

.timeline-slot {
  display: grid;
  grid-template-columns: 42px 56px 1fr;
  gap: 10px 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--divider);
  align-items: start;
}

.timeline-done-label {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 2px;
}

.timeline-done-input {
  width: 22px;
  height: 22px;
  margin: 0;
  accent-color: var(--success);
  cursor: pointer;
}

.timeline-slot:last-child {
  border-bottom: 0;
}

.timeline-slot--now {
  background: linear-gradient(
    90deg,
    rgba(111, 157, 245, 0.14) 0%,
    rgba(111, 157, 245, 0.04) 100%
  );
  border-left: 3px solid var(--accent);
}

.timeline-time {
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}

.timeline-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.timeline-body strong {
  font-size: 15px;
}

.recipe-detail-dialog {
  max-width: min(520px, 92vw);
  width: 100%;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--text);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
}

.recipe-detail-dialog::backdrop {
  background: rgba(0, 0, 0, 0.55);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
}

.recipe-detail-dialog__inner {
  padding: 18px 18px 20px;
  max-height: min(78dvh, 620px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.recipe-detail-dialog__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 4px;
}

.recipe-detail-dialog__title {
  margin: 0;
  font-size: 18px;
  line-height: 1.25;
  flex: 1;
  min-width: 0;
}

.recipe-detail-dialog__close {
  flex-shrink: 0;
  padding: 4px 10px;
  font-size: 22px;
  line-height: 1;
  min-width: 40px;
}

.recipe-detail-dialog__sub {
  margin: 14px 0 8px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.recipe-detail-dialog__ings {
  margin: 0;
  padding-left: 1.15rem;
  font-size: 14px;
  line-height: 1.45;
}

.recipe-detail-dialog__instructions {
  margin: 0;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  background: rgba(0, 0, 0, 0.22);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.timeline-run-wrap {
  margin: 6px 0 0;
}

a.timeline-run-link {
  display: inline-block;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-bright);
  text-decoration: none;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  background: rgba(111, 157, 245, 0.12);
  border: 1px solid rgba(111, 157, 245, 0.35);
  transition:
    background 0.15s var(--ease-out),
    transform 0.12s var(--ease-out);
}

a.timeline-run-link:active {
  transform: scale(0.98);
}

a.timeline-run-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.live-card-actions {
  margin: 12px 0 0;
}

.live-card-actions .timeline-run-link {
  margin-top: 0;
}

.timeline-unscheduled-list {
  list-style: none;
  padding: 0;
  margin: 0 0 16px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  background: rgba(0, 0, 0, 0.12);
}

.timeline-unscheduled-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--divider);
  font-size: 15px;
}

.timeline-unscheduled-item:last-child {
  border-bottom: 0;
}

.timeline-unscheduled-title {
  flex: 1;
  min-width: 0;
  font-weight: 600;
}

.timeline-report {
  margin-top: 4px;
}

.timeline-report__title {
  margin: 0 0 10px;
  font-size: 17px;
  font-weight: 700;
}

.timeline-report__summary {
  margin: 0 0 14px;
  font-size: 15px;
  color: var(--muted);
}

.timeline-report__summary strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.timeline-report__sub {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.timeline-report__list {
  margin: 0 0 14px;
  padding-left: 1.15em;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
}

.timeline-report__list--todo {
  color: var(--warn);
}

.timeline-report__list--todo .muted {
  color: rgba(235, 192, 77, 0.65);
}

.tasks.loose {
  list-style: disc;
  padding-left: 1.2em;
}

.tasks.loose li {
  margin: 6px 0;
  font-size: 14px;
}

/* Tasks with time */
.task-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.input-time.sm {
  min-width: 96px;
  max-width: 110px;
  flex: 0 0 auto;
}

/* Sport — сборка тренировки */
.workout-build .wl-meta {
  margin-bottom: 12px;
}

.workout-edit-btn {
  margin-left: 8px;
  padding: 4px 8px;
  font-size: 12px;
  vertical-align: middle;
}

#wbModeHint {
  margin: 0 0 10px;
}

.workout-build .wl-meta .wl-field {
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px 10px;
}

.workout-build .wl-meta .wl-lbl {
  flex: 0 1 42%;
  max-width: 11rem;
  min-width: 0;
}

.workout-build .wl-meta .wl-dash {
  flex: 0 0 auto;
  opacity: 0.5;
}

.workout-build .wl-meta .wl-control {
  flex: 1 1 50%;
  min-width: 0;
}

.workout-line-card {
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--radius-sm);
  padding: 14px 14px 12px;
  margin-bottom: 12px;
  background: rgba(255, 255, 255, 0.03);
  box-shadow: var(--shadow-inset);
}

.wlines {
  margin-bottom: 10px;
}

.wl-progression {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin: 4px 0 14px;
}

.wl-progression__hint {
  flex: 1 1 160px;
  line-height: 1.35;
}

.wl-line-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-top: 4px;
}

.wl-bump-line {
  flex: 0 0 auto;
}

/* Спорт: «В ленту дня» — сетка, одинаковая высота полей */
.sport-feed-section .sport-feed-hint {
  margin: 0 0 12px;
}

.sport-feed-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.4fr) minmax(108px, 0.75fr) auto;
  column-gap: 20px;
  row-gap: 18px;
  align-items: end;
  padding: 2px 0 4px;
}

.sport-feed-cell {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  padding: 0 2px;
}

.sport-feed-cell__lbl {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  line-height: 1.25;
  min-height: 1.25em;
}

.sport-feed-cell__lbl--phantom {
  visibility: hidden;
  min-height: 1.25em;
}

.sport-feed-control {
  width: 100%;
  min-height: 48px;
  box-sizing: border-box;
  flex: none;
}

.sport-feed-cell--btn .sport-feed-btn {
  width: 100%;
  min-height: 48px;
  box-sizing: border-box;
  padding-top: 11px;
  padding-bottom: 11px;
}

@media (max-width: 720px) {
  .sport-feed-grid {
    grid-template-columns: 1fr 1fr;
    column-gap: 18px;
    row-gap: 20px;
  }

  .sport-feed-cell--btn {
    grid-column: 1 / -1;
  }
}

@media (max-width: 420px) {
  .sport-feed-grid {
    grid-template-columns: 1fr;
    row-gap: 16px;
  }

  .sport-feed-cell {
    padding: 0;
  }
}

.wl-field {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin-bottom: 10px;
}

.wl-field:last-of-type {
  margin-bottom: 4px;
}

.wl-lbl {
  flex: 1 1 140px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  line-height: 1.35;
}

.wl-dash {
  flex: 0 0 auto;
  color: var(--muted);
  opacity: 0.85;
}

.wl-control {
  flex: 2 1 180px;
  min-width: 0;
}

.wl-control .wl-input,
.wl-control input,
.wl-control select {
  width: 100%;
}

.wl-remove {
  display: block;
  width: 100%;
  text-align: left;
  margin-top: 4px;
  padding: 8px 0;
}

.run-screen .run-card {
  margin: 16px 0;
}

.run-progress {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.02em;
}

.run-sub {
  margin: 0 0 12px;
  font-size: 14px;
}

.run-workout-name {
  margin: 0 0 12px;
  font-size: 18px;
  font-weight: 700;
}

.run-card--set h3 {
  margin: 0 0 8px;
  font-size: 20px;
}

.run-pick-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.run-pick-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--divider);
}

.run-pick-item:last-child {
  border-bottom: 0;
}

.run-pick-item.is-done {
  opacity: 0.78;
}

.run-pick-main {
  min-width: 0;
}

.run-pick-name {
  margin: 0 0 2px;
  font-size: 16px;
  font-weight: 600;
}

.run-pick-meta {
  margin: 0;
}

.run-pick-start {
  flex: 0 0 auto;
}

.run-pick-done {
  font-size: 12px;
  color: var(--success);
  font-weight: 600;
  white-space: nowrap;
}

.run-btn-done {
  width: 100%;
  margin-top: 16px;
  padding: 14px 16px;
  font-size: 16px;
}

.run-btn-list {
  width: 100%;
  margin-top: 10px;
}

.run-card--rest {
  text-align: center;
  padding: 20px 16px 16px;
}

.run-countdown {
  margin: 0 0 16px;
  font-size: 42px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--warn);
  line-height: 1.1;
}

.run-next-set-hint {
  margin: 10px 0 8px;
  text-align: center;
  font-size: 15px;
}

.run-rest-hint {
  margin: 12px 0 8px;
  text-align: center;
}

.run-back-link {
  display: inline-block;
  margin-top: 12px;
}

.run-done h2 {
  margin-top: 0;
}

.run-detail {
  font-size: 20px;
  font-weight: 600;
  margin: 8px 0 0;
}

.run-screen a,
.run-back-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 14px;
}

.run-screen a:active,
.run-back-link:active {
  opacity: 0.85;
}

input[type="date"] {
  flex: 1;
  min-width: 0;
  background: var(--input-bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: var(--input-font-size);
  font-family: inherit;
  transition:
    border-color 0.15s var(--ease-out),
    box-shadow 0.15s var(--ease-out);
}

input[type="date"]:focus-visible {
  outline: none;
  border-color: rgba(111, 157, 245, 0.55);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* Hero (на ленте прокручивается вместе с контентом) */
.hero {
  position: relative;
  background:
    radial-gradient(120% 90% at 15% 0%, rgba(111, 157, 245, 0.12), transparent 52%),
    linear-gradient(155deg, #151d2c 0%, var(--card) 48%, #101820 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  padding: 20px 18px;
  margin-bottom: 0;
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.hero-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.hero-label {
  margin: 0 0 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  font-weight: 600;
}

.hero-title {
  margin: 0;
  font-size: 27px;
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.15;
}

.hero-date {
  margin: 8px 0 0;
  font-size: 15px;
  color: var(--muted);
  font-weight: 500;
}

.hero-badge {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 600;
  padding: 9px 14px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--muted);
  max-width: 55%;
  text-align: right;
  transition:
    border-color 0.15s var(--ease-out),
    color 0.15s var(--ease-out);
}

.hero-badge.status-ok {
  color: var(--success);
  border-color: rgba(94, 214, 154, 0.38);
  background: rgba(94, 214, 154, 0.08);
}

.hero-badge.status-error {
  color: var(--danger);
  border-color: rgba(255, 148, 148, 0.4);
  background: rgba(255, 148, 148, 0.06);
}

.hero-hint {
  margin: 14px 0 0;
  font-size: 13px;
  line-height: 1.5;
}

/* Nav */
.app-nav {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 8px 0;
  background: linear-gradient(to bottom, var(--bg) 70%, transparent);
}

.app-nav__link {
  flex: 1;
  text-align: center;
  padding: 10px 8px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--border);
}

.app-nav__link:active {
  background: var(--accent-dim);
  color: var(--text);
}

/* Stats */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.stat-pill {
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm);
  padding: 12px 10px 14px;
  text-align: center;
  box-shadow: var(--shadow-inset);
}

.stat-pill--accent {
  border-color: rgba(111, 157, 245, 0.45);
  background: linear-gradient(165deg, rgba(111, 157, 245, 0.12) 0%, var(--card) 100%);
  box-shadow: var(--shadow-inset);
}

.stat-pill__label {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
}

.stat-pill__value {
  font-size: 17px;
  font-weight: 700;
}

/* Cards / sections */
.card {
  background: linear-gradient(180deg, var(--card-inner) 0%, var(--card) 100%);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius);
  padding: 18px 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-card);
}

.section-head {
  margin-bottom: 12px;
}

.section-head h2 {
  margin: 0 0 6px;
  font-size: 19px;
  font-weight: 700;
}

.section-sub {
  margin: 0;
  font-size: 14px;
}

.muted {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.small {
  font-size: 13px;
  margin: 8px 0 0;
}

.empty-state {
  padding: 22px 14px;
  text-align: center;
  font-size: 14px;
  line-height: 1.55;
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  margin-top: 8px;
  background: rgba(255, 255, 255, 0.02);
}

/* Forms */
.row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: stretch;
}

input[type="text"],
input[type="search"],
input[type="number"],
input[type="time"],
input[type="date"] {
  flex: 1;
  min-width: 0;
  background: var(--input-bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: var(--input-font-size);
  font-family: inherit;
  transition:
    border-color 0.15s var(--ease-out),
    box-shadow 0.15s var(--ease-out);
}

input[type="text"]:focus-visible,
input[type="search"]:focus-visible,
input[type="number"]:focus-visible,
input[type="time"]:focus-visible,
input[type="date"]:focus-visible {
  outline: none;
  border-color: rgba(111, 157, 245, 0.55);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.input-time {
  flex: 0 0 auto;
  min-width: 110px;
  max-width: 130px;
}

.meal-form input[type="text"]#mealTitle {
  flex: 2 1 200px;
}

.meal-form input[type="text"]#mealNote {
  flex: 2 1 180px;
}

.btn-primary {
  border: 0;
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, #8cb4ff 0%, #4f7fd8 52%, #3d6bc4 100%);
  color: #f8fbff;
  padding: 12px 18px;
  font-weight: 600;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  min-height: 44px;
  box-shadow:
    var(--shadow-inset),
    0 4px 18px rgba(74, 127, 212, 0.38);
  transition:
    transform 0.12s var(--ease-out),
    filter 0.15s var(--ease-out),
    box-shadow 0.15s var(--ease-out);
}

.btn-primary:hover {
  filter: brightness(1.04);
}

.btn-primary:active {
  transform: scale(0.98);
  filter: brightness(0.97);
}

.btn-primary:focus-visible {
  outline: none;
  box-shadow:
    var(--shadow-inset),
    0 0 0 3px var(--accent-glow),
    0 4px 18px rgba(74, 127, 212, 0.38);
}

.expense-form input[type="number"] {
  flex: 0 0 100px;
}

.expense-form input[type="text"]#expenseCategory {
  flex: 1 1 120px;
}

.expense-form input[type="text"]#expenseNote {
  flex: 2 1 160px;
}

/* Tasks */
.tasks {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
}

.task {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--divider);
}

.task:last-child {
  border-bottom: 0;
}

.task input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  flex-shrink: 0;
}

.task.done span {
  color: var(--muted);
  text-decoration: line-through;
}

/* Meal timeline */
.meal-timeline {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
}

.meal-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--divider);
}

.meal-row:last-child {
  border-bottom: 0;
}

.meal-datetime {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 0;
  min-width: 5.5rem;
}

.meal-date {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.meal-time {
  font-size: 17px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  line-height: 1.2;
}

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

.meal-remove {
  flex-shrink: 0;
  align-self: center;
  font-size: 12px;
  padding: 6px 10px;
}

.meal-row-empty {
  border: 0 !important;
  padding: 8px 0 !important;
}

/* Питание: калькулятор КБЖУ за день */
.food-day-calc {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--divider);
}

.food-day-calc__title {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 700;
}

.food-day-calc__lead {
  margin: 0 0 12px;
}

.food-day-calc-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -4px;
  padding: 0 4px;
}

.food-day-calc-table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  font-size: 13px;
}

.food-day-calc-table th,
.food-day-calc-table td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid var(--divider);
  font-variant-numeric: tabular-nums;
}

.food-day-calc-table th {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.food-day-calc-table tbody tr:last-child td {
  border-bottom: 0;
}

.food-day-calc-table__act {
  width: 2.5rem;
  text-align: center;
  padding-left: 4px;
  padding-right: 4px;
}

.food-day-calc-row--manual td {
  background: rgba(255, 255, 255, 0.02);
}

.food-manual-del {
  min-width: 36px;
  font-size: 18px;
  line-height: 1;
  padding: 2px 6px;
}

.food-day-calc-grand {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: rgba(94, 214, 154, 0.08);
  border: 1px solid rgba(94, 214, 154, 0.2);
}

.food-day-calc-grand__label {
  font-weight: 700;
  font-size: 14px;
}

.food-day-calc-grand__nums {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  font-size: 14px;
  color: var(--muted);
}

.food-day-calc-grand__nums strong {
  color: #e8eeff;
  font-weight: 700;
}

/* Питание: цели КБЖУ из «Здоровье» */
.food-energy-panel {
  margin: 18px 0 16px;
  padding: 16px 14px;
  border-radius: var(--radius-sm);
  background: rgba(111, 157, 245, 0.06);
  border: 1px solid rgba(111, 157, 245, 0.18);
}

.food-energy-panel__head {
  margin-bottom: 12px;
}

.food-energy-panel__title {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 700;
}

.food-energy-panel__sub {
  margin: 0;
}

.food-energy-mode-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.food-energy-mode-btn {
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--muted);
}

.food-energy-mode-btn.is-active {
  background: rgba(94, 214, 154, 0.18);
  border-color: rgba(94, 214, 154, 0.45);
  color: #cfeadb;
}

.food-energy-mode-hint {
  margin: 0 0 14px;
}

.food-energy-panel__missing {
  padding: 12px 0 4px;
}

.food-energy-panel__missing-title {
  margin: 0 0 6px;
  font-weight: 600;
  font-size: 14px;
}

.food-energy-to-health {
  display: inline-block;
  margin-top: 12px;
  text-decoration: none;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
}

.food-energy-panel__targets {
  margin-bottom: 14px;
}

.food-energy-target-pill {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  margin: 0 12px 8px 0;
  font-size: 13px;
}

.food-energy-target-pill__k {
  color: var(--muted);
  font-weight: 600;
}

.food-energy-target-pill__v {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.food-energy-tdee-hint {
  margin: 10px 0 0;
}

.food-energy-bars {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}

.food-macro-bar {
  display: grid;
  grid-template-columns: 5.5rem minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  font-size: 13px;
}

.food-macro-bar__lbl {
  color: var(--muted);
  font-weight: 600;
}

.food-macro-bar__track {
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.food-macro-bar__fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #5ed69a, #6f9df5);
  min-width: 2px;
}

.food-macro-bar__fill--p {
  background: linear-gradient(90deg, #7eb8ff, #9dd5ff);
}

.food-macro-bar__fill--f {
  background: linear-gradient(90deg, #e8c266, #f0d78c);
}

.food-macro-bar__fill--c {
  background: linear-gradient(90deg, #c49bff, #ddb8ff);
}

.food-macro-bar__nums {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.food-energy-verdict {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.15);
}

.food-energy-verdict__title {
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 700;
}

.food-energy-verdict__text {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: #c8d2e0;
}

.food-energy-verdict--ok {
  border-color: rgba(94, 214, 154, 0.25);
  background: rgba(94, 214, 154, 0.08);
}

.food-energy-verdict--over {
  border-color: rgba(255, 166, 102, 0.35);
  background: rgba(255, 166, 102, 0.08);
}

.food-energy-verdict--under {
  border-color: rgba(111, 157, 245, 0.3);
  background: rgba(111, 157, 245, 0.07);
}

.health-energy-card .health-section-title {
  margin-top: 0;
}

.health-energy-grid {
  align-items: end;
}

.food-day-calc-manual {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--divider);
}

.food-day-calc-manual__hint {
  margin: 0 0 10px;
}

.food-day-calc-manual-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr));
  gap: 10px 12px;
  align-items: end;
}

.food-day-calc-manual-note {
  grid-column: 1 / -1;
}

@media (min-width: 720px) {
  .food-day-calc-manual-note {
    grid-column: span 2;
  }
}

.food-day-calc-manual-add {
  grid-column: 1 / -1;
  justify-self: start;
}

@media (min-width: 560px) {
  .food-day-calc-manual-add {
    grid-column: auto;
    align-self: end;
  }
}

.meal-title-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.meal-title-row input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin-top: 3px;
  flex-shrink: 0;
}

.meal-title {
  flex: 1;
  font-size: 16px;
  font-weight: 600;
}

.meal-row.done .meal-title {
  color: var(--muted);
  text-decoration: line-through;
}

.meal-note {
  margin: 6px 0 0 28px;
  font-size: 13px;
  line-height: 1.4;
}

.meal-actions {
  margin-left: auto;
}

button.btn-ghost {
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  padding: 4px 8px;
}

button.btn-ghost:active {
  color: var(--danger);
}

/* Expenses */
.expense-list {
  list-style: none;
  padding: 0;
  margin: 10px 0 0;
}

.expense-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--divider);
  font-size: 14px;
}

.expense-list li:last-child {
  border-bottom: 0;
}

.expense-list .amount {
  font-weight: 600;
  color: var(--warn);
}

.expense-list button.del {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s var(--ease-out);
}

.expense-list button.del:active {
  background: rgba(255, 148, 148, 0.15);
  border-color: rgba(255, 148, 148, 0.25);
}

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

/* Money — счета с остатками */
.accounts-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.help-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--muted);
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}

.help-icon:hover,
.help-icon:focus-visible {
  color: var(--text);
  border-color: var(--accent);
}

.accounts-help {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  line-height: 1.45;
}

.account-balance-list {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
}

.account-balance-row {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  padding: 12px 0;
  border-bottom: 1px solid var(--divider);
}

.account-balance-row:last-child {
  border-bottom: 0;
}

.account-balance-name {
  font-weight: 600;
  min-width: 0;
}

.account-balance-currencies {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.account-balance-curr {
  margin: 0;
}

.money-sum {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.money-sum--up {
  color: var(--success);
}

.money-sum--down {
  color: var(--danger);
}

.money-sum--same {
  color: var(--text);
}

/* Привычки */
.habits-page .habit-add {
  margin-bottom: 0;
}

.habit-list {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
}

.habit-card {
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 10px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04) 0%, var(--surface) 100%);
  box-shadow: var(--shadow-inset);
}

.habit-card:last-child {
  margin-bottom: 0;
}

.habit-card__top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.habit-pill {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.habit-pill--build {
  background: rgba(94, 207, 140, 0.12);
  color: var(--success);
  border: 1px solid rgba(94, 207, 140, 0.35);
}

.habit-pill--name {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
  text-transform: none;
  letter-spacing: normal;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
  padding: 6px 12px;
  overflow-wrap: anywhere;
}

.habit-pill--break {
  background: rgba(111, 157, 245, 0.1);
  color: var(--accent);
  border: 1px solid rgba(111, 157, 245, 0.38);
}

.habit-streak {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.habit-title {
  margin: 0 0 10px;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.35;
}

.habit-week-block {
  max-width: 220px;
  margin-bottom: 12px;
}

.habit-week-labels,
.habit-week-dates,
.habit-week {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
  align-items: center;
}

.habit-week-labels {
  margin-bottom: 2px;
}

.habit-week-dates {
  margin-bottom: 3px;
}

.habit-wd {
  display: block;
  text-align: center;
  font-size: 9px;
  font-weight: 700;
  color: var(--muted);
  line-height: 1.15;
  letter-spacing: -0.03em;
  min-width: 0;
}

.habit-wd--today {
  color: var(--text);
}

.habit-day-num {
  display: block;
  text-align: center;
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  min-width: 0;
}

.habit-day-num--today {
  color: var(--text);
}

.habit-dot {
  width: 11px;
  height: 11px;
  margin: 0 auto;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.habit-dot--on {
  background: var(--success);
  box-shadow: 0 0 0 1px rgba(94, 207, 140, 0.4);
}

.habit-card--break .habit-dot--on {
  background: var(--accent);
  box-shadow: 0 0 0 1px rgba(111, 157, 245, 0.45);
}

.habit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: stretch;
}

.habit-actions .btn-primary {
  flex: 1 1 200px;
  min-width: 0;
}

.habit-actions .habit-del {
  flex: 0 0 auto;
}

.habit-actions--break {
  flex-direction: column;
  align-items: stretch;
}

.habit-actions--break .btn-primary {
  flex: 1 1 auto;
}

.habit-empty {
  margin: 8px 0 0;
}

.habits-foot {
  margin-top: 16px;
}

.grid-form .grid-full {
  grid-column: 1 / -1;
}

.habit-add-extra {
  margin-top: 4px;
}

.habit-add-extra .input {
  max-width: 100%;
}

.habit-break-palette {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.habit-break-swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.2);
  background: var(--swatch, #5ecfff);
  cursor: pointer;
  padding: 0;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15);
  transition:
    transform 0.12s var(--ease-out),
    box-shadow 0.12s var(--ease-out);
}

.habit-break-swatch--on {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  transform: scale(1.06);
}

.habit-break-card {
  border-color: rgba(111, 157, 245, 0.22);
  background:
    radial-gradient(
      ellipse 80% 60% at 50% -30%,
      color-mix(in srgb, var(--habit-break-accent, var(--accent)) 28%, transparent),
      transparent 55%
    ),
    linear-gradient(180deg, rgba(255, 255, 255, 0.05) 0%, var(--surface) 100%);
}

.habit-break-hero {
  display: grid;
  grid-template-columns: minmax(0, 120px) minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  margin-bottom: 14px;
  color: var(--habit-break-accent, var(--accent));
}

.habit-break-ring-wrap {
  position: relative;
  width: 100%;
  max-width: 120px;
  margin: 0 auto;
}

.habit-break-ring-svg {
  width: 100%;
  height: auto;
  display: block;
  filter: drop-shadow(0 4px 14px rgba(0, 0, 0, 0.35));
}

.habit-break-ring-svg .habit-break-tree {
  color: var(--habit-break-accent, var(--accent));
}

.habit-break-hero__text {
  min-width: 0;
}

.habit-break-hero__days {
  font-size: 44px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.habit-break-hero__sub {
  margin: 6px 0 8px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
}

.habit-break-hero__hms {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  color: var(--text);
}

.habit-break-hero__hms-label {
  margin: 4px 0 0;
  font-size: 11px;
  line-height: 1.35;
}

.habit-break-statgrid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.habit-break-stat {
  text-align: center;
  min-width: 0;
}

.habit-break-stat__label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 4px;
}

.habit-break-stat strong {
  font-size: 20px;
  font-variant-numeric: tabular-nums;
}

.habit-break-card__top {
  margin-top: 4px;
}

.habit-break-notes {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.habit-break-notes__title {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.habit-break-note-list {
  list-style: none;
  padding: 0;
  margin: 0 0 12px;
}

.habit-break-note {
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.habit-break-note:last-child {
  border-bottom: none;
}

.habit-break-note__meta {
  font-size: 11px;
  color: var(--muted);
  display: block;
  margin-bottom: 4px;
}

.habit-break-note__text {
  margin: 0 0 8px;
  font-size: 14px;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
}

.habit-break-note-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

@media (min-width: 480px) {
  .habit-break-note-form {
    flex-direction: row;
    align-items: stretch;
  }

  .habit-break-note-form .habit-break-note-input {
    flex: 1;
  }

  .habit-break-note-form .habit-break-note-add {
    flex: 0 0 auto;
  }
}

/* Общие состояния доступности */
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

button.btn-ghost:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

/* Здоровье */
.health-page .health-hero {
  position: relative;
  overflow: hidden;
  margin-bottom: 16px;
  padding: 22px 20px 20px;
  border-radius: var(--radius);
  border: 1px solid rgba(111, 157, 245, 0.28);
  background:
    radial-gradient(ellipse 120% 80% at 20% -20%, rgba(94, 214, 154, 0.18), transparent 55%),
    radial-gradient(ellipse 90% 60% at 100% 0%, rgba(111, 157, 245, 0.2), transparent 50%),
    linear-gradient(165deg, rgba(22, 29, 40, 0.98) 0%, rgba(15, 20, 28, 0.99) 100%);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.04) inset,
    0 12px 40px rgba(0, 0, 0, 0.35);
}

.health-hero__badge {
  display: inline-block;
  margin-bottom: 10px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-bright);
  background: linear-gradient(135deg, rgba(111, 157, 245, 0.2), rgba(94, 214, 154, 0.12));
  border: 1px solid rgba(111, 157, 245, 0.35);
}

.health-hero__title {
  margin: 0 0 8px;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.04em;
}

.health-hero__lead {
  margin: 0 0 18px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--muted);
  max-width: 36rem;
}

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

.health-mini-stat {
  padding: 12px 10px;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.06);
  text-align: center;
}

.health-mini-stat__v {
  display: block;
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.health-mini-stat__k {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.25;
}

.health-mini-stat__hint {
  font-weight: 500;
  color: var(--muted);
}

.health-hero__now {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

.health-hero__now strong {
  color: var(--text);
  font-weight: 700;
}

.health-section-title {
  margin: 0 0 12px;
  font-size: 16px;
}

.health-insight {
  margin-bottom: 4px;
}

.health-insight-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.health-insight-card {
  padding: 14px 14px 12px;
  border-radius: var(--radius-sm);
  background: var(--card-inner);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.health-insight-card--wide {
  grid-column: 1 / -1;
}

.health-insight-card__n {
  display: block;
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--accent-bright);
}

.health-insight-card__t {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.3;
}

.health-insight-card__goal {
  font-size: 14px;
  font-weight: 600;
  color: var(--success);
}

.health-edit-profile-wrap {
  margin: 0 0 12px;
  text-align: center;
}

.health-weigh-row {
  align-items: stretch;
  gap: 10px;
  flex-wrap: wrap;
}

.health-weigh-input {
  flex: 1;
  min-width: 120px;
}

.health-chart-card {
  overflow: hidden;
}

.health-chart-wrap {
  margin-top: 8px;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 8px 4px 4px;
}

.health-chart-svg {
  display: block;
  width: 100%;
  max-width: 420px;
  height: auto;
  margin: 0 auto;
}

.health-chart-axis {
  fill: var(--muted);
  font-size: 10px;
}

.health-chart-line {
  filter: drop-shadow(0 1px 8px rgba(111, 157, 245, 0.35));
}

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

.health-chart-empty {
  padding: 24px 12px;
  text-align: center;
}

.health-log-list {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
}

.health-log-list li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--divider);
  font-size: 14px;
}

.health-log-list li:last-child {
  border-bottom: 0;
}

.health-log-w {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
