:root {
  --wine: #970b2f;
  --wine-dark: #66051f;
  --wine-soft: #f8e9ee;
  --ink: #201a1c;
  --muted: #786d71;
  --paper: #f6f3f0;
  --card: rgba(255, 255, 255, 0.92);
  --line: #e9e0e2;
  --blue: #4e9ec5;
  --blue-soft: #e7f5fb;
  --green: #52866a;
  --gold: #b98a43;
  --shadow: 0 18px 48px rgba(75, 36, 48, 0.08);
  --radius-xl: 30px;
  --radius-lg: 23px;
  --radius-md: 17px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 0%, rgba(197, 111, 139, .10), transparent 28rem),
    radial-gradient(circle at 95% 22%, rgba(78, 158, 197, .08), transparent 24rem),
    var(--paper);
  font-family: "Segoe UI", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button, input, select, textarea { -webkit-tap-highlight-color: transparent; }

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(151, 11, 47, .22);
  outline-offset: 2px;
}

.app-shell {
  width: min(100%, 940px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 20px 20px calc(118px + env(safe-area-inset-bottom));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 4px 0 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0;
  border: 0;
  color: var(--ink);
  background: transparent;
  text-align: left;
}

.brand-mark {
  display: grid;
  width: 45px;
  height: 45px;
  place-items: center;
  border-radius: 15px;
  color: #fff;
  background: linear-gradient(145deg, #b51b47, var(--wine-dark));
  box-shadow: 0 9px 20px rgba(151, 11, 47, .23);
  font-weight: 800;
  letter-spacing: -.05em;
}

.brand small,
.brand strong { display: block; }
.brand small {
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.brand strong { margin-top: 2px; font-size: 18px; line-height: 1; }

.soft-button,
.light-button {
  padding: 10px 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  background: rgba(255,255,255,.72);
  font-size: 12px;
  font-weight: 800;
}

.screen { display: none; }
.screen.active {
  display: block;
  animation: screenIn .36s cubic-bezier(.22, .8, .35, 1);
}

@keyframes screenIn {
  from { opacity: 0; transform: translateY(9px); }
  to { opacity: 1; transform: translateY(0); }
}

h1, h2, h3, p { margin-top: 0; }
h1 { letter-spacing: -.055em; }
h2 { letter-spacing: -.035em; }

.hero-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(180px, .6fr);
  gap: 24px;
  min-height: 280px;
  padding: clamp(25px, 5vw, 48px);
  overflow: hidden;
  border-radius: 36px;
  color: #fff;
  background:
    radial-gradient(circle at 92% 15%, rgba(255,255,255,.16), transparent 13rem),
    linear-gradient(135deg, #a8113b 0%, #7e0829 58%, #57031c 100%);
  box-shadow: 0 30px 70px rgba(104, 6, 35, .22);
}

.hero-card::after {
  content: "52";
  position: absolute;
  right: -24px;
  bottom: -78px;
  color: rgba(255,255,255,.045);
  font-size: 260px;
  font-weight: 800;
  letter-spacing: -.14em;
  pointer-events: none;
}

.hero-copy,
.hero-weight { position: relative; z-index: 1; }
.overline,
.kicker {
  display: block;
  color: var(--wine);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.hero-card .overline { color: rgba(255,255,255,.68); }
.hero-card h1 {
  max-width: 520px;
  margin: 16px 0 18px;
  font-size: clamp(42px, 7vw, 68px);
  line-height: .98;
}
.hero-phrase {
  max-width: 460px;
  margin-bottom: 0;
  color: rgba(255,255,255,.77);
  font-size: 14px;
  line-height: 1.65;
}

.hero-weight {
  align-self: end;
  justify-self: end;
  min-width: 180px;
  padding: 18px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 24px;
  background: rgba(255,255,255,.10);
  backdrop-filter: blur(8px);
}
.hero-weight span,
.hero-weight strong { display: block; }
.hero-weight span { color: rgba(255,255,255,.65); font-size: 11px; }
.hero-weight strong { margin: 6px 0; font-size: 38px; letter-spacing: -.06em; }
.hero-weight strong i { font-style: normal; }
.hero-weight strong small { font-size: 14px; letter-spacing: 0; }
.hero-weight b { color: #fff; }

.section-heading,
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
}
.section-heading { margin: 34px 2px 16px; }
.section-heading span {
  color: var(--wine);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.section-heading h2,
.card-head h2 { margin: 3px 0 0; font-size: 23px; }
.text-button {
  padding: 8px 0;
  border: 0;
  color: var(--wine);
  background: transparent;
  font-size: 12px;
  font-weight: 800;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.metric-card {
  position: relative;
  min-width: 0;
  padding: 17px;
  overflow: hidden;
  border: 1px solid rgba(233,224,226,.92);
  border-radius: var(--radius-lg);
  background: var(--card);
  box-shadow: 0 10px 34px rgba(69, 40, 49, .05);
}
.metric-card > span {
  display: block;
  margin-top: 26px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}
.metric-card strong {
  display: block;
  margin: 6px 0 14px;
  overflow: hidden;
  font-size: 22px;
  letter-spacing: -.04em;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.metric-card strong i { font-style: normal; }
.metric-card strong small { color: var(--muted); font-size: 10px; letter-spacing: 0; }
.metric-icon {
  position: absolute;
  top: 15px;
  left: 17px;
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  border-radius: 9px;
  color: var(--wine);
  background: var(--wine-soft);
  font-size: 10px;
  font-weight: 800;
}
.water-icon { color: var(--blue); background: var(--blue-soft); }
.progress {
  height: 5px;
  overflow: hidden;
  border-radius: 99px;
  background: #f0e9eb;
}
.progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--wine);
  transition: width .48s cubic-bezier(.22,.8,.35,1);
}
.progress.blue span { background: var(--blue); }
.progress.green span { background: var(--green); }
.progress.gold span { background: var(--gold); }

.content-card {
  margin-top: 15px;
  padding: 23px;
  border: 1px solid rgba(233,224,226,.92);
  border-radius: var(--radius-xl);
  background: var(--card);
  box-shadow: var(--shadow);
}
.card-head { margin-bottom: 18px; }
.blue-text { color: var(--blue); }

.energy-card {
  overflow: hidden;
  background:
    radial-gradient(circle at 100% 0%, rgba(151,11,47,.08), transparent 18rem),
    var(--card);
}
.energy-note {
  margin: -5px 0 16px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}
.activity-calories-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}
.activity-calories-form .primary-button { min-width: 165px; }
.energy-badge.deficit { color: #2e7250; background: #e8f4ed; }
.energy-badge.surplus { color: #a14332; background: #fae9e5; }
.energy-badge.balanced { color: var(--blue); background: var(--blue-soft); }
.energy-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 16px;
}
.energy-summary div {
  min-width: 0;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: rgba(255,255,255,.72);
}
.energy-summary span,
.energy-summary strong { display: block; }
.energy-summary span { min-height: 25px; color: var(--muted); font-size: 9px; line-height: 1.35; }
.energy-summary strong { margin-top: 6px; font-size: 15px; letter-spacing: -.03em; }
.energy-summary i { font-style: normal; }
.deficit-progress-card {
  margin-top: 13px;
  padding: 17px;
  border-radius: 21px;
  color: #fff;
  background: linear-gradient(140deg, #30272a, #171315);
}
.deficit-progress-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
}
.deficit-progress-head > div:last-child { text-align: right; }
.deficit-progress-head span,
.deficit-progress-head strong { display: block; }
.deficit-progress-head span { color: rgba(255,255,255,.56); font-size: 9px; }
.deficit-progress-head strong { margin-top: 4px; font-size: 15px; }
.deficit-level-track {
  height: 8px;
  margin: 17px 0 9px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(255,255,255,.12);
}
.deficit-level-track i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #cf476d, #f08ca8);
  transition: width .48s cubic-bezier(.22,.8,.35,1);
}
.deficit-level-markers {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  color: rgba(255,255,255,.46);
  font-size: 8px;
  text-align: center;
}
.deficit-level-markers span { position: relative; }
.deficit-level-markers i {
  display: grid;
  width: 20px;
  height: 20px;
  margin: 0 auto 4px;
  place-items: center;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 50%;
  color: rgba(255,255,255,.68);
  font-style: normal;
  font-weight: 800;
}
.deficit-level-markers .reached { color: #fff; }
.deficit-level-markers .reached i { border-color: #e27392; color: #fff; background: #a61942; }
.icon-button {
  display: grid;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 15px;
  color: var(--wine);
  background: #fff;
  font-size: 20px;
  font-weight: 700;
  transition: transform .2s ease, background .2s ease;
}
.icon-button:active { transform: scale(.94); }

.water-card {
  background: linear-gradient(145deg, rgba(255,255,255,.98), rgba(237,248,252,.94));
}
.water-glasses {
  display: grid;
  grid-template-columns: repeat(8, minmax(36px, 1fr));
  gap: 10px;
}
.glass {
  position: relative;
  height: 62px;
  padding: 0;
  overflow: hidden;
  border: 2px solid #cfe5ed;
  border-top-width: 1px;
  border-radius: 7px 7px 13px 13px;
  background: rgba(255,255,255,.72);
  transform: perspective(70px) rotateX(-2deg);
}
.glass::before {
  content: "";
  position: absolute;
  right: 3px;
  bottom: 3px;
  left: 3px;
  height: 0;
  border-radius: 4px 4px 8px 8px;
  background: linear-gradient(180deg, #75c1df, #4e9ec5);
  transition: height .35s cubic-bezier(.2,.8,.3,1);
}
.glass::after {
  content: attr(data-number);
  position: relative;
  z-index: 1;
  color: #7a9ba9;
  font-size: 10px;
  font-weight: 800;
}
.glass.filled { border-color: #76b9d2; }
.glass.filled::before { height: calc(100% - 6px); }
.glass.filled::after { color: #fff; }
.hint { margin: 13px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }

.measure-form,
.custom-food-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
label > span,
.month-select > span {
  display: block;
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  color: var(--ink);
  background: rgba(255,255,255,.88);
  transition: border-color .2s ease, box-shadow .2s ease;
}
input, select { min-height: 49px; padding: 0 14px; }
textarea { min-height: 92px; padding: 14px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  border-color: rgba(151,11,47,.35);
  box-shadow: 0 0 0 4px rgba(151,11,47,.06);
}
.full, .wide { grid-column: 1 / -1; }
.primary-button,
.secondary-button {
  min-height: 50px;
  padding: 0 18px;
  border: 0;
  border-radius: var(--radius-md);
  font-weight: 800;
  transition: transform .2s ease, box-shadow .2s ease, filter .2s ease;
}
.primary-button {
  color: #fff;
  background: linear-gradient(135deg, #b11443, var(--wine-dark));
  box-shadow: 0 11px 24px rgba(151,11,47,.19);
}
.secondary-button { margin-top: 11px; color: var(--wine); background: var(--wine-soft); }
.primary-button:active, .secondary-button:active { transform: translateY(1px) scale(.995); }

.page-intro { padding: 17px 4px 10px; }
.page-intro h1 {
  margin: 10px 0 9px;
  font-size: clamp(43px, 7vw, 70px);
  line-height: 1;
}
.page-intro p { max-width: 520px; margin-bottom: 0; color: var(--muted); font-size: 13px; line-height: 1.65; }

.day-switcher,
.report-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  margin: 21px 0 13px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,.64);
}
.day-switcher button,
.report-tabs button {
  min-height: 43px;
  border: 0;
  border-radius: 14px;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  font-weight: 800;
}
.day-switcher button.active,
.report-tabs button.active {
  color: #fff;
  background: var(--ink);
  box-shadow: 0 8px 20px rgba(32,26,28,.15);
}

.menu-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}
.menu-summary > div {
  padding: 14px 17px;
  border-radius: 18px;
  background: rgba(255,255,255,.72);
}
.menu-summary span, .menu-summary strong { display: block; }
.menu-summary span { color: var(--muted); font-size: 10px; }
.menu-summary strong { margin-top: 4px; font-size: 14px; }
.menu-summary i { font-style: normal; }

.planned-meals { display: grid; gap: 12px; }
.meal-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 15px;
  align-items: center;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--card);
  box-shadow: 0 12px 36px rgba(69,40,49,.055);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.meal-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.meal-card.eaten { border-color: rgba(82,134,106,.34); background: linear-gradient(135deg, #fff, #f2f8f4); }
.meal-number {
  display: grid;
  width: 47px;
  height: 47px;
  place-items: center;
  border-radius: 16px;
  color: var(--wine);
  background: var(--wine-soft);
  font-size: 16px;
  font-weight: 800;
}
.meal-card.eaten .meal-number { color: #fff; background: var(--green); }
.meal-copy { min-width: 0; }
.meal-copy span { color: var(--wine); font-size: 9px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.meal-copy h3 {
  margin: 4px 0 6px;
  overflow: hidden;
  font-size: 17px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.meal-copy p { margin: 0; color: var(--muted); font-size: 10px; }
.meal-actions { display: flex; gap: 8px; align-items: center; }
.recipe-open {
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--muted);
  background: #fff;
  font-weight: 800;
}
.meal-check {
  display: grid;
  width: 41px;
  height: 41px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: transparent;
  background: #fff;
  font-size: 18px;
  font-weight: 800;
}
.meal-card.eaten .meal-check { border-color: var(--green); color: #fff; background: var(--green); }
.meal-check:disabled { opacity: .35; cursor: not-allowed; }

.custom-food-form {
  margin-top: 16px;
  padding-top: 17px;
  border-top: 1px solid var(--line);
}
.summary-badge {
  flex: 0 0 auto;
  padding: 8px 11px;
  border-radius: 12px;
  color: var(--wine);
  background: var(--wine-soft);
  font-size: 11px;
}
.eaten-list { display: grid; gap: 2px; }
.eaten-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 13px 0;
  border-top: 1px solid var(--line);
}
.eaten-item:first-child { border-top: 0; }
.eaten-item strong, .eaten-item span { display: block; }
.eaten-item strong { font-size: 13px; }
.eaten-item span { margin-top: 3px; color: var(--muted); font-size: 10px; }
.delete-food {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 11px;
  color: var(--wine);
  background: var(--wine-soft);
}
.empty-state {
  padding: 24px 10px;
  color: var(--muted);
  text-align: center;
  font-size: 12px;
  line-height: 1.6;
}

.report-panel { display: none; }
.report-panel.active { display: block; animation: screenIn .28s ease; }
.date-navigation {
  display: grid;
  grid-template-columns: 45px minmax(0, 1fr) 45px;
  gap: 9px;
  align-items: end;
  margin: 13px 0 15px;
}
.date-navigation > button {
  height: 49px;
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--ink);
  background: #fff;
}

.daily-report-card {
  padding: 24px;
  border-radius: var(--radius-xl);
  color: #fff;
  background: linear-gradient(140deg, #2b2426, #171315);
  box-shadow: 0 18px 48px rgba(32,26,28,.16);
}
.daily-report-card > span { color: rgba(255,255,255,.58); font-size: 10px; text-transform: uppercase; letter-spacing: .12em; }
.daily-report-card h2 { margin: 5px 0 16px; font-size: 25px; }
.nutrition-target-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 13px;
}
.nutrition-target {
  min-width: 0;
  padding: 13px;
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 16px;
  background: rgba(255,255,255,.06);
}
.nutrition-target > span,
.nutrition-target > strong { display: block; }
.nutrition-target > span { color: rgba(255,255,255,.55); font-size: 9px; }
.nutrition-target > strong {
  margin: 7px 0 10px;
  overflow: hidden;
  font-size: 17px;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nutrition-target > strong small {
  color: rgba(255,255,255,.48);
  font-size: 8px;
  font-weight: 600;
}
.nutrition-progress {
  height: 4px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(255,255,255,.11);
}
.nutrition-progress i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #e06b8b;
}
.nutrition-target.protein .nutrition-progress i { background: #70bc91; }
.nutrition-target.fat .nutrition-progress i { background: #e4b35f; }
.nutrition-target.carbs .nutrition-progress i { background: #6db9dd; }
.nutrition-target.over .nutrition-progress i { background: #ff8b77; }
.energy-report-block {
  margin: 13px 0;
  padding: 15px;
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 18px;
  background: rgba(255,255,255,.06);
}
.energy-report-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  font-size: 10px;
}
.energy-report-title > span { color: rgba(255,255,255,.55); }
.energy-report-title strong.deficit { color: #88d2aa; }
.energy-report-title strong.surplus { color: #ff9c88; }
.energy-report-title strong.balanced { color: #91d0ec; }
.energy-report-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}
.energy-report-grid div { min-width: 0; padding: 10px; border-radius: 13px; background: rgba(255,255,255,.06); }
.energy-report-grid span,
.energy-report-grid strong { display: block; }
.energy-report-grid span { min-height: 23px; color: rgba(255,255,255,.48); font-size: 8px; line-height: 1.3; }
.energy-report-grid strong { margin-top: 5px; overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.report-energy-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
  margin-top: 12px;
}
.report-energy-form label > span { color: rgba(255,255,255,.5); }
.report-energy-form input {
  min-height: 43px;
  border-color: rgba(255,255,255,.15);
  color: #fff;
  background: rgba(255,255,255,.09);
}
.report-energy-form button {
  min-height: 43px;
  padding: 0 15px;
  border: 0;
  border-radius: 14px;
  color: #fff;
  background: var(--wine);
  font-size: 11px;
  font-weight: 800;
}
.energy-tracking-note { margin: 10px 0 0; color: rgba(255,255,255,.5); font-size: 9px; line-height: 1.45; }
.daily-report-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.daily-report-grid div { padding: 12px; border: 1px solid rgba(255,255,255,.10); border-radius: 16px; background: rgba(255,255,255,.06); }
.daily-report-grid span, .daily-report-grid strong { display: block; }
.daily-report-grid span { color: rgba(255,255,255,.55); font-size: 9px; }
.daily-report-grid strong { margin-top: 6px; font-size: 16px; }
.report-detail-list { margin-top: 13px; padding: 20px; border: 1px solid var(--line); border-radius: 24px; background: var(--card); }
.report-detail-list h3 { margin-bottom: 12px; font-size: 16px; }
.report-food-row { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 11px; }
.report-food-row:first-of-type { border-top: 0; }
.report-food-row span { color: var(--muted); text-align: right; }
.win-report { margin: 13px 0 0; padding: 17px 20px; border-radius: 21px; color: var(--wine-dark); background: var(--wine-soft); font-size: 12px; line-height: 1.6; }

.month-select { display: block; margin: 13px 0; }
.month-stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.month-stat {
  min-width: 0;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 21px;
  background: var(--card);
}
.month-stat span, .month-stat strong { display: block; }
.month-stat span { min-height: 28px; color: var(--muted); font-size: 9px; line-height: 1.4; }
.month-stat strong { margin-top: 8px; overflow: hidden; font-size: 20px; letter-spacing: -.04em; text-overflow: ellipsis; }
.month-stat.deficit { border-color: #cfe7d9; background: #f4fbf7; }
.month-stat.deficit strong { color: #2e7250; }
.month-stat.surplus { border-color: #f0d3cd; background: #fff7f5; }
.month-stat.surplus strong { color: #a14332; }
.chart-card canvas { display: block; width: 100%; height: 210px; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 15px; margin-top: 12px; color: var(--muted); font-size: 10px; }
.chart-legend span::before { content: ""; display: inline-block; width: 14px; height: 3px; margin: 0 6px 2px 0; border-radius: 9px; background: var(--wine); }
.chart-legend .waist-line::before { background: var(--blue); }
.chart-legend .hips-line::before { background: var(--gold); }
.month-table { overflow-x: auto; border: 1px solid var(--line); border-radius: 18px; }
.month-row {
  display: grid;
  grid-template-columns: 48px repeat(4, minmax(76px, 1fr)) repeat(3, minmax(62px, .75fr)) repeat(3, minmax(58px, .7fr));
  gap: 7px;
  min-width: 820px;
  padding: 11px 12px;
  border-top: 1px solid var(--line);
  font-size: 9px;
}
.month-row:first-child { border-top: 0; }
.month-row.header { color: var(--muted); background: #faf7f7; font-size: 8px; font-weight: 800; text-transform: uppercase; }
.month-row span:not(:first-child) { text-align: right; }

.motivation-feature {
  position: relative;
  min-height: 300px;
  margin-top: 22px;
  padding: clamp(27px, 6vw, 48px);
  overflow: hidden;
  border-radius: 36px;
  color: #fff;
  background:
    radial-gradient(circle at 100% 0%, rgba(255,255,255,.17), transparent 15rem),
    linear-gradient(145deg, #7d0a2a, #3e0316);
  box-shadow: 0 25px 60px rgba(84, 5, 30, .21);
}
.motivation-feature::after {
  content: "“";
  position: absolute;
  right: 20px;
  bottom: -110px;
  color: rgba(255,255,255,.06);
  font-family: Georgia, serif;
  font-size: 310px;
}
.motivation-feature > span { color: rgba(255,255,255,.6); font-size: 10px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.motivation-feature blockquote {
  position: relative;
  z-index: 1;
  max-width: 650px;
  margin: 27px 0 30px;
  font-size: clamp(28px, 5vw, 45px);
  font-weight: 700;
  line-height: 1.16;
  letter-spacing: -.045em;
}
.motivation-feature .light-button { position: relative; z-index: 1; color: #fff; border-color: rgba(255,255,255,.19); background: rgba(255,255,255,.10); }
.motivation-list { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.motivation-note { padding: 15px; border-radius: 17px; color: #4f4548; background: #faf6f7; font-size: 11px; line-height: 1.55; }
.motivation-note::before { content: "✦"; display: block; margin-bottom: 7px; color: var(--wine); }

.rescue-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: center;
  margin-top: 15px;
  padding: 26px;
  border-radius: var(--radius-xl);
  color: #fff;
  background: var(--ink);
}
.rescue-card span { color: rgba(255,255,255,.55); font-size: 9px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.rescue-card h2 { margin: 5px 0 7px; }
.rescue-card p { margin: 0; color: rgba(255,255,255,.62); font-size: 11px; line-height: 1.5; }
.slip-button,
.floating-slip {
  border: 0;
  color: #fff;
  background: linear-gradient(145deg, #d71a4f, #8b062d);
  box-shadow: 0 10px 28px rgba(151,11,47,.32);
  font-weight: 800;
}
.slip-button { width: 84px; height: 84px; border-radius: 50%; }
.floating-slip {
  position: fixed;
  z-index: 15;
  right: max(18px, calc((100vw - 940px) / 2 + 18px));
  bottom: calc(90px + env(safe-area-inset-bottom));
  display: none;
  width: 58px;
  height: 58px;
  border-radius: 20px;
  font-size: 10px;
}

.bottom-nav {
  position: fixed;
  z-index: 10;
  right: 50%;
  bottom: calc(14px + env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: repeat(4, minmax(72px, 1fr));
  width: min(calc(100% - 28px), 620px);
  padding: 7px;
  border: 1px solid rgba(233,224,226,.9);
  border-radius: 23px;
  background: rgba(255,255,255,.88);
  box-shadow: 0 16px 50px rgba(50,25,33,.16);
  backdrop-filter: blur(18px);
  transform: translateX(50%);
}
.bottom-nav button {
  min-height: 52px;
  padding: 6px;
  border: 0;
  border-radius: 17px;
  color: var(--muted);
  background: transparent;
  font-size: 9px;
  font-weight: 800;
}
.bottom-nav button span { display: block; margin-bottom: 3px; font-size: 17px; }
.bottom-nav button.active { color: #fff; background: var(--ink); }

.modal {
  width: min(calc(100% - 28px), 620px);
  max-height: min(84vh, 760px);
  padding: 30px;
  overflow: auto;
  border: 0;
  border-radius: 30px;
  color: var(--ink);
  background: #fff;
  box-shadow: 0 30px 90px rgba(31,14,20,.30);
}
.modal::backdrop { background: rgba(27,17,20,.58); backdrop-filter: blur(4px); }
.modal[open] { animation: modalIn .26s cubic-bezier(.22,.8,.35,1); }
@keyframes modalIn { from { opacity: 0; transform: translateY(20px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 14px;
  color: var(--muted);
  background: #f5f1f2;
  font-size: 24px;
}
.modal h2 { max-width: 470px; margin: 8px 45px 14px 0; font-size: 31px; line-height: 1.1; }
.modal h3 { margin: 24px 0 10px; font-size: 15px; }
.modal ul, .modal ol { margin: 0; padding-left: 20px; color: #5f5458; font-size: 12px; line-height: 1.75; }
.macro-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.macro-row span { padding: 10px; border-radius: 13px; color: var(--muted); background: #f8f4f5; font-size: 9px; text-align: center; }
.macro-row strong { display: block; margin-bottom: 2px; color: var(--ink); font-size: 14px; }
.rescue-modal blockquote { margin: 18px 0; padding: 17px; border-radius: 18px; color: var(--wine-dark); background: var(--wine-soft); font-size: 16px; font-weight: 700; line-height: 1.5; }
.rescue-steps { display: grid; gap: 10px; }
.rescue-steps div { display: grid; grid-template-columns: 33px 1fr; gap: 11px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 17px; }
.rescue-steps span { display: grid; width: 33px; height: 33px; place-items: center; border-radius: 11px; color: #fff; background: var(--ink); font-size: 11px; font-weight: 800; }
.rescue-steps p { margin: 0; color: #554b4e; font-size: 11px; line-height: 1.55; }

.toast {
  position: fixed;
  z-index: 30;
  right: 50%;
  bottom: calc(92px + env(safe-area-inset-bottom));
  max-width: calc(100% - 40px);
  padding: 12px 17px;
  border-radius: 999px;
  color: #fff;
  background: var(--ink);
  box-shadow: 0 12px 30px rgba(0,0,0,.2);
  font-size: 11px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transform: translate(50%, 12px);
  transition: opacity .2s ease, transform .2s ease;
}
.toast.show { opacity: 1; transform: translate(50%, 0); }
.hidden { display: none !important; }

@media (max-width: 760px) {
  body {
    background:
      radial-gradient(circle at 12% 0%, rgba(197, 111, 139, .11), transparent 22rem),
      var(--paper);
  }
  .app-shell {
    width: 100%;
    padding: 14px 13px calc(112px + env(safe-area-inset-bottom));
    overflow-x: hidden;
  }
  .topbar { margin: 1px 1px 16px; }
  .brand { min-width: 0; }
  .brand-mark {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    border-radius: 14px;
  }
  .brand > span:last-child { min-width: 0; }
  .brand strong {
    overflow: hidden;
    font-size: 17px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .soft-button { flex: 0 0 auto; padding: 9px 12px; }
  .hero-card {
    grid-template-columns: 1fr;
    gap: 19px;
    min-height: 0;
    padding: 27px 24px 24px;
    border-radius: 30px;
  }
  .hero-card::after {
    right: -14px;
    bottom: -60px;
    font-size: 205px;
  }
  .hero-card h1 {
    margin: 14px 0 15px;
    font-size: clamp(42px, 12vw, 57px);
    line-height: .98;
  }
  .hero-phrase { font-size: 13px; line-height: 1.55; }
  .hero-weight { align-self: end; justify-self: stretch; display: grid; grid-template-columns: 1fr auto; align-items: center; min-width: 0; }
  .hero-weight strong { grid-row: 1 / 3; grid-column: 2; margin: 0 0 0 14px; font-size: 34px; }
  .section-heading { margin-right: 2px; margin-left: 2px; }
  .metric-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .metric-card { min-height: 137px; }
  .content-card { margin-top: 12px; }
  .energy-summary { grid-template-columns: 1fr 1fr; }
  .energy-report-grid { grid-template-columns: 1fr 1fr; }
  .water-glasses { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; }
  .glass { height: 54px; }
  .month-stat-grid { grid-template-columns: 1fr 1fr; }
  .nutrition-target-grid { grid-template-columns: 1fr 1fr; }
  .daily-report-grid { grid-template-columns: 1fr 1fr; }
  .floating-slip {
    right: 13px;
    bottom: calc(82px + env(safe-area-inset-bottom));
    display: block;
    width: 54px;
    height: 54px;
    border-radius: 18px;
  }
  .bottom-nav {
    bottom: calc(8px + env(safe-area-inset-bottom));
    grid-template-columns: repeat(4, minmax(0, 1fr));
    width: calc(100% - 20px);
    max-width: 620px;
    padding: 6px;
    border-radius: 22px;
  }
  .bottom-nav button {
    min-width: 0;
    min-height: 51px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

@media (max-width: 520px) {
  .app-shell { padding-right: 12px; padding-left: 12px; }
  .content-card { padding: 18px; border-radius: 24px; }
  .section-heading { margin-top: 26px; }
  .section-heading h2,
  .card-head h2 { font-size: 21px; line-height: 1.12; }
  .metric-card { min-height: 132px; padding: 14px; border-radius: 21px; }
  .metric-card > span { margin-top: 25px; }
  .metric-card strong { margin: 6px 0 13px; font-size: 19px; }
  .metric-card strong small { font-size: 9px; }
  .activity-calories-form { grid-template-columns: 1fr; }
  .activity-calories-form .primary-button { width: 100%; min-width: 0; }
  .deficit-progress-head { align-items: flex-start; }
  .deficit-progress-head > div:last-child { max-width: 48%; }
  .measure-form, .custom-food-form { grid-template-columns: 1fr; }
  .measure-form .wide, .custom-food-form .full { grid-column: 1; }
  .menu-summary { grid-template-columns: 1fr 1fr; }
  .meal-card { grid-template-columns: auto minmax(0,1fr); padding: 15px; }
  .meal-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .recipe-open { width: auto; padding: 0 12px; }
  .recipe-open::before { content: "Рецепт "; }
  .motivation-list { grid-template-columns: 1fr; }
  .rescue-card { grid-template-columns: 1fr; }
  .slip-button { width: 100%; height: 52px; border-radius: 17px; }
  .month-table {
    display: grid;
    gap: 10px;
    overflow: visible;
    border: 0;
    border-radius: 0;
  }
  .month-row.header { display: none; }
  .month-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0;
    min-width: 0;
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--card);
    font-size: 12px;
  }
  .month-row:first-child { border-top: 1px solid var(--line); }
  .month-row span {
    min-width: 0;
    padding: 10px 12px;
    border-top: 1px solid var(--line);
    text-align: left !important;
  }
  .month-row span:nth-child(odd):not(:first-child) { border-left: 1px solid var(--line); }
  .month-row span::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 3px;
    color: var(--muted);
    font-size: 8px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
  }
  .month-row span:first-child {
    grid-column: 1 / -1;
    padding: 11px 13px;
    border-top: 0;
    color: var(--wine);
    background: #faf6f7;
    font-size: 15px;
    font-weight: 800;
  }
  .month-row span:nth-child(even) { border-left: 0; }
  .month-row span:last-child:nth-child(even) { grid-column: 1 / -1; }
  .modal { padding: 25px 20px; border-radius: 28px; }
  .modal h2 { font-size: 26px; }
  .macro-row { grid-template-columns: 1fr 1fr; }
  .page-intro { padding-top: 9px; }
  .page-intro h1 { font-size: clamp(43px, 14vw, 58px); }
  .card-head { align-items: flex-start; }
  input, select { min-height: 52px; }
  .bottom-nav button { padding: 6px 3px; font-size: 8px; }
  .bottom-nav button span { font-size: 16px; }
}

@media (max-width: 360px) {
  .app-shell { padding-right: 10px; padding-left: 10px; }
  .hero-card { padding: 24px 20px 21px; }
  .hero-card h1 { font-size: 39px; }
  .hero-weight { padding: 15px; border-radius: 20px; }
  .hero-weight strong { font-size: 30px; }
  .metric-grid { gap: 8px; }
  .metric-card { padding: 12px; }
  .metric-card strong { font-size: 18px; }
  .content-card { padding: 16px; }
  .bottom-nav button { font-size: 7.5px; }
  .energy-summary { gap: 6px; }
  .energy-summary div { padding: 11px; }
  .energy-summary strong { font-size: 14px; }
  .deficit-progress-card { padding: 15px 12px; }
  .deficit-level-markers { font-size: 7px; }
  .report-energy-form { grid-template-columns: 1fr; }
  .report-energy-form button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
