﻿@font-face {
  font-family: "Google Sans Flex";
  src: url("./fonts/google-sans-flex/GoogleSansFlex-400.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Google Sans Flex";
  src: url("./fonts/google-sans-flex/GoogleSansFlex-700.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #f8f9fb;
  --surface: rgba(255, 255, 255, .92);
  --surface-strong: #ffffff;
  --ink: #050608;
  --muted: #8c929d;
  --soft: #f5f7f9;
  --line: rgba(20, 24, 31, .075);
  --green: #69cf5c;
  --green-dark: #45b54c;
  --mint: #eaf9ee;
  --blue: #8cc8ff;
  --coral: #ff5f70;
  --gold: #ff8d3f;
  --violet: #9b62f2;
  --danger: #ff5f70;
  --shadow: 0 28px 80px rgba(20, 24, 31, .08);
  --shadow-soft: 0 14px 36px rgba(20, 24, 31, .07);
  --blur: blur(28px);
  --text-size: 14px;
  --heading-size: 24px;
  font-family: "Google Sans Flex", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: #f0ffff;
  font-weight: normal;
  font-size: var(--text-size);
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.topbar {
  position: sticky;
  top: 14px;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  width: min(1320px, calc(100vw - 36px));
  margin: 14px auto 0;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, .72);
  border-radius: 0;
  background: rgba(255, 255, 255, .70);
  box-shadow: 0 18px 54px rgba(20, 24, 31, .08);
  backdrop-filter: var(--blur);
}

.user-menu {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.user-menu span {
  color: var(--muted);
  font-size: 13px;
}

.user-stats {
  white-space: nowrap;
}

.user-menu .secondary {
  min-height: 34px;
  padding: 6px 12px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0;
}

.brand span {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: linear-gradient(145deg, #8de66e, var(--green-dark));
  box-shadow: 0 12px 28px rgba(105, 207, 92, .30);
}

nav {
  display: flex;
  gap: 6px;
  padding: 5px;
  border: 1px solid rgba(20, 24, 31, .06);
  border-radius: 0;
  background: rgba(244, 246, 249, .82);
  box-shadow: inset 0 1px 4px rgba(20, 24, 31, .04);
}

nav a {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border-radius: 0;
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
}

nav a.active {
  color: var(--ink);
  background: var(--surface-strong);
  box-shadow: 0 10px 26px rgba(20, 24, 31, .10);
}

.view {
  min-height: calc(100vh - 84px);
  padding: clamp(22px, 5vw, 58px);
}

.hidden { display: none !important; }

.home {
  position: relative;
  display: grid;
  place-items: center;
  align-content: end;
  padding-top: 340px;
}

.home-status {
  position: absolute;
  top: clamp(20px, 5vw, 48px);
  left: 50%;
  display: grid;
  grid-template-columns: 132px minmax(560px, 1fr);
  grid-template-areas:
    "bmi gauge"
    "weight weight";
  gap: 16px;
  width: min(1320px, calc(100vw - 36px));
  transform: translateX(-50%);
}

.bmi-card {
  grid-area: bmi;
}

.calorie-gauge {
  grid-area: gauge;
}

.weight-dashboard {
  grid-area: weight;
}

.bmi-card,
.calorie-gauge,
.dashboard-card,
.panel,
dialog,
.message-dialog {
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: var(--blur);
}

.dashboard-card {
  display: grid;
  gap: 14px;
  padding: 20px;
}

.dashboard-card-head {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  gap: 16px;
}

.dashboard-card-head p {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
}

.dashboard-card-head h2 {
  font-size: clamp(24px, 3vw, 34px);
}

.dashboard-card-head strong {
  justify-self: end;
  font-size: clamp(24px, 3vw, 36px);
  line-height: 1;
}

.weight-delta {
  justify-self: center;
  align-self: center;
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid rgba(20, 24, 31, .08);
  border-radius: 0;
  color: var(--ink);
  background: rgba(247, 249, 251, .86);
  box-shadow: 0 10px 24px rgba(20, 24, 31, .06);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.weight-dashboard {
  background:
    radial-gradient(circle at 12% 12%, rgba(105, 207, 92, .14), transparent 34%),
    rgba(255, 255, 255, .92);
}

.weight-dashboard canvas {
  width: 100%;
  height: 240px;
  border: 0;
  border-radius: 0;
  background: rgba(247, 249, 251, .72);
}

.home-weight-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.bmi-card {
  display: grid;
  gap: 0;
  align-content: center;
  justify-items: center;
  text-align: center;
  padding: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 28% 22%, rgba(105, 207, 92, .16), transparent 38%),
    rgba(255, 255, 255, .92);
}

.bmi-card-section {
  position: relative;
  display: grid;
  gap: 7px;
  width: 100%;
  min-height: 96px;
  align-content: center;
  justify-items: center;
  padding: 16px 12px;
}

.bmi-card-section + .bmi-card-section {
  min-height: 118px;
  border-top: 1px solid rgba(255, 199, 44, .36);
  background: linear-gradient(90deg, rgba(255, 232, 117, .72), rgba(255, 199, 44, .96));
}

.bmi-card strong {
  display: block;
  width: 100%;
  font-size: 34px;
  line-height: 1;
  text-align: center;
}

.bmi-card small {
  color: var(--muted);
  font-size: 14px;
}


.need-remaining-label {
  display: grid;
  gap: 2px;
  justify-items: center;
  color: var(--ink);
  line-height: 1.25;
  text-align: center;
}

.need-remaining-label b {
  display: block;
  font-size: var(--heading-size);
  line-height: 1;
  font-weight: 700;
}

.need-remaining-label em {
  display: block;
  color: var(--ink);
  font-style: normal;
  font-weight: 700;
}

.bmi-card-section.over-need {
  background: #da143c;
  color: #fff;
}

.bmi-card-section.over-need .need-remaining-label,
.bmi-card-section.over-need .need-remaining-label em,
.bmi-card-section.over-need .need-remaining-label b {
  color: #fff;
}


.bmi-card .remaining-label {
  display: grid;
  gap: 2px;
  justify-items: center;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--ink);
  font-size: 11px;
  line-height: 1.25;
  text-align: center;
  white-space: normal;
}

.bmi-card .remaining-label b {
  display: block;
  font-size: 22px;
  line-height: 1;
  font-weight: 700;
}

.bmi-card .remaining-label em {
  display: block;
  color: var(--ink);
  font-style: normal;
  font-weight: 700;
}

.bmi-card .remaining-label small {
  display: block;
  max-width: 116px;
  color: rgba(5, 6, 8, .68);
  font-size: 10px;
  line-height: 1.18;
}

.calorie-gauge {
  display: grid;
  gap: 12px;
  padding: 20px;
  font-weight: normal;
}

.gauge-head,
.gauge-readouts {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.gauge-head {
  flex-wrap: wrap;
}

.gauge-head span {
  max-width: none;
  color: var(--ink);
  font-size: clamp(18px, 2vw, 24px);
  font-weight: 700;
  line-height: 1.12;
  white-space: nowrap;
}

.remaining-label {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 10px;
  border: 1px solid rgba(17, 24, 22, .10);
  border-radius: 0;
  color: #111816;
  background: #eef1ef;
  box-shadow: 0 10px 24px rgba(17, 24, 22, .08);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}


.gauge-dial {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 270px;
  padding: 2px 4px 0;
}

#calorieDial {
  width: min(100%, 680px);
  height: auto;
  overflow: visible;
}

.dial-arc {
  fill: none;
  stroke-linecap: butt;
  stroke-width: 24;
}

.dial-arc-green {
  stroke: #69cf5c;
}

.dial-arc-red {
  stroke: #da143c;
}

.deficit-arc {
  stroke: #ffc72c;
  stroke-width: 18;
  filter: drop-shadow(0 8px 18px rgba(255, 199, 44, .20));
}

.dial-ticks line {
  stroke: rgba(17, 24, 22, .24);
  stroke-width: 1;
}

.dial-ticks text {
  fill: var(--muted);
  font-size: 10px;
  font-weight: normal;
}

.need-needle {
  stroke: var(--green);
  stroke-width: 3;
  stroke-linecap: round;
}

.intake-needle {
  stroke: var(--ink);
  stroke-width: 5;
  stroke-linecap: round;
  filter: drop-shadow(0 7px 14px rgba(17, 24, 22, .20));
}

.dial-hub {
  fill: var(--ink);
  stroke: white;
  stroke-width: 5;
}

.need-marker-text,
.intake-marker-text,
.deficit-percent {
  paint-order: stroke;
  stroke: rgba(255, 255, 255, .86);
  stroke-width: 4px;
  stroke-linejoin: round;
  fill: var(--ink);
  font-weight: 700;
}

.need-marker-text {
  fill: var(--green-dark);
  font-size: 13px;
}

.intake-marker-text {
  fill: var(--ink);
  font-size: 15px;
}

.deficit-percent {
  fill: #312412;
  font-size: 12px;
}

.gauge-ruler {
  display: none;
}

small,
.head p {
  color: var(--muted);
  font-weight: 700;
}

.calorie-gauge small,
.calorie-gauge strong {
  font-weight: normal;
}

.calorie-gauge .remaining-label {
  font-weight: 700;
}

.gauge-readouts {
  position: relative;
  height: 34px;
  margin-top: 8px;
}

.deficit-readout {
  position: absolute;
  left: var(--deficit-center, 50%);
  top: 0;
  padding: 7px 12px;
  border: 1px solid rgba(255, 199, 44, .36);
  border-radius: 0;
  color: #111816;
  background: linear-gradient(90deg, rgba(255, 232, 117, .72), rgba(255, 199, 44, .96));
  box-shadow: 0 10px 24px rgba(255, 199, 44, .16);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  transform: translateX(-50%);
}

.gauge-ruler {
  position: relative;
  height: 28px;
  margin-top: -6px;
  border-top: 1px solid rgba(17, 24, 22, .14);
}

.ruler-label {
  position: absolute;
  top: 8px;
  color: var(--muted);
  font-size: 10px;
  font-weight: normal;
  white-space: nowrap;
  transform: translateX(-50%);
}

.ruler-label::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -8px;
  width: 1px;
  height: 6px;
  background: rgba(17, 24, 22, .28);
}

.home-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: clamp(18px, 5vw, 54px);
}

.plus {
  display: grid;
  gap: 6px;
  width: min(34vw, 210px);
  height: min(34vw, 210px);
  min-width: 142px;
  min-height: 142px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: white;
  background:
    radial-gradient(circle at 30% 24%, rgba(255, 255, 255, .56), transparent 30%),
    linear-gradient(145deg, #91e66e, #55c95a);
  box-shadow: 0 34px 88px rgba(105, 207, 92, .34);
  cursor: pointer;
  font-weight: normal;
  line-height: 1;
  padding: 18px;
  transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
}

.plus span {
  font-size: clamp(84px, 14vw, 148px);
  line-height: .74;
  transform: translateY(5px);
}

.plus small {
  align-self: start;
  color: rgba(255, 255, 255, .9);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
}

.activity-plus {
  color: #111816;
  background:
    radial-gradient(circle at 30% 24%, rgba(255, 255, 255, .58), transparent 30%),
    linear-gradient(145deg, #b988ff, #8b5ce8);
  box-shadow: 0 34px 88px rgba(155, 98, 242, .26);
}

.activity-plus small {
  color: rgba(255, 255, 255, .92);
}

.plus:hover {
  transform: translateY(-5px) scale(1.015);
  filter: saturate(1.03);
  box-shadow: 0 40px 110px rgba(47, 138, 95, .34);
}

.page {
  max-width: 1180px;
  margin: 0 auto;
}

.head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}

.head p,
dialog p,
.message-dialog p {
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 16px;
  font-weight: 700;
  text-transform: none;
}

h1,
h2 {
  margin: 0;
  line-height: 1.02;
  font-weight: 700;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(42px, 7vw, 76px);
}

h2 {
  font-size: clamp(26px, 4vw, 40px);
}

.profile-grid {
  display: grid;
  grid-template-columns: minmax(280px, 390px) 1fr;
  gap: 22px;
  align-items: start;
}

.form-grid,
.metrics {
  display: grid;
  gap: 14px;
  padding: 20px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 14px 16px;
  color: var(--ink);
  background: rgba(247, 249, 251, .88);
  font-weight: normal;
  outline: none;
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(47, 138, 95, .62);
  background: white;
  box-shadow: 0 0 0 4px rgba(47, 138, 95, .12);
}

.primary,
.secondary,
.danger,
.import {
  display: inline-flex;
  min-height: 50px;
  align-items: center;
  justify-content: center;
  border-radius: 0;
  padding: 12px 22px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}

.primary {
  border: 0;
  color: white;
  background: linear-gradient(145deg, #8be268, var(--green-dark));
  box-shadow: 0 16px 36px rgba(105, 207, 92, .30);
}

.secondary,
.import {
  border: 1px solid rgba(20, 24, 31, .08);
  color: var(--ink);
  background: rgba(255, 255, 255, .90);
  box-shadow: 0 12px 28px rgba(20, 24, 31, .06);
}

.danger {
  border: 0;
  color: white;
  background: linear-gradient(145deg, #ff8794, var(--danger));
  box-shadow: 0 16px 36px rgba(255, 95, 112, .24);
}

.primary:hover,
.secondary:hover,
.danger:hover,
.import:hover {
  transform: translateY(-1px);
}

.primary:disabled,
.secondary:disabled,
.danger:disabled {
  color: #8a928d;
  background: #e7ebe7;
  border: 1px solid var(--line);
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}

.metrics {
  grid-template-columns: repeat(2, minmax(180px, 1fr));
}

.metric {
  display: grid;
  gap: 8px;
  padding: 18px;
  border: 1px solid rgba(20, 24, 31, .07);
  border-radius: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, .94), rgba(245, 249, 246, .90));
  box-shadow: 0 16px 36px rgba(20, 24, 31, .06);
}

.metric span {
  color: var(--muted);
  font-weight: 700;
}

.metric strong {
  font-size: clamp(32px, 6vw, 54px);
  line-height: .95;
}

.scale,
.weight-row,
canvas {
  grid-column: 1 / -1;
}

.scale > div {
  position: relative;
  height: 14px;
  border-radius: 0;
  background: linear-gradient(90deg, var(--blue), var(--green), var(--gold), var(--coral));
}

.scale span {
  position: absolute;
  top: 50%;
  left: 0;
  width: 22px;
  height: 22px;
  border: 4px solid white;
  border-radius: 50%;
  background: var(--ink);
  box-shadow: var(--shadow-soft);
  transform: translate(-50%, -50%);
}

.scale footer {
  display: flex;
  justify-content: space-between;
  margin-top: 9px;
}

.weight-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: end;
  padding: 0;
}

canvas {
  width: 100%;
  height: 230px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: white;
}

.pill {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  border-radius: 0;
  padding: 6px 12px;
  color: var(--green-dark);
  background: var(--mint);
  font-weight: 700;
}

.month-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.month-nav button,
.icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 0;
  color: var(--ink);
  background: rgba(255, 255, 255, .88);
  font-size: 25px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(17, 24, 22, .05);
}

.weekdays,
.calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.weekdays {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.day {
  display: grid;
  min-height: 118px;
  align-content: space-between;
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 10px;
  color: var(--ink);
  text-align: left;
  background: rgba(255, 255, 255, .84);
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(17, 24, 22, .04);
}

.day.outside {
  opacity: .42;
}

.day.today {
  border-color: rgba(105, 207, 92, .45);
  background: linear-gradient(180deg, white, #edfbee);
}

.day b:last-child {
  color: var(--green-dark);
  font-size: clamp(18px, 2.3vw, 28px);
}

.details {
  margin-top: 18px;
  padding: 18px;
}

.details ul {
  display: grid;
  gap: 10px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.details li,
.gate,
.estimate,
.product-preview,
.manual-product {
  border: 1px solid rgba(28, 42, 36, .08);
  border-radius: 0;
  background: var(--soft);
}

.details li {
  display: grid;
  gap: 8px;
  padding: 13px;
}

.activity-entry {
  background: linear-gradient(180deg, rgba(242, 201, 76, .18), rgba(242, 201, 76, .08));
}

.entry-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.entry-actions button {
  min-height: 34px;
  border-radius: 0;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.storage-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.storage {
  display: grid;
  gap: 8px;
  min-height: 126px;
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 18px;
  color: var(--ink);
  text-align: left;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  cursor: pointer;
}

.storage.selected {
  border-color: rgba(105, 207, 92, .45);
  background: linear-gradient(180deg, white, #effbed);
}

.storage span {
  color: var(--muted);
}

.pdf-export {
  display: grid;
  gap: 16px;
  margin-top: 18px;
  padding: 20px;
}

.pdf-export p {
  margin: 0 0 7px;
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.pdf-export h2 {
  font-size: clamp(24px, 4vw, 34px);
}

.pdf-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 20px;
}

.food-actions {
  align-items: center;
  justify-content: space-between;
  padding: 0;
}

.food-actions-left {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.import input {
  display: none;
}

dialog {
  width: min(760px, calc(100vw - 28px));
  border: 0;
  padding: 0;
  border-radius: 0;
}

dialog::backdrop {
  background: rgba(17, 24, 22, .34);
  backdrop-filter: blur(10px);
}

dialog form {
  padding: clamp(18px, 4vw, 30px);
}

.dialog-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 20px;
}

.gate,
.estimate {
  display: grid;
  gap: 7px;
  padding: 14px;
}

.gate a {
  color: var(--green-dark);
  font-weight: 700;
}

.product-preview {
  display: grid;
  grid-template-columns: 104px 1fr;
  gap: 14px;
  padding: 12px;
}

.product-preview img {
  width: 104px;
  height: 104px;
  object-fit: contain;
  border-radius: 0;
  background: white;
}

.product-preview div {
  display: grid;
  gap: 6px;
  align-content: start;
}

.product-preview ul {
  display: grid;
  gap: 3px;
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.amount-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) 140px;
  gap: 12px;
}
.manual-product {
  display: grid;
  gap: 14px;
  padding: 14px;
}

.manual-product-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.manual-product-head div {
  display: grid;
  gap: 4px;
}

.manual-product-head span {
  color: var(--muted);
  font-size: 13px;
}

.manual-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.manual-wide {
  grid-column: 1 / -1;
}

#showManualProduct {
  justify-self: start;
}

#saveManualProduct {
  justify-self: start;
}

.nutrition-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.nutrition-list span {
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 4px 8px;
  color: var(--ink);
  background: white;
  font-size: 12px;
  font-weight: 700;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(17, 24, 22, .34);
  backdrop-filter: blur(10px);
}

.message-dialog {
  display: grid;
  gap: 14px;
  width: min(460px, calc(100vw - 28px));
  padding: clamp(18px, 4vw, 30px);
  background: rgba(255, 255, 255, .96);
}

.message-dialog h2 {
  font-size: clamp(24px, 4vw, 34px);
}

.message-dialog #messageText {
  color: var(--muted);
  font-weight: 700;
  line-height: 1.45;
}

.message-actions {
  justify-content: flex-end;
  padding: 0;
}

.auth-overlay {
  z-index: 30;
}

.auth-dialog {
  width: min(460px, calc(100vw - 28px));
}

.auth-tabs {
  display: flex;
  gap: 10px;
}

.auth-form {
  display: grid;
  gap: 12px;
}

@media (max-width: 760px) {
  .topbar {
    position: fixed;
    top: auto;
    right: 14px;
    bottom: 14px;
    left: 14px;
    width: auto;
    margin: 0;
    align-items: center;
    flex-direction: row;
    border-radius: 0;
    padding: 8px;
  }

  .brand,
  .user-menu {
    display: none;
  }

  nav {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  nav a {
    min-height: 52px;
    padding: 6px 4px;
    text-align: center;
    font-size: 12px;
    color: var(--muted);
    flex-direction: column;
  }

  nav a.active {
    color: var(--green-dark);
    background: rgba(105, 207, 92, .14);
    box-shadow: none;
  }

  .view {
    padding-bottom: 112px;
  }

  .home-status,
  .profile-grid,
  .metrics,
  .storage-grid {
    grid-template-columns: 1fr;
  }

  .home-status {
    grid-template-areas:
      "bmi"
      "gauge"
      "weight";
  }

  .home {
    align-content: center;
    padding-top: 560px;
  }

  .head,
  .weight-row {
    align-items: stretch;
    flex-direction: column;
    grid-template-columns: 1fr;
  }

  .weekdays,
  .calendar {
    gap: 5px;
  }

  .day {
    min-height: 82px;
    padding: 7px;
  }

  .day b:last-child {
    font-size: 13px;
  }

  .product-preview {
    grid-template-columns: 1fr;
  }

  .manual-grid {
    grid-template-columns: 1fr;
  }

  .manual-product-head {
    align-items: stretch;
    flex-direction: column;
  }

  .home-weight-form {
    grid-template-columns: 1fr;
  }

  .dashboard-card-head {
    grid-template-columns: 1fr;
  }

  .dashboard-card-head strong,
  .weight-delta {
    justify-self: start;
  }
}

/* Unified type scale */
body,
button,
input,
select,
textarea,
label,
small,
p,
span,
a,
td,
th,
li,
.user-menu span,
nav a,
.head p,
dialog p,
.message-dialog p,
.dashboard-card-head p,
.metric span,
.storage span,
.weekdays,
.details,
.nutrition-list span,
.ruler-label,
.deficit-percent,
.remaining-label,
.weight-delta,
.pill {
  font-size: var(--text-size);
  font-weight: normal;
}

h1,
h2,
.head h1,
.dialog-head h2,
.message-dialog h2,
.dashboard-card-head h2,
.pdf-export h2,
.brand,
.metric strong,
.bmi-card strong,
.dashboard-card-head strong,
.day b:last-child,
.need-marker-home span,
.intake-marker span,
.deficit-readout,
.remaining-label b,
.remaining-label em,
.primary,
.secondary,
.danger,
.import,
.storage strong,
.details > strong,
.details li strong,
.month-nav strong,
.entry-actions button {
  font-weight: 700;
}

h1,
h2,
.head h1,
.dialog-head h2,
.message-dialog h2,
.dashboard-card-head h2,
.pdf-export h2 {
  font-size: var(--heading-size);
}

.plus span {
  font-size: clamp(84px, 14vw, 148px);
}

.bmi-card strong,
.metric strong,
.dashboard-card-head strong {
  font-size: var(--heading-size);
}

.remaining-label b {
  font-size: var(--heading-size);
}

.need-remaining-label b,
.bmi-card .remaining-label b {
  font-size: 20px;
  white-space: nowrap;
}

.need-remaining-label,
.bmi-card .remaining-label {
  width: 100%;
}









/* Restored pre-tachometer dashboard */
.home {
  position: relative;
  display: grid;
  place-items: center;
  align-content: end;
  padding-top: 340px;
  background: #f0ffff;
}

.home-status {
  position: absolute;
  top: clamp(20px, 5vw, 48px);
  left: 50%;
  display: grid;
  grid-template-columns: 132px minmax(560px, 1fr);
  grid-template-areas:
    "bmi gauge"
    "weight weight";
  gap: 16px;
  width: min(1320px, calc(100vw - 36px));
  transform: translateX(-50%);
}

.bmi-card { grid-area: bmi; }
.calorie-gauge { grid-area: gauge; }
.weight-dashboard { grid-area: weight; }

.calorie-gauge {
  display: grid;
  gap: 12px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: var(--blur);
  font-weight: normal;
}

.gauge-head,
.gauge-readouts {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.gauge-head { flex-wrap: wrap; }
.gauge-head span {
  max-width: none;
  color: var(--ink);
  font-size: clamp(18px, 2vw, 24px);
  font-weight: 700;
  line-height: 1.12;
  white-space: nowrap;
}

.gauge-track {
  position: relative;
  --need-pos: 100%;
  height: 32px;
  margin-top: 36px;
  overflow: visible;
  border: 1px solid rgba(28, 42, 36, .12);
  border-radius: 0;
  background: linear-gradient(90deg, #ffffff 0%, rgba(105, 207, 92, .76) var(--need-pos), #da143c var(--need-pos), #da143c 100%);
  box-shadow: inset 0 1px 5px rgba(20, 24, 31, .08);
}

.gauge-ticks {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.gauge-ticks span {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(17, 24, 22, .16);
}

.deficit-band {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 92px;
  padding: 0 8px;
  border: 1px solid rgba(255, 199, 44, .36);
  border-radius: 0;
  background: linear-gradient(90deg, rgba(255, 232, 117, .72), rgba(255, 199, 44, .96));
  color: #312412;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  z-index: 1;
}

.deficit-percent {
  color: #312412;
  background: transparent;
}

.need-marker-home {
  position: absolute;
  top: -7px;
  bottom: -7px;
  left: 0;
  width: 2px;
  border-radius: 999px;
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, .72);
  z-index: 3;
}

.need-marker-home span {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  padding: 7px 12px;
  border-radius: 0;
  color: white;
  background: var(--green);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  transform: translateX(-50%);
}

.intake-marker {
  position: absolute;
  top: 50%;
  left: 0;
  width: 22px;
  height: 22px;
  border: 4px solid white;
  border-radius: 50%;
  background: var(--ink);
  box-shadow: 0 8px 22px rgba(17, 24, 22, .24);
  transform: translate(-50%, -50%);
  z-index: 4;
}

.intake-marker span {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  padding: 4px 8px;
  border-radius: 0;
  color: white;
  background: var(--ink);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  transform: translateX(-50%);
}

.gauge-readouts {
  position: relative;
  height: 34px;
  margin-top: 8px;
}

.deficit-readout {
  position: absolute;
  left: var(--deficit-center, 50%);
  top: 0;
  padding: 7px 12px;
  border: 1px solid rgba(255, 199, 44, .36);
  border-radius: 0;
  color: #111816;
  background: linear-gradient(90deg, rgba(255, 232, 117, .72), rgba(255, 199, 44, .96));
  box-shadow: 0 10px 24px rgba(255, 199, 44, .16);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  transform: translateX(-50%);
}

.gauge-ruler {
  position: relative;
  display: block;
  height: 28px;
  margin-top: -6px;
  border-top: 1px solid rgba(17, 24, 22, .14);
}

.ruler-label {
  position: absolute;
  top: 8px;
  color: var(--muted);
  font-size: 10px;
  font-weight: normal;
  white-space: nowrap;
  transform: translateX(-50%);
}

.ruler-label::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -8px;
  width: 1px;
  height: 6px;
  background: rgba(17, 24, 22, .28);
}

.bmi-card-section.over-need {
  background: #da143c;
  color: #fff;
}

.bmi-card-section.over-need .need-remaining-label,
.bmi-card-section.over-need .need-remaining-label em,
.bmi-card-section.over-need .need-remaining-label b {
  color: #fff;
}

@media (max-width: 900px) {
  .home-status {
    grid-template-columns: 1fr;
    grid-template-areas:
      "bmi"
      "gauge"
      "weight";
  }
  .home { padding-top: 560px; }
}

/* Restwert Tagesbedarf override */
.need-remaining-label {
  width: 100%;
  padding: 10px 12px;
  background: #2f8a5f;
  color: #fff;
}

.need-remaining-label b,
.need-remaining-label em {
  color: #fff;
}

.need-remaining-label em {
  font-size: 10px;
  line-height: 1;
  white-space: nowrap;
}

/* Restwert Tagesbedarf full width alignment */
.need-remaining-label {
  width: 100%;
  min-width: 100%;
  align-self: stretch;
  justify-items: center;
  align-content: center;
  text-align: center;
}

/* Dashboard scale schema layout */
.home {
  align-content: start;
  padding-top: clamp(640px, 72vh, 760px);
}

.home-status {
  grid-template-columns: 184px minmax(520px, 1fr) 184px;
  grid-template-areas:
    "bmi gauge actions"
    "weight weight weight";
  align-items: stretch;
}

.home-actions {
  grid-area: actions;
  display: grid;
  grid-template-rows: 1fr 1fr;
  align-self: stretch;
  gap: 6px;
}

.home-actions .plus {
  display: grid;
  height: 100%;
  min-width: 0;
  min-height: 0;
  place-items: center;
  align-content: center;
  gap: 8px;
  border: 1px solid rgba(20, 24, 31, .08);
  border-radius: 0;
  padding: 18px 12px;
  background: linear-gradient(180deg, rgba(105, 207, 92, .18), rgba(47, 138, 95, .08)), rgba(255, 255, 255, .92);
  box-shadow: var(--shadow);
  color: #111816;}

.home-actions .activity-plus {
  background: linear-gradient(180deg, rgba(139, 92, 232, .16), rgba(139, 92, 232, .06)), rgba(255, 255, 255, .92);
}

.home-actions .plus span {
  display: grid;
  width: 56px;
  height: 56px;
  place-items: center;
  border-radius: 50%;
  background: #69cf5c;
  color: #fff;
  font-size: 52px;
  line-height: .82;
  transform: none;
}

.home-actions .activity-plus span {
  background: #8b5ce8;
}

.home-actions .plus small,
.home-actions .activity-plus small {
  align-self: auto;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
}

.home-actions .plus:hover {
  transform: translateY(-2px);
  box-shadow: 0 24px 60px rgba(20, 24, 31, .12);
}

@media (max-width: 980px) {
  .home {
    padding-top: 760px;
  }

  .home-status {
    grid-template-columns: 1fr;
    grid-template-areas:
      "bmi"
      "gauge"
      "actions"
      "weight";
  }

  .home-actions {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: minmax(116px, auto);
  }
}

@media (max-width: 560px) {
  .home {
    padding-top: 860px;
  }

  .home-actions {
    grid-template-columns: 1fr;
    grid-template-rows: repeat(2, minmax(104px, auto));
  }
}

/* Balanced schema card spacing */
.home-status {
  gap: 6px;
}

.bmi-card,
.home-actions {
  gap: 6px;
}

.bmi-card {
  display: grid;
  grid-template-rows: 1fr 1fr;
  align-self: stretch;
  border: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  overflow: visible;
}

.bmi-card-section {
  min-height: 0;
  height: 100%;
  border: 1px solid rgba(20, 24, 31, .08);
  background: rgba(255, 255, 255, .92);
  box-shadow: var(--shadow);
  backdrop-filter: var(--blur);
}

.bmi-card-section + .bmi-card-section {
  min-height: 0;
  border-top: 1px solid rgba(20, 24, 31, .08);
}

.rest-card-need {
  background: #2f8a5f;
}

.rest-card-deficit {
  background: linear-gradient(90deg, rgba(255, 232, 117, .72), rgba(255, 199, 44, .96));
}

.need-remaining-label {
  padding: 0;
  background: transparent;
}

.home-actions .plus {
  box-shadow: var(--shadow);}

.calorie-gauge,
.weight-dashboard {
  box-shadow: var(--shadow);
}

/* Equal side card sizing */
.home-status {
  --side-card-width: 184px;
  grid-template-columns: var(--side-card-width) minmax(520px, 1fr) var(--side-card-width);
}

.bmi-card,
.home-actions {
  display: grid;
  grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
  align-self: stretch;
  align-content: stretch;
  justify-items: stretch;
  height: 100%;
}

.bmi-card-section,
.home-actions .plus {
  box-sizing: border-box;
  height: 100%;
  min-height: 0;}

.home-actions .plus {
  justify-self: stretch;
  align-self: stretch;}

@media (max-width: 980px) {
  .home-status {
    grid-template-columns: 1fr;
  }
}

/* Strict schema geometry */
.home-status {
  --side-card-width: 184px;
  --schema-gap: 6px;
  --schema-top-height: clamp(232px, 22vw, 286px);
  grid-template-columns: var(--side-card-width) minmax(520px, 1fr) var(--side-card-width);
  grid-template-rows: var(--schema-top-height) auto;
  gap: var(--schema-gap);
  align-items: stretch;
}

.bmi-card,
.home-actions,
.calorie-gauge {
  min-height: var(--schema-top-height);
  height: var(--schema-top-height);
}

.bmi-card,
.home-actions {
  display: grid;
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: var(--schema-gap);
  align-self: stretch;
}

.bmi-card-section,
.home-actions .plus {
  min-height: 0;
  height: auto;
  align-self: stretch;
  justify-self: stretch;}

.home-actions .plus {
  border-radius: 0;
  padding: 12px;}

.home-actions .plus span {
  width: 50px;
  height: 50px;
  font-size: 48px;
}

@media (max-width: 980px) {
  .home-status {
    --schema-top-height: auto;
    grid-template-columns: 1fr;
    grid-template-rows: auto;
  }

  .bmi-card,
  .home-actions,
  .calorie-gauge {
    min-height: 0;
    height: auto;
  }

  .bmi-card,
  .home-actions {
    grid-template-rows: repeat(2, minmax(112px, auto));
  }
}

/* Disable home action hover movement */
.home-actions .plus:hover {
  transform: none;
  filter: none;
  box-shadow: var(--shadow);
}

/* Home action max width */
.home-actions .plus {
  max-width: 182px;
}


.form-title {
  display: grid;
  gap: 4px;
}

.form-title p {
  margin: 0;
  color: var(--muted);
}

.form-title h2 {
  margin: 0;
}

.account-form {
  grid-column: 1;
}

.profile-grid .metrics {
  grid-column: 2;
  grid-row: 1 / span 2;
}

.password-input {
  position: relative;
  display: block;
}

.password-input input {
  padding-right: 54px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 0;
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.password-toggle svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.password-toggle.is-visible {
  color: var(--green-dark);
  background: rgba(125, 211, 92, .16);
}

@media (max-width: 760px) {
  .account-form,
  .profile-grid .metrics {
    grid-column: auto;
    grid-row: auto;
  }
}
