/* ================================
   Fit AI — UI KIT (Dark Theme)
   ================================ */

/* Design tokens */
:root {
  /* Palette */
  --bg: #2c2c2e; /* графитовый */
  --fg: #f2f2f7; /* софт-белый */
  --midnight: #191970; /* полночный синий */
  --fitaiblue: #6f6fdf; /* полночный синий */
  --burnt: #cc7a33; /* жженый оранжевый */
  --emerald: #20d38f; /* яркий изумрудный ⭐ */
  --forest: #1bb978; /* лесной зелёный ⭐ */
  --coral: #e55b5d; /* коралловый */
  --muted: rgba(242, 242, 247, 0.28);

  /* Roles */
  --primary: var(--emerald);
  --accent: var(--forest);
  --warning: var(--burnt);
  --danger: var(--coral);

  /* Typography */
  --font-sans: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Inter, Arial, 'Noto Sans',
    'Helvetica Neue', sans-serif;
  --h1-size: clamp(22px, 4vw, 28px);
  --h1-weight: 700;
  --text-size: 16px;
  --small-size: 13px;

  /* Radii & Elevation */
  --radius: 14px;
  --elev-1: 0 2px 10px rgba(0, 0, 0, 0.25);
  --elev-2: 0 6px 18px rgba(0, 0, 0, 0.3);
  --elev-3: 0 14px 32px rgba(0, 0, 0, 0.35);

  /* Motion */
  --anim-fast: 120ms;
  --anim-normal: 200ms;
  --bezier: cubic-bezier(0.2, 0.8, 0.2, 1);
  --tap-scale: 0.98;

  /* Layout */
  --container: 440px;
  --gap: 16px;
}

/* Base */
* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
  overflow-x: hidden;
  width: 100%;
  max-width: 100vw;
}
body {
  margin: 0;
  font-family: var(--font-sans);
  background: radial-gradient(1200px 600px at 80% -10%, rgba(25, 25, 112, 0.18), transparent),
    var(--bg);
  color: var(--fg);
  font-size: var(--text-size);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding: 24px 20px 32px;
}

/* Headings */
.app-title {
  font-size: var(--h1-size);
  font-weight: var(--h1-weight);
  letter-spacing: 0.2px;
  margin: 0 0 8px 0;
}

/* Sub text */
.subtle {
  color: rgba(242, 242, 247, 0.7);
  font-size: var(--small-size);
}

/* Tabs (top menu) */
.tabs {
  display: flex;
  gap: 24px;
  border-bottom: 1px solid rgba(242, 242, 247, 0.08);
  margin: 12px 0 10px 0;
}
.tab {
  position: relative;
  padding: 10px 2px 12px;
  color: rgba(242, 242, 247, 0.82);
  text-decoration: none;
  font-weight: 600;
  transition: color var(--anim-fast) var(--bezier);
}
.tab:hover {
  color: #fff;
}
.tab--active {
  color: #fff;
}
.tab--active::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 3px 3px 0 0;
}

/* Forms */
.form {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}
.form-row {
  display: grid;
  gap: 8px;
}
.label {
  font-size: var(--small-size);
  color: rgba(242, 242, 247, 0.78);
}
.input {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  color: var(--fg);
  border: 1px solid var(--muted);
  border-radius: var(--radius);
  padding: 14px 14px;
  outline: none;
  transition: border-color var(--anim-fast) var(--bezier), box-shadow var(--anim-fast) var(--bezier),
    transform var(--anim-fast) var(--bezier);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}
.input::placeholder {
  color: rgba(242, 242, 247, 0.55);
}
.input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(32, 211, 143, 0.18);
  transform: translateY(-0.5px);
}
.input[aria-invalid='true'] {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(229, 91, 93, 0.18);
}

/* Buttons */
.btn {
  --bg-btn: rgba(255, 255, 255, 0.06);
  --fg-btn: var(--fg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 46px;
  padding: 0 16px;
  border: 1px solid var(--muted);
  border-radius: var(--radius);
  background: var(--bg-btn);
  color: var(--fg-btn);
  text-decoration: none;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--elev-1);
  transition: transform var(--anim-fast) var(--bezier), box-shadow var(--anim-fast) var(--bezier),
    background-color var(--anim-fast) var(--bezier), border-color var(--anim-fast) var(--bezier),
    opacity var(--anim-fast) var(--bezier);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.btn:hover {
  box-shadow: var(--elev-2);
}
.btn:active {
  transform: scale(var(--tap-scale));
  box-shadow: var(--elev-1);
}
.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

/* Button variants */
.btn--primary {
  --bg-btn: linear-gradient(180deg, var(--primary), var(--accent));
  border-color: transparent;
  color: #052b1d;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.2);
}
.btn--ghost {
  --bg-btn: transparent;
}
.btn--google {
  --bg-btn: #ffffff;
  color: #1f1f1f;
  border-color: #e6e6e6;
}
.btn--full {
  width: 100%;
}

/* Icon holder */
.icon {
  width: 18px;
  height: 18px;
  display: inline-block;
}

/* Links */
.link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}
.link:hover {
  text-decoration: underline;
}

/* Sections / spacing helpers */
.stack-8 {
  display: grid;
  gap: 8px;
}
.stack-12 {
  display: grid;
  gap: 12px;
}
.stack-16 {
  display: grid;
  gap: 16px;
}

.helper-center {
  display: grid;
  align-content: start;
  min-height: 100dvh;
}

/* Accessibility focus ring for clickable elements lacking native outline */
a:focus-visible,
.btn:focus-visible,
.tab:focus-visible,
.input:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(32, 211, 143, 0.28);
  border-color: var(--primary);
}

/* Small caption under tabs */
.caption {
  margin-top: 6px;
  color: rgba(242, 242, 247, 0.75);
  font-size: var(--small-size);
}

/* Divider text (— или ——— или «или войдите с помощью») */
.divider {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  color: rgba(242, 242, 247, 0.65);
  font-size: var(--small-size);
}
.divider::before,
.divider::after {
  content: '';
  height: 1px;
  background: rgba(242, 242, 247, 0.12);
}

/* Google logo (minimal inline SVG style) */
.google-mark {
  width: 16px;
  height: 16px;
}

/* ===== Additions for Sign Up screen ===== */

/* Top bar: back + title */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}
.back {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--muted);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: var(--elev-1);
  transition: transform var(--anim-fast) var(--bezier), box-shadow var(--anim-fast) var(--bezier),
    background var(--anim-fast) var(--bezier);
  -webkit-tap-highlight-color: transparent;
}
.back:hover {
  box-shadow: var(--elev-2);
}
.back:active {
  transform: scale(var(--tap-scale));
  box-shadow: var(--elev-1);
}
.screen-title {
  font-weight: 800;
  font-size: 20px;
  letter-spacing: 0.2px;
  margin: 0;
}

/* Progress (3 thick segments) */
.progress {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 14px 0 4px;
}
.progress__step {
  height: 10px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 1px 0 rgba(0, 0, 0, 0.25);
}
.progress__step--active {
  background: linear-gradient(90deg, var(--primary), var(--accent));
  box-shadow: 0 2px 10px rgba(32, 211, 143, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

/* Select matches input style */
.select {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  color: var(--fg);
  border: 1px solid var(--muted);
  border-radius: var(--radius);
  padding: 14px 40px 14px 14px; /* room for caret */
  outline: none;
  transition: border-color var(--anim-fast) var(--bezier), box-shadow var(--anim-fast) var(--bezier),
    transform var(--anim-fast) var(--bezier);
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, rgba(242, 242, 247, 0.7) 50%),
    linear-gradient(135deg, rgba(242, 242, 247, 0.7) 50%, transparent 50%);
  background-position: calc(100% - 18px) 52%, calc(100% - 12px) 52%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}
.select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(32, 211, 143, 0.18);
  transform: translateY(-0.5px);
}

/* Two columns for height/weight */
.grid-2 {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr 1fr;
}
@media (max-width: 420px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

/* ===== Dark dropdown for native <select> ===== */

/* Подсказываем браузеру, что интерфейс тёмный (влияет на системные попапы) */
:root,
.select {
  color-scheme: dark;
}

/* Цвет выпадающего меню и пунктов (поддерживается в Chrome/Edge/Firefox) */
.select option,
.select optgroup {
  background-color: var(--bg);
  color: var(--fg);
}

/* Ховер/выбранный пункт — лёгкая подсветка акцентом */
.select option:checked,
.select option:hover {
  background-color: rgba(32, 211, 143, 0.15);
  color: var(--fg);
}

/* Firefox: иногда игнорирует color-scheme без этого */
@-moz-document url-prefix() {
  .select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
  }
  .select option {
    background-color: var(--bg) !important;
    color: var(--fg) !important;
  }
}

/* ===== Activity screen additions ===== */

/* Section titles */
.section-title {
  margin: 14px 0 4px 0;
  font-size: 18px;
  font-weight: 800;
}
.section-caption {
  color: rgba(242, 242, 247, 0.75);
  font-size: var(--small-size);
  margin-bottom: 10px;
}

/* Radio group (list) */
.radio-group {
  display: grid;
  gap: 10px;
}
.radio-item {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--muted);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.04);
  box-shadow: var(--elev-1);
  transition: transform var(--anim-fast) var(--bezier), box-shadow var(--anim-fast) var(--bezier),
    border-color var(--anim-fast) var(--bezier), background var(--anim-fast) var(--bezier);
  cursor: pointer;
}
.radio-item:hover {
  box-shadow: var(--elev-2);
}
.radio-item:active {
  transform: scale(var(--tap-scale));
  box-shadow: var(--elev-1);
}

/* Custom radio */
.radio {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(242, 242, 247, 0.6);
  border-radius: 50%;
  display: grid;
  place-items: center;
  outline: none;
  background: transparent;
  transition: border-color var(--anim-fast) var(--bezier), box-shadow var(--anim-fast) var(--bezier);
}
.radio:focus-visible {
  box-shadow: 0 0 0 3px rgba(32, 211, 143, 0.28);
  border-color: var(--primary);
}
.radio:checked {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(32, 211, 143, 0.18);
}
.radio:checked::after {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: linear-gradient(180deg, var(--primary), var(--accent));
}

/* Radio labels */
.radio-text {
  display: grid;
  gap: 2px;
}
.radio-title {
  font-weight: 700;
}
.radio-sub {
  color: rgba(242, 242, 247, 0.75);
  font-size: var(--small-size);
}

/* Progress state helper: second step active */
.progress--step2 .progress__step:nth-child(2) {
  background: linear-gradient(90deg, var(--primary), var(--accent));
  box-shadow: 0 2px 10px rgba(32, 211, 143, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
.progress--step2 .progress__step:nth-child(1),
.progress--step2 .progress__step:nth-child(3) {
  background: rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 1px 0 rgba(0, 0, 0, 0.25);
}

/* ===== Goals screen additions ===== */

/* Progress state helper: third step active */
.progress--step3 .progress__step:nth-child(3) {
  background: linear-gradient(90deg, var(--primary), var(--accent));
  box-shadow: 0 2px 10px rgba(32, 211, 143, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
.progress--step3 .progress__step:nth-child(1),
.progress--step3 .progress__step:nth-child(2) {
  background: rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 1px 0 rgba(0, 0, 0, 0.25);
}

/* Chips cloud (single-select) */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-start;
}
.chip-radio {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  min-height: 36px;
  border-radius: calc(var(--radius) - 6px);
  border: 1px solid var(--muted);
  background: rgba(255, 255, 255, 0.04);
  color: var(--fg);
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--elev-1);
  transition: transform var(--anim-fast) var(--bezier), box-shadow var(--anim-fast) var(--bezier),
    background var(--anim-fast) var(--bezier), border-color var(--anim-fast) var(--bezier);
  -webkit-tap-highlight-color: transparent;
}
.chip:hover {
  box-shadow: var(--elev-2);
}
.chip:active {
  transform: scale(var(--tap-scale));
  box-shadow: var(--elev-1);
}

/* Active state when its radio is checked (adjacent sibling) */
.chip-radio:checked + .chip {
  background: linear-gradient(180deg, var(--primary), var(--accent));
  border-color: transparent;
  color: #052b1d;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* Optional helper spacing under the cloud */
.chips-note {
  margin-top: 6px;
}

/* Small subheader before chips block */
.subhead {
  color: rgba(242, 242, 247, 0.85);
  font-weight: 700;
  margin-top: 8px;
}

/* ===== Main screen (dashboard) additions ===== */

/* Layout: sticky header + sticky bottom nav */
.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(44, 44, 46, 0.92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid rgba(242, 242, 247, 0.08);
  width: 100%;
  max-width: 100vw;
  overflow: hidden;
}
.app-header__inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-sizing: border-box;
  width: 100%;
}
.main-page {
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}
.main-scroll {
  max-width: var(--container);
  width: 100%;
  margin: 0 auto;
  padding: 16px 20px 88px; /* bottom padding for nav overlay */
  box-sizing: border-box;
  overflow-x: hidden;
}

/* Cards */
.card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--muted);
  border-radius: var(--radius);
  box-shadow: var(--elev-1);
  padding: 14px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
.card + .card {
  margin-top: 12px;
}
.card__title {
  font-weight: 800;
  margin: 0 0 10px 0;
}
.card--accent {
  border-color: transparent;
  background: linear-gradient(0deg, rgba(32, 211, 143, 0.08), rgba(32, 211, 143, 0.08)),
    rgba(255, 255, 255, 0.04);
  box-shadow: 0 0 0 1px rgba(32, 211, 143, 0.35), var(--elev-1);
}
.card--blue {
  border-color: transparent;
  background: linear-gradient(0deg, rgba(25, 25, 112, 0.18), rgba(25, 25, 112, 0.18)),
    rgba(255, 255, 255, 0.04);
  box-shadow: 0 0 0 1px rgba(25, 25, 112, 0.45), var(--elev-1);
}

/* Welcome banner */
.welcome {
  border-radius: var(--radius);
  padding: 14px;
  padding-right: 18px; /* Extra padding for crown on mobile */
  background: linear-gradient(135deg, rgba(25, 25, 112, 0.5), rgba(27, 185, 120, 0.25));
  border: 1px solid rgba(242, 242, 247, 0.12);
  box-shadow: var(--elev-1);
  margin-bottom: var(--gap);
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  overflow: visible;
  position: relative;
}
.welcome__hi {
  font-weight: 800;
  margin: 0 0 6px;
}
.welcome__date {
  color: rgba(242, 242, 247, 0.8);
  font-size: var(--small-size);
}

.welcome__avatar {
  width: 60px;
  height: 60px;
  border-radius: 999px;
  overflow: visible;
  border: 2px solid rgba(242, 242, 247, 0.18);
  box-shadow: var(--elev-1);
  position: relative;
  background: transparent;
}
.welcome__avatar > img:first-child {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 999px;
  display: block;
}
.welcome__crown {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 24px !important;
  height: 24px !important;
  min-width: 24px;
  min-height: 24px;
  max-width: 24px;
  max-height: 24px;
  pointer-events: none;
  z-index: 10;
  display: block;
  /* Force gold color - override any inherited colors */
  color: #FFD700 !important; /* Gold color */
  /* Shadow effect */
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
  /* Ensure proper rendering on mobile */
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
  will-change: transform;
}

/* Today stats row */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  text-align: center;
}
.stat {
  display: grid;
  justify-items: center;
  gap: 6px;
}
.stat__icon {
  width: 28px;
  height: 28px; /* одинаковый размер для всех иконок */
}
.stat__val {
  font-weight: 800;
}
.stat__label {
  color: rgba(242, 242, 247, 0.75);
  font-size: var(--small-size);
}

/* Last workout card */
.workout__title {
  font-weight: 800;
  margin: 0 0 6px;
}
.workout__subtitle {
  color: rgba(242, 242, 247, 0.85);
}
.workout__meta {
  color: rgba(242, 242, 247, 0.75);
  font-size: var(--small-size);
}

/* Quick actions */
.card--no-padding {
  padding: 14px 0 !important;
  overflow: hidden;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  min-width: 0;
}

.quick-actions-scroll {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(242, 242, 247, 0.3) transparent;
  gap: 10px;
  padding: 0 14px 8px 14px;
  align-items: center;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  min-width: 0;
}

.quick-actions-scroll > * {
  flex-shrink: 0;
}

.quick-actions-scroll::-webkit-scrollbar {
  height: 2px;
}

.quick-actions-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.quick-actions-scroll::-webkit-scrollbar-thumb {
  background-color: rgba(242, 242, 247, 0.3);
  border-radius: 1px;
}

.qbtn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 8px;
  border-radius: var(--radius);
  border: 1px solid var(--muted);
  background: rgba(255, 255, 255, 0.04);
  color: var(--fg);
  text-decoration: none;
  font-weight: 700;
  box-shadow: var(--elev-1);
  transition: transform var(--anim-fast) var(--bezier), box-shadow var(--anim-fast) var(--bezier);
  min-height: 84px;
  min-width: 80px;
  width: 80px;
  max-width: 80px;
  text-align: center;
  word-break: break-word;
  position: relative;
  flex-shrink: 0;
  flex-grow: 0;
}
.qbtn:hover {
  box-shadow: var(--elev-2);
}
.qbtn:active {
  transform: scale(var(--tap-scale));
  box-shadow: var(--elev-1);
}
.qbtn__icon {
  width: 24px;
  height: 24px;
}
.qbtn__add {
  position: absolute;
  bottom: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  pointer-events: none;
  filter: brightness(0) invert(1);
  opacity: 0.95;
}
.qbtn__label {
  font-size: 14px;
  line-height: 1.15;
} /* чуть меньше текст */
.qbtn .stat__label {
  font-weight: 400;
  font-size: 11px;
  line-height: 1.2;
  margin-bottom: 16px;
}
.qbtn--round {
  width: 42px;
  height: 42px;
  min-width: 42px;
  min-height: 42px;
  max-height: 42px;
  border-radius: 50%;
  padding: 0;
  background: var(--fg);
  border: none;
  flex-shrink: 0;
  align-self: center;
}
.qbtn--round .qbtn__icon {
  filter: brightness(0);
}
.qbtn--plus .qbtn__icon {
  width: 24px;
  height: 24px;
}

/* Weekly bar chart (mock) */
.barcard__row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  align-items: end;
  gap: 8px;
  height: 120px;
  margin-top: 8px;
}
.bar {
  border-radius: 8px;
  background: var(--emerald);
  box-shadow: var(--elev-1);
}
.bar--1 {
  background: var(--emerald);
}
.bar--2 {
  background: var(--forest);
}
.bar--3 {
  background: var(--burnt);
}
.bar--4 {
  background: var(--coral);
}
.bar--5 {
  background: var(--midnight);
}
.bar--6 {
  background: linear-gradient(180deg, var(--emerald), var(--forest));
}
.bar--7 {
  background: linear-gradient(180deg, var(--burnt), var(--coral));
}
.barcard__labels {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  margin-top: 6px;
  color: rgba(242, 242, 247, 0.75);
  font-size: var(--small-size);
  text-align: center;
}

/* Bottom navigation */
.bottom-nav {
  position: sticky;
  bottom: 0;
  z-index: 20;
  background: rgba(44, 44, 46, 0.94);
  backdrop-filter: blur(6px);
  border-top: 1px solid rgba(242, 242, 247, 0.08);
  width: 100%;
  max-width: 100vw;
  overflow: hidden;
}
.bottom-nav__inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 8px 10px env(safe-area-inset-bottom);
  box-sizing: border-box;
  width: 100%;
}
.bn-list {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}
.bn-link {
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 8px 6px;
  border-radius: calc(var(--radius) - 8px);
  color: rgba(242, 242, 247, 0.9);
  text-decoration: none;
  transition: background var(--anim-fast) var(--bezier);
}
.bn-link:hover {
  background: rgba(255, 255, 255, 0.06);
}
.bn-icon {
  width: 20px;
  height: 20px;
}
.bn-label {
  font-size: 12px;
}

/* Make dark PNG icons light on dark background */
.stat__icon,
.qbtn__icon,
.bn-icon {
  filter: brightness(0) invert(1);
}

/* ===== Header right profile icon ===== */
.app-header__actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.profile-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(242, 242, 247, 0.18);
  box-shadow: var(--elev-1);
  object-fit: cover;
}
.profile-icon {
  filter: brightness(0) invert(1);
}

.bell-icon-notifyed {
  position: relative;
  display: inline-block;
  width: 28px;
  height: 28px;
}

.bell-icon-notifyed img {
  width: 28px;
  height: 28px;
  filter: brightness(0) invert(1);
  object-fit: contain;
}

.bell-icon-notifyed::after {
  content: '';
  position: absolute;
  top: 2px;
  right: 2px;
  width: 8px;
  height: 8px;
  background-color: #e55b5d;
  border-radius: 50%;
  border: 1.5px solid #2c2c2e;
  box-shadow: 0 0 2px rgba(229, 91, 93, 0.6);
}

/* ===== Second sticky strip under header (goal widget) ===== */
:root {
  --header-h: 56px;
  --subheader-h: 68px;
}

.app-subheader {
  position: sticky;
  top: var(--header-h);
  z-index: 18;
  background: rgba(44, 44, 46, 0.92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid rgba(242, 242, 247, 0.08);
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}
.app-subheader__inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 10px 20px;
  box-sizing: border-box;
  width: 100%;
}

/* Goal widget (non-scroll strip content) */
.goal-strip {
  display: grid;
  gap: 4px;
}
.goal-strip__top {
  font-weight: 800;
}
.goal-strip__bottom {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: rgba(242, 242, 247, 0.85);
  font-size: var(--small-size);
}
.goal-strip__accent {
  color: var(--primary);
  font-weight: 800;
}
.goal-strip__delta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.goal-strip__delta img {
  filter: brightness(0) invert(1);
  opacity: 0.9; /* чуть мягче, по вкусу */
}

/* Adjust main layout rows: header + subheader + scroll + bottom nav */
.main-page {
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
}

/* Give scroll area a bit more top padding is no longer needed;
   but keep bottom padding for bottom nav overlay */
.main-scroll {
  padding: 16px 20px 88px;
}

/* Responsive padding for mobile to prevent overflow */
@media (max-width: 480px) {
  .app-header__inner,
  .app-subheader__inner,
  .main-scroll {
    padding-left: 16px;
    padding-right: 16px;
  }
}

@media (max-width: 360px) {
  .app-header__inner,
  .app-subheader__inner,
  .main-scroll {
    padding-left: 12px;
    padding-right: 12px;
  }
  
  .quick-actions-scroll {
    padding-left: 12px;
    padding-right: 12px;
  }
  
  .card--no-padding {
    padding: 14px 0 !important;
  }
}

/* ===== Quick actions: 4 items + centered text ===== */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.qbtn {
  text-align: center;
}

/* ===== Tabs above chart (Week/Month/Year/All) ===== */
.seg-tabs {
  display: flex;
  gap: 18px;
  border-bottom: 1px solid rgba(242, 242, 247, 0.08);
  margin-bottom: 10px;
}
.seg-tab {
  position: relative;
  padding: 10px 2px 12px;
  color: rgba(242, 242, 247, 0.82);
  font-weight: 700;
  cursor: pointer;
  background: none;
  border: none; /* убираем рамку браузера */
  outline: none;
}
.seg-tab:focus-visible {
  box-shadow: 0 0 0 3px rgba(32, 211, 143, 0.28);
  border-radius: 6px;
}
.seg-tab:hover {
  color: #fff;
}
.seg-tab.is-active {
  color: #fff;
}
.seg-tab.is-active::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 3px 3px 0 0;
}

/* ===== Chart with norm line ===== */
.barcard {
  position: relative;
}
.chart-add-btn {
  position: absolute;
  bottom: 12px;
  right: 12px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(242, 242, 247, 0.15);
  transition: all 0.2s ease;
  z-index: 10;
  text-decoration: none;
}
.chart-add-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transform: scale(1.05);
}
.chart-add-btn:active {
  transform: scale(0.95);
}
.chart-add-btn img {
  width: 20px;
  height: 20px;
  filter: brightness(0) invert(1);
  opacity: 0.95;
}
.norm-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 0;
  border-top: 2px dashed rgba(242, 242, 247, 0.45);
  pointer-events: none;
}

.bar {
  transition: height 260ms var(--bezier);
}
/* ===== Bottom nav order is controlled in HTML (links updated) ===== */

/* ===== Training screen additions ===== */

/* Заголовок и подзаголовок-строка */
.page-head {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
}
.page-title {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
}
.subrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.subrow__left {
  color: rgba(242, 242, 247, 0.8);
  font-size: var(--small-size);
}
.subrow__right .btn {
  padding: 6px 12px;
  min-height: 36px;
  font-weight: 800;
}
.btn--small {
  min-height: 36px;
  padding: 6px 12px;
  font-weight: 800;
}

/* Недельный селектор (круглые кнопки с прогрессом) */
.week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  margin: 10px 0 14px;
}
.day {
  --p: 0; /* 0..100 — процент прогресса */
  --ring: 8; /* толщина кольца в px (для SVG stroke-width) */
  aspect-ratio: 1;
  width: 100%;
  max-width: 48px;
  border-radius: 999px;
  position: relative;
  border: 1px solid var(--muted);
  background: rgba(255, 255, 255, 0.04);
  box-shadow: var(--elev-1);
  color: var(--fg);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform var(--anim-fast) var(--bezier), box-shadow var(--anim-fast) var(--bezier);
}
.day:hover {
  box-shadow: var(--elev-2);
}
.day:active {
  transform: scale(var(--tap-scale));
}

/* SVG-кольцо — занимает всю кнопку, не мешает клику/тексту */
.ring {
  position: absolute;
  inset: 0;
  pointer-events: none;
  transform: rotate(-90deg); /* старт прогресса сверху */
}
.ring__track,
.ring__prog {
  fill: none;
}
.ring__track {
  stroke: rgba(242, 242, 247, 0.12); /* фоновое «пустое» кольцо */
  stroke-width: var(--ring);
}
.ring__prog {
  stroke: var(--primary); /* прогресс */
  stroke-width: var(--ring);
  stroke-linecap: round;
  stroke-dasharray: 100;
  stroke-dashoffset: calc(100 - var(--p)); /* магия прогресса */
}

/* текст в центре */
.day__inner {
  position: relative;
  z-index: 1;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 2px;
}
.day__dow {
  font-size: 10px;
  opacity: 0.85;
  line-height: 1;
}
.day__date {
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

/* текущий день — лёгкая подсветка фона + рамка */
.day--current {
  border-color: transparent;
  background: rgba(32, 211, 143, 0.14);
  box-shadow: 0 0 0 1px rgba(32, 211, 143, 0.35), var(--elev-1);
}

/* будущие дни — серые, без прогресса */
.day--disabled {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(242, 242, 247, 0.12);
  color: rgba(242, 242, 247, 0.6);
  cursor: default;
  box-shadow: none;
}
.day--disabled .ring__prog {
  stroke: transparent;
} /* скрываем прогресс вовсе */

@media (max-width: 380px) {
  .week {
    gap: 6px;
  }
  .day {
    max-width: 42px;
  }
}

/* Аккордеоны-шаблоны */
.acc {
  border: 1px solid var(--muted);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.04);
  box-shadow: var(--elev-1);
  padding: 0;
  max-width: var(--container);
  width: 100%;
}

.acc + .acc {
  margin-top: 10px;
}
.acc summary {
  list-style: none;
  cursor: pointer;
  padding: 14px;
  font-weight: 800;
  position: relative;
}
.acc summary::-webkit-details-marker {
  display: none;
}
.acc[open] summary {
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(242, 242, 247, 0.1);
}
.acc__body {
  padding: 12px 14px 14px;
  display: grid;
  gap: 10px;
}
.exercise {
  display: grid;
  gap: 4px;
  border: 1px dashed rgba(242, 242, 247, 0.18);
  border-radius: calc(var(--radius) - 6px);
  padding: 10px;
}
.exercise__title {
  font-weight: 700;
}
.exercise__desc {
  color: rgba(242, 242, 247, 0.85);
  font-size: var(--small-size);
}
.acc__actions {
  margin-top: 4px;
}

/* CTA: Создать новый шаблон */
.card--cta {
  border: 0;
  background: linear-gradient(0deg, rgba(32, 211, 143, 0.18), rgba(32, 211, 143, 0.18)),
    rgba(255, 255, 255, 0.04);
  box-shadow: 0 0 0 1px rgba(32, 211, 143, 0.35), var(--elev-1);
  position: relative;
  overflow: hidden;
}
.fab {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, var(--primary), var(--accent));
  border: none;
  box-shadow: var(--elev-2);
  transition: transform var(--anim-fast) var(--bezier), box-shadow var(--anim-fast) var(--bezier);
}
.fab img {
  width: 20px;
  height: 20px;
  filter: brightness(0) invert(1);
}
.fab:hover {
  box-shadow: var(--elev-3);
}
.fab:active {
  transform: scale(var(--tap-scale));
}

/* ===== Bottom nav: active state ===== */
.bn-link {
  position: relative;
}
.bn-link.is-active {
  color: #fff;
}
.bn-link.is-active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 28px;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 3px;
}

/* ===== Week selector as RINGS (thinner, 7-in-row fit) ===== */
.week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  margin: 10px 0 14px;
}

.day {
  --p: 0; /* 0..100 — процент прогресса */
  --ring: 6px; /* толщина кольца прогресса (синхронизируй с толщиной подчёркиваний) */
  aspect-ratio: 1; /* делает кнопку квадратной/круглой */
  width: 100%;
  max-width: 48px; /* чтобы все 7 поместились на узких экранах */
  border-radius: 999px;
  position: relative;
  border: 1px solid var(--muted);
  background: conic-gradient(var(--primary) calc(var(--p) * 1%), rgba(242, 242, 247, 0.12) 0)
    border-box; /* кольцо */
  box-shadow: var(--elev-1);
  color: var(--fg);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform var(--anim-fast) var(--bezier), box-shadow var(--anim-fast) var(--bezier);
}
.day:hover {
  box-shadow: var(--elev-2);
}
.day:active {
  transform: scale(var(--tap-scale));
}

/* внутренняя «заглушка», чтобы осталась только кольцевая полоса */
.day::before {
  content: '';
  position: absolute;
  inset: var(--ring);
  background: rgba(255, 255, 255, 0.04); /* фон внутри кольца */
  border-radius: inherit;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

/* текст поверх внутреннего круга */
.day__inner {
  position: relative;
  z-index: 1;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 2px;
}
.day__dow {
  font-size: 10px;
  opacity: 0.85;
  line-height: 1;
}
.day__date {
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

/* текущий день — акцентный фон (внутри кольца чуть подсвечиваем) */
.day--current {
  border-color: transparent;
  box-shadow: 0 0 0 1px rgba(32, 211, 143, 0.35), var(--elev-1);
}
.day--current::before {
  background: rgba(32, 211, 143, 0.14);
}

/* будущие дни — серые, без прогресса */
.day--disabled {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(242, 242, 247, 0.12);
  color: rgba(242, 242, 247, 0.6);
  cursor: default;
  box-shadow: none;
}
.day--disabled::before {
  background: rgba(255, 255, 255, 0.03);
}

/* На очень узких экранах делаем кольца чуть меньше */
@media (max-width: 380px) {
  .week {
    gap: 6px;
  }
  .day {
    max-width: 42px;
    --ring: 5px;
  }
  .day__dow {
    font-size: 9px;
  }
  .day__date {
    font-size: 11px;
  }
}

/* ===== Training: sticky header + sticky week ===== */
:root {
  --train-header-h: 68px;
  --train-week-h: 86px;
}

.train-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(44, 44, 46, 0.94);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid rgba(242, 242, 247, 0.08);
}
.train-header__inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 12px 20px;
}

.train-week {
  position: sticky;
  top: var(--train-header-h);
  z-index: 19;
  background: rgba(44, 44, 46, 0.94);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid rgba(242, 242, 247, 0.08);
}
.train-week__inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 10px 20px;
}

/* Прокручиваем только контент с карточками */
.train-scroll {
  max-width: var(--container);
  margin: 0 auto;
  padding: 14px 20px 96px;
}

/* ===== Week selector — TRUE rings via SVG; полностью убираем старый фон ===== */
.week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  margin: 0; /* управляем внешними отступами контейнеров */
}

/* СБРОС старых правил: убираем любой фон/псевдоэлементы */
.day {
  background: none !important; /* <-- критично, чтобы не было conic-gradient */
  position: relative;
  aspect-ratio: 1;
  width: 100%;
  max-width: 48px;
  border-radius: 999px;
  border: 1px solid var(--muted);
  box-shadow: var(--elev-1);
  color: var(--fg);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform var(--anim-fast) var(--bezier), box-shadow var(--anim-fast) var(--bezier);
}
.day::before {
  content: none !important;
} /* гасим старый inner-circle */

/* SVG кольца */
.ring {
  position: absolute;
  inset: 0;
  pointer-events: none;
  transform: rotate(-90deg);
}
.ring__track,
.ring__prog {
  fill: none;
}
.ring__track {
  stroke: rgba(242, 242, 247, 0.12);
  stroke-width: 8;
}
.ring__prog {
  stroke: var(--primary);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 100;
  stroke-dashoffset: calc(100 - var(--p));
}

.day__inner {
  position: relative;
  z-index: 1;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 2px;
}
.day__dow {
  font-size: 10px;
  opacity: 0.85;
  line-height: 1;
}
.day__date {
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

.day:hover {
  box-shadow: var(--elev-2);
}
.day:active {
  transform: scale(var(--tap-scale));
}

.day--current {
  border-color: transparent;
  background: rgba(32, 211, 143, 0.14);
  box-shadow: 0 0 0 1px rgba(32, 211, 143, 0.35), var(--elev-1);
}
.day--disabled {
  border: 1px solid rgba(242, 242, 247, 0.12);
  color: rgba(242, 242, 247, 0.6);
  box-shadow: none;
}
.day--disabled .ring__prog {
  stroke: transparent;
}

@media (max-width: 380px) {
  .week {
    gap: 6px;
  }
  .day {
    max-width: 42px;
  }
}

.acc + .card {
  margin-top: 12px;
}

/* ===== Training: единый sticky-контейнер для заголовка и недели ===== */
.train-top {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(44, 44, 46, 0.94);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid rgba(242, 242, 247, 0.08);
}

.train-header__inner,
.train-week__inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 12px 20px; /* одинаковые отступы */
}

/* тонкая разделительная линия между заголовком и неделей */
.train-week__inner {
  border-top: 1px solid rgba(242, 242, 247, 0.08);
  padding-top: 10px;
  padding-bottom: 10px;
}

/* убираем старые высоты/смещения, чтобы не было наложений */
.train-header,
.train-week {
  all: unset;
}

/* Размеры FAB как токены */
:root {
  --fab-size: 44px;
  --fab-gap: 12px;
}

/* Карточка-CTA: резервируем место под кнопку внизу-справа */
.card--cta {
  position: relative;
  padding: 14px;
  padding-right: calc(var(--fab-size) + var(--fab-gap) + 12px);
  padding-bottom: calc(var(--fab-size) + var(--fab-gap) + 8px);
}

/* Кнопка Добавить */
.fab {
  position: absolute;
  right: var(--fab-gap);
  bottom: var(--fab-gap);
  width: var(--fab-size);
  height: var(--fab-size);
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, var(--primary), var(--accent));
  border: none;
  box-shadow: var(--elev-2);
  transition: transform var(--anim-fast) var(--bezier), box-shadow var(--anim-fast) var(--bezier);
}
.fab img {
  width: 20px;
  height: 20px;
  filter: brightness(0) invert(1);
}

/* На очень узких экранах уменьшим FAB и запас */
@media (max-width: 380px) {
  :root {
    --fab-size: 40px;
    --fab-gap: 10px;
  }
}

/* ===== Start training screen ===== */

/* Общий базовый стиль для sticky headers */
.st-top,
.nu-top,
.al-top,
.pr-top,
.ai-top,
.ma-top {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(44, 44, 46, 0.94);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid rgba(242, 242, 247, 0.08);
}

.st-top__inner,
.nu-top__inner,
.al-top__inner,
.pr-top__inner,
.ai-top__inner,
.ma-top__inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 12px 20px;
  display: grid;
  gap: 6px;
}

.al-top__inner {
  padding: 12px 20px 8px;
}

.ma-top__inner {
  padding: 12px 20px;
}
.st-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.st-title {
  font-size: 20px;
  font-weight: 800;
  margin: 0;
}
.st-sub {
  color: rgba(242, 242, 247, 0.85);
  font-size: var(--small-size);
  display: flex;
  gap: 12px;
}
.st-timer {
  font-weight: 800;
  white-space: nowrap;
}

/* Scroll area for exercises */
.st-scroll {
  max-width: var(--container);
  margin: 0 auto;
  padding: 14px 20px 110px; /* reserve for bottom bar */
  display: grid;
  gap: 12px;
}

/* Exercise card */
.ex-card {
  border: 1px solid var(--muted);
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--radius);
  box-shadow: var(--elev-1);
  padding: 12px;
  display: grid;
  gap: 10px;
}
.ex-title {
  font-weight: 800;
  margin: 0;
}

/* Row 1: reps + weight + timer button + remove small button */
.ex-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto auto;
  align-items: center;
  gap: 8px;
}
.ex-row .input {
  min-height: 40px;
  padding: 10px 12px;
}

/* Small icon buttons */
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: calc(var(--radius) - 8px);
  border: 1px solid var(--muted);
  background: rgba(255, 255, 255, 0.04);
  box-shadow: var(--elev-1);
  cursor: pointer;
  transition: transform var(--anim-fast) var(--bezier), box-shadow var(--anim-fast) var(--bezier);
}
.icon-btn:hover {
  box-shadow: var(--elev-2);
}
.icon-btn:active {
  transform: scale(var(--tap-scale));
}
.icon-btn img {
  width: 18px;
  height: 18px;
  filter: brightness(0) invert(1);
}

/* Row 2: supersets toggle + add set + menu */
.ex-row2 {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
}

/* Toggle (switch) */
.switch {
  --w: 46px;
  --h: 26px;
  position: relative;
  width: var(--w);
  height: var(--h);
  border-radius: var(--h);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--muted);
  box-shadow: var(--elev-1) inset;
  transition: background var(--anim-fast) var(--bezier), border-color var(--anim-fast) var(--bezier);
}
.switch input {
  position: absolute;
  inset: 0;
  opacity: 0;
}
.switch__thumb {
  position: absolute;
  top: 50%;
  left: 4px;
  width: 22px;
  height: 22px;
  background: #fff;
  border-radius: 999px;
  transform: translateY(-50%);
  transition: left var(--anim-fast) var(--bezier);
}
.switch input:checked + .switch__thumb {
  left: calc(var(--w) - 4px - 22px);
}
.switch input:checked ~ .switch__bg {
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-color: transparent;
}
.switch__bg {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 1px solid var(--muted);
  background: rgba(255, 255, 255, 0.08);
  transition: background var(--anim-fast) var(--bezier), border-color var(--anim-fast) var(--bezier);
}

/* 'Суперсет' label next to switch */
.ss-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: var(--small-size);
  color: rgba(242, 242, 247, 0.9);
  font-weight: 700;
}

/* Big add button */
.btn--add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  font-weight: 800;
}
.btn--add img {
  width: 16px;
  height: 16px;
  filter: brightness(0) invert(1);
}

/* 'Добавить упражнения' full width */
.add-ex-btn {
  margin-top: 2px;
}

/* Fixed bottom bar with 'Finish' */
.st-bottom {
  position: sticky;
  bottom: 0;
  z-index: 21;
  background: rgba(44, 44, 46, 0.96);
  backdrop-filter: blur(6px);
  border-top: 1px solid rgba(242, 242, 247, 0.08);
}
.st-bottom__inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 10px 20px calc(env(safe-area-inset-bottom) + 10px);
}
/* Exercise row: time-only variant (duration + timer + delete) */
.ex-row--time {
  grid-template-columns: 1fr auto auto; /* один инпут + две маленькие кнопки */
}
/* Кнопка удаления: иконка жжёный оранжевый #CC7A33 */
.icon-btn--delete img {
  /* перекрашиваем чёрный PNG в #CC7A33 */
  filter: brightness(0) saturate(100%) invert(57%) sepia(26%) saturate(916%) hue-rotate(345deg)
    brightness(96%) contrast(98%);
}

/* Кнопка "Добавить": иконка должна быть ЧЁРНОЙ */
.btn--add img {
  filter: none; /* переопределяем ранее заданный инверт */
}

/* ===== Lunch screen ===== */
.nu-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.nu-title {
  font-size: 20px;
  font-weight: 800;
  margin: 0;
}
.nu-sub {
  color: rgba(242, 242, 247, 0.85);
  font-size: var(--small-size);
}

/* Sticky week band */
.nu-week {
  position: sticky;
  top: calc(0px + 56px); /* высота заголовка приблизительно; браузер посчитает */
  z-index: 19;
  background: rgba(44, 44, 46, 0.94);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid rgba(242, 242, 247, 0.08);
}
.nu-week__inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 10px 20px;
}

/* Scroll area */
.nu-scroll {
  max-width: var(--container);
  margin: 0 auto;
  padding: 14px 20px 96px;
  display: grid;
  gap: 12px;
}

/* Totals (КБЖУ) — кликабельная карточка с пончиком справа */
.nut-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  text-decoration: none;
  color: var(--fg);
}
.nut-card:hover {
  box-shadow: var(--elev-2);
}
.nut-card__title {
  font-weight: 800;
  margin: 0 0 6px 0;
}
.nut-card__sub {
  color: rgba(242, 242, 247, 0.82);
  font-size: var(--small-size);
}

/* Donut (multi-rings) */
.donut {
  width: 120px;
  height: 120px;
}
.donut circle {
  fill: none;
}
.donut__cal {
  stroke: var(--burnt);
  stroke-width: 10;
}
.donut__pro {
  stroke: var(--emerald);
  stroke-width: 10;
}
.donut__fat {
  stroke: var(--coral);
  stroke-width: 10;
}
.donut__car {
  stroke: var(--forest);
  stroke-width: 10;
}
.donut__track {
  stroke: rgba(242, 242, 247, 0.12);
  stroke-width: 10;
}
.donut .ring {
  stroke-dasharray: 100;
  stroke-dashoffset: 0;
  stroke-linecap: round;
}
.donut .ring.val {
  stroke-dashoffset: calc(100 - var(--val, 0));
}

/* Meal card с мини-графиком и плюсом справа */
.meal-card {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
}
.meal-title {
  font-weight: 800;
  margin: 0 0 6px;
}
.meal-sub {
  color: rgba(242, 242, 247, 0.82);
  font-size: var(--small-size);
}

/* Mini bars: настраиваемая ширина — var(--mini-w, 100px) */
.mini {
  --mini-w: 100px; /* 👉 менять прямо в HTML при желании */
  width: var(--mini-w);
  display: grid;
  gap: 6px;
  position: relative;
}
.mini__row {
  height: 6px;
  border-radius: 6px;
  background: rgba(242, 242, 247, 0.12);
  position: relative;
  overflow: hidden;
}
.mini__bar {
  height: 100%;
  width: var(--w, 0%);
  background: var(--emerald);
}
.mini__bar--cal {
  background: var(--burnt);
}
.mini__bar--pro {
  background: var(--emerald);
}
.mini__bar--fat {
  background: var(--coral);
}
.mini__bar--car {
  background: var(--forest);
}

/* Вертикальная линия «норма» */
.mini__norm {
  position: absolute;
  top: -4px;
  bottom: -4px;
  width: 0;
  border-left: 2px dashed rgba(242, 242, 247, 0.6);
  left: var(--norm, 60%); /* по умолчанию 60% */
  pointer-events: none;
}

/* Плюс-кнопка справа */
.meal-plus {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, var(--primary), var(--accent));
  box-shadow: var(--elev-2);
}
.meal-plus img {
  width: 20px;
  height: 20px;
  filter: brightness(0) invert(1);
}

/* Детализация блюд (раскрывашка) */
.meal-acc summary {
  list-style: none;
  cursor: pointer;
  padding: 14px;
  font-weight: 800;
  border-bottom: 1px solid rgba(242, 242, 247, 0.1);
}
.meal-acc summary::-webkit-details-marker {
  display: none;
}
.meal-acc__body {
  padding: 10px 14px 14px;
  display: grid;
  gap: 10px;
}
.meal-item {
  display: grid;
  gap: 2px;
  border: 1px dashed rgba(242, 242, 247, 0.18);
  border-radius: calc(var(--radius) - 6px);
  padding: 10px;
}
.meal-item__title {
  font-weight: 700;
}
.meal-item__meta {
  color: rgba(242, 242, 247, 0.85);
  font-size: var(--small-size);
}

/* КБЖУ: текст к верху, а не по центру */
.nut-card {
  align-items: flex-start;
  margin-bottom: 10px;
  /* width: 400px; */
}

/* КБЖУ: кольца — поворачиваем старт наверх и гарантируем заливку значением */
.donut {
  width: 120px;
  height: 120px;
  transform: rotate(-90deg);
} /* старт сверху */
.donut circle {
  fill: none;
}
.donut__track {
  stroke: rgba(242, 242, 247, 0.12);
  stroke-width: 10;
}

.donut__cal {
  stroke: var(--burnt);
  stroke-width: 10;
}
.donut__pro {
  stroke: var(--emerald);
  stroke-width: 10;
}
.donut__fat {
  stroke: var(--coral);
  stroke-width: 10;
}
.donut__car {
  stroke: var(--forest);
  stroke-width: 10;
}

/* прогресс в процентах через pathLength */
.donut .ring {
  stroke-linecap: round;
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
}
.donut .ring.val {
  stroke-dashoffset: calc(100 - var(--val, 0));
}
/* Не даём ничему «серить» SVG-пончики */
.donut {
  filter: none !important;
}

/* ===== Add Lunch screen ===== */
.al-title {
  margin: 0 0 6px 0;
  font-size: 20px;
  font-weight: 800;
}

/* Reuse tabs style, but a bit tighter */
.al-tabs {
  display: flex;
  gap: 18px;
  border-bottom: 1px solid rgba(242, 242, 247, 0.08);
}
.al-tab {
  position: relative;
  padding: 10px 2px 12px;
  color: rgba(242, 242, 247, 0.82);
  font-weight: 700;
  background: none;
  border: none;
  cursor: pointer;
}
.al-tab:hover {
  color: #fff;
}
.al-tab.is-active {
  color: #fff;
}
.al-tab.is-active::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 3px 3px 0 0;
}

/* Scroll list */
.al-scroll {
  max-width: var(--container);
  margin: 0 auto;
  padding: 12px 20px 120px; /* place for bottom actions */
  display: grid;
  gap: 10px;
}

/* Food item card */
.food-card {
  border: 1px solid var(--muted);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.04);
  box-shadow: var(--elev-1);
  padding: 12px;
  display: grid;
  gap: 4px;
}
.food-title {
  font-weight: 800;
  margin: 0;
}
.food-meta {
  color: rgba(242, 242, 247, 0.85);
  font-size: var(--small-size);
}

/* Bottom actions (3 big buttons) */
.al-bottom {
  position: sticky;
  bottom: 0;
  z-index: 21;
  background: rgba(44, 44, 46, 0.96);
  backdrop-filter: blur(6px);
  border-top: 1px solid rgba(242, 242, 247, 0.08);
}
.al-bottom__inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 10px 20px calc(env(safe-area-inset-bottom) + 10px);
}
.capture-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.cap-btn {
  border: 1px solid var(--muted);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.04);
  box-shadow: var(--elev-1);
  text-decoration: none;
  color: var(--fg);
  display: grid;
  grid-template-rows: auto 1fr auto; /* заголовок наверху, иконка внизу */
  justify-items: center;
  min-height: 130px;
  padding: 10px;
  transition: transform var(--anim-fast) var(--bezier), box-shadow var(--anim-fast) var(--bezier);
}
.cap-btn:hover {
  box-shadow: var(--elev-2);
}
.cap-btn:active {
  transform: scale(var(--tap-scale));
}
.cap-label {
  font-weight: 800;
  text-align: center;
  margin-top: 2px;
}
.cap-icon {
  width: 48px;
  height: 48px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, var(--primary), var(--accent));
  box-shadow: var(--elev-2);
  margin-top: 8px;
}
.cap-icon img {
  width: 22px;
  height: 22px;
  filter: brightness(0) invert(1);
}

@media (max-width: 380px) {
  .cap-icon {
    width: 44px;
    height: 44px;
  }
  .cap-btn {
    min-height: 120px;
  }
}

/* Расширяем карточку еды на всю ширину и даём правый столбец под кнопку */
.food-card {
  display: grid;
  grid-template-columns: 1fr auto; /* текст слева, круглая кнопка справа */
  align-items: center;
  gap: 12px;
  width: 100%;
}

/* Круглая кнопка добавления в карточке */
.food-add {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, var(--primary), var(--accent));
  box-shadow: var(--elev-2);
}
.food-add img {
  width: 20px;
  height: 20px;
  filter: brightness(0) invert(1);
}

/* Чуть плотнее текст внутри карточки */
.food-title {
  margin: 0 0 2px;
}

/* ===== Meal Added screen ===== */
.ma-title {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
}

.ma-scroll {
  max-width: var(--container);
  margin: 0 auto;
  padding: 14px 20px 110px; /* запас под нижнюю кнопку */
  display: grid;
  gap: 12px;
  text-align: center;
}

.meal-photo {
  display: block;
  width: 100%;
  max-width: 360px;
  border-radius: var(--radius);
  margin: 0 auto;
  object-fit: cover;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--muted);
  box-shadow: var(--elev-1);
}

.ma-kcal {
  font-size: 18px;
  font-weight: 800;
  margin-top: 6px;
}
.ma-macros {
  color: rgba(242, 242, 247, 0.85);
}
.ma-progress {
  color: var(--fg);
  font-weight: 700;
}

/* Переиспользуем нижнюю панель из тренировки */
.st-bottom {
  position: sticky;
  bottom: 0;
  z-index: 21;
  background: rgba(44, 44, 46, 0.96);
  backdrop-filter: blur(6px);
  border-top: 1px solid rgba(242, 242, 247, 0.08);
}
.st-bottom__inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 10px 20px calc(env(safe-area-inset-bottom) + 10px);
}

/* ===== Universal back block ===== */
.backbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px; /* подгони при необходимости */
}

.backbtn {
  -webkit-tap-highlight-color: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px; /* удобная зона касания */
  height: 40px;
  border: 0;
  background: transparent; /* фона нет */
  cursor: pointer;
  transition: transform var(--anim-fast) var(--bezier), opacity var(--anim-fast) var(--bezier);
}
.backbtn:active {
  transform: scale(var(--tap-scale));
  opacity: 0.85;
}
.backbtn img {
  width: 20px;
  height: 20px;
  /* делаем PNG белым */
  filter: brightness(0) invert(1);
}

/* (опционально) липкая версия: закрепить сверху */
.backbar--sticky {
  position: sticky;
  top: 0;
  z-index: 22;
  background: transparent; /* можно поставить rgba(...) если нужен фон */
  padding-top: env(safe-area-inset-top);
}

.titlebar {
  position: relative;
  padding: 12px 20px;
  text-align: center; /* заголовок по центру */
}
.backbtn--abs {
  position: absolute;
  left: 20px; /* отступ слева */
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px; /* фиксируем ширину/высоту */
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.backbtn--abs img {
  width: 20px;
  height: 20px;
  filter: brightness(0) invert(1);
}

/* Шапка тренировки: фиксированный слот под "назад" = 64px */
.st-row {
  display: grid;
  grid-template-columns: 20px 1fr auto; /* ⬅️ 64px под кнопку, центр — заголовок, справа — таймер */
  align-items: center;
  gap: 16px;
}

/* Кнопка "назад": занимает ровно 64px, даже если иконка маленькая */
.backbtn {
  -webkit-tap-highlight-color: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start; /* иконка прижата влево внутри слота */
  width: 20px; /* ⬅️ фикс */
  height: 40px; /* удобная зона касания */
  border: 0;
  background: transparent;
  cursor: pointer;
}
.backbtn img {
  width: 20px;
  height: 20px;
  filter: brightness(0) invert(1); /* белая иконка для тёмной темы */
}

/* Явно укажем колонки для заголовка и таймера,
   чтобы при отсутствии .backbtn слева всё равно оставался 64px отступ */
.st-row > .st-title {
  grid-column: 2;
}
.st-row > .st-timer {
  grid-column: 3;
}

/* ===== AI Coach ===== */
.ai-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.ai-title {
  font-size: 20px;
  font-weight: 800;
  margin: 0;
}
.ai-sub {
  color: rgba(242, 242, 247, 0.85);
  font-size: var(--small-size);
}

/* Menu line under header */
.ai-menu {
  position: sticky;
  top: 64px; /* приблизительная высота заголовка; браузер подстроит */
  z-index: 19;
  background: rgba(44, 44, 46, 0.94);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid rgba(242, 242, 247, 0.08);
}
.ai-menu__inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 8px 20px;
  display: flex;
  align-items: center;
}

/* Hamburger button */
.menu-btn {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--anim-fast) var(--bezier), opacity var(--anim-fast) var(--bezier);
}
.menu-btn:active {
  transform: scale(var(--tap-scale));
  opacity: 0.9;
}
.menu-btn img {
  width: 22px;
  height: 22px;
  filter: brightness(0) invert(1);
}

/* Scroll area */
.ai-scroll {
  max-width: var(--container);
  margin: 0 auto;
  padding: 14px 20px 96px;
  display: grid;
  gap: 12px;
}

/* Sections */
.ai-card {
  padding: 14px;
}
.ai-card .card__title {
  margin: 0 0 6px;
}
.ai-text {
  color: rgba(242, 242, 247, 0.9);
}

/* 2x2 actions */
.ai-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.ai-act {
  display: grid;
  place-items: center;
  text-align: center;
  min-height: 88px;
  font-weight: 800;
  border: 1px solid var(--muted);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.04);
  box-shadow: var(--elev-1);
  transition: transform var(--anim-fast) var(--bezier), box-shadow var(--anim-fast) var(--bezier);
  text-decoration: none;
  color: var(--fg);
}
.ai-act:hover {
  box-shadow: var(--elev-2);
}
.ai-act:active {
  transform: scale(var(--tap-scale));
}

/* Question box */
.ai-question .input {
  min-height: 48px;
  padding: 12px 14px;
}

/* ===== Drawer (sandwich menu) ===== */
.drawer {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: none;
}
.drawer.is-open {
  display: block;
}
.drawer__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
}
.drawer__panel {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: min(86vw, 360px);
  background: rgba(44, 44, 46, 0.98);
  border-right: 1px solid rgba(242, 242, 247, 0.08);
  box-shadow: var(--elev-3);
  display: grid;
  grid-template-rows: auto 1fr auto;
}

/* Drawer header */
.drawer__head {
  padding: 12px 16px;
  font-weight: 800;
  border-bottom: 1px solid rgba(242, 242, 247, 0.08);
}

/* Scrollable history */
.drawer__history {
  overflow: auto;
  padding: 10px 12px;
  display: grid;
  gap: 8px;
}
.hist-item {
  border: 1px solid var(--muted);
  border-radius: calc(var(--radius) - 8px);
  padding: 10px;
  background: rgba(255, 255, 255, 0.04);
}
.hist-title {
  font-weight: 700;
  margin: 0 0 6px;
}
.hist-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* Tags (chips) */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--muted);
  background: rgba(255, 255, 255, 0.04);
  font-size: 12px;
  font-weight: 700;
}

/* Fixed tag cloud at bottom (non-scroll) */
.drawer__tags {
  padding: 10px 12px 14px;
  border-top: 1px solid rgba(242, 242, 247, 0.08);
}
.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* --- компактные карточки истории --- */
.hist-item {
  border: 1px solid var(--muted);
  border-radius: calc(var(--radius) - 8px);
  padding: 8px 10px; /* меньше отступов */
  background: rgba(255, 255, 255, 0.04);
  line-height: 1.3; /* плотнее текст */
}
.hist-title {
  font-weight: 700;
  margin: 0 0 4px;
  color: #fff;
}
.hist-text {
  font-size: 13px;
  color: rgba(242, 242, 247, 0.85);
  margin-bottom: 6px;
}
.hist-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* История: контейнер без растяжений строк */
.drawer__history {
  display: block; /* вместо grid/flex */
  padding: 10px 12px;
  overflow: auto;
}

/* Карточка = только по содержимому */
.hist-item {
  display: inline-grid; /* гарантируем auto-height */
  grid-auto-rows: min-content;
  align-content: start;
  justify-items: start;
  width: 100%;
  margin: 8px 0;
  padding: 8px 10px;
  border: 1px solid var(--muted);
  border-radius: calc(var(--radius) - 8px);
  background: rgba(255, 255, 255, 0.04);
  line-height: 1.3;
  height: auto !important;
  min-height: 0 !important;
}

/* Внутренние отступы/маргины компактные */
.hist-title {
  margin: 0 0 4px;
  font-weight: 700;
}
.hist-text {
  margin: 0 0 6px;
  font-size: 13px;
  color: rgba(242, 242, 247, 0.85);
}
.hist-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
}

/* ===== Progress screen ===== */
.pr-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.pr-title {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
}
.pr-sub {
  color: rgba(242, 242, 247, 0.85);
  font-size: var(--small-size);
}

/* Sticky week selector */
.pr-week {
  position: sticky;
  top: 64px;
  z-index: 19;
  background: rgba(44, 44, 46, 0.94);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid rgba(242, 242, 247, 0.08);
}
.pr-week__inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 10px 20px;
}

/* Range tabs */
.pr-tabs {
  position: sticky;
  top: 94px;
  z-index: 18;
  background: rgba(44, 44, 46, 0.94);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid rgba(242, 242, 247, 0.08);
}
.pr-tabs__inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 8px 20px;
}
.pr-seg {
  display: flex;
  gap: 18px;
}
.pr-seg .seg-tab {
  background: none;
  border: none;
  padding: 10px 2px 12px;
  font-weight: 700;
  color: rgba(242, 242, 247, 0.82);
}
.pr-seg .seg-tab.is-active {
  color: #fff;
}
.pr-seg .seg-tab.is-active::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 3px 3px 0 0;
}

/* Scroll area */
.pr-scroll {
  max-width: var(--container);
  margin: 0 auto;
  padding: 14px 20px 96px;
  display: grid;
  gap: 12px;
}

/* 1) Weight bars */
.weight {
  position: relative;
  height: 160px;
  display: grid;
  align-items: end;
  gap: 10px;
  grid-template-columns: repeat(7, 1fr);
}
.wbar {
  background: linear-gradient(180deg, var(--forest), var(--emerald));
  border-radius: 8px;
  box-shadow: var(--elev-1);
  height: var(--h, 50%);
  transition: height 260ms var(--bezier);
}
.weight__norm {
  position: absolute;
  left: 0;
  right: 0;
  bottom: var(--at, 60%);
  border-top: 2px dashed rgba(242, 242, 247, 0.85);
  pointer-events: none;
}

/* 2) Nutrition lines (SVG) */
.nutlines {
  width: 100%;
  height: 180px;
}
.path-cal {
  stroke: var(--burnt);
  stroke-width: 2.5;
  fill: none;
}
.path-pro {
  stroke: var(--emerald);
  stroke-width: 2.5;
  fill: none;
}
.path-fat {
  stroke: var(--coral);
  stroke-width: 2.5;
  fill: none;
}
.path-car {
  stroke: var(--forest);
  stroke-width: 2.5;
  fill: none;
}
.path-grid {
  stroke: rgba(242, 242, 247, 0.12);
  stroke-width: 1;
  fill: none;
}

/* 3) Walking rings (blue theme) */
.walk .ring__prog {
  stroke: var(--coral);
} /* другой цвет, чем у недельного селектора */

/* 4) Workout time buttons */
.workrow {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}
.wbtn {
  --p: 0; /* 0..100 */
  min-height: 42px;
  border-radius: calc(var(--radius) - 6px);
  border: 1px solid var(--muted);
  text-align: center;
  font-weight: 800;
  background: linear-gradient(
    90deg,
    var(--emerald) calc(var(--p) * 1%),
    rgba(255, 255, 255, 0.04) 0
  );
  box-shadow: var(--elev-1);
  display: grid;
  place-items: center;
}
.wbtn--off {
  background: rgba(255, 255, 255, 0.04);
  color: rgba(242, 242, 247, 0.6);
}

/* 5) Goal dynamics */
.goal-lines {
  width: 100%;
  height: 180px;
}
.path-trend {
  stroke: rgba(242, 242, 247, 0.55);
  stroke-width: 2;
  stroke-dasharray: 6 6;
  fill: none;
}
.goal-norm {
  stroke: rgba(242, 242, 247, 0.9);
  stroke-width: 2;
  stroke-dasharray: 6 6;
  fill: none;
}

/* Cards unify */
.card .card__title {
  margin: 0 0 8px;
}
.chart-panel {
  display: none;
  min-height: 180px;
}
.chart-panel.is-active {
  display: block;
}
/* Контейнер под Plotly-пончик в карточке КБЖУ */
.donut-plot {
  width: 120px;
  height: 120px;
}
.meal-chart {
  width: 200px;
  height: 160px;
  margin-top: 8px;
}
/* Карточка еды: сетка 1fr + колонка под кнопку */
.meal-card {
  display: grid;
  grid-template-columns: 1fr 56px; /* график слева, плюс справа */
  grid-auto-rows: min-content;
  align-items: start;
  gap: 10px;
}

/* Заголовок наверху слева */
.meal-header {
  grid-column: 1;
  grid-row: 1;
}
.meal-title {
  margin: 0;
}

/* График под заголовком, растягивается по ширине левого столбца */
.meal-chart {
  grid-column: 1;
  grid-row: 2;
  width: 100%;
  height: 160px;
}

/* Плюс — справа, по центру по вертикали */
.meal-plus {
  grid-column: 2;
  grid-row: 1 / span 2;
  justify-self: end;
  align-self: center;
  width: 44px;
  height: 44px;
}

/* Страховка для Plotly, чтобы не ужимал контейнер и не «уползал» вправо */
.meal-chart .js-plotly-plot {
  width: 100% !important;
  height: 100% !important;
}
/* Сжать карточку "Завтрак" до содержимого */
.meal-card {
  padding: 10px 12px; /* вместо больших внутренних отступов */
  gap: 8px; /* поменьше зазор между строками */
  min-height: auto; /* убираем возможные глобальные min-height */
}

/* Сжать сам график */
.meal-chart {
  height: 70px; /* было 160px — делаем компактнее */
}

/* Подстрахуем Plotly, чтобы не раздувал контейнер */
.meal-chart .js-plotly-plot {
  width: 100% !important;
  height: 100% !important;
}
.meal-chart .svg-container {
  width: 100% !important;
  height: 100% !important;
}
/* карточка: заголовок = 1-й ряд, график = 2-й ряд (растягиваем) */
.meal-card {
  display: grid;
  grid-template-columns: 1fr 56px;
  grid-template-rows: auto 1fr; /* второй ряд занимает доступную высоту */
  align-items: start;
}

/* график остаётся во 2-м ряду */
.meal-chart {
  grid-column: 1;
  grid-row: 2;
  height: 70px; /* как у тебя */
}

/* кнопка справа, во 2-м ряду, прижата к низу */
.meal-plus {
  grid-column: 2;
  grid-row: 2;
  align-self: end; /* ⬅️ прижим вниз */
  justify-self: end;
}
.workout-card {
  display: block;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.workout-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

/* Раскладываем полосу цели: текст слева, кнопка справа */
.app-subheader__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* Пусть левая часть тянется, а кнопка не ломает переносы */
.goal-strip {
  flex: 1 1 auto;
  min-width: 0;
}

/* Акцентная кнопка (если уже есть .btn/.btn--primary — можно использовать их)
   Палитра: изумрудный → лесной зелёный */
.btn.goal-btn {
  text-decoration: none;
  white-space: nowrap;
}
.btn--accent {
  background: linear-gradient(90deg, #20d38f, #1bb978);
  color: #0b0b0c; /* читаемый на зелёном */
  border: 1px solid rgba(242, 242, 247, 0.14);
  box-shadow: 0 2px 8px rgba(32, 211, 143, 0.25);
}
.btn--accent:hover {
  transform: translateY(-1px);
}
.btn--sm {
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
}

.range-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
}
.iconbtn {
  background: none;
  border: none;
  padding: 6px;
  cursor: pointer;
  line-height: 0;
}
.iconbtn img {
  width: 20px;
  height: 20px;
  filter: brightness(0) invert(1); /* перекрасить чёрную иконку в цвет текста */
  opacity: 0.9;
}
.range-nav__label {
  flex: 1 1 auto;
  text-align: center;
  font-weight: 400;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Общая строка с табами и кнопкой "Сегодня" */
.seg-tabs-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px; /* можно подрегулировать расстояние до блока ниже */
}

/* Контейнер с табами */
.seg-tabs {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Кнопка "Сегодня" */
.today-btn {
  font-size: 13px;
  line-height: 1;
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid rgba(242, 242, 247, 0.14);
  background: linear-gradient(90deg, #20d38f, #1bb978);
  color: #0b0b0c;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(32, 211, 143, 0.25);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  white-space: nowrap;
  min-height: auto;
}
.today-btn:hover {
  transform: translateY(-1px);
}
:root {
  --bn-h: 72px; /* высота нижнего меню */
}

/* сам бар — фиксируем к низу экрана */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--bn-h);
  background: #2c2c2e; /* цвет фона твоей темы */
  border-top: 1px solid rgba(242, 242, 247, 0.08);
  z-index: 1000; /* выше карточек/скролла */
  padding-bottom: env(safe-area-inset-bottom); /* iOS вырез */
  width: 100%;
  max-width: 100vw;
  overflow: hidden;
}

/* внутренности — по центру, без переполнения */
.bottom-nav__inner {
  max-width: 900px; /* если используешь контейнер */
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  box-sizing: border-box;
  width: 100%;
  justify-content: center;
}

.bn-list {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  width: 100%;
  padding: 0 12px;
}

.bn-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-decoration: none;
  color: #f2f2f7;
}

/* иконки + подписи как у тебя */
.bn-icon {
  width: 22px;
  height: 22px;
  filter: brightness(0) invert(1);
  opacity: 0.9;
}
.bn-label {
  font-size: 11px;
  opacity: 0.9;
}

.bn-link.is-active .bn-label {
  opacity: 1;
  font-weight: 600;
}

.week-rings {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
}

.rings-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  flex: 1;
  overflow-x: auto;
}

/* Унифицированные стили для кнопок и контейнеров */
.iconbtn {
  background: none;
  border: none;
  padding: 6px;
  cursor: pointer;
  line-height: 0;
}
.iconbtn img {
  width: 20px;
  height: 20px;
  filter: brightness(0) invert(1);
  opacity: 0.9;
}
.iconbtn:disabled {
  opacity: 0.4;
  pointer-events: none;
}

.btn-today {
  background: var(--accent-color, #20d38f);
  color: #000;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  padding: 3px 10px;
  cursor: pointer;
  visibility: visible;
  white-space: nowrap;
}
.btn-today.hidden {
  visibility: hidden;
}
.hidden {
  display: none !important;
}

.week-rings {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  width: 100%;
  box-sizing: border-box;
}

.week-rings__toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 28px;
  width: 100%;
  box-sizing: border-box;
  margin-top: 8px;
  margin-bottom: 6px;
  gap: 8px;
}

.week-rings__right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.week-rings__row {
  width: 100%;
  box-sizing: border-box;
  display: block;
}

.rings-wrapper {
  display: flex;
  flex-direction: column;
  flex: 1 0 auto;
  min-width: 0;
  align-items: center;
}

.rings-header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  height: 28px;
  width: 100%;
  margin-bottom: 4px;
}

.rings-header__spacer {
  flex: 1;
}

.rings-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex: 1 0 auto;
  width: 100%;
  min-width: 0;
  overflow: hidden;
}

.rings-container > div {
  cursor: pointer;
  flex: 0 0 auto;
}

.rings-container > div:focus {
  outline: 2px solid rgba(255, 255, 255, 0.25);
  outline-offset: 2px;
}

/* Fix: week-rings шириной как у остальных виджетов (train-scroll) */
.week-rings.container {
  /* max-width: var(--container); */
  max-width: 400px;
  margin-inline: auto;
  padding-inline: 4px; /* как у .train-scroll */
}

/* Унифицированные стили для карточек питания */
.nut-card__sub table {
  width: 100%;
  border-collapse: collapse;
}

.nut-card__sub td {
  padding: 6px 0;
  vertical-align: middle;
}

.nut-card__sub tr > td:first-child {
  width: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nut-icon {
  width: 14px;
  height: 14px;
  display: block;
  object-fit: contain;
}

.nut-card .nut-icon {
  filter: none;
}

.nut-icon--train {
  filter: brightness(0) saturate(100%) invert(52%) sepia(42%) saturate(1575%) hue-rotate(330deg)
    brightness(88%) contrast(79%) !important;
}

.nut-icon--steps {
  filter: brightness(0) saturate(100%) invert(99%) sepia(81%) saturate(800%) hue-rotate(90deg)
    brightness(79%) contrast(79%) !important;
}

.nut-icon--sleep {
  filter: brightness(0) saturate(100%) invert(49%) sepia(19%) saturate(1475%) hue-rotate(202deg)
    brightness(82%) contrast(117%) !important;
}

.nut-warn {
  width: 16px;
  height: 16px;
  display: block;
  color: #999;
  object-fit: contain;
}

.nut-warn--clr {
  filter: brightness(0) saturate(100%) invert(48%) sepia(19%) saturate(1550%) hue-rotate(310deg)
    brightness(84%) contrast(119%);
}

.nut-dot {
  width: 14px;
  height: 14px;
  display: inline-block;
  background-color: currentColor;
  -webkit-mask: url('./icons/small_circle.png') no-repeat center / contain;
  mask: url('./icons/small_circle.png') no-repeat center / contain;
  color: #999;
}

.nut-dot--train {
  color: #ff7a00;
}

.nut-dot--steps {
  color: #22c55e;
}

.nut-dot--sleep {
  color: #6366f1;
}

/* Базовая точка */
.dot {
  --dot-size: 14px; /* размер точки */
  --dot-color: #999; /* цвет по умолчанию */

  width: var(--dot-size);
  height: var(--dot-size);
  display: inline-block;
  border-radius: 50%;
  background: var(--dot-color);
  flex: 0 0 auto;
}

.dot--train,
.dot--cal {
  --dot-color: var(--burnt);
}
.dot--steps,
.dot--prot {
  --dot-color: var(--forest);
}
.dot--sleep,
.dot--carb {
  --dot-color: var(--fitaiblue);
}
.dot--fat {
  --dot-color: var(--coral);
}

/* (опционально) тонкое кольцо-обводка для контраста в тёмной теме */
.dot--ring {
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15);
}

/**********************************/

/* ===== Notifications ===== */
.food-card.notification-new {
  position: relative;
}

.food-card.notification-new .food-title {
  font-weight: 700;
}

.food-card.notification-read .food-title {
  font-weight: 400;
}

.notification-icon {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 20px;
  height: 20px;
  display: block;
  flex-shrink: 0;
}

.notification-icon path {
  fill: var(--accent);
}

/* ===== Profile Page Styles ===== */
.profile-header {
  position: relative;
  padding: 12px 0 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}

.profile-avatar-wrapper {
  position: relative;
  width: 120px;
  height: 120px;
  margin-bottom: 8px;
}

.profile-avatar {
  width: 120px;
  height: 120px;
  border-radius: 999px;
  overflow: visible;
  border: 2px solid rgba(242, 242, 247, 0.18);
  box-shadow: var(--elev-1);
  position: relative;
  background: transparent;
}

.profile-avatar > img:first-child {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 999px;
  display: block;
}

.profile-crown {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 28px !important;
  height: 28px !important;
  min-width: 28px;
  min-height: 28px;
  max-width: 28px;
  max-height: 28px;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3)) brightness(0) saturate(100%) invert(83%)
    sepia(100%) saturate(1000%) hue-rotate(10deg) brightness(110%) contrast(120%);
  z-index: 2;
}

.profile-edit-btn {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent, #20d38f);
  border: 2px solid var(--bg, #2c2c2e);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--elev-2);
  cursor: pointer;
  transition: transform var(--anim-fast, 0.2s) var(--bezier, ease);
  z-index: 3;
}

.profile-edit-btn:active {
  transform: scale(0.95);
}

.profile-edit-btn img {
  width: 18px;
  height: 18px;
  filter: brightness(0) invert(1);
}

.profile-name {
  font-size: 22px;
  font-weight: 700;
  margin: 0;
  color: var(--fg, #f2f2f7);
  text-align: center;
}

.profile-email {
  font-size: 16px;
  font-weight: 400;
  margin: 0;
  color: rgba(242, 242, 247, 0.7);
  text-align: center;
}

.profile-birthday {
  font-size: 16px;
  text-align: center;
  margin: 0;
}

.profile-birthday strong {
  font-weight: 700;
  color: var(--fg, #f2f2f7);
}

.profile-birthday span {
  font-weight: 400;
  color: rgba(242, 242, 247, 0.7);
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--muted, rgba(242, 242, 247, 0.08));
  border: 1px solid var(--muted, rgba(242, 242, 247, 0.08));
  border-radius: var(--radius, 12px);
  overflow: hidden;
  margin: 20px 20px 0;
  padding: 0;
}

.profile-stat-item {
  background: rgba(255, 255, 255, 0.04);
  padding: 16px 12px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.profile-stat-label {
  font-size: 14px;
  color: rgba(242, 242, 247, 0.7);
  font-weight: 400;
}

.profile-stat-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--fg, #f2f2f7);
}

.profile-form-section {
  padding: 0;
}

/* Навигационные кнопки профиля */
.profile-nav-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 46px;
  padding: 14px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--muted, rgba(242, 242, 247, 0.08));
  border-radius: var(--radius, 12px);
  color: var(--fg, #f2f2f7);
  text-decoration: none;
  cursor: pointer;
  transition: border-color var(--anim-fast, 0.2s) var(--bezier, ease),
    box-shadow var(--anim-fast, 0.2s) var(--bezier, ease),
    transform var(--anim-fast, 0.2s) var(--bezier, ease);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
  margin-top: 12px;
}

.profile-nav-btn:hover {
  border-color: var(--primary, #20d38f);
  box-shadow: 0 0 0 3px rgba(32, 211, 143, 0.18);
}

.profile-nav-btn:active {
  transform: translateY(-0.5px);
}

.profile-nav-btn-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.profile-nav-btn-title {
  font-weight: 600;
  font-size: 16px;
  line-height: 1.3;
  color: var(--fg, #f2f2f7);
  word-wrap: break-word;
  word-break: break-word;
}

.profile-nav-btn-subtitle {
  font-weight: 400;
  font-size: 14px;
  line-height: 1.3;
  color: rgba(242, 242, 247, 0.7);
  word-wrap: break-word;
  word-break: break-word;
}

.profile-nav-btn-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  filter: brightness(0) invert(1);
  opacity: 0.9;
}

/* Кнопка "Купить Pro" */
.profile-nav-btn--pro {
  background: linear-gradient(180deg, var(--primary, #20d38f), var(--accent, #1bb978));
  border-color: transparent;
  color: #052b1d;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.2);
}

.profile-nav-btn--pro .profile-nav-btn-title {
  color: #052b1d;
  font-weight: 700;
}

.profile-nav-btn--pro .profile-nav-btn-subtitle {
  color: rgba(5, 43, 29, 0.8);
}

.profile-nav-btn--pro .profile-nav-btn-icon {
  filter: brightness(0) saturate(100%);
  opacity: 0.8;
}

.profile-nav-btn--pro .profile-nav-btn-crown {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3)) brightness(0) saturate(100%) invert(83%)
    sepia(100%) saturate(1000%) hue-rotate(10deg) brightness(110%) contrast(120%);
  margin-right: 8px;
}

.profile-nav-btn--pro .profile-nav-btn-content {
  flex-direction: row;
  align-items: center;
}

.profile-nav-btn--pro .profile-nav-btn-title {
  flex: 1;
}

/* Кнопка "Выйти" с коралловым фоном */
.profile-nav-btn--logout {
  background: var(--coral, #e55b5d);
  border-color: transparent;
  color: #ffffff;
}

.profile-nav-btn--logout .profile-nav-btn-title {
  color: #ffffff;
  font-weight: 700;
}

.profile-nav-btn--logout:hover {
  background: var(--coral, #e55b5d);
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(229, 91, 93, 0.3);
}

.profile-nav-btn--logout .profile-nav-btn-icon {
  filter: brightness(0) invert(1);
}

.profile-buttons-section {
  margin-top: 24px;
}

.profile-buttons-section .profile-nav-btn:first-child {
  margin-top: 0;
}

/* Upgrade page styles */
.upgrade-header-text {
  text-align: center;
  color: var(--fg, #f2f2f7);
  font-size: 16px;
  line-height: 1.5;
  padding: 16px 20px;
  margin: 0;
}

.upgrade-table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
}

.upgrade-table th,
.upgrade-table td {
  padding: 16px 12px;
  text-align: left;
  border-bottom: 1px solid rgba(242, 242, 247, 0.08);
}

.upgrade-table th {
  font-weight: 700;
  font-size: 16px;
  color: var(--fg, #f2f2f7);
}

.upgrade-table td {
  font-size: 15px;
  color: rgba(242, 242, 247, 0.9);
  line-height: 1.4;
}

.upgrade-table th:first-child,
.upgrade-table td:first-child {
  padding-left: 20px;
}

.upgrade-table th:last-child,
.upgrade-table td:last-child {
  padding-right: 20px;
}

.upgrade-table th:nth-child(2),
.upgrade-table td:nth-child(2),
.upgrade-table th:nth-child(3),
.upgrade-table td:nth-child(3) {
  width: 80px;
  text-align: center;
}

.upgrade-table th:nth-child(3),
.upgrade-table td:nth-child(3) {
  background: rgba(27, 185, 120, 0.12); /* accent color with 12% opacity */
}

.upgrade-checkbox {
  width: 24px;
  height: 24px;
  display: inline-block;
  filter: brightness(0) saturate(100%) invert(74%) sepia(74%) saturate(400%) hue-rotate(105deg)
    brightness(95%) contrast(88%);
  margin: 0 auto;
}

.upgrade-plan-buttons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 24px 0;
}

.upgrade-plan-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(242, 242, 247, 0.08);
  border-radius: var(--radius, 14px);
  cursor: pointer;
  transition: all var(--anim-fast, 120ms) var(--bezier, cubic-bezier(0.2, 0.8, 0.2, 1));
  text-decoration: none;
  min-height: 100px;
}

.upgrade-plan-btn:hover {
  border-color: var(--primary, #20d38f);
  box-shadow: 0 0 0 3px rgba(32, 211, 143, 0.18);
}

.upgrade-plan-btn:active {
  transform: scale(0.98);
}

.upgrade-plan-btn.is-selected {
  border-color: var(--primary, #20d38f);
  background: rgba(32, 211, 143, 0.1);
  box-shadow: 0 0 0 3px rgba(32, 211, 143, 0.18);
}

.upgrade-plan-title {
  font-weight: 700;
  font-size: 18px;
  color: var(--fg, #f2f2f7);
  margin-bottom: 8px;
  text-align: center;
}

.upgrade-plan-price {
  font-size: 14px;
  color: rgba(242, 242, 247, 0.7);
  text-align: center;
}

.upgrade-buy-section {
  margin-top: 32px;
  padding-bottom: 24px;
}

/**********************************/

/* ===== Ranking Block (Рейтинг) ===== */

.ranking-block {
  padding: 14px;
}

.ranking-block__title {
  font-weight: 800;
  margin: 0 0 12px 0;
  font-size: 18px;
}

.ranking-block__list {
  display: grid;
  gap: 8px;
}

/* Ranking item */
.ranking-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: calc(var(--radius) - 4px);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(242, 242, 247, 0.06);
  transition: background var(--anim-fast) var(--bezier), border-color var(--anim-fast) var(--bezier);
}

.ranking-item--current {
  background: rgba(32, 211, 143, 0.12);
  border-color: rgba(32, 211, 143, 0.3);
  box-shadow: 0 0 12px rgba(32, 211, 143, 0.15);
  position: relative;
}

.ranking-item--current::before {
  content: '';
  position: absolute;
  left: -2px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 70%;
  background: linear-gradient(180deg, var(--primary), var(--accent));
  border-radius: 0 2px 2px 0;
}

.ranking-item--top {
  background: rgba(255, 215, 0, 0.08);
  border-color: rgba(255, 215, 0, 0.2);
}

.ranking-item__number {
  font-size: 11px;
  font-weight: 700;
  color: rgba(242, 242, 247, 0.7);
  min-width: 32px;
  text-align: right;
  flex-shrink: 0;
}

.ranking-item--current .ranking-item__number,
.ranking-item--top .ranking-item__number {
  color: var(--primary);
  font-weight: 800;
}

.ranking-item__avatar {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ranking-item--top .ranking-item__avatar {
  width: 32px;
  height: 32px;
}

.ranking-item__avatar svg {
  width: 100%;
  height: 100%;
  display: block;
}

.ranking-item__info {
  flex: 1 1 auto;
  min-width: 0;
  display: grid;
  gap: 4px;
}

.ranking-item__name {
  font-size: 12px;
  font-weight: 700;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ranking-item__you {
  color: var(--primary);
  font-weight: 600;
  font-size: 11px;
}

.ranking-item__progress {
  height: 3px;
  background: rgba(242, 242, 247, 0.1);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}

.ranking-item__progress-bar {
  height: 100%;
  width: var(--progress, 0%);
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 2px;
  transition: width var(--anim-normal) var(--bezier);
}

.ranking-item--top .ranking-item__progress-bar {
  background: linear-gradient(90deg, #ffd700, #ffa500);
}

/* Ellipsis rows */
.ranking-ellipsis {
  text-align: center;
  color: rgba(242, 242, 247, 0.4);
  font-size: 20px;
  line-height: 1;
  padding: 4px 0;
  letter-spacing: 2px;
  user-select: none;
}

/* ===== Rewards Block (Награды) ===== */

.rewards-block {
  position: relative;
  padding: 14px;
}

.rewards-block__title {
  font-weight: 800;
  margin: 0 0 12px 0;
  font-size: 18px;
}

.rewards-block__badges {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 8px;
  position: relative;
  min-height: 200px;
}

/* Badge items */
.badge {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 10px;
  border-radius: calc(var(--radius) - 4px);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(242, 242, 247, 0.1);
  box-shadow: var(--elev-1);
  cursor: pointer;
  transition: transform var(--anim-fast) var(--bezier), box-shadow var(--anim-fast) var(--bezier),
    background var(--anim-fast) var(--bezier);
  -webkit-tap-highlight-color: transparent;
  text-align: center;
}

.badge:hover,
.badge:active {
  transform: scale(1.05);
  box-shadow: var(--elev-2);
  background: rgba(255, 255, 255, 0.06);
}

.badge:active {
  transform: scale(0.98);
}

/* Badge sizes with irregular positioning */
.badge--small {
  font-size: 10px;
  padding: 6px 8px;
  transform: rotate(-2deg) translateY(2px);
}

.badge--medium {
  font-size: 12px;
  padding: 8px 10px;
  transform: rotate(1deg);
}

.badge--large {
  font-size: 13px;
  padding: 10px 12px;
  transform: rotate(-1deg) translateY(-3px);
  font-weight: 700;
}

.badge:hover,
.badge:active {
  transform: scale(1.05) rotate(0deg);
}

.badge:active {
  transform: scale(0.98) rotate(0deg);
}

/* Specific positioning for playful scatter effect */
.badge:nth-child(1) {
  transform: rotate(-3deg) translateY(0px);
}

.badge:nth-child(2) {
  transform: rotate(2deg) translateY(5px);
}

.badge:nth-child(3) {
  transform: rotate(-1deg) translateY(-2px);
}

.badge:nth-child(4) {
  transform: rotate(3deg) translateY(3px);
}

.badge:nth-child(5) {
  transform: rotate(-2deg) translateY(1px);
}

.badge:nth-child(6) {
  transform: rotate(1deg) translateY(-4px);
}

.badge:nth-child(7) {
  transform: rotate(-2deg) translateY(2px);
}

.badge:hover,
.badge:active {
  transform: scale(1.05) rotate(0deg) !important;
}

.badge__icon {
  font-size: 20px;
  line-height: 1;
  margin-bottom: 4px;
}

.badge--small .badge__icon {
  font-size: 16px;
  margin-bottom: 2px;
}

.badge--large .badge__icon {
  font-size: 24px;
  margin-bottom: 6px;
}

.badge__label {
  font-weight: 600;
  color: var(--fg);
  white-space: nowrap;
  line-height: 1.2;
}

/* Tooltip */
.badge-tooltip {
  position: absolute;
  z-index: 100;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity var(--anim-normal) var(--bezier), transform var(--anim-normal) var(--bezier);
}

.badge-tooltip.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.badge-tooltip__content {
  background: rgba(44, 44, 46, 0.98);
  border: 1px solid rgba(242, 242, 247, 0.2);
  border-radius: calc(var(--radius) - 4px);
  padding: 8px 12px;
  font-size: 12px;
  color: var(--fg);
  box-shadow: var(--elev-3);
  white-space: nowrap;
  backdrop-filter: blur(8px);
}

.badge-tooltip__content::before {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid rgba(44, 44, 46, 0.98);
}

/* Mobile responsiveness */
@media (max-width: 430px) {
  .rewards-block__badges {
    min-height: auto;
  }

  .ranking-item {
    padding: 8px 10px;
  }

  .ranking-item__number {
    min-width: 38px;
    font-size: 12px;
  }

  .ranking-item__name {
    font-size: 13px;
  }

  .badge {
    font-size: 11px;
    padding: 8px 10px;
  }

  .badge--small {
    font-size: 10px;
    padding: 6px 8px;
  }

  .badge--large {
    font-size: 12px;
    padding: 10px 12px;
  }
}

/* For larger screens */
@media (min-width: 500px) {
  .ranking-item {
    padding: 8px 10px;
  }

  .badge {
    padding: 10px 12px;
  }
}

/* ===== Feedback Block (Обратная связь) ===== */

.feedback-block {
  padding: 14px;
  background: linear-gradient(135deg, rgba(32, 211, 143, 0.1), rgba(27, 185, 120, 0.06));
  border: 1px solid rgba(32, 211, 143, 0.25);
  box-shadow: 0 0 16px rgba(32, 211, 143, 0.15);
}

.feedback-block__title {
  font-weight: 800;
  margin: 0 0 12px 0;
  font-size: 18px;
  color: var(--fg);
}

.feedback-block__message {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.feedback-block__icon {
  flex-shrink: 0;
  font-size: 32px;
  line-height: 1;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 50%;
  border: 1px solid rgba(242, 242, 247, 0.1);
}

.feedback-block__text {
  flex: 1 1 auto;
  font-size: 14px;
  line-height: 1.5;
  color: var(--fg);
  font-weight: 500;
}

/* Mobile responsiveness */
@media (max-width: 430px) {
  .feedback-block__message {
    gap: 10px;
  }

  .feedback-block__icon {
    width: 36px;
    height: 36px;
    font-size: 28px;
  }

  .feedback-block__text {
    font-size: 13px;
    line-height: 1.4;
  }
}

/**********************************/

/* ===== Habits Table (Привычки) ===== */
.habits-container {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.habits-table {
  width: 100%;
  min-width: 420px;
  border-collapse: collapse;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--muted);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--elev-1);
}

.habits-table thead {
  background: rgba(255, 255, 255, 0.06);
}

.habits-table th {
  padding: 12px 10px;
  text-align: left;
  font-weight: 700;
  font-size: 14px;
  color: var(--fg);
  border-bottom: 1px solid var(--muted);
}

.habits-table th.habits-table__option {
  text-align: center;
  vertical-align: middle;
  padding: 4px 1px;
  width: 38px;
  position: relative;
  height: 80px;
}

.habits-table th.habits-table__option span {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-90deg);
  white-space: nowrap;
  transform-origin: center;
  display: inline-block;
}

.habits-table th.habits-table__delete {
  text-align: center;
  width: 50px;
  padding: 8px 4px;
  vertical-align: middle;
}

.habits-table__habit {
  min-width: 150px;
  max-width: 200px;
  padding-left: 14px !important;
  word-wrap: break-word;
  word-break: break-word;
}

.habits-table__option {
  text-align: center;
  width: 38px;
  padding: 4px 1px !important;
}

.habits-table__row {
  border-bottom: 1px solid rgba(242, 242, 247, 0.08);
  transition: background var(--anim-fast) var(--bezier);
}

.habits-table__row:hover {
  background: rgba(255, 255, 255, 0.02);
}

.habits-table__row:last-child {
  border-bottom: none;
}

.habits-table td {
  padding: 12px 10px;
  vertical-align: middle;
  color: var(--fg);
  font-size: 14px;
}

.habits-table td.habits-table__option {
  text-align: center;
}

.habits-table td.habits-table__habit {
  font-weight: 600;
  padding-left: 14px;
}

.habits-table__option .radio {
  margin: 0;
  width: 18px;
  height: 18px;
}

.habits-table__option .radio:checked::after {
  width: 8px;
  height: 8px;
}

.habits-table__delete {
  text-align: center;
  width: 50px;
  padding: 8px 4px !important;
  vertical-align: middle;
}

.habits-delete-btn {
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--coral, #e55b5d);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--anim-fast) var(--bezier), box-shadow var(--anim-fast) var(--bezier),
    background var(--anim-fast) var(--bezier);
  -webkit-tap-highlight-color: transparent;
  box-shadow: var(--elev-1);
}

.habits-delete-btn:hover {
  background: #d14a4c;
  box-shadow: var(--elev-2);
}

.habits-delete-btn:active {
  transform: scale(var(--tap-scale));
  box-shadow: var(--elev-1);
}

.habits-delete-btn img {
  width: 18px;
  height: 18px;
  filter: brightness(0) invert(1);
  display: block;
}

.habits-actions {
  margin-top: 20px;
  padding-bottom: 12px;
}

/* Mobile responsiveness */
@media (max-width: 640px) {
  .habits-table {
    font-size: 13px;
    min-width: 380px;
  }

  .habits-table th,
  .habits-table td {
    padding: 10px 8px;
  }

  .habits-table th.habits-table__option {
    width: 32px;
    height: 70px;
    padding: 3px 0px;
  }

  .habits-table th.habits-table__delete {
    width: 45px;
    padding: 6px 2px;
  }

  .habits-table__habit {
    min-width: 140px;
    max-width: 180px;
    padding-left: 12px !important;
  }

  .habits-table__option {
    width: 32px;
    padding: 3px 0px !important;
  }

  .habits-table__delete {
    width: 45px;
    padding: 6px 2px !important;
  }

  .habits-delete-btn {
    width: 28px;
    height: 28px;
  }

  .habits-delete-btn img {
    width: 16px;
    height: 16px;
  }
}

/* ===== Плавающая кнопка "Добавить воду" ===== */
.water-fab {
  position: fixed;
  right: 20px;
  bottom: calc(var(--bn-h, 72px) + 20px); /* выше нижней навигации */
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #5ac8fa; /* голубой цвет */
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3), 0 2px 4px rgba(0, 0, 0, 0.2);
  z-index: 1001; /* выше bottom-nav (z-index: 1000) */
  transition: transform var(--anim-fast) var(--bezier), box-shadow var(--anim-fast) var(--bezier);
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.water-fab:hover {
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4), 0 4px 8px rgba(0, 0, 0, 0.3);
}

.water-fab:active {
  transform: scale(var(--tap-scale, 0.95));
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
}

.water-fab__progress-ring {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none; /* чтобы не перехватывать клики */
}

.water-fab__progress-bg {
  /* Фоновое кольцо уже определено в SVG */
}

.water-fab__progress-fill {
  /* Кольцо прогресса уже определено в SVG */
}

.water-fab__icon {
  width: 32px;
  height: 32px;
  position: relative;
  z-index: 1;
  filter: brightness(0) invert(1); /* белая иконка */
}

/* Адаптация для мобильных экранов */
@media (max-width: 640px) {
  .water-fab {
    width: 56px;
    height: 56px;
    right: 16px;
    bottom: calc(var(--bn-h, 72px) + 16px);
  }

  .water-fab__icon {
    width: 28px;
    height: 28px;
  }

  .water-fab__progress-ring {
    /* SVG автоматически масштабируется */
  }
}

/* ===== Water Add Screen (Добавить воду) ===== */

/* Аватар с gif */
.water-avatar {
  background: transparent;
  overflow: hidden;
}

.water-avatar img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* Блок "Сегодня: 1,75 литра воды" */
.water-summary {
  padding: 14px;
  margin-bottom: 12px;
}

.water-summary__title {
  font-weight: 800;
  font-size: 18px;
  color: var(--fg);
  text-align: center;
  margin: 0;
}

/* Список записей */
.water-list {
  padding: 14px;
  margin-bottom: 12px;
}

.water-list__item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid rgba(242, 242, 247, 0.08);
}

.water-list__item:last-child {
  border-bottom: none;
}

.water-list__time {
  font-weight: 700;
  font-size: 16px;
  color: var(--fg);
}

.water-list__amount {
  font-size: 16px;
  color: rgba(242, 242, 247, 0.85);
}

/* Блок с полем ввода и кнопками */
.water-input-block {
  padding: 14px;
  margin-bottom: 12px;
}

.water-input-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.water-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform var(--anim-fast) var(--bezier), box-shadow var(--anim-fast) var(--bezier);
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  box-shadow: var(--elev-1);
}

.water-btn--plus {
  background: linear-gradient(180deg, var(--primary), var(--accent));
}

.water-btn--minus {
  background: var(--coral, #e55b5d);
}

.water-btn:hover {
  box-shadow: var(--elev-2);
}

.water-btn:active {
  transform: scale(var(--tap-scale, 0.95));
  box-shadow: var(--elev-1);
}

.water-btn img {
  width: 24px;
  height: 24px;
  filter: brightness(0) invert(1);
  display: block;
}

.water-input {
  width: 80px;
  text-align: center;
  font-size: 18px;
  font-weight: 700;
  color: var(--fg);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--muted);
  border-radius: var(--radius);
  padding: 10px 12px;
  outline: none;
  transition: border-color var(--anim-fast) var(--bezier);
}

.water-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(32, 211, 143, 0.18);
}

.water-label {
  font-size: 16px;
  color: rgba(242, 242, 247, 0.85);
  font-weight: 600;
}

/* Блок с кнопкой "Добавить воду" */
.water-actions {
  margin-top: 8px;
  padding-bottom: 12px;
}

/* Адаптация для мобильных экранов */
@media (max-width: 640px) {
  .water-btn {
    width: 40px;
    height: 40px;
  }

  .water-btn img {
    width: 20px;
    height: 20px;
  }

  .water-input {
    width: 70px;
    font-size: 16px;
    padding: 8px 10px;
  }
}

/* ===== Training End Screen (Завершить тренировку) ===== */

/* Аватар с GIF */
.training-end-avatar {
  background: transparent;
  overflow: hidden;
}

.training-end-avatar img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* Блок достижений тренировки */
.training-achievements {
  padding: 14px;
  margin-bottom: 12px;
  text-align: center;
}

.training-achievements__line {
  font-size: 16px;
  font-weight: 700;
  color: var(--fg);
  margin-bottom: 8px;
  line-height: 1.5;
}

.training-achievements__line:last-child {
  margin-bottom: 0;
}

/* Опросник */
.training-questionnaire {
  padding: 14px;
  margin-bottom: 12px;
}

.training-questionnaire__question {
  margin-bottom: 20px;
}

.training-questionnaire__question:last-child {
  margin-bottom: 0;
}

.training-questionnaire__title {
  font-weight: 700;
  font-size: 16px;
  color: var(--fg);
  margin-bottom: 12px;
  text-align: center;
}

.training-toggle-group {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.training-toggle-btn {
  flex: 1;
  min-width: 60px;
  max-width: 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 8px;
  border: 1px solid var(--muted);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  transition: transform var(--anim-fast) var(--bezier), box-shadow var(--anim-fast) var(--bezier),
    border-color var(--anim-fast) var(--bezier), background var(--anim-fast) var(--bezier);
  box-shadow: var(--elev-1);
  -webkit-tap-highlight-color: transparent;
}

.training-toggle-btn:hover {
  box-shadow: var(--elev-2);
}

.training-toggle-btn:active {
  transform: scale(var(--tap-scale));
}

/* Градиент от coral к forest с промежуточными переходами */
.training-toggle-btn[data-value='-2'] {
  background: linear-gradient(
    135deg,
    rgba(229, 91, 93, 0.7),
    rgba(229, 91, 93, 0.5),
    rgba(229, 91, 93, 0.3)
  );
}

.training-toggle-btn[data-value='-1'] {
  background: linear-gradient(
    135deg,
    rgba(229, 91, 93, 0.5),
    rgba(229, 150, 100, 0.4),
    rgba(229, 91, 93, 0.3)
  );
}

.training-toggle-btn[data-value='0'] {
  background: linear-gradient(
    135deg,
    rgba(229, 91, 93, 0.3),
    rgba(150, 200, 150, 0.4),
    rgba(27, 185, 120, 0.3)
  );
}

.training-toggle-btn[data-value='+1'] {
  background: linear-gradient(
    135deg,
    rgba(27, 185, 120, 0.5),
    rgba(27, 185, 120, 0.4),
    rgba(27, 185, 120, 0.3)
  );
}

.training-toggle-btn[data-value='+2'] {
  background: linear-gradient(
    135deg,
    rgba(27, 185, 120, 0.7),
    rgba(27, 185, 120, 0.5),
    rgba(27, 185, 120, 0.3)
  );
}

.training-toggle-btn.is-active {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(32, 211, 143, 0.18), var(--elev-2);
  transform: scale(1.05);
}

.training-toggle-btn__value {
  font-weight: 800;
  font-size: 18px;
  color: var(--fg);
}

.training-toggle-btn__label {
  font-size: 12px;
  color: rgba(242, 242, 247, 0.9);
  font-weight: 600;
  text-align: center;
  line-height: 1.2;
}

/* Изображение */
.training-image {
  padding: 0;
  margin-bottom: 12px;
  overflow: hidden;
  border-radius: var(--radius);
}

.training-image__img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
}

/* Список упражнений */
.training-exercises {
  display: grid;
  gap: 12px;
  margin-bottom: 12px;
}

.training-exercise-btn {
  cursor: default;
  pointer-events: none;
  opacity: 0.9;
}

.training-exercise-btn:hover {
  border-color: var(--muted);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
  transform: none;
}

.training-exercise-btn:active {
  transform: none;
}

/* Кнопка "Завершить тренировку" */
.training-finish-actions {
  margin-top: 8px;
  padding-bottom: 12px;
}

.training-finish-btn {
  background: var(--coral, #e55b5d);
  border-color: transparent;
  color: #fff;
  font-weight: 800;
  font-size: 18px;
  min-height: 52px;
  box-shadow: 0 4px 12px rgba(229, 91, 93, 0.3), var(--elev-2);
}

.training-finish-btn:hover {
  background: #d14a4c;
  box-shadow: 0 6px 16px rgba(229, 91, 93, 0.4), var(--elev-3);
}

.training-finish-btn:active {
  transform: scale(var(--tap-scale));
  box-shadow: 0 2px 8px rgba(229, 91, 93, 0.3), var(--elev-1);
}

/* Адаптация для мобильных экранов */
@media (max-width: 640px) {
  .training-toggle-group {
    gap: 6px;
  }

  .training-toggle-btn {
    min-width: 55px;
    max-width: 70px;
    padding: 8px 6px;
  }

  .training-toggle-btn__value {
    font-size: 16px;
  }

  .training-toggle-btn__label {
    font-size: 11px;
  }

  .training-achievements__line {
    font-size: 14px;
  }

  .training-finish-btn {
    font-size: 16px;
    min-height: 48px;
  }
}

/**********************************/
/* Weight Management Screen Styles */

/* Weight view containers */
.weight-view {
  display: block;
}
.weight-view[data-view] {
  display: none;
}
.weight-view[data-view].is-active {
  display: block;
}

/* Date navigation for day view */
.weight-date-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 8px 0;
}
.weight-date-label {
  font-weight: 600;
  color: var(--fg);
  text-align: center;
}

/* Circular gauge */
.weight-gauge {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px;
  min-height: 280px;
}
.weight-gauge__circle {
  position: relative;
  width: 240px;
  height: 240px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.weight-gauge__value {
  font-size: 32px;
  font-weight: 800;
  color: var(--fg);
  margin-bottom: 4px;
}
.weight-gauge__bmi,
.weight-gauge__fat {
  font-size: var(--small-size);
  color: rgba(242, 242, 247, 0.75);
  text-align: center;
}
.weight-gauge__button {
  margin-top: 16px;
  padding: 8px 16px;
  font-size: var(--small-size);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--muted);
  border-radius: var(--radius);
  color: var(--fg);
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}
.weight-gauge__button:hover {
  background: rgba(255, 255, 255, 0.12);
}

/* Metric cards grid */
.weight-metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.weight-metric-card {
  padding: 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(242, 242, 247, 0.08);
  border-radius: calc(var(--radius) - 4px);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.weight-metric-card__title {
  font-size: var(--small-size);
  color: rgba(242, 242, 247, 0.75);
  margin-bottom: 4px;
}
.weight-metric-card__value {
  font-size: 18px;
  font-weight: 800;
  color: var(--fg);
}
.weight-metric-card__status {
  font-size: var(--small-size);
  color: rgba(242, 242, 247, 0.65);
  margin-top: 2px;
}

/* Period header */
.weight-period-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 0;
}
.weight-period-header__content {
  flex: 1;
  text-align: center;
}
.weight-period-header__dates {
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 4px;
}
.weight-period-header__avg {
  font-size: var(--small-size);
  color: rgba(242, 242, 247, 0.75);
}

/* Sub-tabs for metric switching */
.seg-tabs--small {
  gap: 12px;
  margin-bottom: 0;
}
.seg-tab--small {
  padding: 8px 4px 10px;
  font-size: var(--small-size);
}

/* Actions buttons */
.weight-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Responsive adjustments */
@media (max-width: 480px) {
  .weight-gauge__circle {
    width: 200px;
    height: 200px;
  }
  .weight-gauge__value {
    font-size: 28px;
  }
  .weight-metrics-grid {
    grid-template-columns: 1fr;
  }
}

/* Weight page specific: reduce gap between header and tabs */
#weight-page .train-top {
  border-bottom: 1px solid rgba(242, 242, 247, 0.08);
}
#weight-page .train-header__inner {
  padding-bottom: 0;
}
#weight-page .page-head {
  margin-bottom: 0;
  gap: 0;
}
#weight-page .pr-tabs {
  position: static;
  border-top: 1px solid rgba(242, 242, 247, 0.08);
  border-bottom: none;
  margin-top: 0;
}
#weight-page .pr-tabs__inner {
  padding-top: 0;
  padding-bottom: 8px;
}

/* Sleep monitoring page styles */
#sleep-page .train-top {
  border-bottom: 1px solid rgba(242, 242, 247, 0.08);
}
#sleep-page .train-header__inner {
  padding-bottom: 0;
}
#sleep-page .page-head {
  margin-bottom: 0;
  gap: 0;
}

/* Sleep time card */
.sleep-time-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--fg);
  margin: 8px 0 4px 0;
}
.sleep-time-interval {
  font-size: var(--small-size);
  color: rgba(242, 242, 247, 0.75);
  margin-bottom: 8px;
}

/* Sleep legend */
.sleep-legend {
  font-size: var(--small-size);
  color: rgba(242, 242, 247, 0.75);
  margin-top: 8px;
}

/* Sleep phases legend */
.sleep-phases-legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}
.sleep-phase-item {
  display: flex;
  align-items: center;
  gap: 8px;
}
.sleep-phase-color {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  flex-shrink: 0;
}
.sleep-phase-text {
  font-size: var(--small-size);
  color: rgba(242, 242, 247, 0.85);
}

/* Sleep score */
.sleep-score-container {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 12px 0;
}
.sleep-score-value {
  font-size: 48px;
  font-weight: 700;
  color: var(--emerald);
}
.sleep-score-label {
  font-size: 18px;
  font-weight: 600;
  color: var(--fg);
}
.sleep-factors-title {
  font-size: var(--small-size);
  color: rgba(242, 242, 247, 0.75);
  margin-top: 16px;
  margin-bottom: 8px;
}

/* Sleep stability */
.sleep-stability-value {
  font-size: 18px;
  font-weight: 600;
  color: var(--fg);
  margin: 12px 0;
}

/**********************************/
