:root {
  color-scheme: light;
  --page: #f6f8f3;
  --white: #fff;
  --ink: #18281f;
  --muted: #56665b;
  --green: #245139;
  --green-dark: #153d2a;
  --lime: #d6e9af;
  --line: #e0e8dc;
  --soft: #edf3e8;
  --warning: #754719;
  --radius: 20px;
  font-family: "Inter", "Segoe UI", system-ui, sans-serif;
}
*, *::before, *::after { box-sizing: border-box }
body { margin: 0; background: var(--page); color: var(--ink); line-height: 1.5 }
button, input, select { font: inherit }
button { cursor: pointer }
a { color: var(--green) }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid #578449; outline-offset: 3px }
h1, h2, h3, p { margin: 0 }
h1, h2, h3 { line-height: 1.13; letter-spacing: -.035em }
h1 { font-size: clamp(2.2rem, 5.5vw, 4.6rem); font-weight: 760 }
h2 { font-size: clamp(1.45rem, 3vw, 2.1rem) }
h3 { font-size: 1.05rem }
img { display: block; max-width: 100% }
[hidden] { display: none !important }
.skip-link { position: fixed; top: -100px; z-index: 10; background: white; padding: 12px }
.skip-link:focus { top: 8px; left: 8px }
.topbar { background: var(--white); border-bottom: 1px solid var(--line) }
.top-inner { max-width: 1232px; margin: 0 auto; display: grid; grid-template-columns: 1fr auto 1fr; gap: 22px; align-items: center; min-height: 76px; padding: 0 26px }
.brand, .profile-link, .nav button { background: transparent; border: 0; color: var(--ink); display: inline-flex; align-items: center; gap: 8px }
.brand { justify-self: start; padding: 0; font-size: 1.17rem; letter-spacing: -.045em; white-space: nowrap }
.brand-mark { display: inline-grid; place-items: center; flex: none; width: 38px; height: 38px; border-radius: 12px; background-color: #21503a; color: #ecf6de }
.brand-mark.icon { mask: none }
.brand-mark::before { content: ""; width: 22px; height: 22px; background: currentColor; mask: url(icons/leaf.png) center / contain no-repeat }
.nav { display: flex; gap: 5px; align-items: center }
.nav button { min-height: 44px; padding: 0 13px; border-radius: 10px; font-size: .94rem; font-weight: 630; color: var(--muted) }
.nav button[aria-current="page"] { color: var(--green-dark); background: var(--soft) }
.nav button:hover, .profile-link:hover { background: var(--soft) }
.nav .profile-mobile { display: none }
.profile-link { justify-self: end; font-weight: 660; font-size: .9rem; border: 1px solid var(--line); padding: 9px 13px; border-radius: 10px }
.profile-link[aria-current="page"] { background: var(--soft) }
.page { width: min(1232px, 100%); margin: 0 auto; min-height: 65vh; padding: 30px 26px 42px }
.foot { text-align: center; color: var(--muted); font-size: .82rem; padding: 0 20px 22px }
.foot span { padding: 0 4px }
.icon { display: inline-grid; place-items: center; flex: none; width: 20px; height: 20px; background-color: currentColor; mask: var(--icon) center / contain no-repeat }
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius) }
.dashboard-top { display: grid; grid-template-columns: minmax(0, 2.45fr) minmax(260px, 1fr); gap: 16px }
.hero { overflow: hidden; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr); min-height: 323px; background: #163f2b; color: #f8f9ef }
.hero-copy { position: relative; padding: clamp(24px, 3.35vw, 50px); align-self: center }
.hero h1 { line-height: .97; letter-spacing: -.064em; margin: 15px 0 13px }
.hero h1 span { color: #d7e9b7 }
.hero p { color: #e0ebdd; max-width: 32ch; font-size: .98rem }
.hero-art { position: relative; min-height: 200px; overflow: hidden; background: #5d6d38 }
.hero-art img { width: 100%; height: 100%; position: absolute; inset: 0; object-fit: cover; object-position: 55% center }
.hero-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(22,63,43,.38), transparent 22%); pointer-events: none }
.kicker { text-transform: uppercase; letter-spacing: .11em; font-size: .8rem; font-weight: 750 }
.hero .kicker { color: #d7e9b7 }
.hero .button { margin-top: 21px }
.button { display: inline-flex; gap: 8px; align-items: center; justify-content: center; min-height: 43px; border: 1px solid transparent; border-radius: 10px; padding: 9px 15px; background: var(--green-dark); color: white; font-weight: 680; font-size: .94rem; text-decoration: none }
.button:hover { background: #2b6244 }
.button.light { background: var(--lime); color: #173420 }
.button.light:hover { background: #e8f3cc }
.button.outline { background: var(--white); color: var(--green-dark); border-color: var(--line) }
.button.outline:hover { background: var(--soft) }
.button.text { background: transparent; color: var(--green); padding: 4px 0; min-height: 37px }
.button.text:hover { text-decoration: underline }
.button:disabled { opacity: .65; cursor: default }
.dashboard-side { display: grid; gap: 12px }
.stat { padding: 16px 19px; display: grid; align-content: start; gap: 5px }
.stat:has(.weight-count) { background: #edf4e6 }
.stat-head { display: flex; align-items: center; gap: 9px; font-size: .95rem; font-weight: 690 }
.stat-head .icon { color: var(--green) }
.count { font-size: clamp(1.85rem, 3.8vw, 2.45rem); letter-spacing: -.065em; line-height: 1.12; font-weight: 770 }
.stat-meta, .muted { color: var(--muted) }
.stat-meta { font-size: .86rem }
.stat .button { justify-self: start; min-height: 32px }
.progress-bar { width: 100%; height: 6px; border-radius: 12px; background: #e7eee3; accent-color: #58834c; border: 0 }
.progress-bar::-webkit-progress-bar { background: #e7eee3; border-radius: 12px }
.progress-bar::-webkit-progress-value { background: #58834c; border-radius: 12px }
.progress-bar::-moz-progress-bar { background: #58834c; border-radius: 12px }
.section-top { margin: 30px 0 14px; display: flex; justify-content: space-between; align-items: end; gap: 12px; flex-wrap: wrap }
.section-top p { margin-top: 4px; color: var(--muted) }
.segment { display: flex; gap: 6px; flex-wrap: wrap }
.segment button { padding: 7px 12px; border-radius: 10px; color: var(--green-dark); background: var(--white); border: 1px solid var(--line); font-weight: 650; min-height: 40px }
.segment button[aria-pressed="true"] { background: var(--green-dark); border-color: var(--green-dark); color: white }
.days { display: grid; grid-template-columns: repeat(7,minmax(0,1fr)); gap: 8px; margin-bottom: 14px }
.day { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 53px; color: var(--muted); border: 1px solid var(--line); border-radius: 12px; background: var(--white); font-size: .9rem; text-transform: capitalize }
.day strong { color: var(--ink); font-size: 1.02rem }
.day[aria-pressed="true"] { color: #e4f0e2; background: var(--green-dark); border-color: var(--green-dark) }
.day[aria-pressed="true"] strong { color: white }
.day:hover:not([aria-pressed="true"]) { background: var(--soft) }
.meal-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px }
.meal { padding: 18px; display: grid; grid-template-rows: auto minmax(48px,1fr) auto; gap: 10px }
.meal-tag { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: .89rem; font-weight: 670 }
.meal-tag i { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; color: #45603f; background: #eaf1df }
.meal:nth-child(2) .meal-tag i { color: #77511e; background: #f6ecdb }
.meal:nth-child(3) .meal-tag i { color: #8b4a3d; background: #f7ece7 }
.meal:nth-child(4) .meal-tag i { color: #4d5685; background: #e9ecf8 }
.meal h3 { font-size: 1.18rem }
.meal .button { justify-self: start; min-height: 32px }
.all-days { display: grid; gap: 16px }
.all-days h3 { margin: 0 0 7px 2px }
.subhead { margin: 8px 0 24px }
.subhead h1 { font-size: clamp(2rem, 5vw, 3.45rem) }
.subhead p { color: var(--muted); max-width: 680px; margin: 8px 0 }
.split { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(247px, 1fr); gap: 16px; align-items: start }
.content-card { padding: clamp(16px,3vw,25px); display: grid; gap: 13px }
.content-card h2 { font-size: 1.35rem }
.content-card + .content-card { margin-top: 14px }
.list { padding: 0; margin: 0; list-style: none }
.list li { display: flex; justify-content: space-between; gap: 14px; padding: 10px 0; border-top: 1px solid var(--line) }
.list li:first-child { border-top: 0 }
.price { text-align: right; font-weight: 750; white-space: nowrap }
.shop-group { margin-bottom: 17px }
.shop-group h2 { margin-bottom: 13px }
.shop-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; align-items: center; border-top: 1px solid var(--line); padding: 11px 0 }
.shop-row .tags { display: flex; gap: 8px; grid-column: 1/-1 }
.shop-row .check-label { font-size: .85rem }
.shop-row small { display: block; margin-top: 2px; color: var(--muted) }
.check-label { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; min-height: 32px }
.check-label input { width: 18px; height: 18px; margin: 0; accent-color: var(--green) }
.pill { background: var(--soft); color: var(--green-dark); border-radius: 8px; min-height: 34px; padding: 4px 8px }
.pill:has(input:checked) { background: var(--lime) }
.shop-row.is-home .price { text-decoration: line-through }
.shop-row.is-bought strong:first-child { text-decoration: line-through }
.controls { display: flex; flex-wrap: wrap; gap: 9px }
form fieldset { border: 0; padding: 0; margin: 0; min-width: 0 }
form legend { font-weight: 710; margin: 0 0 8px }
.fields { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 9px }
.field { display: grid; gap: 5px; font-weight: 650 }
.field input, .field select, select { width: 100%; min-height: 44px; background: #fff; color: var(--ink); border: 1px solid #b6c5b5; border-radius: 9px; padding: 6px 10px }
.field input:disabled { background: var(--soft); color: var(--muted) }
.hint { font-size: .86rem; color: var(--muted); line-height: 1.45 }
.error { color: #a0271d; min-height: 1.2em }
.warn { color: var(--warning); background: #fff5e7; padding: 11px 12px; border-radius: 10px }
.profile-form { gap: 20px }
.progress-board { display: grid; gap: 10px }
.progress-board .count { font-size: 2.75rem }
.chart { display: block; width: 100%; height: 190px; margin: 6px 0 }
dialog { max-width: min(480px, calc(100vw - 26px)); width: 100%; padding: 20px 23px; border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink) }
dialog::backdrop { background: #14251db0 }
.dialog-inner { display: grid; gap: 12px }
.dialog-inner form { display: grid; gap: 12px }
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 6px }
.dialog-head h2 { margin-top: 4px; font-size: 1.65rem }
.close { color: var(--muted); background: var(--soft); border: 0; border-radius: 10px; width: 36px; min-width: 36px; height: 36px; display: grid; place-items: center }
.toast { position: fixed; background: var(--green-dark); color: white; bottom: 18px; right: 18px; z-index: 3; padding: 10px 14px; border-radius: 10px; max-width: calc(100% - 36px) }
.toast:empty { display: none }
@media (max-width: 900px) {
  .top-inner { padding: 0 18px }
  .page { padding: 22px 18px 35px }
  .hero-copy { padding: 24px }
  .meal-grid { grid-template-columns: repeat(2,minmax(0,1fr)) }
}
@media (max-width: 660px) {
  .top-inner { display: flex; min-height: 63px; padding: 0 13px }
  .nav { position: fixed; z-index: 4; bottom: 0; left: 0; right: 0; display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 3px; background: white; border-top: 1px solid var(--line); padding: 5px 5px max(5px,env(safe-area-inset-bottom)) }
  .nav button, .nav .profile-mobile { display: grid; grid-template-columns: 1fr; justify-items: center; gap: 2px; padding: 4px 3px; min-height: 48px; font-size: .79rem }
  .profile-link { display: none }
  .page { padding: 13px 12px 20px }
  .foot { padding: 0 10px 70px }
  .hero { grid-template-columns: 1fr; min-height: auto }
  .hero-art { min-height: 140px; grid-row: 1 }
  .hero-art::after { background: linear-gradient(0deg,rgba(22,63,43,.52), transparent 31%) }
  .hero-copy { padding: 17px 18px 20px }
  .hero h1 { margin: 9px 0 10px }
  .hero .button { margin-top: 14px }
  .dashboard-top, .split { grid-template-columns: minmax(0,1fr); gap: 11px }
  .dashboard-side { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px }
  .stat { padding: 12px 9px }
  .stat .button { text-align: left; justify-content: flex-start }
  .stat-head { gap: 4px; font-size: .83rem }
  .stat-head .icon { width: 16px; height: 16px }
  .section-top { margin-top: 21px }
  .days { gap: 3px }
  .day { flex-direction: column; gap: 0; border-radius: 8px; padding: 4px 0 }
  .meal-grid { gap: 7px }
  .meal { padding: 11px; gap: 7px }
  .meal h3 { font-size: 1.03rem }
  .toast { bottom: 71px }
}
@media (max-width: 385px) {
  .fields { grid-template-columns: 1fr 1fr }
  .shop-row .tags { gap: 4px; flex-wrap: wrap }
}
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; clip-path: inset(50%); overflow: hidden; white-space: nowrap }
.day-nutrition { margin: 0 0 9px; color: var(--muted); font-size: .9rem }
.day-nutrition strong, .day-title { text-transform: capitalize; color: var(--ink) }
.meal-note { margin-top: 5px; color: var(--muted); font-size: .85rem }
.nutrition-foot { margin-top: 13px }
.week-select { max-width: 240px; margin: 0 0 12px }
.taste-group { border-bottom: 1px solid var(--line); padding: 8px 0 }
.taste-group summary { cursor: pointer; font-weight: 650 }
.taste-items { margin-top: 4px }
.taste-row { display: grid; align-items: center; grid-template-columns: minmax(0,1fr) minmax(142px,.65fr); gap: 9px; padding: 3px 0 }
.taste-row select { font-size: .9rem; min-height: 37px }
.field + .hint, .hint + .controls { margin-top: 7px }
.profile-form legend + .hint { margin-bottom: 7px }
.profile-form .error:empty { display: none }
@media (max-width: 380px) {
  .taste-row { grid-template-columns: minmax(0,1fr) minmax(120px,.75fr) }
}

#copy-dialog textarea { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px; resize: vertical; color: var(--ink); font: inherit }
@media (max-width: 660px) {
  html[data-channel="telegram"] .nav { padding-bottom: max(5px, env(safe-area-inset-bottom), var(--tg-content-safe-area-inset-bottom, 0px)) }
  html[data-channel="telegram"] .foot { padding-bottom: calc(70px + var(--tg-content-safe-area-inset-bottom, 0px)) }
}
