@import url('/static/css/fonts.css');

:root {
  --bg: #f6f7f3;
  --surface: #fff;
  --surface-soft: #f8f9f5;
  --ink: #26372e;
  --muted: #899087;
  --line: #e9ece4;
  --green: #254f40;
  --green-light: #eaf0e3;
  --lime: #d5e6aa;
  --protein: #85a78c;
  --fat: #e3b877;
  --carbs: #a3a7cf;
  --shadow: 0 8px 36px #283c2b05;
  --radius: 22px;
  color-scheme: light
}

* {
  box-sizing: border-box
}

body {
  margin: 0;
  font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased
}

button,
input,
select {
  font: inherit
}

button,
a,
input,
select {
  -webkit-tap-highlight-color: transparent
}

button,
a {
  touch-action: manipulation
}

button {
  cursor: pointer
}

a {
  color: inherit;
  text-decoration: none
}

button {
  color: inherit
}

button:disabled {
  cursor: wait;
  opacity: .55
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid #9db784;
  outline-offset: 4px
}

button {
  border: 0;
  background: none
}

svg {
  width: 20px;
  height: 20px;
  vertical-align: middle;
  flex-shrink: 0
}

h1,
h2,
h3,
p {
  margin: 0
}

h1 {
  font-size: 31px;
  line-height: 1.28;
  font-weight: 750;
  letter-spacing: -1.15px
}

h2 {
  font-size: 18px;
  font-weight: 750;
  letter-spacing: -.5px
}

h3 {
  font-size: 15px;
  font-weight: 700
}

strong {
  font-weight: 700
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 236px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 38px 23px 20px;
  z-index: 20;
  display: flex;
  flex-direction: column
}

.brand {
  display: flex;
  align-items: center;
  font-size: 32px;
  letter-spacing: -1.9px;
  font-weight: 800;
  line-height: 1
}

.brand-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 9px;
  color: var(--green)
}

.brand-mark svg {
  width: 33px;
  height: 33px
}

.brand-last {
  color: var(--green)
}

.brand-dot {
  color: #91a269
}

.brand-caption {
  color: var(--muted);
  font-size: 11px;
  padding: 12px 0 0 44px;
  letter-spacing: .4px
}

.nav-label {
  font-size: 9px;
  font-weight: 700;
  color: #a1a79d;
  letter-spacing: 1.2px;
  margin: 57px 14px 17px
}

.nav {
  display: grid;
  gap: 8px
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 14px 15px;
  border-radius: 12px;
  color: #858c82;
  font-size: 13px;
  font-weight: 600;
  transition: background .2s, color .2s
}

.nav-item svg {
  width: 20px;
  height: 20px
}

.nav-item:hover {
  background: var(--surface-soft);
  color: var(--green)
}

.nav-item.active {
  color: var(--green);
  background: var(--green-light)
}

.nav-indicator {
  width: 5px;
  height: 5px;
  background: var(--green);
  border-radius: 50%;
  margin-left: auto
}

.sidebar-note {
  margin: 54px 14px 0;
  padding-top: 27px;
  border-top: 1px solid var(--line)
}

.little-spark {
  display: block;
  color: #7f9472;
  margin-bottom: 15px
}

.little-spark svg {
  width: 25px;
  height: 25px
}

.sidebar-note strong {
  font-size: 14px;
  line-height: 1.7;
  font-weight: 650
}

.sidebar-note p {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.9;
  margin-top: 10px
}

.sidebar-bottom {
  margin-top: auto;
  padding-top: 28px
}

.subtle-link {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 10px;
  color: var(--muted);
  width: 100%;
  padding: 10px 2px
}

.subtle-link svg {
  width: 16px;
  height: 16px
}

.subtle-link>span:last-child {
  margin-left: auto
}

.sidebar-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  margin-top: 17px;
  padding-top: 17px;
  font-size: 10px;
  color: #a6aba1
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 35px;
  height: 35px;
  border-radius: 50%;
  transition: background .2s
}

.icon-button:hover {
  background: var(--green-light)
}

.icon-button svg {
  width: 18px;
  height: 18px
}

.workspace {
  margin-left: 236px;
  min-height: 100vh
}

.topbar {
  height: 88px;
  padding: 0 44px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px
}

.breadcrumb {
  font-size: 11px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 17px
}

.breadcrumb span {
  color: #c8cdc1
}

.breadcrumb strong {
  color: #656e62;
  font-weight: 600
}

.topbar-right {
  display: flex;
  gap: 19px;
  align-items: center
}

.demo-badge {
  font-size: 10px;
  color: #969b90;
  display: inline-flex;
  align-items: center;
  gap: 6px
}

.demo-badge[hidden] {
  display: none
}

.demo-badge i {
  width: 5px;
  height: 5px;
  background: #a6b188;
  border-radius: 50%
}

.balance-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 10px;
  border: 1px solid var(--line);
  border-radius: 30px;
  padding: 8px 12px;
  background: var(--surface)
}

.balance-pill svg {
  width: 14px;
  height: 14px;
  color: #81916c
}

.balance-pill strong {
  font-size: 11px
}

.balance-word {
  color: var(--muted)
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #e8ecdf;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--green);
  font-weight: 700;
  font-size: 12px;
  border: 3px solid var(--surface)
}

.mobile-brand,
.mobile-nav {
  display: none
}

main {
  max-width: 1380px;
  margin: auto;
  padding: 38px 44px 10px;
  min-height: calc(100vh - 152px)
}

.page-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  margin-bottom: 29px
}

.eyebrow {
  display: block;
  font-size: 9px;
  letter-spacing: 1.6px;
  font-weight: 750;
  color: var(--muted);
  margin-bottom: 10px
}

.page-subtitle {
  font-size: 12px;
  color: var(--muted);
  margin-top: 10px
}

.button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  border-radius: 11px;
  font-size: 11px;
  font-weight: 650;
  min-height: 42px;
  padding: 11px 16px;
  transition: transform .18s, background .18s
}

.button:hover {
  transform: translateY(-1px)
}

.button svg {
  width: 16px;
  height: 16px
}

.button.primary {
  background: var(--green);
  color: white
}

.button.primary:hover {
  background: #32604e
}

.button.secondary {
  background: var(--surface);
  border: 1px solid var(--line)
}

.button.soft {
  background: var(--green-light);
  color: var(--green)
}

.button.danger {
  background: #fbefeb;
  color: #a55243
}

.button.full {
  width: 100%
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  gap: 16px
}

.date-tabs {
  display: flex;
  background: #ebeee6;
  padding: 4px;
  gap: 3px;
  border-radius: 11px
}

.date-tab {
  font-size: 10px;
  min-height: 33px;
  padding: 8px 18px;
  border-radius: 8px;
  color: #81897a;
  white-space: nowrap;
  font-weight: 650
}

.date-tab.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 2px 5px #283c2b08
}

.date-tab svg {
  width: 12px;
  height: 12px;
  margin-left: 5px
}

.date-current {
  font-size: 10px;
  color: #93998f;
  display: flex;
  gap: 7px;
  align-items: center
}

.date-current svg {
  width: 14px;
  height: 14px
}

.summary {
  display: grid;
  grid-template-columns: 1.55fr 1fr 1fr 1fr;
  gap: 15px;
  margin-bottom: 26px
}

.metric {
  border-radius: var(--radius);
  padding: 22px 22px 17px;
  background: var(--surface);
  border: 1px solid var(--line);
  min-height: 160px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow)
}

.metric-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: #828a7c;
  font-weight: 550
}

.metric-label>svg {
  width: 15px;
  height: 15px
}

.metric-value {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -1.6px;
  line-height: 1.1;
  margin-top: 22px;
  font-variant-numeric: tabular-nums
}

.metric-value small {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  color: #98a18f;
  margin-left: 5px
}

.metric-foot {
  margin-top: 14px;
  font-size: 9px;
  color: #a0a599;
  display: flex;
  align-items: center;
  gap: 6px
}

.metric-foot:before {
  content: '';
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent, var(--protein))
}

.metric.energy {
  background: var(--green);
  color: #fff;
  border-color: var(--green)
}

.energy .metric-label {
  color: #c3d5be
}

.energy .metric-value {
  font-size: 39px;
  position: relative;
  z-index: 1
}

.energy .metric-value small {
  color: #bfd1b8
}

.energy .metric-foot {
  color: #bfd1b8
}

.energy .metric-foot:before {
  background: var(--lime)
}

.energy-art {
  position: absolute;
  width: 128px;
  height: 128px;
  border: 1px solid #ffffff12;
  border-radius: 50%;
  right: -28px;
  bottom: -14px;
  transform: rotate(-28deg)
}

.energy-art:before,
.energy-art:after {
  content: '';
  position: absolute;
  border: 1px solid #ffffff12;
  border-radius: 50%;
  inset: 15px
}

.energy-art:after {
  inset: 30px
}

.metric-icon {
  margin-left: auto;
  width: 25px;
  height: 25px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--tint, #f1f5ee);
  border-radius: 8px;
  color: var(--accent, var(--protein))
}

.metric-icon svg {
  width: 13px;
  height: 13px
}

.content-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 294px;
  gap: 23px;
  align-items: start
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  align-items: center;
  padding: 23px 24px 13px
}

.panel-heading h2 {
  font-size: 16px
}

.panel-subtitle {
  font-size: 10px;
  color: var(--muted);
  margin-top: 5px
}

.count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  font-size: 9px;
  border-radius: 6px;
  min-width: 24px;
  height: 24px;
  margin-left: 8px;
  vertical-align: middle;
  font-weight: 650;
  color: var(--muted)
}

.text-link {
  font-size: 10px;
  color: #71826b;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 0;
  white-space: nowrap
}

.text-link svg {
  width: 13px;
  height: 13px
}

.meal-list {
  padding: 0 24px
}

.meal-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: opacity .2s;
  width: 100%;
  text-align: left
}

.meal-row:hover {
  opacity: .75
}

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

.meal-image {
  width: 62px;
  height: 62px;
  border-radius: 16px;
  object-fit: cover;
  background: var(--green-light)
}

.meal-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #8fa086;
  font-size: 25px
}

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

.meal-meta {
  display: flex;
  gap: 7px;
  align-items: center;
  font-size: 9px;
  color: #9ba193;
  margin-bottom: 5px
}

.meal-meta svg {
  width: 11px;
  height: 11px
}

.meal-title {
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 300px;
  letter-spacing: -.2px
}

.meal-ingredients {
  font-size: 9px;
  color: #9aa08f;
  margin-top: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 280px
}

.meal-calories {
  text-align: right;
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -.5px;
  white-space: nowrap
}

.meal-calories small {
  display: block;
  font-size: 9px;
  font-weight: 450;
  color: var(--muted);
  letter-spacing: 0;
  margin-top: 3px
}

.meal-arrow {
  color: #b9bfb2
}

.meal-arrow svg {
  width: 14px;
  height: 14px
}

.meal-panel-bottom {
  padding: 13px 24px 17px;
  border-top: 1px solid var(--line);
  font-size: 9px;
  color: #9aa18f;
  display: flex;
  gap: 7px;
  align-items: center
}

.meal-panel-bottom svg {
  width: 12px;
  height: 12px
}

.right-column {
  display: grid;
  gap: 20px
}

.composition-panel .panel-heading {
  padding-bottom: 2px
}

.donut-wrap {
  position: relative;
  width: 158px;
  height: 158px;
  margin: 18px auto 20px
}

.donut {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: conic-gradient(var(--protein) 0deg var(--p), var(--surface) var(--p) calc(var(--p) + 3deg), var(--fat) calc(var(--p) + 3deg) var(--f), var(--surface) var(--f) calc(var(--f) + 3deg), var(--carbs) calc(var(--f) + 3deg) 357deg, var(--surface) 357deg);
  transform: rotate(-90deg)
}

.donut:after {
  content: '';
  position: absolute;
  inset: 15px;
  background: var(--surface);
  border-radius: 50%
}

.donut.empty {
  background: var(--line)
}

.donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  pointer-events: none
}

.donut-center svg {
  color: #91a07e;
  width: 20px;
  height: 20px;
  margin-bottom: 5px
}

.donut-center strong {
  font-size: 23px;
  letter-spacing: -.8px
}

.donut-center small {
  font-size: 9px;
  color: var(--muted);
  margin-top: 2px
}

.composition-legend {
  margin: 0 24px 19px;
  display: grid;
  gap: 10px
}

.legend-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  color: #8c9486
}

.legend-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color)
}

.legend-row strong {
  margin-left: auto;
  font-size: 10px;
  color: #5e6b56;
  font-weight: 650
}

.composition-note {
  margin: 0 20px 18px;
  text-align: center;
  font-size: 8px;
  line-height: 1.6;
  color: #9aa18f
}

.bot-card {
  position: relative;
  background: #eaf0e1;
  border-radius: var(--radius);
  overflow: hidden;
  min-height: 260px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: flex-start
}

.bot-card .eyebrow {
  color: #81916a;
  font-size: 8px;
  letter-spacing: 1.2px
}

.bot-card h2 {
  font-size: 22px;
  line-height: 1.35;
  max-width: 170px;
  letter-spacing: -.8px;
  position: relative;
  z-index: 1
}

.bot-card p {
  font-size: 10px;
  color: #8a967c;
  line-height: 1.8;
  margin-top: 10px;
  max-width: 145px;
  position: relative;
  z-index: 1
}

.bot-card .button {
  margin-top: 20px;
  font-size: 10px;
  padding: 11px 13px;
  position: relative;
  z-index: 1;
  min-height: 38px
}

.bot-card img {
  position: absolute;
  width: 145px;
  height: 145px;
  border-radius: 50%;
  right: -42px;
  bottom: 48px;
  object-fit: cover;
  transform: rotate(-12deg);
  border: 7px solid #f5f6ec;
  box-shadow: 0 10px 22px #3e553820
}

.bot-card:after {
  content: '';
  width: 185px;
  height: 185px;
  border-radius: 50%;
  border: 1px solid #c5d4b4;
  position: absolute;
  right: -66px;
  bottom: 27px
}

.trend-panel {
  margin-top: 21px
}

.trend-top-right {
  font-size: 9px;
  color: var(--muted);
  display: flex;
  gap: 5px;
  align-items: center
}

.trend-top-right:before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #829d70
}

.chart {
  padding: 12px 23px 21px;
  position: relative
}

.chart-bars {
  height: 116px;
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 9px;
  border-bottom: 1px solid var(--line);
  background: repeating-linear-gradient(to top, transparent 0px, transparent 37px, var(--line) 38px, transparent 39px)
}

.bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  position: relative;
  padding: 0 5px
}

.bar-col .bar {
  width: min(100%, 30px);
  min-height: 3px;
  border-radius: 6px 6px 0 0;
  background: #dce6d2;
  transition: height .4s, background .2s;
  position: relative
}

.bar-col.today .bar {
  background: #7f9b6c
}

.bar-col:hover .bar {
  background: var(--green)
}

.bar-tooltip {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  color: var(--surface);
  background: var(--green);
  border-radius: 6px;
  font-size: 8px;
  padding: 4px 6px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  z-index: 2
}

.bar-col:hover .bar-tooltip,
.bar-col:focus-visible .bar-tooltip {
  opacity: 1
}

.chart-labels {
  display: flex;
  gap: 9px;
  margin-top: 10px
}

.chart-labels span {
  flex: 1;
  text-align: center;
  color: #a0a692;
  font-size: 9px
}

.chart-labels span.today {
  color: var(--green);
  font-weight: 750
}

.footer {
  max-width: 1380px;
  margin: 0 auto;
  padding: 27px 44px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #a2a897;
  font-size: 9px
}

.footer span:last-child {
  display: flex;
  align-items: center;
  gap: 6px
}

.status-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #a6b88e
}

.history-panel {
  margin-top: 20px
}

.history-day {
  padding: 22px 24px 0;
  color: #8c9582;
  font-size: 10px;
  display: flex;
  gap: 10px;
  align-items: center
}

.history-day:after {
  content: '';
  height: 1px;
  background: var(--line);
  flex: 1
}

.history-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px
}

.search {
  position: relative;
  max-width: 330px;
  flex: 1
}

.search input {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 11px;
  padding: 12px 15px 12px 40px;
  color: var(--ink);
  font-size: 11px
}

.search>svg {
  position: absolute;
  left: 14px;
  top: 13px;
  width: 15px;
  height: 15px;
  color: #9aa58d
}

.history-summary {
  font-size: 10px;
  color: var(--muted)
}

.empty {
  padding: 45px 20px;
  text-align: center
}

.empty-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  margin: 0 auto 20px;
  background: var(--green-light);
  color: #82936c;
  border-radius: 20px
}

.empty-icon svg {
  width: 25px;
  height: 25px
}

.empty h3 {
  font-size: 15px;
  margin-bottom: 9px
}

.empty p {
  font-size: 11px;
  color: var(--muted);
  max-width: 310px;
  line-height: 1.9;
  margin: 0 auto 20px
}

.initial-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  gap: 18px;
  color: var(--muted);
  font-size: 12px
}

.loader {
  width: 27px;
  height: 27px;
  border: 2px solid var(--line);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin .8s linear infinite
}

@keyframes spin {
  to {
    transform: rotate(360deg)
  }
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(7px)
  }

  to {
    opacity: 1;
    transform: translateY(0)
  }
}

.page {
  animation: fadeUp .3s ease
}

.profile-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 23px;
  align-items: start
}

.profile-user {
  display: flex;
  align-items: center;
  gap: 17px;
  padding: 25px
}

.profile-user .avatar {
  width: 60px;
  height: 60px;
  font-size: 22px;
  border: 0
}

.profile-user h2 {
  font-size: 20px
}

.profile-user p {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px
}

.profile-user small {
  display: block;
  font-size: 9px;
  color: var(--muted);
  margin-top: 7px
}

.profile-wallet {
  margin-top: 20px;
  padding: 27px;
  background: var(--green);
  color: white;
  border-radius: var(--radius);
  position: relative;
  overflow: hidden
}

.profile-wallet .eyebrow {
  color: #b7c9ae
}

.profile-wallet h2 {
  font-size: 43px;
  letter-spacing: -1.5px;
  margin-top: 15px
}

.profile-wallet h2 small {
  font-size: 13px;
  color: #bbceaf;
  letter-spacing: 0;
  font-weight: 450
}

.profile-wallet p {
  color: #b9cbb1;
  font-size: 11px;
  margin-top: 11px;
  line-height: 1.9
}

.profile-wallet .button {
  background: var(--lime);
  color: var(--green);
  margin-top: 22px
}

.profile-wallet .wallet-details {
  display: flex;
  gap: 30px;
  padding-top: 22px;
  margin-top: 22px;
  border-top: 1px solid #ffffff15;
  font-size: 10px;
  color: #b9cbb1
}

.wallet-details strong {
  display: block;
  font-size: 14px;
  color: #eff4e8;
  margin-top: 4px
}

.settings-panel {
  margin-top: 20px
}

.setting-row {
  padding: 18px 24px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  text-align: left
}

.setting-row>svg {
  color: #8c9a7a;
  width: 18px;
  height: 18px
}

.setting-row>div {
  flex: 1;
  font-size: 11px;
  font-weight: 650
}

.setting-row small {
  display: block;
  color: var(--muted);
  font-size: 9px;
  font-weight: 400;
  margin-top: 4px
}

.setting-row .row-tail {
  font-size: 10px;
  color: var(--muted);
  max-width: 170px;
  text-align: right
}

.setting-row.danger-row {
  color: #b47362
}

.referral-panel {
  padding: 25px
}

.referral-icon {
  width: 49px;
  height: 49px;
  background: var(--green-light);
  border-radius: 16px;
  color: #7e9268;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 22px
}

.referral-icon svg {
  width: 24px;
  height: 24px
}

.referral-panel h2 {
  font-size: 22px;
  line-height: 1.4;
  max-width: 220px
}

.referral-panel p {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.9;
  margin-top: 13px
}

.referral-amount {
  font-size: 30px;
  font-weight: 750;
  color: var(--green);
  letter-spacing: -1px;
  margin: 18px 0 3px
}

.referral-amount small {
  font-size: 11px;
  color: var(--muted);
  font-weight: 450;
  letter-spacing: 0
}

.referral-panel .button {
  margin-top: 19px
}

.referral-stat {
  border-top: 1px solid var(--line);
  padding-top: 17px;
  margin-top: 22px;
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--muted)
}

.referral-stat strong {
  color: var(--ink);
  font-size: 17px;
  display: block;
  margin-bottom: 4px
}

.profile-aside-note {
  font-size: 10px;
  color: var(--muted);
  padding: 20px;
  line-height: 1.9;
  display: flex;
  gap: 10px
}

.profile-aside-note svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  margin-top: 2px
}

dialog {
  padding: 28px;
  border: none;
  background: var(--surface);
  color: var(--ink);
  border-radius: 24px;
  width: min(620px, calc(100vw - 32px));
  max-height: 88dvh;
  box-shadow: 0 25px 100px #172e2940;
  overflow: auto
}

dialog::backdrop {
  background: #17281e65;
  backdrop-filter: blur(5px)
}

.modal-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 24px
}

.modal-top .eyebrow {
  font-size: 8px;
  margin-bottom: 6px
}

.modal-top h2 {
  font-size: 23px;
  line-height: 1.4
}

.modal-text {
  font-size: 12px;
  line-height: 1.9;
  color: var(--muted)
}

.modal-text p+p {
  margin-top: 15px
}

.modal-text strong {
  color: var(--ink)
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 24px;
  justify-content: flex-end
}

.form-label {
  display: block;
  font-size: 10px;
  font-weight: 650;
  color: #828e77;
  margin-bottom: 8px
}

.form-input {
  width: 100%;
  padding: 11px 12px;
  background: var(--surface-soft);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 12px;
  min-height: 42px
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px
}

.form-error {
  font-size: 11px;
  color: #b57261;
  margin-top: 12px;
  min-height: 16px
}

.detail-meta {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 10px;
  flex-wrap: wrap
}

.detail-photo {
  width: 100%;
  height: 160px;
  border-radius: 15px;
  object-fit: cover;
  margin-bottom: 20px
}

.detail-totals {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  background: var(--surface-soft);
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 13px;
  margin: 20px 0
}

.detail-totals strong {
  font-size: 18px;
  display: block;
  font-weight: 700
}

.detail-totals small {
  font-size: 9px;
  color: var(--muted)
}

.table-scroll {
  overflow-x: auto
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 10px
}

th {
  font-size: 8px;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
  padding: 12px 5px;
  border-bottom: 1px solid var(--line)
}

td {
  padding: 14px 5px;
  border-bottom: 1px solid var(--line)
}

td:first-child {
  min-width: 130px;
  font-weight: 600
}

td:not(:first-child),
th:not(:first-child) {
  text-align: right
}

td .form-input {
  min-height: 32px;
  font-size: 10px;
  padding: 6px;
  width: 64px
}

td:first-child .form-input {
  width: 150px
}

.note {
  font-size: 10px;
  color: var(--muted);
  line-height: 1.8;
  margin-top: 15px;
  display: flex;
  gap: 8px
}

.note svg {
  width: 14px;
  height: 14px;
  margin-top: 2px;
  flex-shrink: 0
}

.transaction {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line)
}

.transaction-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-soft);
  border-radius: 12px;
  color: #8da378
}

.transaction-icon svg {
  width: 16px;
  height: 16px
}

.transaction-main {
  flex: 1
}

.transaction-main strong {
  font-size: 11px;
  display: block
}

.transaction-main small {
  font-size: 9px;
  color: var(--muted);
  display: block;
  margin-top: 4px
}

.transaction-amount {
  font-size: 13px;
  font-weight: 700
}

.transaction-amount.positive {
  color: #7e9b66
}

.toast {
  position: fixed;
  z-index: 100;
  bottom: 30px;
  left: calc(50% + 110px);
  transform: translate(-50%, 15px);
  padding: 13px 20px;
  background: var(--green);
  color: white;
  box-shadow: 0 8px 25px #15322520;
  border-radius: 12px;
  font-size: 11px;
  max-width: calc(100vw - 40px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s
}

.toast.visible {
  opacity: 1;
  transform: translate(-50%, 0)
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 999;
  padding: 10px;
  background: white;
  color: black;
  transform: translateY(-200%)
}

.skip-link:focus {
  transform: translateY(0)
}

.copy-field {
  display: flex;
  gap: 9px;
  margin-top: 18px
}

.copy-field input {
  min-width: 0
}

.load-more {
  display: flex;
  justify-content: center;
  padding: 18px
}

.privacy-section {
  margin-top: 20px
}

.privacy-section h3 {
  margin-bottom: 8px
}

.radio-options {
  display: grid;
  gap: 10px
}

.radio-options label {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 12px
}

.auth-error {
  max-width: 420px;
  margin: 12vh auto;
  text-align: center
}

.auth-error h1 {
  font-size: 26px
}

.auth-error p {
  font-size: 12px;
  line-height: 1.9;
  color: var(--muted);
  margin: 18px 0
}

html[data-theme=dark] {
  --bg: #171e19;
  --surface: #202923;
  --surface-soft: #263027;
  --ink: #e3ebdb;
  --muted: #8d9b85;
  --line: #323d31;
  --green: #365e45;
  --green-light: #2d3c2b;
  color-scheme: dark
}

html[data-theme=dark] .date-tabs {
  background: #253022
}

html[data-theme=dark] .bot-card {
  background: #2f402b
}

html[data-theme=dark] .avatar {
  background: #394b31;
  color: #d4e6ba
}

html[data-theme=dark] .legend-row strong {
  color: #c7d4b7
}

html[data-theme=dark] .metric-icon {
  background: #293c2a
}

html[data-theme=dark] .sidebar-note strong {
  color: #cbd9bf
}

html[data-theme=dark] .profile-wallet {
  background: #2a4c35
}

@media(min-width:1550px) {
  main {
    padding-top: 45px
  }

  .metric {
    min-height: 177px;
    padding: 24px
  }

  .metric-value {
    font-size: 38px
  }

  .energy .metric-value {
    font-size: 46px
  }

  .content-columns {
    grid-template-columns: minmax(0, 1fr) 330px
  }

  .meal-row {
    padding: 23px 0
  }

  .meal-image {
    width: 72px;
    height: 72px
  }

  .meal-title {
    font-size: 13px
  }

  .chart-bars {
    height: 135px
  }

  .bot-card {
    min-height: 285px
  }

  .bot-card img {
    width: 170px;
    height: 170px
  }
}

@media(max-width:1250px) {
  .sidebar {
    width: 206px;
    padding-left: 17px;
    padding-right: 17px
  }

  .workspace {
    margin-left: 206px
  }

  .topbar {
    padding: 0 30px
  }

  main {
    padding: 30px 30px 10px
  }

  .footer {
    padding-left: 30px;
    padding-right: 30px
  }

  .content-columns {
    grid-template-columns: minmax(0, 1fr) 260px;
    gap: 18px
  }

  .metric {
    padding: 18px 16px;
    min-height: 152px
  }

  .metric-value {
    font-size: 30px
  }

  .energy .metric-value {
    font-size: 34px
  }

  .summary {
    gap: 10px
  }

  .panel-heading {
    padding-left: 20px;
    padding-right: 20px
  }

  .meal-list {
    padding: 0 20px
  }

  .meal-image {
    width: 53px;
    height: 53px;
    border-radius: 13px
  }

  .meal-title {
    font-size: 11px;
    max-width: 235px
  }

  .meal-ingredients {
    max-width: 210px
  }

  .meal-arrow {
    display: none
  }

  .meal-calories {
    font-size: 14px
  }

  .profile-grid {
    grid-template-columns: minmax(0, 1fr) 280px
  }

  .topbar-right {
    gap: 12px
  }

  .nav-label {
    font-size: 8px
  }

  .subtle-link {
    font-size: 9px
  }
}

@media(max-width:1050px) {
  .sidebar {
    width: 180px;
    padding-left: 13px;
    padding-right: 13px
  }

  .brand {
    font-size: 28px
  }

  .brand-mark {
    margin-right: 5px
  }

  .brand-mark svg {
    width: 29px;
    height: 29px
  }

  .brand-caption {
    font-size: 9px;
    padding-left: 34px
  }

  .workspace {
    margin-left: 180px
  }

  .topbar {
    padding: 0 24px;
    height: 75px
  }

  main {
    padding: 30px 24px 10px
  }

  .footer {
    padding-left: 24px;
    padding-right: 24px
  }

  .nav-label {
    font-size: 7px;
    margin-left: 10px
  }

  .nav-item {
    font-size: 11px;
    padding-left: 12px;
    gap: 9px
  }

  .sidebar-note {
    margin-left: 10px;
    margin-right: 10px
  }

  .sidebar-note strong {
    font-size: 12px
  }

  .sidebar-note p {
    font-size: 10px
  }

  .subtle-link {
    font-size: 8px
  }

  .subtle-link>span:last-child {
    display: none
  }

  .content-columns {
    grid-template-columns: minmax(0, 1fr) 230px;
    gap: 16px
  }

  .panel-heading {
    padding: 20px 17px 12px
  }

  .meal-list {
    padding: 0 17px
  }

  .meal-row {
    gap: 10px
  }

  .meal-title {
    max-width: 180px;
    font-size: 10px
  }

  .meal-ingredients {
    max-width: 165px;
    font-size: 8px
  }

  .meal-meta {
    font-size: 8px
  }

  .meal-calories {
    font-size: 13px
  }

  .metric-label {
    font-size: 10px;
    gap: 5px
  }

  .metric-icon {
    width: 21px;
    height: 21px
  }

  .metric-value {
    font-size: 28px
  }

  .energy .metric-value {
    font-size: 32px
  }

  .metric-foot {
    font-size: 8px
  }

  .date-tab {
    padding-left: 14px;
    padding-right: 14px
  }

  .composition-legend {
    margin-left: 18px;
    margin-right: 18px
  }

  .bot-card {
    padding: 21px
  }

  .bot-card img {
    right: -65px;
    bottom: 52px
  }

  .profile-grid {
    grid-template-columns: minmax(0, 1fr) 260px
  }

  .breadcrumb {
    font-size: 10px;
    gap: 12px
  }

  .demo-badge {
    font-size: 8px
  }

  .page-heading h1 {
    font-size: 27px
  }

  .summary {
    grid-template-columns: 1.45fr 1fr 1fr 1fr
  }

  .metric {
    padding: 17px 13px
  }

  .metric-value small {
    font-size: 10px
  }

  .date-current {
    font-size: 9px
  }

  .meal-panel-bottom {
    padding-left: 17px;
    font-size: 8px
  }
}

@media(max-width:850px) {
  .content-columns {
    grid-template-columns: 1fr
  }

  .right-column {
    grid-template-columns: 1fr 1fr;
    align-items: stretch;
    margin-top: 3px
  }

  .bot-card {
    min-height: 300px
  }

  .bot-card h2 {
    font-size: 24px
  }

  .bot-card p {
    max-width: 145px
  }

  .bot-card img {
    width: 150px;
    height: 150px;
    right: -60px;
    bottom: 50px
  }

  .meal-title {
    max-width: 300px;
    font-size: 12px
  }

  .meal-ingredients {
    max-width: 260px;
    font-size: 9px
  }

  .meal-image {
    width: 62px;
    height: 62px
  }

  .meal-calories {
    font-size: 16px
  }

  .meal-meta {
    font-size: 9px
  }

  .profile-grid {
    grid-template-columns: 1fr
  }

  .profile-aside {
    display: grid;
    grid-template-columns: 1fr
  }

  .summary {
    grid-template-columns: 1.25fr 1fr 1fr 1fr
  }

  .metric {
    padding: 15px 12px;
    min-height: 145px
  }

  .metric-value {
    font-size: 25px
  }

  .energy .metric-value {
    font-size: 28px
  }

  .metric-icon {
    display: none
  }

  .metric-label {
    font-size: 9px
  }

  .metric-foot {
    font-size: 7px
  }

  .demo-badge {
    display: none
  }

  .page-heading .button {
    padding: 10px 12px;
    font-size: 10px
  }

  .date-current svg {
    display: none
  }

  .date-tab {
    padding-left: 11px;
    padding-right: 11px
  }

  .footer {
    font-size: 8px
  }

  .footer>span:first-child {
    display: none
  }

  .footer {
    justify-content: center
  }
}

@media(max-width:650px) {
  .sidebar {
    display: none
  }

  .workspace {
    margin-left: 0
  }

  .topbar {
    height: 74px;
    padding: 0 21px
  }

  .breadcrumb {
    display: none
  }

  .mobile-brand {
    display: block;
    font-size: 25px;
    letter-spacing: -1.2px;
    font-weight: 800
  }

  .mobile-brand span {
    color: #7b9366
  }

  .topbar-right {
    gap: 12px
  }

  .avatar {
    width: 32px;
    height: 32px
  }

  .balance-pill {
    font-size: 9px;
    padding: 7px 10px
  }

  .balance-pill strong {
    font-size: 10px
  }

  .balance-pill svg {
    width: 12px;
    height: 12px
  }

  .balance-word {
    display: none
  }

  main {
    padding: 29px 21px 10px;
    min-height: calc(100dvh - 200px)
  }

  .page-heading {
    margin-bottom: 25px;
    align-items: flex-start
  }

  .eyebrow {
    font-size: 8px;
    letter-spacing: 1.4px
  }

  .page-heading h1 {
    font-size: 26px;
    letter-spacing: -1px
  }

  .page-subtitle {
    font-size: 11px;
    margin-top: 8px;
    line-height: 1.8;
    max-width: 260px
  }

  .page-heading .button {
    width: 37px;
    min-width: 37px;
    height: 37px;
    min-height: 0;
    padding: 0;
    border-radius: 11px;
    margin-top: 21px
  }

  .page-heading .button .button-label {
    display: none
  }

  .page-heading .button svg {
    width: 17px;
    height: 17px
  }

  .toolbar {
    flex-direction: column;
    gap: 14px;
    align-items: stretch;
    margin-bottom: 20px
  }

  .date-tabs {
    width: 100%;
    padding: 4px;
    border-radius: 11px
  }

  .date-tab {
    flex: 1;
    font-size: 10px;
    padding: 10px 7px;
    min-height: 36px
  }

  .date-current {
    font-size: 9px;
    justify-content: space-between;
    padding: 0 2px
  }

  .date-current:after {
    content: 'По времени вашего профиля';
    color: #a2a994;
    font-size: 8px
  }

  .summary {
    grid-template-columns: 1fr 1fr;
    gap: 11px;
    margin-bottom: 23px
  }

  .metric {
    min-height: 145px;
    padding: 19px 18px;
    border-radius: 18px
  }

  .metric-label {
    font-size: 10px
  }

  .metric-icon {
    display: flex;
    width: 24px;
    height: 24px
  }

  .metric-value {
    font-size: 32px;
    margin-top: 18px
  }

  .energy .metric-value {
    font-size: 34px
  }

  .metric-value small {
    font-size: 11px
  }

  .metric-foot {
    font-size: 8px;
    margin-top: 12px
  }

  .metric.energy {
    grid-column: auto
  }

  .metric.energy .metric-label svg {
    width: 13px;
    height: 13px
  }

  .panel {
    border-radius: 19px
  }

  .panel-heading {
    padding: 21px 18px 10px
  }

  .panel-heading h2 {
    font-size: 15px
  }

  .panel-subtitle {
    font-size: 9px
  }

  .meal-list {
    padding: 0 17px
  }

  .meal-row {
    padding: 19px 0;
    gap: 12px
  }

  .meal-image {
    width: 55px;
    height: 55px;
    border-radius: 14px
  }

  .meal-title {
    font-size: 11px;
    max-width: 195px
  }

  .meal-ingredients {
    font-size: 8px;
    max-width: 185px;
    margin-top: 5px
  }

  .meal-calories {
    font-size: 15px
  }

  .meal-calories small {
    font-size: 8px
  }

  .meal-meta {
    font-size: 8px;
    margin-bottom: 4px
  }

  .meal-meta svg {
    width: 10px;
    height: 10px
  }

  .meal-panel-bottom {
    padding: 14px 17px;
    font-size: 8px
  }

  .text-link {
    font-size: 9px
  }

  .trend-panel {
    margin-top: 17px
  }

  .trend-top-right {
    font-size: 8px
  }

  .chart {
    padding: 13px 16px 19px
  }

  .chart-bars {
    height: 114px;
    gap: 5px
  }

  .bar-col {
    padding: 0 5px
  }

  .chart-labels {
    gap: 5px
  }

  .chart-labels span {
    font-size: 8px
  }

  .right-column {
    gap: 14px;
    margin-top: 0
  }

  .composition-panel .panel-heading {
    padding: 19px 15px 0
  }

  .composition-panel .panel-heading h2 {
    font-size: 12px
  }

  .composition-panel .panel-subtitle {
    font-size: 8px
  }

  .donut-wrap {
    width: 123px;
    height: 123px;
    margin: 15px auto 18px
  }

  .donut:after {
    inset: 11px
  }

  .donut-center strong {
    font-size: 20px
  }

  .donut-center small {
    font-size: 8px
  }

  .donut-center svg {
    width: 17px;
    height: 17px
  }

  .composition-legend {
    margin: 0 15px 16px;
    gap: 8px
  }

  .legend-row,
  .legend-row strong {
    font-size: 9px
  }

  .composition-note {
    font-size: 7px;
    margin: 0 12px 15px
  }

  .bot-card {
    padding: 20px 17px;
    border-radius: 19px;
    min-height: 310px
  }

  .bot-card .eyebrow {
    font-size: 7px;
    letter-spacing: 1px
  }

  .bot-card h2 {
    font-size: 21px;
    max-width: 150px
  }

  .bot-card p {
    font-size: 9px;
    max-width: 135px;
    line-height: 1.9
  }

  .bot-card .button {
    margin-top: auto;
    font-size: 9px;
    padding: 10px;
    gap: 6px
  }

  .bot-card .button svg {
    width: 13px;
    height: 13px
  }

  .bot-card img {
    width: 108px;
    height: 108px;
    bottom: 65px;
    right: -27px;
    border-width: 5px
  }

  .bot-card:after {
    width: 136px;
    height: 136px;
    right: -40px;
    bottom: 50px
  }

  .mobile-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 30;
    background: var(--surface);
    border-top: 1px solid var(--line);
    padding: 11px 18px calc(10px + env(safe-area-inset-bottom));
    justify-content: space-around
  }

  .mobile-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    color: #939d87;
    font-size: 9px;
    padding: 0 20px
  }

  .mobile-nav svg {
    width: 20px;
    height: 20px
  }

  .mobile-nav a.active {
    color: var(--green);
    font-weight: 750
  }

  .footer {
    padding: 24px 21px 105px;
    font-size: 8px
  }

  .toast {
    left: 50%;
    bottom: 90px;
    font-size: 11px;
    max-width: 90vw;
    width: max-content
  }

  .history-tools {
    gap: 10px
  }

  .history-summary {
    font-size: 9px
  }

  .search input {
    font-size: 10px;
    padding-left: 33px
  }

  .search>svg {
    left: 11px
  }

  .history-day {
    padding-left: 18px;
    padding-right: 18px;
    font-size: 9px
  }

  .history-panel {
    margin-top: 16px
  }

  .history-panel .meal-row {
    padding: 17px 0
  }

  .profile-user {
    padding: 22px
  }

  .profile-wallet {
    padding: 24px
  }

  .profile-wallet h2 {
    font-size: 39px
  }

  .setting-row {
    padding: 17px 20px
  }

  .setting-row .row-tail {
    font-size: 9px
  }

  .profile-user h2 {
    font-size: 19px
  }

  .referral-panel {
    padding: 23px
  }

  .profile-grid {
    gap: 17px
  }

  .referral-panel h2 {
    max-width: 250px
  }

  .referral-panel .button {
    width: 100%
  }

  dialog {
    width: calc(100vw - 24px);
    padding: 23px 19px;
    border-radius: 20px;
    max-height: 88dvh
  }

  .modal-top {
    margin-bottom: 20px
  }

  .modal-top h2 {
    font-size: 20px
  }

  .modal-actions {
    flex-wrap: wrap;
    justify-content: stretch
  }

  .modal-actions .button {
    flex: 1
  }

  .detail-photo {
    height: 145px
  }

  .detail-totals {
    padding: 14px;
    gap: 7px
  }

  .detail-totals strong {
    font-size: 16px
  }

  .detail-totals small {
    font-size: 8px
  }

  .form-grid {
    gap: 10px
  }

  .modal-text {
    font-size: 11px
  }

  .detail-meta {
    font-size: 9px
  }

  .profile-aside-note {
    padding: 15px 5px
  }

  .count-badge {
    height: 21px;
    min-width: 21px;
    font-size: 8px;
    margin-left: 5px
  }
}

@media(max-width:380px) {
  main {
    padding-left: 15px;
    padding-right: 15px
  }

  .topbar {
    padding-left: 17px;
    padding-right: 17px
  }

  .meal-title {
    max-width: 160px;
    font-size: 10px
  }

  .meal-ingredients {
    max-width: 150px
  }

  .meal-row {
    gap: 9px
  }

  .meal-image {
    width: 47px;
    height: 47px
  }

  .meal-calories {
    font-size: 13px
  }

  .summary {
    gap: 9px
  }

  .metric {
    padding: 17px 14px
  }

  .metric-value {
    font-size: 30px
  }

  .energy .metric-value {
    font-size: 31px
  }

  .bot-card h2 {
    font-size: 19px
  }

  .bot-card {
    padding-left: 14px;
    padding-right: 14px
  }

  .composition-panel .panel-heading h2 {
    font-size: 11px
  }

  .date-tab {
    font-size: 9px
  }

  .date-current:after {
    font-size: 7px
  }
}

@media(prefers-reduced-motion:reduce) {

  *,
  *:before,
  *:after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important
  }
}

.nav-indicator {
  display: none
}

.nav-item.active:after {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--green);
  margin-left: auto
}

@media(max-width:650px) {
  .demo-badge:not([hidden]) {
    display: inline-flex;
    font-size: 8px;
    gap: 4px
  }

  .topbar-right {
    gap: 10px
  }
}

@media (max-width: 650px) {
  .topbar {
    height: calc(74px + var(--tg-safe-top, 0px));
    padding-top: var(--tg-safe-top, 0px);
  }

  .mobile-nav {
    padding-bottom: calc(10px + max(env(safe-area-inset-bottom), var(--tg-safe-bottom, 0px)));
  }
}

/* Optional calorie goals share the existing diary's visual language. */
.calorie-balance {
  margin: 0 0 24px;
  padding: 24px;
}

.balance-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
}

.balance-heading .eyebrow {
  font-size: 8px;
  margin-bottom: 7px;
}

.balance-heading h2 {
  font-size: 20px;
}

.balance-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 26px;
  margin-top: 23px;
}

.balance-primary>span,
.balance-facts span,
.balance-remainder>div>span {
  display: block;
  color: var(--muted);
  font-size: 10px;
}

.balance-number {
  display: block;
  font-size: 38px;
  letter-spacing: -1.3px;
  line-height: 1.25;
  margin: 8px 0;
}

.balance-number small {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--muted);
  margin-left: 7px;
}

.balance-primary p {
  font-size: 10px;
  color: var(--muted);
}

.balance-number.within,
.balance-dot.within {
  color: var(--green);
}

.balance-number.exceeded,
.balance-remainder .exceeded {
  color: #bd794c;
}

.balance-number.no_data {
  color: var(--muted);
}

.balance-facts {
  display: flex;
  gap: 35px;
}

.balance-facts strong {
  display: block;
  font-size: 22px;
  margin-top: 8px;
  letter-spacing: -.5px;
}

.balance-facts small,
.balance-remainder small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0;
}

.budget-progress {
  height: 7px;
  border-radius: 10px;
  background: var(--line);
  overflow: hidden;
  margin-top: 23px;
}

.budget-progress span {
  display: block;
  height: 100%;
  background: var(--protein);
  border-radius: inherit;
}

.budget-progress.exceeded span {
  background: #d6a06e;
}

.budget-progress.no_data span {
  background: #aab0a4;
}

.balance-progress-caption {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  font-size: 9px;
  color: var(--muted);
  margin-top: 8px;
}

.balance-counts {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 20px;
  font-size: 9px;
  color: var(--muted);
}

.balance-counts>span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.balance-dot {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #aab0a4;
}

.balance-dot.within {
  background: var(--protein);
}

.balance-dot.exceeded {
  background: #d6a06e;
}

.balance-counts .today-chip {
  margin-left: auto;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 7px;
  font-size: 8px;
}

.balance-coverage {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin-top: 16px;
  font-size: 10px;
  color: var(--muted);
  line-height: 1.8;
}

.balance-coverage svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  margin-top: 3px;
}

.balance-remainder {
  display: grid;
  grid-template-columns: 1fr 1fr 1.3fr;
  gap: 20px;
  padding-top: 19px;
  margin-top: 20px;
  border-top: 1px solid var(--line);
}

.balance-remainder strong {
  display: block;
  font-size: 22px;
  margin-top: 9px;
}

.balance-remainder>div>small {
  display: block;
  font-size: 9px;
  margin-top: 4px;
}

.balance-gap {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 13px;
  margin-top: 19px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.8;
}

.balance-gap svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  margin-top: 3px;
}

.balance-bottom {
  margin-top: 19px;
  padding-top: 15px;
  border-top: 1px solid var(--line);
  font-size: 10px;
  color: var(--muted);
}

.balance-bottom>span {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.balance-bottom svg {
  width: 13px;
  height: 13px;
}

.balance-bottom strong {
  color: var(--ink);
  font-weight: 650;
}

.balance-bottom p {
  font-size: 9px;
  margin-top: 7px;
  line-height: 1.8;
}

.balance-segments {
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 13px;
}

.balance-segments summary,
.daily-data summary,
.goal-history summary {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 10px;
  color: var(--muted);
  list-style: none;
}

.balance-segments summary::-webkit-details-marker,
.daily-data summary::-webkit-details-marker,
.goal-history summary::-webkit-details-marker {
  display: none;
}

.balance-segments summary svg,
.daily-data summary svg,
.goal-history summary svg {
  width: 13px;
  height: 13px;
}

.balance-segments>div {
  display: flex;
  gap: 25px;
  padding-top: 13px;
}

.balance-segments p {
  font-size: 9px;
  line-height: 1.9;
  flex: 1;
}

.balance-segments p strong,
.balance-segments p span {
  display: block;
}

.balance-segments p strong {
  color: var(--ink);
  font-weight: 600;
}

.balance-segments p span {
  color: var(--muted);
}

.daily-chart-legend {
  display: flex;
  gap: 10px;
  font-size: 8px;
  color: var(--muted);
}

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

.daily-chart-legend i {
  width: 7px;
  height: 7px;
  background: var(--protein);
  border-radius: 2px;
}

.daily-chart-legend .goal-key {
  background: none;
  border-top: 2px dashed var(--muted);
  width: 10px;
  height: 0;
}

.daily-chart-scroll {
  overflow-x: auto;
  overscroll-behavior-x: contain;
  padding: 36px 19px 5px;
  scrollbar-width: thin;
  scrollbar-color: var(--protein) transparent;
}

.daily-chart {
  display: flex;
  gap: 9px;
  height: 165px;
}

.daily-column {
  flex: 1;
  min-width: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0;
  position: relative;
}

.daily-plot {
  height: 132px;
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  position: relative;
  border-bottom: 1px solid var(--line);
  background: repeating-linear-gradient(to top, transparent 0, transparent 42px, var(--line) 43px, transparent 44px);
}

.daily-bar {
  width: min(29px, 65%);
  border-radius: 5px 5px 0 0;
  background: var(--protein);
  min-height: 2px;
}

.daily-column.exceeded .daily-bar {
  background: #d6a06e;
}

.daily-column.no_goal .daily-bar {
  background: #a7b69b;
}

.daily-column .daily-bar.missing {
  background: transparent;
  border: 1px dashed #aab0a4;
  border-radius: 3px 3px 0 0;
}

.daily-column.future .daily-bar {
  opacity: .45;
}

.daily-goal-line {
  width: 80%;
  position: absolute;
  border-top: 1.5px dashed var(--muted);
  left: 10%;
  z-index: 1;
  pointer-events: none;
}

.daily-date {
  font-size: 8px;
  color: var(--muted);
  margin-top: 11px;
  white-space: nowrap;
}

.daily-column.today .daily-date {
  font-weight: 750;
  color: var(--ink);
}

.daily-column.today .daily-date:after {
  content: '·';
  display: block;
  color: var(--green);
  line-height: .8;
  font-size: 15px;
}

.daily-tooltip {
  display: none;
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--green);
  color: #fff;
  font-size: 8px;
  padding: 7px;
  border-radius: 7px;
  width: 140px;
  text-align: left;
  z-index: 5;
  pointer-events: none;
}

.daily-column:hover .daily-tooltip,
.daily-column:focus-visible .daily-tooltip {
  display: block;
}

.daily-chart-footer {
  display: flex;
  gap: 6px;
  padding: 10px 21px 17px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.8;
}

.daily-chart-footer svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  margin-top: 2px;
}

.daily-data {
  padding: 14px 21px;
  border-top: 1px solid var(--line);
}

.daily-data .table-scroll {
  max-height: 290px;
  margin-top: 12px;
}

.daily-data table {
  font-size: 9px;
}

.daily-data td:first-child {
  min-width: 90px;
}

.daily-data td {
  white-space: nowrap;
  padding-top: 9px;
  padding-bottom: 9px;
}

.daily-table-note {
  color: var(--muted);
  font-size: 9px;
  line-height: 1.8;
  margin-top: 12px;
}

.day-status {
  font-size: 8px;
  color: var(--muted);
}

.day-status.within {
  color: #799366;
}

.day-status.exceeded {
  color: #bd794c;
}

.day-incomplete {
  display: block;
  color: var(--muted);
  font-size: 8px;
  margin-top: 3px;
}

.day-detail-summary {
  display: grid;
  gap: 7px;
  margin-bottom: 15px;
  padding: 15px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.day-detail-summary strong {
  font-size: 17px;
}

.day-detail-summary span {
  font-size: 10px;
  color: var(--muted);
}

.day-meal {
  border-bottom: 1px solid var(--line);
}

.day-meal .meal-row {
  border: 0;
  padding-bottom: 8px;
}

.day-meal-macros {
  margin-left: 76px;
  padding-bottom: 15px;
  color: var(--muted);
  font-size: 9px;
}

.goal-input-label {
  display: block;
  margin-top: 22px;
}

.goal-input {
  font-size: 22px;
  font-weight: 650;
  padding: 15px;
  min-height: 60px;
}

.goal-history {
  border-top: 1px solid var(--line);
  margin-top: 24px;
  padding-top: 17px;
}

.goal-history summary>span {
  margin-left: auto;
  font-size: 9px;
}

.goal-history-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 15px 0;
  border-bottom: 1px solid var(--line);
}

.goal-history-row strong {
  display: block;
  font-size: 11px;
}

.goal-history-row small {
  display: block;
  color: var(--muted);
  font-size: 9px;
  margin-top: 5px;
}

.goal-history-row svg {
  width: 16px;
  height: 16px;
  color: var(--muted);
}

.goal-history[open]>#goal-history-list {
  margin-top: 10px;
}

@media(max-width:850px) {
  .balance-main {
    align-items: flex-start;
  }

  .balance-facts {
    gap: 20px;
  }

  .balance-facts strong {
    font-size: 19px;
  }

  .balance-number {
    font-size: 33px;
  }

  .balance-primary>span,
  .balance-facts span {
    font-size: 9px;
  }
}

@media(max-width:650px) {
  .calorie-balance {
    padding: 21px 18px;
    margin-bottom: 21px;
  }

  .balance-heading h2 {
    font-size: 18px;
  }

  .balance-heading .eyebrow {
    font-size: 7px;
    letter-spacing: 1px;
  }

  .balance-heading .text-link {
    font-size: 8px;
    gap: 4px;
  }

  .balance-main {
    display: block;
    margin-top: 20px;
  }

  .balance-number {
    font-size: 35px;
  }

  .balance-primary>span {
    font-size: 10px;
  }

  .balance-primary p {
    font-size: 9px;
  }

  .balance-facts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    margin-top: 19px;
    gap: 10px;
  }

  .balance-facts strong {
    font-size: 20px;
  }

  .balance-facts span {
    font-size: 9px;
  }

  .budget-progress {
    margin-top: 20px;
  }

  .balance-progress-caption {
    font-size: 8px;
    gap: 10px;
  }

  .balance-counts {
    gap: 10px;
    font-size: 8px;
    margin-top: 16px;
  }

  .balance-counts .today-chip {
    margin-left: 0;
  }

  .balance-remainder {
    grid-template-columns: 1fr 1fr;
    gap: 17px 12px;
    margin-top: 17px;
  }

  .balance-remainder>div:last-child {
    grid-column: 1/-1;
  }

  .balance-remainder strong {
    font-size: 21px;
    margin-top: 7px;
  }

  .balance-remainder>div>span {
    font-size: 9px;
  }

  .balance-bottom {
    font-size: 9px;
  }

  .balance-bottom p {
    font-size: 8px;
  }

  .balance-gap {
    font-size: 9px;
    padding: 11px;
  }

  .balance-coverage {
    font-size: 9px;
  }

  .balance-segments>div {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .balance-segments p span {
    font-size: 9px;
  }

  .balance-segments summary {
    font-size: 9px;
  }

  .daily-chart-scroll {
    padding-left: 15px;
    padding-right: 15px;
  }

  .daily-chart {
    gap: 6px;
  }

  .daily-chart-legend {
    font-size: 7px;
    gap: 7px;
  }

  .daily-chart-footer {
    font-size: 8px;
    padding-left: 17px;
    padding-right: 17px;
  }

  .daily-data {
    padding-left: 17px;
    padding-right: 17px;
  }

  .daily-data summary {
    font-size: 9px;
  }

  .day-meal-macros {
    margin-left: 67px;
  }
}

html[data-theme=dark] .balance-number.within {
  color: #a5c48f;
}

html[data-theme=dark] .balance-number.exceeded,
html[data-theme=dark] .balance-remainder .exceeded,
html[data-theme=dark] .day-status.exceeded {
  color: #dfac7e;
}

/* Keep long calendar charts inside their grid cell on narrow screens. */
.content-columns>* {
  min-width: 0;
}

.daily-trend {
  min-width: 0;
  max-width: 100%;
}

.daily-chart-scroll {
  max-width: 100%;
}
