:root {
  --bg: #f7f4ef;
  --surface: #ffffff;
  --surface-strong: #fdfaf5;
  --text: #17211d;
  --muted: #66706b;
  --line: #ded8ce;
  --green: #2f7d5c;
  --green-dark: #1f5d45;
  --coral: #d9654b;
  --amber: #d79a2b;
  --teal: #217e82;
  --danger: #b83c3c;
  --shadow: 0 18px 46px rgba(33, 28, 20, 0.1), 0 2px 8px rgba(33, 28, 20, 0.045);
  --shadow-soft: 0 10px 26px rgba(33, 28, 20, 0.075), 0 1px 4px rgba(33, 28, 20, 0.05);
  --shadow-tight: 0 8px 18px rgba(33, 28, 20, 0.08);
  --gloss: linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0) 46%);
  color-scheme: light;
  font-family:
    Aptos, "Aptos Display", "Segoe UI Variable Text", "Segoe UI Variable", "Segoe UI",
    ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

:root[data-theme="dark"] {
  --bg: #101612;
  --surface: #18211c;
  --surface-strong: #141d18;
  --text: #eef5f0;
  --muted: #a8b6ad;
  --line: #324238;
  --green: #4ca876;
  --green-dark: #9ee8bd;
  --coral: #e17961;
  --amber: #e4b24c;
  --teal: #59bfc3;
  --danger: #df6262;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.34), 0 2px 8px rgba(0, 0, 0, 0.22);
  --shadow-soft: 0 12px 28px rgba(0, 0, 0, 0.25), 0 1px 4px rgba(0, 0, 0, 0.18);
  --shadow-tight: 0 8px 18px rgba(0, 0, 0, 0.24);
  --gloss: linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0) 48%);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(247, 244, 239, 0.94)),
    var(--bg);
  color: var(--text);
  font-feature-settings: "kern" 1, "liga" 1, "tnum" 1;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.legal-page {
  min-height: 100vh;
}

.legal-shell {
  width: min(920px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.legal-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.legal-page-header h1 {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 2.7rem);
  line-height: 1;
  letter-spacing: 0;
}

.legal-card {
  display: grid;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 22px;
}

.legal-card section {
  display: grid;
  gap: 7px;
}

.legal-card h2 {
  margin: 0;
  font-size: 1.05rem;
}

.legal-card p,
.legal-card ul {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.legal-card ul {
  padding-left: 20px;
}

.legal-card strong {
  color: var(--text);
}

.legal-back {
  white-space: nowrap;
}

.share-page {
  min-height: 100vh;
}

.share-shell {
  width: min(980px, calc(100% - 28px));
  margin: 0 auto;
  padding: 28px 0 36px;
}

.share-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.share-hero h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 1;
  letter-spacing: 0;
}

.share-meta {
  margin: 8px 0 0;
  color: var(--muted);
  font-weight: 800;
}

.share-validity {
  margin: 8px 0 0;
  color: var(--green-dark);
  font-size: 0.9rem;
  font-weight: 850;
}

.share-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.share-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 18px;
}

.share-status {
  color: var(--muted);
  font-weight: 800;
}

.share-status.share-error {
  border-color: #edc4bc;
  background: #f8e9e6;
  color: var(--danger);
}

.share-kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.share-kpi {
  display: grid;
  gap: 4px;
  min-height: 86px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface-strong);
}

.share-kpi-label {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 850;
  text-transform: uppercase;
}

.share-kpi strong {
  font-size: 1.45rem;
  line-height: 1;
}

.share-kpi.kcal {
  border-color: rgba(255, 48, 48, 0.42);
  background: rgba(255, 48, 48, 0.16);
}

.share-kpi.protein {
  border-color: rgba(243, 207, 16, 0.5);
  background: rgba(243, 207, 16, 0.18);
}

.share-kpi.fat {
  border-color: rgba(210, 111, 21, 0.48);
  background: rgba(210, 111, 21, 0.17);
}

.share-kpi.carbs,
.share-kpi.sugar {
  border-color: rgba(45, 174, 224, 0.48);
  background: rgba(45, 174, 224, 0.17);
}

.share-kpi.fiber {
  border-color: rgba(48, 197, 75, 0.46);
  background: rgba(48, 197, 75, 0.16);
}

.share-meals {
  display: grid;
  gap: 12px;
}

.share-meal {
  border: 1px solid #c6d9ce;
  border-radius: 8px;
  overflow: hidden;
  background: #fffdf8;
}

.share-meal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid #c6d9ce;
  border-left: 5px solid var(--green);
  background: linear-gradient(90deg, rgba(47, 125, 92, 0.16), rgba(239, 247, 242, 0.88));
}

.share-meal h2 {
  margin: 0;
  font-size: 1.05rem;
  color: var(--green-dark);
  font-weight: 950;
}

.share-meal p {
  margin: 4px 0 0;
  color: #4f665a;
  font-size: 0.82rem;
  font-weight: 800;
}

.share-food-list {
  display: grid;
}

.share-food-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.7);
}

.share-food-row + .share-food-row {
  border-top: 1px solid var(--line);
}

.share-food-text {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.share-food-text strong,
.share-food-text span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.share-food-text span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
}

.share-food-macros {
  white-space: normal;
}

.share-food-kcal {
  font-size: 1rem;
  white-space: nowrap;
}

.share-legal-footer {
  margin-top: 18px;
}

@media (max-width: 720px) {
  .share-shell {
    width: min(100% - 20px, 560px);
    padding-top: 18px;
  }

  .share-hero {
    display: grid;
  }

  .share-actions {
    justify-content: stretch;
  }

  .share-actions .button {
    flex: 1 1 150px;
  }

  .share-card {
    padding: 12px;
  }

  .share-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .share-kpi {
    min-height: 72px;
    padding: 10px;
  }

  .share-kpi strong {
    font-size: 1.18rem;
  }

  .share-food-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    padding: 11px 10px;
  }
}

@media print {
  .share-actions,
  .share-legal-footer {
    display: none;
  }

  body {
    background: #fff;
  }

  .share-shell {
    width: 100%;
    padding: 0;
  }

  .share-card,
  .share-meal,
  .share-kpi {
    box-shadow: none;
  }
}

@media (min-width: 821px) {
  html,
  body {
    overflow-x: hidden;
  }

  .app-shell {
    width: 125%;
    min-height: 125vh;
    transform: scale(0.8);
    transform-origin: top left;
  }

  .day-actions {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) auto auto auto;
    align-items: end;
    column-gap: 8px;
    row-gap: 7px;
    max-width: 620px;
  }

  .day-actions .button,
  .day-actions .icon-button {
    align-self: end;
    min-height: 38px;
  }
}

:root[data-theme="dark"] body {
  background:
    linear-gradient(180deg, rgba(26, 34, 29, 0.96), rgba(13, 18, 15, 0.98)),
    var(--bg);
}

:root[data-theme="dark"] .share-meal {
  border-color: #3d654f;
  background: #152019;
}

:root[data-theme="dark"] .share-meal-header {
  border-bottom-color: #3d654f;
  background: linear-gradient(90deg, rgba(76, 168, 118, 0.22), rgba(24, 33, 28, 0.92));
}

:root[data-theme="dark"] .share-meal p {
  color: var(--muted);
}

:root[data-theme="dark"] .share-food-row {
  background: rgba(24, 33, 28, 0.72);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled,
.button:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(247, 244, 239, 0.96)),
    var(--bg);
}

.auth-screen.auth-hidden {
  display: none;
}

.auth-card {
  width: min(100%, 430px);
  display: grid;
  gap: 14px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.brand-logo {
  background-image: url("data:image/webp;base64,UklGRjggAABXRUJQVlA4ICwgAACQjwCdASrMAdgAPok+m0qlIzUwpJLKoqARCWVu+/qmrJ7oHdnpB3RNzoyctAJuRgz1PD87uyx6atwH5sf159dL0r/+Tfp/1A4ID+8WwZyyx79Vc+LEf89tb96fx81CPYG8a7r/xvQF9mPq//P9Rr63zT/rP8v7AXnl3mH3v/k+wR/PP7L6w/+X5UfrX2H/2N36picendSx9uc2M2qjIifCsnlz60Tt8a79EKlb/8QFbX2WwnoK1fteth01lZAjS0K2I3aDoYDlL+Xvuj+P+5DtgIL8aSWDrqHZn24WLOdYQCXzf+WDqhUQXBZAAxzwvRwuytMR5FvTK63Q2y7Eb7SDsTcW2uZJS3toZOZDlHRjYzDbwl3y6XV1k1Zk4rgyyECkYUFTJMT+vf0mt2QmJwvtIBOINiKT7perx//P9GNBXN7CJRJWPl5UROv7WofKtLqOFF34YE/ViMHbZWxlDqNkiE58MyPRl11jjCP3LZC8KjTl44D53EYcycZAnUwTl6+iLOB9Sgv9LeNwT37uP8A5dk3TUg9+kCkOWds4lUtu+ZKLb6ahGE/Rl1dmJoZ55RRsdOy97/dC6VQcLSrpuffgSwZJpeDTf+7TqpTwmB0TRmy0+4L27ENl8IrVNyEgYoCnYQCXufD3ufb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gym7lMjZ7WRb5n2+ibxuUzKrv2WZrwcRk8hNmqW6WtY6NgAXxQLDOx6VZF100024Vq8zjArPtPdMc+qlFJZVygNPf9N9F1wVbNC/4vcUNqsQbK37N0LoIJUuJrJEWQKM53cUEqbWycEZzkhzN8kwIDCNRu4qGWkrXTg5twUb6DqGkmh9vjD9kWwPfcIzmhUJbixEumXAXURZgfjIswzgHdhidw5gT4GEN15RTfOayZWUsdd/Dfiekjorz0VzxnYpesiO6ScOu9SPePNpsF0xh/35+ZV8dulT02tAu6iO4pj048UmI3q4YLjh39a6cECs3mrC8WWvL7np2IGAGHQL5MbVB1F+OJd3l093XAZH3UJxw4iyDD+0TiOJMA9Ruju54j5sFIquz0CLwiZitew7r2gu/jx5tyfF6BVYdLkWaJWJWQAkk8n/MhTaHPM0f9m82YRib3ENsbeSozfwXclMx9GmPCt+MeABzCowAOgOyc0BtPOBbTp/R7+QjpEedAxZTLsXNghP/0F/EpuKo8AwUkAPYE5zoRm/AANU7hbo3RAuIB1sbnvx7+Fy+RE+lAs9SDfDgV8+zG5Lre78AAA");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border: 1px solid rgba(7, 43, 34, 0.2);
  border-radius: 8px;
  box-shadow: 0 14px 28px rgba(20, 46, 36, 0.16);
}

.auth-brand-logo {
  width: min(100%, 360px);
  aspect-ratio: 760 / 357;
  justify-self: center;
  margin: -4px 0 2px;
}

.auth-card h1 {
  margin: -8px 0 4px;
  font-size: 2rem;
  line-height: 1;
  letter-spacing: 0;
}

.auth-copy {
  margin: -6px 0 2px;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
}

.auth-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.auth-separator {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
}

.auth-separator::before,
.auth-separator::after {
  content: "";
  height: 1px;
  background: var(--line);
}

.auth-google-button {
  width: 100%;
  min-height: 42px;
  gap: 9px;
}

.auth-google-icon {
  display: inline-grid;
  place-items: center;
  width: 21px;
  height: 21px;
  border-radius: 999px;
  background: #fff;
  color: #4285f4;
  border: 1px solid #d7dce2;
  font-weight: 950;
  font-size: 0.88rem;
  line-height: 1;
}

.auth-remember-line {
  justify-content: flex-start;
  margin-top: -2px;
  color: var(--muted);
}

.auth-remember-line span {
  color: var(--text);
}

.legal-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 16px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.legal-footer a {
  color: inherit;
  text-decoration: none;
}

.legal-footer a:hover,
.legal-footer a:focus {
  color: var(--green-dark);
  text-decoration: underline;
}

.auth-legal-footer {
  position: absolute;
  right: 18px;
  bottom: 16px;
  left: 18px;
}

.text-button {
  width: fit-content;
  border: 0;
  background: transparent;
  color: var(--green-dark);
  padding: 0;
  font-weight: 800;
  text-align: left;
}

.text-button:hover {
  color: var(--green);
  text-decoration: underline;
}

.auth-error {
  min-height: 1.2em;
  margin: 0;
  color: var(--danger);
  font-size: 0.82rem;
  font-weight: 750;
}

.password-dialog {
  width: min(92vw, 430px);
  border: 0;
  border-radius: 8px;
  padding: 0;
  background: transparent;
}

.password-dialog::backdrop {
  background: rgba(23, 33, 29, 0.42);
}

.password-card {
  display: grid;
  gap: 12px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.password-card h2 {
  margin: 0;
  font-size: 1.1rem;
}

.password-dialog.password-recovery #currentPasswordLabel {
  display: none;
}

.account-dialog-email {
  margin: -4px 0 2px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.account-action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.account-settings-block {
  display: grid;
  gap: 7px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 78%, var(--bg));
}

.account-settings-title {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
}

.account-settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.account-language-switch,
.account-settings-grid .theme-toggle {
  width: 100%;
  min-width: 0;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(207px, 252px) minmax(480px, 1fr) minmax(300px, 360px);
  grid-template-areas:
    "topbar topbar topbar"
    "sidebar workspace summary"
    "footer footer footer";
  align-content: start;
  min-height: 100vh;
  gap: 16px;
  padding: 18px;
}

.app-legal-footer {
  grid-area: footer;
  padding: 0 0 8px;
}

.app-shell.auth-locked {
  display: none;
}

.app-shell.weight-view .sidebar,
.app-shell.weight-view .day-workspace,
.app-shell.weight-view .summary-rail,
.app-shell.calculator-view .sidebar,
.app-shell.calculator-view .day-workspace,
.app-shell.calculator-view .summary-rail,
.app-shell.global-food-view .sidebar,
.app-shell.global-food-view .day-workspace,
.app-shell.global-food-view .summary-rail,
.app-shell.local-food-view .sidebar,
.app-shell.local-food-view .day-workspace,
.app-shell.local-food-view .summary-rail {
  display: none;
}

.topbar {
  grid-area: topbar;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 4px 2px 2px;
}

.topbar h1,
.panel h2 {
  margin: 0;
}

.topbar h1 {
  font-size: clamp(1.6rem, 3vw, 2.45rem);
  line-height: 1;
  letter-spacing: 0;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--green-dark);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.toolbar,
.day-actions,
.form-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.account-button {
  width: 50px;
  min-width: 50px;
  max-width: 50px;
  padding: 0;
  overflow: visible;
  border-color: #cfd6d2;
  background: #eef0f1;
  color: #4f5b55;
  white-space: nowrap;
}

.account-button:hover {
  border-color: #bcc6c0;
  background: #e2e6e4;
  color: #26342d;
}

.account-button-icon {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
}

.view-switch {
  display: inline-grid;
  grid-template-columns: repeat(3, 50px);
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 82%, var(--bg));
}

.view-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  padding: 0;
  font-size: 0.78rem;
  font-weight: 850;
  white-space: nowrap;
}

.view-toggle-icon {
  width: 22px;
  height: 22px;
}

.view-toggle-icon-pair {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.view-toggle-icon-pair .view-toggle-icon {
  width: 18px;
  height: 18px;
}

.view-toggle.active {
  background: var(--green);
  color: #fff;
}

.language-switch {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(42px, 1fr));
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 82%, var(--bg));
}

.auth-language-switch {
  width: 112px;
}

.mobile-nav {
  display: none;
}

.sync-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  padding: 6px 10px;
  font-size: 0.76rem;
  font-weight: 850;
}

.theme-toggle {
  min-width: 78px;
}

.sync-status[data-variant="ok"] {
  border-color: #b7d7c5;
  background: #e8f4ec;
  color: var(--green-dark);
}

.sync-status[data-variant="busy"] {
  border-color: #d9c188;
  background: #fff6da;
  color: #7d5f14;
}

.sync-status[data-variant="warn"],
.sync-status[data-variant="error"] {
  border-color: #e6b0a9;
  background: #fceae7;
  color: var(--danger);
}

.sidebar {
  grid-area: sidebar;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.day-workspace {
  grid-area: workspace;
  min-width: 0;
}

.summary-rail {
  grid-area: summary;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.panel {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(253, 250, 245, 0.94)),
    var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px 10px;
}

.panel-heading.compact {
  align-items: center;
}

.panel h2 {
  font-size: 1rem;
  letter-spacing: 0;
}

.button,
.icon-button,
.file-button {
  border: 0;
  border-radius: 7px;
  background: var(--green);
  color: #fff;
  min-height: 38px;
  padding: 0 14px;
  font-weight: 750;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    0 2px 5px rgba(31, 93, 69, 0.12);
  transition:
    transform 0.14s ease,
    box-shadow 0.14s ease,
    background-color 0.14s ease,
    border-color 0.14s ease;
}

.button:hover,
.icon-button:hover,
.file-button:hover {
  background: var(--green-dark);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.24),
    0 5px 12px rgba(31, 93, 69, 0.18);
  transform: translateY(-1px);
}

.button.ghost,
.file-button.ghost {
  background: #eef3ef;
  color: var(--green-dark);
  border: 1px solid #c8d6ce;
}

.button.ghost:hover,
.file-button.ghost:hover {
  background: #dfe9e2;
}

.button.danger,
.button.danger.ghost,
.icon-button.danger {
  color: #fff;
  background: var(--danger);
}

.button.danger.ghost {
  color: var(--danger);
  background: #f8e9e6;
  border-color: #edc4bc;
}

.admin-tool.active {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}

.icon-button {
  width: 36px;
  min-width: 36px;
  padding: 0;
  font-size: 1.25rem;
  line-height: 1;
}

.day-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 0 11px 13px;
}

.day-tab-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 22px;
  align-items: center;
  gap: 4px;
}

.day-tab {
  width: 100%;
  min-height: 43px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 7px;
  padding: 7px 9px;
  text-align: left;
}

.day-tab:hover,
.day-tab.active {
  border-color: #bfd1c5;
  background: #eef4ef;
}

.day-tab.today strong {
  color: #000;
  font-weight: 950;
}

.day-tab.today > span > span {
  color: #17211d;
  font-weight: 800;
}

.day-tab strong,
.day-tab span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.day-tab span {
  color: var(--muted);
  font-size: 0.8rem;
}

.day-menu {
  position: relative;
}

.day-menu-button {
  list-style: none;
  width: 22px;
  min-height: 38px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #111;
  font-size: 0.95rem;
  font-weight: 950;
  line-height: 1;
  cursor: pointer;
  user-select: none;
}

.day-menu-button::-webkit-details-marker {
  display: none;
}

.day-menu[open] .day-menu-button,
.day-menu-button:hover {
  background: #eef4ef;
}

.day-menu-panel {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 120;
  min-width: 206px;
  display: grid;
  gap: 3px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 18px 40px rgba(33, 28, 20, 0.18);
}

.day-menu-action {
  width: 100%;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  padding: 8px 9px;
  text-align: left;
  font-size: 0.76rem;
  font-weight: 850;
}

.day-menu-action:hover,
.day-menu-action:focus {
  background: #eef4ef;
  outline: none;
}

.day-menu-action.danger {
  color: var(--danger);
}

.day-menu-icon {
  width: 18px;
  height: 18px;
  display: inline-block;
  color: currentColor;
}

.pill {
  border-radius: 999px;
  color: var(--green-dark);
  background: #dfeee5;
  padding: 4px 8px;
  font-size: 0.72rem;
  font-weight: 800;
}

.settings-panel {
  padding-bottom: 16px;
}

.settings-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  padding: 0 16px;
}

.sidebar .panel-heading {
  padding: 16px 16px 9px;
}

.sidebar .settings-grid {
  gap: 9px;
  padding: 0 14px;
}

.sidebar .settings-panel {
  padding-bottom: 14px;
}

.sidebar label {
  gap: 5px;
  font-size: 0.74rem;
}

.sidebar input,
.sidebar select {
  min-height: 34px;
  padding: 7px 9px;
  font-size: 0.9rem;
}

.sidebar .icon-button {
  width: 32px;
  min-width: 32px;
  min-height: 34px;
  font-size: 1.1rem;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

input,
select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(251, 248, 243, 0.9)),
    #fff;
  color: var(--text);
  padding: 8px 10px;
  outline: none;
  box-shadow:
    inset 0 1px 2px rgba(33, 28, 20, 0.035),
    0 1px 0 rgba(255, 255, 255, 0.72);
}

input:focus,
select:focus {
  border-color: var(--green);
  box-shadow:
    inset 0 1px 2px rgba(33, 28, 20, 0.035),
    0 0 0 3px rgba(47, 125, 92, 0.14);
}

.password-input-wrap {
  position: relative;
  display: block;
}

.password-input-wrap input {
  padding-right: 42px;
}

.password-visibility-toggle {
  position: absolute;
  top: 50%;
  right: 7px;
  display: inline-grid;
  place-items: center;
  width: 30px;
  min-width: 30px;
  height: 30px;
  min-height: 30px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  transform: translateY(-50%);
}

.password-visibility-toggle:hover,
.password-visibility-toggle:focus {
  background: rgba(47, 125, 92, 0.1);
  color: var(--green-dark);
}

.password-visibility-toggle svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.input-suffix {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 7px;
}

.input-suffix span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.active-day-panel {
  min-height: calc(100vh - 112px);
}

.day-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 440px);
  align-items: center;
  gap: 12px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.day-title-block {
  display: grid;
  grid-template-columns: minmax(0, auto) 180px;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: none;
}

.day-title-input {
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  padding: 2px 0 6px;
  font-size: 1.45rem;
  font-weight: 850;
  min-height: 38px;
  min-width: 0;
}

.day-title-input:focus {
  box-shadow: none;
  border-color: var(--green);
}

.date-input {
  width: 180px;
  max-width: 100%;
}

.day-actions {
  display: grid;
  grid-template-columns: minmax(170px, 1fr) 42px;
  align-items: center;
  justify-self: end;
  width: 100%;
  max-width: 440px;
  gap: 8px;
}

.day-actions select {
  min-height: 38px;
}

.meal-action-button {
  width: 42px;
  min-width: 42px;
  min-height: 38px;
  padding: 0;
  gap: 2px;
}

.meal-action-sign {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 10px;
  font-size: 1rem;
  font-weight: 950;
  line-height: 1;
}

.meal-action-icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.day-target-control {
  width: 100%;
  min-width: 0;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
}

.day-target-control .input-suffix {
  gap: 5px;
}

.meal-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 10px 18px 0;
}

.meal-nav[hidden] {
  display: none;
}

.meal-nav-button {
  min-height: 30px;
  max-width: 230px;
  border: 1px solid #c8d6ce;
  border-radius: 7px;
  background: #eef3ef;
  color: var(--green-dark);
  padding: 0 10px;
  font-size: 0.74rem;
  font-weight: 850;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meal-nav-button:hover,
.meal-nav-button.active {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.day-tools {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(430px, 1.1fr);
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
}

.inline-tool-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.58);
  padding: 10px;
}

.inline-tool-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.inline-tool-heading h3,
.settings-subheading {
  margin: 0;
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 850;
}

.compact-button {
  min-height: 28px;
  padding: 0 9px;
  font-size: 0.74rem;
}

.icon-action-button {
  min-width: 34px;
  width: 34px;
  padding: 0;
  gap: 0;
}

.action-button-icon {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.template-actions {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 7px;
}

.template-actions .button,
.template-actions select {
  min-height: 34px;
}

.template-actions .icon-action-button {
  min-width: 42px;
  width: 42px;
}

.macro-target-grid {
  display: grid;
  gap: 8px;
}

.settings-subheading,
.settings-macro-targets {
  grid-column: 1 / -1;
}

.settings-subheading {
  margin-top: 2px;
}

.settings-macro-targets {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.day-macro-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.macro-target-grid label {
  gap: 4px;
  font-size: 0.68rem;
}

.macro-target-grid input {
  min-height: 32px;
  padding: 6px 8px;
  font-size: 0.86rem;
}

.meals {
  display: grid;
  gap: 11px;
  padding: 13px;
}

.meal {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: visible;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(253, 250, 245, 0.96)),
    var(--surface-strong);
  box-shadow: var(--shadow-soft), inset 0 1px 0 rgba(255, 255, 255, 0.78);
  scroll-margin-top: 92px;
}

.meal-header {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) auto auto auto;
  align-items: center;
  gap: 7px;
  padding: 9px;
  border-bottom: 1px solid var(--line);
  border-radius: 8px 8px 0 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.08)),
    color-mix(in srgb, var(--surface-strong) 82%, #ffffff);
}

.meal-title {
  font-size: 0.88rem;
  font-weight: 850;
  background: transparent;
  border-color: transparent;
  padding-left: 0;
  min-height: 24px;
}

.meal-total {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
  color: #000;
  font-size: 0.95rem;
  font-weight: 900;
  white-space: nowrap;
}

.macro-pill {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--macro-color);
  border-radius: 5px;
  background: var(--macro-color);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0) 48%),
    color-mix(in srgb, var(--macro-color) 74%, #ffffff);
  color: #000;
  line-height: 1.05;
  padding: 3px 5px;
  white-space: nowrap;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.42),
    0 1px 2px rgba(33, 28, 20, 0.08);
}

.macro-pill.macro-carbs {
  min-width: 82px;
}

.meal-copy {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  min-width: 0;
}

.meal-more-menu {
  position: relative;
}

.meal-more-button {
  list-style: none;
  display: grid;
  place-items: center;
  width: 28px;
  min-width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 950;
  line-height: 1;
  cursor: pointer;
  user-select: none;
}

.meal-more-button::-webkit-details-marker {
  display: none;
}

.meal-more-menu[open] .meal-more-button,
.meal-more-button:hover {
  border-color: #aec8b7;
  background: #eef4ef;
}

.meal-more-panel {
  position: absolute;
  top: calc(100% + 5px);
  right: 0;
  z-index: 130;
  width: min(330px, calc(100vw - 32px));
  display: grid;
  gap: 5px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 18px 40px rgba(33, 28, 20, 0.2);
}

.meal-copy-menu {
  display: grid;
  gap: 5px;
  padding: 2px 2px 7px;
  border-bottom: 1px solid var(--line);
}

.meal-menu-label {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 850;
}

.meal-copy-menu-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  gap: 6px;
}

.meal-copy-menu-row select {
  width: 100%;
  min-width: 0;
  min-height: 34px;
  padding: 5px 7px;
  font-size: 0.72rem;
}

.meal-copy-menu-row .icon-action-button {
  width: 34px;
  min-width: 34px;
  min-height: 34px;
  padding: 0;
}

.meal-menu-action {
  width: 100%;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  padding: 9px;
  text-align: left;
  font-size: 0.76rem;
  font-weight: 850;
}

.meal-menu-action:hover,
.meal-menu-action:focus {
  background: #eef4ef;
  outline: none;
}

.meal-menu-action .action-button-icon {
  width: 18px;
  height: 18px;
}

.meal-order {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.meal-order .mini-button {
  min-width: 28px;
  width: 28px;
  height: 28px;
  padding: 0;
  font-size: 0.9rem;
  line-height: 1;
}

.meal-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.meal-table th {
  color: var(--muted);
  font-size: 0.58rem;
  font-weight: 850;
  text-align: left;
  padding: 5px 4px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.meal-table td {
  padding: 3px 4px;
  border-bottom: 1px solid #ebe5dc;
  vertical-align: middle;
}

.meal-table td[data-label="Lebensmittel"] {
  position: relative;
}

.meal-table input,
.meal-table select {
  min-height: 22px;
  padding: 2px 5px;
  border-radius: 5px;
  font-size: 0.7rem;
}

.meal-table .amount-input.needs-value {
  border-color: #d98a00;
  background: #ffd166;
  color: #15100a;
  box-shadow: inset 0 0 0 1px rgba(160, 91, 0, 0.22);
}

.meal-table .amount-input.needs-value:focus {
  border-color: #b96d00;
  box-shadow:
    inset 0 0 0 1px rgba(160, 91, 0, 0.22),
    0 0 0 3px rgba(255, 184, 46, 0.34);
}

.meal-table th + th,
.meal-table td + td {
  border-left: 1px solid #eee8dd;
}

.meal-table tr:last-child td {
  border-bottom: 0;
}

.food-suggestion-list {
  position: absolute;
  z-index: 80;
  top: calc(100% + 4px);
  left: 4px;
  right: 4px;
  max-height: 270px;
  overflow-y: auto;
  display: grid;
  gap: 2px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 18px 40px rgba(33, 28, 20, 0.18);
  overscroll-behavior: contain;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
}

.food-suggestion-list button {
  width: 100%;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  padding: 7px 8px;
  text-align: left;
  touch-action: pan-y;
}

.food-suggestion-list button:hover,
.food-suggestion-list button:focus {
  background: #eef4ef;
  outline: none;
}

.food-suggestion-list strong,
.food-suggestion-list span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.food-suggestion-list strong {
  font-size: 0.76rem;
}

.food-suggestion-list span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 750;
}

.food-estimate-badge {
  display: inline-block;
  margin-left: 4px;
  color: var(--muted);
  font-size: 0.78em;
  font-style: italic;
  font-weight: 800;
  vertical-align: baseline;
}

.entry-food-estimate-slot {
  display: block;
  min-height: 0;
}

.entry-summary-estimate {
  margin-left: 0;
}

.entry-summary-estimate[hidden] {
  display: none;
}

.meal-table .food-col {
  width: 34%;
}

.meal-table .amount-col {
  width: 58px;
}

.meal-table .unit-col {
  width: 78px;
}

.meal-table .macro-col {
  width: 64px;
}

.meal-table .remove-col {
  width: 30px;
}

.mobile-entry-summary {
  display: none;
}

.entry-summary-button {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.entry-macro {
  font-variant-numeric: tabular-nums;
  color: #000;
  font-size: 0.92rem;
  font-weight: 900;
  line-height: 1.08;
}

.entry-macro.muted {
  color: #000;
  font-weight: 900;
}

.entry-macro.colored {
  background: var(--macro-color);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.24), rgba(255, 255, 255, 0) 46%),
    color-mix(in srgb, var(--macro-color) 66%, #ffffff);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.32),
    inset 0 -1px 0 rgba(0, 0, 0, 0.04);
}

.entry-macro-value,
.entry-macro-inline {
  display: block;
}

.entry-macro.has-sub {
  padding-top: 2px;
  padding-bottom: 2px;
  font-size: 0.76rem;
}

.entry-macro-inline {
  white-space: nowrap;
}

.custom-macro-cell {
  padding: 1px 3px;
}

.custom-macro-input {
  width: 100%;
  min-height: 20px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: #000;
  box-shadow: none;
  font: inherit;
  font-weight: 900;
  text-align: left;
}

.custom-macro-input:focus {
  outline: 2px solid rgba(0, 0, 0, 0.32);
  outline-offset: -2px;
  box-shadow: none;
}

.custom-macro-inline {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 2px;
  color: #000;
  font-size: 0.58rem;
  font-weight: 850;
  line-height: 1;
}

.custom-macro-inline span {
  white-space: nowrap;
}

.custom-macro-main-input,
.custom-macro-sub-input {
  min-height: 16px;
  padding: 0;
  font-size: 0.62rem;
  line-height: 1;
}

.temporary-amount[readonly],
.temporary-mode-select {
  color: var(--muted);
}

.add-entry-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 10px;
}

.meal-entry-action-button {
  width: 62px;
  min-width: 62px;
  min-height: 36px;
  padding: 0;
}

.meal-entry-plus {
  font-size: 1.2rem;
  line-height: 1;
  font-weight: 950;
  transform: translateY(-1px);
}

.meal-entry-action-icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.meal-entry-action-icon-file {
  width: 18px;
  height: 22px;
  fill: currentColor;
  stroke: none;
}

.meal-entry-action-icon-barcode {
  width: 20px;
  height: 22px;
  fill: currentColor;
  stroke: none;
}

.button.ghost.meal-entry-action-barcode,
.button.ghost.meal-entry-action-photo {
  border-color: #91d2ec;
  background: #d8f1ff;
  color: #075d78;
}

.button.ghost.meal-entry-action-barcode:hover,
.button.ghost.meal-entry-action-photo:hover {
  background: #bee7fb;
}

.meal-photo-scanner {
  display: grid;
  gap: 8px;
  margin: 0 10px 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
}

.meal-photo-video {
  width: 100%;
  max-height: 360px;
  border-radius: 8px;
  background: #111;
  object-fit: cover;
  cursor: pointer;
}

.meal-photo-context {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.meal-photo-context label {
  display: grid;
  gap: 4px;
  color: var(--green-dark);
  font-size: 0.72rem;
  font-weight: 850;
}

.meal-photo-context-notes {
  grid-column: 1 / -1;
}

.meal-photo-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.meal-barcode-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.meal-photo-status {
  margin: 0;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 850;
}

.meal-photo-status[data-variant="ok"] {
  color: var(--green-dark);
}

.meal-photo-status[data-variant="warn"] {
  color: #8a6517;
}

.meal-photo-status[data-variant="error"] {
  color: var(--danger);
}

.kpi-grid,
.targets-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 0 16px 16px;
}

.kpi {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(253, 250, 245, 0.88)),
    #fff;
  box-shadow: var(--shadow-tight), inset 0 1px 0 rgba(255, 255, 255, 0.86);
}

.kpi::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 52%;
  background: var(--gloss);
  pointer-events: none;
}

.kpi.color-card {
  border-color: color-mix(in srgb, var(--kpi-color) 70%, #ffffff);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.42), rgba(255, 255, 255, 0) 55%),
    color-mix(in srgb, var(--kpi-color) 16%, #ffffff);
  box-shadow:
    0 11px 26px color-mix(in srgb, var(--kpi-color) 16%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.78);
}

.kpi.progress-card {
  --kpi-progress: 0%;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.38), rgba(255, 255, 255, 0) 54%),
    linear-gradient(
      90deg,
      color-mix(in srgb, var(--kpi-color) 66%, #ffffff) 0 var(--kpi-progress),
      color-mix(in srgb, var(--kpi-color) 15%, #ffffff) var(--kpi-progress) 100%
    );
  box-shadow:
    0 12px 26px color-mix(in srgb, var(--kpi-color) 18%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.kpi span {
  position: relative;
  z-index: 1;
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
}

.kpi strong {
  position: relative;
  z-index: 1;
  display: block;
  margin-top: 5px;
  font-size: 1.18rem;
  letter-spacing: 0;
}

.kpi small {
  position: relative;
  z-index: 1;
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.73rem;
}

.macro-chart-wrap {
  display: grid;
  grid-template-columns: 142px 1fr;
  align-items: center;
  gap: 16px;
  padding: 2px 16px 18px;
}

.macro-chart {
  width: 142px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: conic-gradient(var(--green) 0deg, var(--line) 0deg);
  border: 10px solid #fff;
  box-shadow:
    inset 0 0 0 1px var(--line),
    inset 8px 10px 16px rgba(255, 255, 255, 0.3),
    inset -10px -12px 18px rgba(33, 28, 20, 0.08),
    0 16px 32px rgba(42, 35, 24, 0.16);
  filter: saturate(1.08);
}

.week-panel {
  overflow: hidden;
}

.week-summary {
  display: grid;
  gap: 10px;
  padding: 0 16px 16px;
}

.week-total {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 11px;
}

.week-total strong,
.week-total span {
  display: block;
}

.week-total strong {
  font-size: 1rem;
}

.week-total span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 750;
}

.week-days {
  display: grid;
  gap: 6px;
}

.week-day {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  display: grid;
  grid-template-columns: 74px 1fr;
  gap: 8px;
  padding: 9px;
  text-align: left;
}

.week-day:hover,
.week-day.active {
  border-color: #bfd1c5;
  background: #eef4ef;
}

.week-day strong,
.week-day small {
  display: block;
}

.week-day strong {
  font-size: 0.8rem;
}

.week-day small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 760;
}

.macro-legend {
  display: grid;
  gap: 8px;
}

.legend-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.84rem;
}

.swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.color-controls {
  display: grid;
  gap: 8px;
  padding: 0 16px 16px;
}

.account-color-settings .color-controls {
  padding: 0;
}

.color-heading {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
}

.color-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.color-control {
  display: grid;
  gap: 5px;
  min-width: 0;
  position: relative;
}

.color-control span {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 850;
}

.color-control i {
  width: 13px;
  height: 13px;
  border-radius: 4px;
  background: var(--selected-color);
  border: 1px solid color-mix(in srgb, var(--selected-color) 70%, #000000);
}

.color-control select {
  display: none;
  min-height: 30px;
  padding: 5px 7px;
  font-size: 0.76rem;
}

.color-picker-panel {
  position: relative;
}

.color-picker-panel summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 32px;
  list-style: none;
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  padding: 4px 6px;
}

.color-picker-panel summary::-webkit-details-marker {
  display: none;
}

.color-current {
  display: block;
  width: 100%;
  height: 22px;
  border-radius: 5px;
  background: var(--selected-color);
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.38);
}

.color-popover {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 45;
  display: grid;
  grid-template-columns: repeat(10, 18px);
  gap: 5px;
  width: max-content;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 18px 45px rgba(33, 28, 20, 0.18);
}

.color-control:nth-child(even) .color-popover {
  right: 0;
  left: auto;
}

.color-swatch-button {
  width: 18px;
  min-width: 18px;
  height: 18px;
  border: 1px solid rgba(0, 0, 0, 0.18);
  border-radius: 999px;
  background: var(--swatch-color);
  padding: 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.34);
}

.color-swatch-button:hover {
  transform: scale(1.12);
}

.color-swatch-button[aria-pressed="true"] {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

.weight-workspace {
  grid-column: 1 / -1;
  grid-row: 2;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  grid-template-areas:
    "dashboard input"
    "dashboard entries"
    "weeks entries";
  gap: 16px;
  align-items: start;
}

.weight-workspace[hidden] {
  display: none;
}

.calculator-workspace {
  grid-column: 1 / -1;
  grid-row: 2;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.95fr);
  gap: 16px;
  align-items: start;
}

.calculator-workspace[hidden] {
  display: none;
}

.global-food-workspace {
  grid-column: 1 / -1;
  grid-row: 2;
  display: grid;
  align-items: start;
}

.global-food-workspace[hidden] {
  display: none;
}

.global-food-panel {
  max-width: 1180px;
  width: 100%;
  justify-self: center;
}

.global-food-heading {
  align-items: start;
}

.global-food-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.global-food-hint {
  margin: -4px 16px 14px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.global-food-list {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.calculator-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 0 16px 16px;
}

.calculator-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
}

.calculator-grid input,
.calculator-grid select {
  width: 100%;
  min-height: 38px;
}

.calculator-result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 0 16px 16px;
}

.calculator-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.calculator-card span,
.calculator-card small {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 760;
}

.calculator-card strong {
  display: block;
  margin: 4px 0 3px;
  font-size: 1.35rem;
  line-height: 1.05;
}

.calculator-note {
  display: grid;
  gap: 5px;
  margin: 0 16px 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 760;
}

.calculator-note strong {
  color: var(--text);
}

.calculator-guide-panel {
  grid-column: 1 / -1;
}

.calculator-guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 10px;
  padding: 0 16px 12px;
}

.calculator-guide-item {
  display: grid;
  gap: 6px;
  min-height: 126px;
  border: 1px solid rgba(35, 110, 83, 0.18);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(248, 250, 246, 0.92)),
    var(--surface);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.78);
  padding: 12px;
}

.calculator-guide-item h3 {
  margin: 0;
  color: var(--green-dark);
  font-size: 0.92rem;
}

.calculator-guide-item p,
.calculator-guide-disclaimer {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 720;
  line-height: 1.5;
}

.calculator-guide-disclaimer {
  margin: 0 16px 16px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
}

.weight-dashboard-stack {
  grid-area: dashboard;
  display: grid;
  gap: 16px;
}

@media (min-width: 821px) {
  .weight-dashboard-stack {
    gap: 0;
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(253, 250, 245, 0.94)),
      var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.85);
  }

  .weight-dashboard-stack > .panel {
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .weight-dashboard-stack .weight-chart-panel .weight-chart-card {
    margin-top: 0;
  }
}

.weight-dashboard-panel {
  grid-area: auto;
}

.weight-input-panel {
  grid-area: input;
}

.weight-chart-panel {
  grid-area: auto;
}

.weight-entries-panel {
  grid-area: entries;
}

.weight-week-panel {
  grid-area: weeks;
}

.weight-subtitle,
.weight-chart-heading span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
}

.weight-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 0 16px 16px;
}

.weight-kpi {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.weight-kpi span,
.weight-kpi small {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
}

.weight-kpi strong {
  display: block;
  margin: 5px 0 2px;
  font-size: 1.25rem;
}

.weight-chart-card {
  margin: 0 16px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  padding: 12px;
}

.weight-chart-panel .weight-chart-card {
  margin-top: 16px;
}

.weight-chart-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.weight-chart-heading h3 {
  margin: 0;
  font-size: 0.95rem;
}

.weight-chart svg {
  display: block;
  width: 100%;
  height: auto;
}

.weight-grid-line {
  stroke: var(--line);
  stroke-width: 1;
}

.weight-axis-label {
  fill: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.weight-axis-label.end {
  text-anchor: end;
}

.weight-line {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3.2;
}

.weight-line.raw {
  stroke: #1f7a55;
}

.weight-line.avg {
  stroke: #df7b1b;
}

.weight-point-group {
  cursor: crosshair;
  outline: none;
}

.weight-point-hit {
  fill: transparent;
  pointer-events: all;
}

.weight-point-marker {
  fill: #fff;
  stroke: #1f7a55;
  stroke-width: 2.4;
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
  transition:
    opacity 140ms ease,
    transform 140ms ease;
}

.weight-tooltip {
  opacity: 0;
  pointer-events: none;
  filter: drop-shadow(0 10px 18px rgba(24, 36, 28, 0.18));
  transition: opacity 120ms ease;
}

.weight-tooltip-box {
  fill: rgba(255, 255, 255, 0.97);
  stroke: rgba(31, 122, 85, 0.26);
  stroke-width: 1;
}

.weight-tooltip-text {
  fill: var(--text);
  font-size: 12px;
  font-weight: 830;
}

.weight-tooltip-date {
  fill: var(--muted);
  font-size: 11px;
}

.weight-point-group:hover .weight-point-marker,
.weight-point-group:focus .weight-point-marker,
.weight-point-group:focus-visible .weight-point-marker {
  opacity: 1;
  transform: scale(1.35);
}

.weight-point-group:hover .weight-tooltip,
.weight-point-group:focus .weight-tooltip,
.weight-point-group:focus-visible .weight-tooltip {
  opacity: 1;
}

.weight-chart-legend {
  display: flex;
  gap: 14px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
}

.weight-chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.weight-chart-legend i {
  width: 20px;
  height: 4px;
  border-radius: 999px;
}

.weight-chart-legend .raw {
  background: #1f7a55;
}

.weight-chart-legend .avg {
  background: #df7b1b;
}

.weight-form,
.weight-settings {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 0 16px 16px;
}

.weight-form .button {
  min-height: 36px;
}

.weight-settings {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.weight-entry-list,
.weight-week-list {
  display: grid;
  gap: 8px;
  max-height: 550px;
  overflow: auto;
  padding: 0 16px 16px;
}

.weight-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: stretch;
}

.weight-entry-main,
.weight-week {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}

.weight-entry-main {
  display: grid;
  gap: 3px;
  text-align: left;
  padding: 9px;
}

.weight-entry-main strong,
.weight-entry-main span {
  font-size: 0.82rem;
}

.weight-entry-main small {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 760;
}

.weight-week {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 92px 82px minmax(124px, 140px);
  align-items: center;
  gap: 12px;
  padding: 9px;
  font-size: 0.78rem;
  font-weight: 850;
}

.weight-kpi.weight-target,
.weight-week.is-target {
  border-color: #a8d5b2;
  background: #eef9f0;
}

.weight-kpi.weight-neutral,
.weight-week.is-neutral {
  border-color: #f1c98f;
  background: #fff6e6;
}

.weight-kpi.weight-warning,
.weight-week.is-warning {
  border-color: #efaaa2;
  background: #fff0ef;
}

.weight-week small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 760;
}

.weight-week-average,
.weight-week-change,
.weight-week-status {
  display: block;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.weight-week-status {
  text-align: left;
}

.food-panel {
  overflow: hidden;
}

.food-search-block {
  margin: 0 16px 12px;
  display: grid;
  gap: 6px;
}

.food-search-block label,
.workspace-food-search-block label,
.off-panel h3 {
  color: var(--green-dark);
  font-size: 0.76rem;
  font-weight: 900;
}

.search-input {
  margin: 0 16px 12px;
  width: calc(100% - 32px);
}

.food-search-block .search-input {
  margin: 0;
  width: 100%;
}

.workspace-food-search-block {
  display: grid;
  gap: 6px;
  margin: 0 16px 12px;
}

.workspace-food-search-block .search-input {
  margin: 0;
  width: 100%;
}

.off-panel {
  margin: 0 16px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
}

.off-panel h3 {
  margin: 0;
  padding: 10px 12px 0;
}

.off-controls {
  display: grid;
  gap: 10px;
  padding: 8px 12px 12px;
}

.off-controls label {
  gap: 5px;
}

.inline-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 6px;
  align-items: center;
}

.inline-search input {
  min-width: 0;
}

.off-barcode-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.off-barcode-row input {
  grid-column: 1 / -1;
}

.off-clear-button {
  width: 100%;
  justify-self: stretch;
}

.scan-button {
  display: none;
}

.off-panel > .scan-button {
  margin: 8px 12px 0;
  width: calc(100% - 24px);
}

.scan-button .meal-entry-action-icon-barcode {
  width: 18px;
  height: 19px;
  flex: 0 0 auto;
}

.off-status {
  min-height: 18px;
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.off-status[data-variant="ok"] {
  color: var(--green-dark);
}

.off-status[data-variant="warn"] {
  color: #8a6517;
}

.off-status[data-variant="error"] {
  color: var(--danger);
}

.off-results {
  display: grid;
  gap: 7px;
}

.off-result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 9px;
}

.off-result h3,
.off-result p {
  margin: 0;
}

.off-result h3 {
  font-size: 0.82rem;
}

.off-result p,
.off-attribution {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 760;
}

.off-result .food-macros {
  margin-top: 6px;
}

.off-scanner {
  display: grid;
  gap: 8px;
  margin: 8px 12px 0;
}

.off-scanner.hidden {
  display: none;
}

.off-scanner video {
  width: 100%;
  max-height: 220px;
  border-radius: 8px;
  background: #111;
  cursor: pointer;
  object-fit: cover;
  touch-action: manipulation;
}

.off-attribution {
  margin: 0;
}

.off-attribution a {
  color: var(--green-dark);
  font-weight: 900;
}

.food-form {
  display: grid;
  gap: 10px;
  padding: 0 16px 14px;
  border-bottom: 1px solid var(--line);
}

.food-form.hidden {
  display: none;
}

.checkbox-line {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 850;
}

.checkbox-line input {
  width: 18px;
  min-width: 18px;
  min-height: 18px;
  padding: 0;
}

.food-insert-line {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  padding: 9px 10px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.category-note-stack {
  display: grid;
  gap: 10px;
}

.category-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 8px;
}

.category-control label {
  min-width: 0;
}

.category-delete-button {
  min-height: 38px;
  white-space: nowrap;
}

.private-category-control {
  grid-template-columns: 1fr;
}

.private-category-control .category-delete-button {
  justify-self: start;
  width: fit-content;
  max-width: 100%;
}

.food-list {
  display: grid;
  gap: 8px;
  max-height: 430px;
  overflow: auto;
  padding: 0 16px 16px;
}

.food-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
  display: grid;
  gap: 8px;
}

.food-item header {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: 8px;
}

.food-item h3 {
  margin: 0;
  font-size: 0.92rem;
  letter-spacing: 0;
}

.favorite-food,
.favorite-local-food {
  color: #b7b7b7;
  font-size: 1.28rem;
  line-height: 1;
}

.favorite-food.active,
.favorite-local-food.active {
  border-color: #e1a900;
  background: #fff8df;
  color: #f6c400;
  text-shadow: 0 1px 0 rgba(127, 88, 0, 0.15);
}

.food-item p {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
}

.food-note {
  margin-top: 4px;
  color: #4d5a53;
  font-size: 0.72rem;
  line-height: 1.35;
}

.food-aliases {
  font-style: italic;
}

.food-count {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.food-macros {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.food-macros span {
  border-radius: 999px;
  background: #f1eee8;
  color: #4d5650;
  padding: 4px 7px;
  font-size: 0.72rem;
  font-weight: 800;
}

@media (min-width: 821px) {
  .food-list {
    overflow-x: hidden;
    overflow-y: auto;
  }

  .food-item,
  .food-item header > div {
    min-width: 0;
  }

  .food-item header {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .food-item h3,
  .food-item p,
  .food-note {
    overflow-wrap: anywhere;
  }
}

.row-actions {
  display: flex;
  gap: 6px;
}

.mini-button {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  min-width: 32px;
  height: 32px;
  font-weight: 850;
}

.meal-table .mini-button {
  min-width: 23px;
  height: 23px;
  border-radius: 5px;
  font-size: 0.8rem;
}

.mini-button:hover {
  background: #f2eee8;
}

.mini-button.danger {
  border-color: var(--danger);
  background: var(--danger);
  color: #fff;
}

.mini-button.danger:hover {
  background: #982f2f;
}

.empty-state {
  color: var(--muted);
  padding: 24px;
  text-align: center;
}

:root[data-theme="dark"] .auth-screen {
  background:
    linear-gradient(180deg, rgba(26, 34, 29, 0.96), rgba(13, 18, 15, 0.98)),
    var(--bg);
}

:root[data-theme="dark"] .auth-card,
:root[data-theme="dark"] .password-card,
:root[data-theme="dark"] .panel,
:root[data-theme="dark"] .inline-tool-panel,
:root[data-theme="dark"] .kpi,
:root[data-theme="dark"] .weight-kpi,
:root[data-theme="dark"] .calculator-card,
:root[data-theme="dark"] .calculator-guide-item,
:root[data-theme="dark"] .weight-entry-main,
:root[data-theme="dark"] .weight-week,
:root[data-theme="dark"] .week-total,
:root[data-theme="dark"] .week-day,
:root[data-theme="dark"] .food-item,
:root[data-theme="dark"] .mini-button {
  background: var(--surface);
}

:root[data-theme="dark"] .panel {
  background:
    linear-gradient(180deg, rgba(32, 43, 36, 0.96), rgba(19, 28, 23, 0.96)),
    var(--surface);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

:root[data-theme="dark"] .calculator-guide-item {
  border-color: rgba(100, 218, 166, 0.2);
  background:
    linear-gradient(180deg, rgba(34, 48, 40, 0.9), rgba(18, 27, 22, 0.92)),
    var(--surface);
}

:root[data-theme="dark"] .calculator-guide-item h3 {
  color: var(--green-soft);
}

:root[data-theme="dark"] .meal {
  background:
    linear-gradient(180deg, rgba(24, 35, 29, 0.95), rgba(17, 25, 20, 0.98)),
    var(--surface-strong);
  box-shadow: var(--shadow-soft), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

:root[data-theme="dark"] .meal-header {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0) 62%),
    #131f18;
}

:root[data-theme="dark"] .kpi {
  background:
    linear-gradient(180deg, rgba(31, 42, 35, 0.95), rgba(17, 25, 20, 0.96)),
    var(--surface);
  box-shadow: var(--shadow-tight), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

:root[data-theme="dark"] input,
:root[data-theme="dark"] select,
:root[data-theme="dark"] .sync-status,
:root[data-theme="dark"] .color-picker-panel summary,
:root[data-theme="dark"] .color-popover {
  background: #101813;
  color: var(--text);
}

:root[data-theme="dark"] .password-visibility-toggle:hover,
:root[data-theme="dark"] .password-visibility-toggle:focus {
  background: rgba(76, 168, 118, 0.14);
}

:root[data-theme="dark"] input:focus,
:root[data-theme="dark"] select:focus {
  box-shadow: 0 0 0 3px rgba(76, 168, 118, 0.24);
}

:root[data-theme="dark"] .day-title-input,
:root[data-theme="dark"] .meal-title {
  background: transparent;
}

:root[data-theme="dark"] .button.ghost,
:root[data-theme="dark"] .file-button.ghost,
:root[data-theme="dark"] .view-switch,
:root[data-theme="dark"] .language-switch {
  border-color: #3b5949;
  background: #13241b;
  color: var(--green-dark);
}

:root[data-theme="dark"] .button.ghost:hover,
:root[data-theme="dark"] .file-button.ghost:hover,
:root[data-theme="dark"] .mini-button:hover {
  background: #1e3327;
}

:root[data-theme="dark"] .account-button {
  border-color: #4b5650;
  background: #26302b;
  color: #d9e2dd;
}

:root[data-theme="dark"] .account-button:hover {
  border-color: #5d6b64;
  background: #313c36;
  color: #ffffff;
}

:root[data-theme="dark"] .scan-button {
  border-color: #4aa8c8;
  background: #173849;
  color: #c7f0ff;
}

:root[data-theme="dark"] .scan-button:hover {
  background: #1f4a5f;
}

:root[data-theme="dark"] .button.ghost.meal-entry-action-barcode,
:root[data-theme="dark"] .button.ghost.meal-entry-action-photo {
  border-color: #4aa8c8;
  background: #173849;
  color: #c7f0ff;
}

:root[data-theme="dark"] .button.ghost.meal-entry-action-barcode:hover,
:root[data-theme="dark"] .button.ghost.meal-entry-action-photo:hover {
  background: #1f4a5f;
}

:root[data-theme="dark"] .meal-nav-button {
  border-color: #31583f;
  background: #13251b;
  color: #a7e8bd;
}

:root[data-theme="dark"] .meal-nav-button:hover,
:root[data-theme="dark"] .meal-nav-button.active {
  border-color: #51b884;
  background: #2f8b63;
  color: #fff;
}

:root[data-theme="dark"] .button.danger.ghost {
  border-color: #68403d;
  background: #321c1c;
  color: #f2a09a;
}

:root[data-theme="dark"] .text-button {
  color: var(--green-dark);
}

:root[data-theme="dark"] .day-tab:hover,
:root[data-theme="dark"] .day-tab.active,
:root[data-theme="dark"] .week-day:hover,
:root[data-theme="dark"] .week-day.active {
  border-color: #3d654f;
  background: #1a2b22;
}

:root[data-theme="dark"] .day-menu-button {
  color: #eef5f0;
}

:root[data-theme="dark"] .day-menu[open] .day-menu-button,
:root[data-theme="dark"] .day-menu-button:hover,
:root[data-theme="dark"] .meal-more-menu[open] .meal-more-button,
:root[data-theme="dark"] .meal-more-button:hover,
:root[data-theme="dark"] .meal-menu-action:hover,
:root[data-theme="dark"] .meal-menu-action:focus,
:root[data-theme="dark"] .day-menu-action:hover,
:root[data-theme="dark"] .day-menu-action:focus {
  background: #1e3327;
}

:root[data-theme="dark"] .day-menu-panel,
:root[data-theme="dark"] .meal-more-panel {
  border-color: #3b5949;
  background: var(--surface);
}

:root[data-theme="dark"] .meal-more-button {
  border-color: #3b5949;
  background: var(--surface);
  color: #eef5f0;
}

:root[data-theme="dark"] .day-tab.today strong,
:root[data-theme="dark"] .day-tab.today > span > span {
  color: #ffffff;
}

:root[data-theme="dark"] .pill {
  background: #203b2d;
  color: var(--green-dark);
}

:root[data-theme="dark"] .meal-table td {
  border-bottom-color: #26352d;
}

:root[data-theme="dark"] .weight-point-marker {
  fill: #0f1e17;
  stroke: #72d59c;
}

:root[data-theme="dark"] .weight-tooltip {
  filter: drop-shadow(0 12px 20px rgba(0, 0, 0, 0.34));
}

:root[data-theme="dark"] .weight-tooltip-box {
  fill: rgba(18, 33, 25, 0.98);
  stroke: rgba(114, 213, 156, 0.32);
}

:root[data-theme="dark"] .meal-table th + th,
:root[data-theme="dark"] .meal-table td + td {
  border-left-color: #26352d;
}

:root[data-theme="dark"] .kpi.color-card {
  border-color: color-mix(in srgb, var(--kpi-color) 46%, var(--surface));
  background: color-mix(in srgb, var(--kpi-color) 12%, var(--surface));
}

:root[data-theme="dark"] .kpi.progress-card {
  background:
    linear-gradient(
      90deg,
      color-mix(in srgb, var(--kpi-color) 40%, var(--surface)) 0 var(--kpi-progress),
      color-mix(in srgb, var(--kpi-color) 12%, var(--surface)) var(--kpi-progress) 100%
    );
}

:root[data-theme="dark"] .macro-chart {
  border-color: #101813;
  box-shadow:
    inset 0 0 0 1px #26352d,
    inset 8px 10px 18px rgba(255, 255, 255, 0.08),
    inset -10px -12px 18px rgba(0, 0, 0, 0.28),
    0 16px 34px rgba(0, 0, 0, 0.34);
}

:root[data-theme="dark"] .weight-chart-card {
  background: var(--surface-strong);
}

:root[data-theme="dark"] .weight-kpi.weight-target,
:root[data-theme="dark"] .weight-week.is-target {
  border-color: #365e42;
  background: #15271b;
}

:root[data-theme="dark"] .weight-kpi.weight-neutral,
:root[data-theme="dark"] .weight-week.is-neutral {
  border-color: #70562b;
  background: #2a2112;
}

:root[data-theme="dark"] .weight-kpi.weight-warning,
:root[data-theme="dark"] .weight-week.is-warning {
  border-color: #74432d;
  background: #351f16;
}

:root[data-theme="dark"] .food-note {
  color: #c0cbc4;
}

:root[data-theme="dark"] .off-panel,
:root[data-theme="dark"] .food-insert-line,
:root[data-theme="dark"] .off-result {
  background: var(--surface);
}

:root[data-theme="dark"] .off-status[data-variant="ok"],
:root[data-theme="dark"] .off-attribution a {
  color: #a7e8bd;
}

:root[data-theme="dark"] .off-status[data-variant="warn"] {
  color: #f2d486;
}

:root[data-theme="dark"] .off-status[data-variant="error"] {
  color: #f2a09a;
}

:root[data-theme="dark"] .food-macros span {
  background: #222d26;
  color: #d5ded8;
}

:root[data-theme="dark"] .food-suggestion-list button:hover,
:root[data-theme="dark"] .food-suggestion-list button:focus {
  background: #1e3327;
}

:root[data-theme="dark"] .favorite-food.active,
:root[data-theme="dark"] .favorite-local-food.active {
  border-color: #8b702f;
  background: #32290f;
  color: #ffd23d;
}

:root[data-theme="dark"] .sync-status[data-variant="ok"] {
  border-color: #31583f;
  background: #162d20;
  color: #a7e8bd;
}

:root[data-theme="dark"] .sync-status[data-variant="busy"] {
  border-color: #6f5921;
  background: #30250e;
  color: #f2d486;
}

:root[data-theme="dark"] .sync-status[data-variant="warn"],
:root[data-theme="dark"] .sync-status[data-variant="error"] {
  border-color: #70413d;
  background: #321c1c;
  color: #f2a09a;
}

@media (min-width: 821px) and (max-width: 944px) {
  .app-shell {
    grid-template-columns: 234px minmax(0, 1fr);
    grid-template-areas:
      "topbar topbar"
      "sidebar workspace"
      "summary summary"
      "footer footer";
  }

  .summary-rail {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(300px, 420px);
    align-items: start;
  }
}

@media (max-width: 820px) {
  .legal-shell {
    width: min(100% - 20px, 920px);
    padding: 16px 0 28px;
  }

  .legal-page-header {
    display: grid;
    gap: 10px;
  }

  .legal-card {
    padding: 16px;
  }

  :root[data-theme="dark"] .topbar {
    border-bottom-color: var(--line);
    background: rgba(16, 22, 18, 0.96);
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.32);
  }

  :root[data-theme="dark"] .mobile-nav {
    border-top-color: var(--line);
    background: rgba(18, 25, 21, 0.97);
    box-shadow: 0 -12px 28px rgba(0, 0, 0, 0.36);
  }

  :root[data-theme="dark"] .meal-nav {
    border-top-color: var(--line);
    background: rgba(18, 25, 21, 0.97);
    box-shadow: 0 -10px 24px rgba(0, 0, 0, 0.32);
  }

  :root[data-theme="dark"] .mobile-nav button.active,
  :root[data-theme="dark"] #todayMobileButton {
    border-color: #31583f;
    background: #162d20;
    color: #a7e8bd;
  }

  .app-shell {
    display: block;
    min-height: 100svh;
    padding: 10px 10px calc(82px + env(safe-area-inset-bottom));
  }

  .app-shell[data-mobile-view="day"] {
    padding-bottom: calc(132px + env(safe-area-inset-bottom));
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 15;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin: -10px -10px 10px;
    padding: 10px;
    border-bottom: 1px solid var(--line);
    background: rgba(247, 244, 239, 0.96);
    box-shadow: 0 10px 26px rgba(33, 28, 20, 0.08);
    backdrop-filter: blur(10px);
  }

  .topbar h1 {
    font-size: 1.65rem;
  }

  .auth-brand-logo {
    display: none;
  }

  .topbar .eyebrow {
    margin-bottom: 3px;
    font-size: 0.68rem;
  }

  .toolbar {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    overflow: visible;
  }

  .account-button {
    max-width: none;
    order: -1;
    grid-column: 4;
    grid-row: 1;
  }

  .toolbar .button,
  .toolbar .file-button,
  .toolbar .sync-status {
    width: 100%;
    min-width: 0;
    min-height: 34px;
    padding: 0 6px;
    font-size: 0.7rem;
    white-space: nowrap;
  }

  .toolbar .view-switch {
    order: -2;
    grid-column: 1 / 4;
    grid-row: 1;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
  }

  .toolbar .language-switch {
    width: 100%;
  }

  .toolbar .view-toggle {
    min-width: 0;
    min-height: 34px;
    padding: 0;
    font-size: 0.7rem;
  }

  .app-shell.macro-view[data-mobile-view="day"] .topbar {
    gap: 7px;
    padding-top: 8px;
    padding-bottom: 8px;
  }

  .app-shell.macro-view[data-mobile-view="day"] .topbar > div:first-child {
    display: none;
  }

  .app-shell.macro-view[data-mobile-view="day"] .toolbar {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }

  .app-shell.macro-view[data-mobile-view="day"] .toolbar .account-button {
    grid-column: 4;
    grid-row: 1;
    min-height: 32px;
  }

  .app-shell.macro-view[data-mobile-view="day"] .toolbar .view-switch {
    grid-column: 1 / 4;
    grid-row: 1;
  }

  .app-shell.macro-view[data-mobile-view="day"] .toolbar .admin-tool,
  .app-shell.macro-view[data-mobile-view="day"] .toolbar [data-maintenance-only] {
    display: none;
  }

  .mobile-nav {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 30;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
    padding: 7px max(8px, env(safe-area-inset-right)) calc(7px + env(safe-area-inset-bottom))
      max(8px, env(safe-area-inset-left));
    border-top: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 -12px 28px rgba(33, 28, 20, 0.1);
    backdrop-filter: blur(10px);
  }

  .mobile-nav[hidden] {
    display: none;
  }

  .mobile-nav button {
    min-width: 0;
    min-height: 44px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    padding: 5px 3px;
    font-size: 0.72rem;
    font-weight: 850;
  }

  .mobile-nav button.active {
    border-color: #b7d7c5;
    background: #e8f4ec;
    color: var(--green-dark);
  }

  #todayMobileButton {
    border-color: #b7d7c5;
    background: #e8f4ec;
    color: var(--green-dark);
  }

  .app-shell .sidebar,
  .app-shell .day-workspace,
  .app-shell .summary-rail {
    display: none;
  }

  .app-shell[data-mobile-view="day"] .day-workspace,
  .app-shell[data-mobile-view="summary"] .summary-rail,
  .app-shell[data-mobile-view="foods"] .summary-rail {
    display: block;
  }

  .app-shell[data-mobile-view="days"] .sidebar {
    display: flex;
  }

  .app-shell[data-mobile-view="summary"] .food-panel,
  .app-shell[data-mobile-view="foods"] .summary-panel,
  .app-shell[data-mobile-view="foods"] .week-panel {
    display: none;
  }

  .app-shell.weight-view .sidebar,
  .app-shell.weight-view .day-workspace,
  .app-shell.weight-view .summary-rail,
  .app-shell.calculator-view .sidebar,
  .app-shell.calculator-view .day-workspace,
  .app-shell.calculator-view .summary-rail {
    display: none;
  }

  .app-shell.weight-view .weight-workspace {
    display: grid;
  }

  .app-shell.calculator-view .calculator-workspace {
    display: grid;
  }

  .app-shell.global-food-view .sidebar,
  .app-shell.global-food-view .day-workspace,
  .app-shell.global-food-view .summary-rail,
  .app-shell.global-food-view #localFoodWorkspace,
  .app-shell.local-food-view .sidebar,
  .app-shell.local-food-view .day-workspace,
  .app-shell.local-food-view .summary-rail,
  .app-shell.local-food-view #globalFoodWorkspace {
    display: none;
  }

  .app-shell.global-food-view #globalFoodWorkspace,
  .app-shell.local-food-view #localFoodWorkspace {
    display: grid;
  }

  .app-shell.global-food-view,
  .app-shell.local-food-view {
    padding-bottom: 18px;
  }

  .app-shell.global-food-view .global-food-hint,
  .app-shell.local-food-view .global-food-hint {
    display: none;
  }

  .app-shell.global-food-view .global-food-panel,
  .app-shell.local-food-view .global-food-panel {
    display: flex;
    flex-direction: column;
    max-width: none;
    padding-top: 12px;
  }

  .app-shell.global-food-view .workspace-off-slot,
  .app-shell.local-food-view .workspace-off-slot {
    order: -1;
  }

  .app-shell.global-food-view .global-food-heading,
  .app-shell.local-food-view .global-food-heading {
    order: -2;
    display: flex;
    align-items: start;
    gap: 10px;
    margin: 0 12px 10px;
  }

  .app-shell.global-food-view .global-food-heading h2,
  .app-shell.local-food-view .global-food-heading h2 {
    font-size: 1.25rem;
  }

  .app-shell.global-food-view .global-food-actions,
  .app-shell.local-food-view .global-food-actions {
    display: flex;
    justify-content: end;
  }

  .app-shell.global-food-view .global-food-actions > :not(#newGlobalFood),
  .app-shell.local-food-view .global-food-actions > :not(#newLocalFood) {
    display: none;
  }

  .app-shell.global-food-view .workspace-food-search-block,
  .app-shell.local-food-view .workspace-food-search-block {
    margin: 0 12px 10px;
  }

  .app-shell.global-food-view .global-food-list,
  .app-shell.local-food-view .global-food-list {
    grid-template-columns: 1fr;
    max-height: none;
  }

  .panel {
    box-shadow: none;
  }

  .weight-workspace {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-areas:
      "input"
      "chart"
      "dashboard"
      "weeks"
      "entries";
    gap: 10px;
  }

  .weight-dashboard-stack {
    display: contents;
  }

  .weight-dashboard-panel {
    grid-area: dashboard;
  }

  .weight-chart-panel {
    grid-area: chart;
  }

  .calculator-workspace {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .calculator-grid,
  .calculator-result-grid {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 0 12px 12px;
  }

  .calculator-note {
    margin: 0 12px 12px;
  }

  .calculator-guide-grid {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 0 12px 10px;
  }

  .calculator-guide-item {
    min-height: 0;
    padding: 11px;
  }

  .calculator-guide-disclaimer {
    margin: 0 12px 12px;
  }

  .weight-kpi-grid,
  .weight-form,
  .weight-settings {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding-right: 12px;
    padding-left: 12px;
  }

  .weight-chart-card {
    margin-right: 12px;
    margin-left: 12px;
    padding: 10px;
  }

  .weight-chart-heading {
    display: block;
  }

  .weight-entry-list,
  .weight-week-list {
    max-height: none;
    padding-right: 12px;
    padding-left: 12px;
  }

  .weight-week {
    grid-template-columns: minmax(0, 1fr) 72px 68px;
    gap: 5px 8px;
  }

  .weight-week-status {
    grid-column: 1 / -1;
    text-align: left;
  }

  .weight-week span:nth-child(3),
  .weight-week-status {
    color: var(--muted);
    font-size: 0.72rem;
  }

  .active-day-panel {
    display: flex;
    flex-direction: column;
    min-height: auto;
  }

  .day-title-block {
    grid-template-columns: minmax(0, 1fr) minmax(0, 48%);
    align-items: center;
    max-width: none;
    min-width: 0;
  }

  .day-header {
    order: 1;
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 8px;
    padding: 12px;
  }

  .app-shell.macro-view[data-mobile-view="day"] .day-header {
    position: sticky;
    top: var(--mobile-day-header-top, 56px);
    z-index: 24;
    margin: -1px -1px 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.97);
    box-shadow: 0 10px 22px rgba(33, 28, 20, 0.12);
    backdrop-filter: blur(10px);
  }

  :root[data-theme="dark"] .app-shell.macro-view[data-mobile-view="day"] .day-header {
    background: rgba(18, 25, 21, 0.97);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.35);
  }

  .meal-nav {
    order: 2;
  }

  .app-shell[data-mobile-view="day"] .meal-nav {
    position: fixed;
    right: 0;
    bottom: calc(58px + env(safe-area-inset-bottom));
    left: 0;
    z-index: 29;
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    padding: 7px max(8px, env(safe-area-inset-right)) 7px max(8px, env(safe-area-inset-left));
    border-top: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 -10px 24px rgba(33, 28, 20, 0.08);
    backdrop-filter: blur(10px);
    -webkit-overflow-scrolling: touch;
  }

  .app-shell[data-mobile-view="day"] .meal-nav[hidden] {
    display: none;
  }

  .meal-nav-button {
    flex: 0 0 auto;
    max-width: 180px;
    min-height: 36px;
    font-size: 0.72rem;
  }

  .day-tools {
    order: 4;
    grid-template-columns: 1fr;
    gap: 9px;
    margin-top: 10px;
    padding: 10px 0 0;
    border-top: 1px solid var(--line);
    border-bottom: 0;
  }

  .inline-tool-panel {
    padding: 9px;
  }

  .template-actions {
    grid-template-columns: minmax(0, 1fr) auto auto;
  }

  .template-actions .button.danger {
    grid-column: auto;
  }

  .day-macro-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .day-title-input {
    min-height: 38px;
    font-size: 1.25rem;
  }

  .date-input {
    width: 100%;
    min-width: 0;
    max-width: none;
  }

  .day-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 42px;
    gap: 6px;
    width: 100%;
    max-width: none;
    align-items: end;
    justify-self: stretch;
  }

  .day-actions select {
    min-height: 38px;
    align-self: end;
  }

  .day-actions .button,
  .day-actions .icon-button {
    width: 100%;
    min-height: 36px;
    padding: 0 8px;
    font-size: 0.9rem;
  }

  .day-actions .meal-action-button {
    width: 42px;
    min-width: 42px;
    padding: 0;
  }

  .meal-header {
    grid-template-columns: minmax(0, 1fr) 30px;
    gap: 5px;
    padding: 9px;
  }

  .meal-title {
    grid-column: 1 / -1;
    min-height: 34px;
    padding: 4px 0;
    font-size: 0.95rem;
  }

  .meal-header .meal-delete {
    grid-column: 2;
    grid-row: 2;
    width: 30px;
    min-width: 30px;
    height: 30px;
    min-height: 30px;
    padding: 0;
    align-self: center;
    justify-self: end;
  }

  .meal-header .meal-delete .action-button-icon {
    width: 14px;
    height: 14px;
  }

  .meal-total {
    grid-column: 1 / -1;
  }

  .meal-copy {
    grid-column: 1;
    grid-row: 2;
    display: flex;
    justify-content: flex-end;
    gap: 4px;
    align-items: center;
  }

  .meal-copy select,
  .meal-copy .button {
    min-height: 30px;
    font-size: 0.68rem;
  }

  .meal-copy select {
    padding: 5px 7px;
  }

  .meal-copy .button {
    padding: 0 7px;
  }

  .meal-copy .icon-action-button {
    min-width: 30px;
    width: 30px;
    padding: 0;
  }

  .meal-copy .meal-more-button {
    min-width: 30px;
    width: 30px;
    height: 30px;
  }

  .meal-copy .meal-more-panel {
    right: -68px;
    width: min(320px, calc(100vw - 38px));
  }

  .meal-order {
    grid-column: auto;
    grid-row: auto;
    display: grid;
    grid-template-columns: repeat(2, 30px);
    justify-content: end;
    gap: 4px;
    align-self: center;
    margin-top: 0;
  }

  .meal-order .mini-button {
    min-width: 30px;
    width: 30px;
    height: 30px;
    font-size: 0.86rem;
  }

  .meal-total {
    flex-wrap: wrap;
    justify-content: stretch;
    gap: 5px;
    white-space: normal;
    font-size: 0.76rem;
  }

  .macro-pill {
    flex: 1 1 48px;
    min-width: 48px;
    padding: 5px 3px;
    text-align: center;
  }

  .meals {
    order: 3;
    gap: 10px;
    padding: 10px 0 0;
  }

  .meal {
    scroll-margin-top: 182px;
    scroll-margin-bottom: 128px;
  }

  .meal-table,
  .meal-table tbody {
    display: block;
    width: 100%;
  }

  .meal-table colgroup,
  .meal-table thead {
    display: none;
  }

  .meal-table tr {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 4px;
    padding: 7px 8px;
    border-bottom: 1px solid var(--line);
  }

  .meal-table tr:last-child {
    border-bottom: 0;
  }

  .meal-table td {
    display: block;
    width: 100%;
    border: 0;
    padding: 0;
  }

  .meal-table td.mobile-entry-summary {
    display: block;
    grid-column: 1 / -1;
  }

  .entry-summary-button {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 10px;
    min-height: 64px;
    padding: 10px 8px;
  }

  .entry-summary-main {
    display: grid;
    gap: 3px;
    min-width: 0;
  }

  .entry-summary-name,
  .entry-summary-subtitle {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .entry-summary-name {
    font-size: 1rem;
    line-height: 1.15;
  }

  .entry-summary-subtitle {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 760;
  }

  .entry-summary-kcal {
    color: var(--text);
    font-size: 1rem;
    font-weight: 900;
    white-space: nowrap;
  }

  .entry-summary-chevron {
    color: var(--muted);
    font-size: 1.35rem;
    line-height: 1;
    transition: transform 0.16s ease;
  }

  .entry-expanded .entry-summary-button {
    min-height: 50px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--line);
  }

  .entry-expanded .entry-summary-chevron {
    transform: rotate(90deg);
  }

  .meal-table th + th,
  .meal-table td + td {
    border-left: 0;
  }

  .meal-table td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 3px;
    color: var(--muted);
    font-size: 0.62rem;
    font-weight: 850;
  }

  .meal-table td[data-field="food"] {
    grid-column: 1 / 5;
  }

  .food-suggestion-list {
    left: 0;
    right: -54px;
    max-height: 240px;
  }

  .meal-table td[data-label=""] {
    grid-column: 5 / 6;
    grid-row: 1;
    display: flex;
    align-items: end;
    justify-content: end;
  }

  .meal-table td[data-label=""]::before {
    display: none;
  }

  .meal-table td[data-field="amount"] {
    grid-column: 1 / 3;
  }

  .meal-table td[data-field="unit"] {
    grid-column: 3 / 6;
  }

  .meal-table td[data-output] {
    min-height: 24px;
    border-radius: 6px;
    padding: 1px 2px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 0.62rem;
    line-height: 1;
  }

  .meal-table td[data-output] .custom-macro-input {
    min-height: 16px;
    padding: 0;
    font-size: inherit;
    line-height: 1;
    text-align: center;
  }

  .meal-table td[data-output]::before {
    margin-bottom: 0;
    font-size: 0.44rem;
    line-height: 1;
  }

  .meal-table .entry-macro.has-sub {
    font-size: 0.52rem;
  }

  .meal-table .custom-macro-inline {
    font-size: 0.52rem;
  }

  .meal-table input,
  .meal-table select {
    min-height: 36px;
    padding: 7px 8px;
    font-size: 0.82rem;
  }

  .meal-table .mini-button {
    min-width: 36px;
    height: 36px;
  }

  .meal-table td.mobile-entry-summary {
    grid-column: 1 / -1;
    grid-row: auto;
    display: block;
    align-items: initial;
    justify-content: initial;
  }

  .meal-table td.mobile-entry-summary::before {
    display: none;
  }

  .meal-table tr:not(.entry-expanded) {
    gap: 0;
    padding: 0;
  }

  .meal-table tr:not(.entry-expanded) td:not(.mobile-entry-summary) {
    display: none;
  }

  .add-entry-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    padding: 8px;
  }

  .add-entry-row .meal-entry-action-button {
    justify-self: stretch;
    min-width: 0;
    width: auto;
    min-height: 40px;
  }

  .meal-photo-scanner {
    margin: 0 8px 10px;
    padding: 8px;
  }

  .meal-photo-video {
    max-height: 58vh;
  }

  .meal-photo-actions .button {
    min-height: 44px;
  }

  .meal-photo-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .kpi-grid,
  .targets-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 0 12px 12px;
  }

  .kpi {
    padding: 10px;
  }

  .kpi strong {
    font-size: 1.08rem;
  }

  .macro-chart-wrap {
    grid-template-columns: 120px 1fr;
    gap: 12px;
    padding: 0 12px 14px;
  }

  .macro-chart {
    width: 120px;
    border-width: 8px;
  }

  .legend-item {
    gap: 6px;
    font-size: 0.78rem;
  }

  .color-controls {
    padding: 0 12px 12px;
  }

  .account-color-settings .color-controls {
    padding: 0;
  }

  .sidebar {
    gap: 10px;
  }

  .sidebar .settings-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .food-form,
  .food-list,
  .week-summary {
    padding-right: 12px;
    padding-left: 12px;
  }

  .food-search-block,
  .off-panel {
    margin-right: 12px;
    margin-left: 12px;
  }

  .button.ghost.scan-button {
    display: inline-flex;
    min-height: 46px;
    border-color: #91d2ec;
    background: #d8f1ff;
    color: #075d78;
    font-size: 0.92rem;
    font-weight: 900;
  }

  .button.ghost.scan-button:hover {
    background: #bee7fb;
  }

  :root[data-theme="dark"] .button.ghost.scan-button {
    border-color: #4aa8c8;
    background: #173849;
    color: #c7f0ff;
  }

  :root[data-theme="dark"] .button.ghost.scan-button:hover {
    background: #1f4a5f;
  }

  .food-list {
    max-height: none;
  }

  .week-day {
    grid-template-columns: 68px 1fr;
    padding: 8px;
  }
}

@media (max-width: 540px) {
  .toolbar {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .account-action-grid {
    grid-template-columns: 1fr;
  }

  .kpi-grid,
  .targets-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .form-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .inline-search {
    grid-template-columns: 1fr;
  }

  .inline-search.off-barcode-row {
    grid-template-columns: 1fr;
  }

  .off-barcode-row input,
  .off-barcode-row #offBarcodeButton {
    grid-column: 1 / -1;
  }

  .off-barcode-row .off-clear-button {
    grid-column: 1 / -1;
    justify-self: center;
    width: auto;
    min-height: 26px;
    padding: 0 10px;
    font-size: 0.68rem;
  }

  .category-control {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 390px) {
  .macro-chart-wrap,
  .color-grid {
    grid-template-columns: 1fr;
  }

  .mobile-nav button {
    font-size: 0.68rem;
  }

  .meal-table td[data-output] {
    min-height: 23px;
    font-size: 0.58rem;
  }

  .meal-table .entry-macro.has-sub,
  .meal-table .custom-macro-inline {
    font-size: 0.48rem;
  }
}

@media (max-width: 360px) {
  .toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
