.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding-top: 0;
}

.topbar h1 {
  font-size: clamp(34px, 5vw, 58px);
}

.profile-title-row {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 14px;
}

.profile-title-row h1 {
  min-width: 0;
  overflow-wrap: anywhere;
}

.profile-avatar,
.settings-account-avatar {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(31, 122, 90, 0.14);
  border-radius: 50%;
  background: linear-gradient(135deg, #eaf5ef, #ffffff);
  background-position: center;
  background-size: cover;
  color: var(--primary-strong);
  font-weight: 850;
  box-shadow: 0 10px 24px rgba(25, 42, 35, 0.08);
}

.profile-avatar {
  width: 54px;
  height: 54px;
  font-size: 21px;
}

.settings-account-avatar {
  width: 44px;
  height: 44px;
  font-size: 17px;
}

.profile-avatar.has-image,
.settings-account-avatar.has-image {
  border-color: rgba(31, 122, 90, 0.12);
  background-color: #eef6f2;
}

.profile-avatar img,
.settings-account-avatar img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.ghost-button,
.secondary-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.ghost-button:hover:not(:disabled),
.secondary-button:hover:not(:disabled) {
  background: #f0f5f2;
  box-shadow: none;
}

.ghost-button:active:not(:disabled),
.secondary-button:active:not(:disabled) {
  background: #e7f0eb;
  box-shadow: none;
  transform: scale(0.985);
}

.chart-section {
  min-width: 0;
}

.action-zone {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  padding: 0;
}

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

.record-entry-button,
.primary-action-button {
  width: 100%;
  min-height: 68px;
  display: grid;
  align-content: center;
  gap: 5px;
  border: 1px solid rgba(31, 122, 90, 0.15);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  background-clip: padding-box;
  color: var(--ink);
  text-align: left;
  box-shadow: 0 12px 34px rgba(25, 42, 35, 0.08);
  overflow: hidden;
  transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease, transform 160ms ease;
}

.body-record-entry {
  border-color: rgba(31, 122, 90, 0.17);
  background:
    radial-gradient(90% 120% at 100% 0%, rgba(79, 148, 121, 0.12), rgba(79, 148, 121, 0) 62%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(239, 249, 244, 0.92));
}

.food-record-entry {
  border-color: rgba(139, 111, 78, 0.2);
  background:
    radial-gradient(90% 120% at 100% 0%, rgba(191, 117, 106, 0.12), rgba(191, 117, 106, 0) 60%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(251, 244, 232, 0.9));
}

.record-entry-button:hover:not(:disabled),
.primary-action-button:hover:not(:disabled) {
  background: #fff;
  color: var(--primary-strong);
  box-shadow: 0 14px 36px rgba(31, 122, 90, 0.13);
}

.food-record-entry:hover:not(:disabled) {
  border-color: rgba(139, 111, 78, 0.32);
  color: #715536;
  box-shadow: 0 14px 36px rgba(139, 111, 78, 0.13);
}

.record-entry-button:active:not(:disabled),
.primary-action-button:active:not(:disabled) {
  background: #f1f8f4;
  color: var(--primary-strong);
  box-shadow: 0 6px 18px rgba(31, 122, 90, 0.1);
  transform: scale(0.992);
}

.food-record-entry:active:not(:disabled) {
  background: #fbf4e8;
  color: #715536;
}

.primary-action-button > span:first-child {
  min-width: 0;
}

.action-label,
.action-meta {
  display: block;
}

.action-label {
  font-size: 18px;
  line-height: 1.2;
}

.action-meta {
  color: rgba(101, 113, 108, 0.72);
  font-size: 12px;
  font-weight: 620;
  line-height: 1.35;
  white-space: normal;
}

.action-create {
  flex: 0 0 auto;
  min-width: 58px;
  min-height: 34px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(31, 122, 90, 0.18);
  border-radius: 8px;
  background: #f3f8f5;
  color: var(--primary-strong);
  font-size: 14px;
  font-weight: 780;
}

.replay-launch-button {
  width: 100%;
  min-height: 54px;
  border: 1px solid rgba(31, 122, 90, 0.18);
  background: #edf3ef;
  background-clip: padding-box;
  color: var(--primary-strong);
  box-shadow: 0 12px 34px rgba(25, 42, 35, 0.06);
  overflow: hidden;
}

.replay-launch-button:hover:not(:disabled),
.replay-launch-button:active:not(:disabled),
.replay-launch-button:focus-visible {
  border-color: rgba(31, 122, 90, 0.3);
  background: #e3eee8;
  color: var(--primary-strong);
  box-shadow: 0 12px 30px rgba(31, 122, 90, 0.1);
}

.replay-launch-button:active:not(:disabled) {
  background: #dbeae2;
  box-shadow: 0 5px 14px rgba(31, 122, 90, 0.1);
  transform: scale(0.985);
}

.replay-launch-button:focus-visible {
  outline: 3px solid rgba(31, 122, 90, 0.18);
  outline-offset: 2px;
}

.history-section {
  padding: 18px;
}

.ai-advice-button {
  width: 100%;
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 16px 0 18px;
  border: 1px solid rgba(31, 122, 90, 0.14);
  border-radius: 8px;
  padding: 14px 16px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(240, 247, 243, 0.9));
  background-clip: padding-box;
  color: var(--ink);
  box-shadow: 0 12px 34px rgba(25, 42, 35, 0.07);
  text-align: left;
}

.ai-advice-button:hover:not(:disabled),
.ai-advice-button:focus-visible {
  border-color: rgba(31, 122, 90, 0.24);
  background: #fff;
  color: var(--primary-strong);
  box-shadow: 0 16px 38px rgba(31, 122, 90, 0.12);
}

.ai-advice-button:active:not(:disabled) {
  background: #eff7f3;
  transform: scale(0.992);
}

.ai-advice-button > span:first-child {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.ai-advice-button small,
.ai-advice-button em {
  display: block;
  color: var(--muted);
  font-style: normal;
  font-weight: 680;
}

.ai-advice-button small {
  color: var(--primary);
  font-size: 12px;
  font-weight: 840;
}

.ai-advice-button strong {
  display: block;
  font-size: 18px;
  line-height: 1.25;
}

.ai-advice-button em {
  font-size: 13px;
  line-height: 1.35;
}

.ai-advice-action {
  flex: 0 0 auto;
  min-width: 58px;
  min-height: 34px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(31, 122, 90, 0.18);
  border-radius: 8px;
  background: #eef7f2;
  color: var(--primary-strong);
  font-size: 14px;
  font-weight: 820;
}

html[data-theme^="glass-"] .ai-advice-button {
  border-color: rgba(255, 255, 255, 0.62);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.58), rgba(255, 255, 255, 0.26)),
    radial-gradient(110% 120% at 0% 0%, rgba(255, 218, 246, 0.24), rgba(255, 255, 255, 0) 56%),
    radial-gradient(110% 120% at 100% 0%, rgba(183, 238, 255, 0.3), rgba(255, 255, 255, 0) 58%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.68), 0 16px 38px rgba(80, 102, 119, 0.1);
  -webkit-backdrop-filter: blur(18px) saturate(1.16);
  backdrop-filter: blur(18px) saturate(1.16);
}

html[data-theme^="glass-"] .ai-advice-button:hover:not(:disabled),
html[data-theme^="glass-"] .ai-advice-button:focus-visible {
  border-color: rgba(255, 255, 255, 0.82);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.34)),
    radial-gradient(110% 120% at 0% 0%, rgba(255, 218, 246, 0.3), rgba(255, 255, 255, 0) 56%),
    radial-gradient(110% 120% at 100% 0%, rgba(183, 238, 255, 0.34), rgba(255, 255, 255, 0) 58%);
  color: var(--ink);
}

html[data-theme^="glass-"] .ai-advice-button small,
html[data-theme^="glass-"] .ai-advice-action {
  color: #2f7280;
}

html[data-theme^="glass-"] .ai-advice-action {
  border-color: rgba(105, 183, 207, 0.24);
  background: rgba(255, 255, 255, 0.32);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.58);
}

html[data-theme^="glass-"] .body-record-entry {
  border-color: rgba(105, 183, 207, 0.24);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.62), rgba(255, 255, 255, 0.28)),
    radial-gradient(105% 120% at 0% 0%, rgba(255, 218, 246, 0.2), rgba(255, 255, 255, 0) 58%);
}

html[data-theme^="glass-"] .food-record-entry {
  border-color: rgba(188, 160, 211, 0.28);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0.26)),
    radial-gradient(105% 120% at 100% 0%, rgba(183, 238, 255, 0.28), rgba(255, 255, 255, 0) 58%);
  color: var(--ink);
}

html[data-theme^="glass-"] .record-entry-button:hover:not(:disabled),
html[data-theme^="glass-"] .record-entry-button:focus-visible,
html[data-theme^="glass-"] .replay-launch-button:hover:not(:disabled),
html[data-theme^="glass-"] .replay-launch-button:focus-visible {
  color: #2f7280;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.section-heading h2 {
  margin: 0;
  font-size: 21px;
  line-height: 1.2;
}

.section-heading span {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.compact-heading {
  margin-bottom: 10px;
}

.capture-flow {
  width: min(520px, 100%);
  margin: 0 auto;
}

.capture-mode-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.78);
}

.capture-mode-tab {
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
  font-weight: 820;
}

.capture-mode-tab:hover:not(:disabled),
.capture-mode-tab:focus-visible {
  background: rgba(231, 242, 235, 0.76);
  color: var(--primary-strong);
  box-shadow: none;
}

.capture-mode-tab.is-active {
  background: var(--primary);
  color: #fff;
}

.camera-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  cursor: pointer;
  margin-top: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #18221d;
  background-clip: padding-box;
  transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.camera-stage.is-food-mode {
  aspect-ratio: 1 / 1;
}

.camera-stage.is-active {
  cursor: default;
}

.camera-stage:active:not(.is-active) {
  border-color: rgba(31, 122, 90, 0.28);
  box-shadow: 0 7px 18px rgba(25, 42, 35, 0.12);
  transform: scale(0.995);
}

.camera-stage video,
.camera-stage img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.camera-stage video.mirrored {
  transform: scaleX(-1);
}

.camera-head-guide {
  position: absolute;
  inset: 0;
  z-index: 4;
  width: 100%;
  height: 100%;
  display: none;
  pointer-events: none;
  -webkit-user-select: none;
  user-select: none;
}

.camera-stage.is-active:not(.is-food-mode) > #cameraVideo:not(.hidden) ~ .camera-head-guide {
  display: block;
}

.camera-switch-button {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 8;
  min-height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.56);
  background: rgba(10, 16, 14, 0.62);
  color: #fff;
  padding: 0 12px;
  backdrop-filter: blur(8px);
}

.camera-switch-button:hover:not(:disabled) {
  background: rgba(10, 16, 14, 0.78);
  box-shadow: none;
}

.camera-switch-button:disabled {
  display: none;
}

.photo-effect-actions {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 9;
  display: flex;
  align-items: center;
  gap: 8px;
}

.photo-effect-button,
.photo-effect-toggle {
  min-height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.58);
  background: rgba(10, 16, 14, 0.68);
  color: #fff;
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 24px rgba(7, 14, 11, 0.18);
}

.photo-effect-button {
  padding: 0 13px;
  font-size: 13px;
  font-weight: 850;
}

.photo-effect-toggle {
  min-width: 52px;
  padding: 0 12px;
  display: inline-grid;
  place-items: center;
  font-size: 13px;
  font-weight: 850;
}

.photo-effect-toggle.is-effect-active {
  border-color: rgba(255, 224, 143, 0.78);
  background: rgba(29, 24, 12, 0.72);
  color: #ffe7a8;
}

.photo-effect-button:hover:not(:disabled),
.photo-effect-toggle:hover:not(:disabled),
.photo-effect-button:focus-visible,
.photo-effect-toggle:focus-visible {
  background: rgba(10, 16, 14, 0.84);
  box-shadow: 0 12px 26px rgba(7, 14, 11, 0.24);
}

.photo-effect-button:active:not(:disabled),
.photo-effect-toggle:active:not(:disabled) {
  transform: scale(0.97);
}

.photo-effect-busy {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  gap: 12px;
  align-content: center;
  color: #fff;
  font-size: 14px;
  font-weight: 850;
  background: rgba(8, 14, 12, 0.42);
  backdrop-filter: blur(2px);
}

.photo-effect-spinner {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.28);
  border-top-color: #fff;
  animation: photoEffectSpin 840ms linear infinite;
}

.camera-stage.is-photo-effect-busy img {
  transform: scale(1.012);
  filter: saturate(1.06) brightness(1.04);
}

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

@media (prefers-reduced-motion: reduce) {
  .photo-effect-spinner {
    animation: none;
  }
}

.empty-camera {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.72);
  font-weight: 820;
}

.empty-camera span {
  display: inline-grid;
  place-items: center;
  min-width: min(72%, 260px);
  min-height: 52px;
  padding: 0 18px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.42);
  letter-spacing: 0;
}

.control-row {
  margin-top: 12px;
}

.control-row button {
  flex: 1 1 0;
}

#captureButton {
  --face-model-progress: 0;
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.capture-button-progress {
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: inherit;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.28)),
    rgba(255, 255, 255, 0.08);
  box-shadow: 10px 0 22px rgba(255, 255, 255, 0.14);
  pointer-events: none;
  transform: scaleX(var(--face-model-progress));
  transform-origin: left center;
  transition: transform 120ms linear;
  will-change: transform;
}

.capture-button-label {
  position: relative;
  z-index: 1;
  display: inline-block;
  min-width: 0;
  pointer-events: none;
}

.capture-flow #captureButton.is-model-loading:disabled,
html[data-theme^="glass-"] .capture-flow #captureButton.is-model-loading:disabled {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .capture-button-progress {
    transition-duration: 0.01ms;
  }
}

#saveBodyRecordButton {
  --body-submit-progress: 0;
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.body-submit-button-progress {
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: inherit;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.28)),
    rgba(255, 255, 255, 0.08);
  box-shadow: 10px 0 22px rgba(255, 255, 255, 0.14);
  pointer-events: none;
  transform: scaleX(var(--body-submit-progress));
  transform-origin: left center;
  transition: transform 120ms linear;
  will-change: transform;
}

.body-submit-button-label {
  position: relative;
  z-index: 1;
  display: inline-block;
  min-width: 0;
  pointer-events: none;
}

.record-form #saveBodyRecordButton.is-body-submitting:disabled,
html[data-theme^="glass-"] .record-form #saveBodyRecordButton.is-body-submitting:disabled {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .body-submit-button-progress {
    transition-duration: 0.01ms;
  }
}

#saveFoodRecordButton {
  --food-submit-progress: 0;
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.food-submit-button-progress {
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: inherit;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.28)),
    rgba(255, 255, 255, 0.08);
  box-shadow: 10px 0 22px rgba(255, 255, 255, 0.14);
  pointer-events: none;
  transform: scaleX(var(--food-submit-progress));
  transform-origin: left center;
  transition: transform 120ms linear;
  will-change: transform;
}

.food-submit-button-label {
  position: relative;
  z-index: 1;
  display: inline-block;
  min-width: 0;
  pointer-events: none;
}

.food-panel-head #saveFoodRecordButton.is-food-submitting:disabled,
html[data-theme^="glass-"] .food-panel-head #saveFoodRecordButton.is-food-submitting:disabled {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .food-submit-button-progress {
    transition-duration: 0.01ms;
  }
}

.record-form {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.record-fields {
  display: grid;
  grid-template-columns: minmax(150px, 0.72fr) minmax(240px, 1.28fr);
  gap: 12px;
}

.record-field label span {
  margin-left: 4px;
  color: #8b9691;
  font-size: 12px;
  font-weight: 650;
}

.field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 7px;
}

.field-label-row label {
  margin: 0;
}

.mood-ai-button {
  min-width: 42px;
  min-height: 26px;
  border: 1px solid rgba(123, 96, 188, 0.18);
  border-radius: 999px;
  padding: 0 11px;
  background: linear-gradient(135deg, rgba(250, 247, 255, 0.96), rgba(239, 249, 244, 0.94));
  color: #7157a8;
  box-shadow: none;
  font-size: 12px;
  font-weight: 850;
}

.mood-ai-button:hover:not(:disabled),
.mood-ai-button:focus-visible {
  border-color: rgba(123, 96, 188, 0.3);
  background: #fff;
  color: #60489b;
  box-shadow: 0 8px 20px rgba(83, 61, 138, 0.1);
}

.mood-ai-button:active:not(:disabled) {
  transform: scale(0.97);
  background: #f4efff;
}

.mood-ai-button.is-loading {
  color: #60489b;
  background: linear-gradient(135deg, rgba(247, 242, 255, 0.96), rgba(237, 248, 243, 0.94));
}

.mood-ai-button.is-loading::after {
  content: "";
  width: 4px;
  height: 4px;
  margin-left: 5px;
  display: inline-block;
  border-radius: 50%;
  background: currentColor;
  vertical-align: middle;
  animation: foodAiPulse 860ms ease-in-out infinite;
}

.record-submit-button {
  width: 100%;
  margin-top: 12px;
  overflow: hidden;
}

.food-record-panel {
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.food-panel-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.food-panel-head h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
}

.food-panel-head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.42;
}

.food-panel-head .record-submit-button {
  width: auto;
  min-width: 132px;
  margin-top: 0;
}

.food-mood-field {
  margin-top: 12px;
}

.food-mood-field input {
  width: 100%;
}

.food-mood-ai-button {
  min-width: 38px;
  min-height: 24px;
  font-size: 11px;
}

.food-photo-carousel {
  min-height: 106px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 2px 2px 10px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

.food-photo-carousel::-webkit-scrollbar {
  display: none;
}

.food-capture-thumb {
  position: relative;
  width: min(116px, 32vw);
  height: min(116px, 32vw);
  flex: 0 0 min(116px, 32vw);
  display: block;
  margin: 0;
  border: 1px solid rgba(31, 122, 90, 0.12);
  border-radius: 8px;
  overflow: hidden;
  background: #edf3ef;
  box-shadow: 0 12px 24px rgba(25, 42, 35, 0.1);
  scroll-snap-align: start;
}

.food-capture-thumb img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  user-select: none;
  -webkit-user-drag: none;
}

.food-photo-delete-button {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 24px;
  min-width: 24px;
  height: 24px;
  min-height: 24px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 999px;
  padding: 0;
  background: rgba(18, 35, 28, 0.62);
  color: #fff;
  box-shadow: 0 6px 14px rgba(18, 35, 28, 0.18);
}

.food-photo-delete-button svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.6;
  stroke-linecap: round;
}

.food-photo-delete-button:hover:not(:disabled),
.food-photo-delete-button:focus-visible {
  background: rgba(18, 35, 28, 0.68);
  box-shadow: 0 6px 14px rgba(18, 35, 28, 0.18);
  transform: none;
}

.food-photo-delete-button:active:not(:disabled) {
  transform: scale(0.94);
}

.food-result-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.food-quick-submit-note {
  display: grid;
  gap: 3px;
  border: 1px solid rgba(75, 159, 178, 0.15);
  border-radius: 14px;
  padding: 12px 14px;
  background: rgba(239, 250, 253, 0.78);
}

.food-quick-submit-note strong {
  color: var(--ink);
  font-size: 14px;
}

.food-quick-submit-note span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.food-result-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 30px;
  gap: 10px;
  align-items: center;
  min-height: 58px;
  border: 1px solid rgba(31, 122, 90, 0.1);
  border-radius: 8px;
  padding: 8px 9px 8px 11px;
  background: rgba(255, 255, 255, 0.78);
}

.food-result-item strong,
.food-result-item span,
.food-result-item small,
.food-result-item p,
.food-result-metrics strong,
.food-result-metrics span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.food-result-item strong {
  color: var(--ink);
  font-size: 15px;
}

.food-result-item span,
.food-result-item small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
}

.food-result-item p {
  margin: 2px 0 0;
  color: #6f7d76;
  font-size: 11px;
  font-weight: 680;
}

.food-result-metrics {
  min-width: 70px;
  display: grid;
  justify-items: end;
  gap: 2px;
  color: var(--muted);
  text-align: right;
}

.food-result-metrics strong {
  color: var(--primary-strong);
  font-size: 13px;
  font-weight: 860;
  line-height: 1.15;
}

.food-result-metrics span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 740;
  line-height: 1.15;
}

.food-nutrition-grid,
.food-selection-nutrition,
.history-food-nutrition {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}

.food-nutrition-grid span,
.food-selection-nutrition span,
.history-food-nutrition span {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  max-width: 100%;
  border: 1px solid rgba(31, 122, 90, 0.09);
  border-radius: 999px;
  padding: 3px 7px;
  background: rgba(245, 250, 247, 0.82);
  color: #65716c;
  font-size: 11px;
  font-weight: 720;
  line-height: 1.2;
  white-space: nowrap;
}

.food-nutrition-grid b,
.food-selection-nutrition b,
.history-food-nutrition b {
  color: #34433c;
  font-weight: 800;
}

.food-delete-button {
  width: 30px;
  min-width: 30px;
  height: 30px;
  min-height: 30px;
  border: 0;
  border-radius: 7px;
  padding: 0;
  background: transparent;
  color: #ba392b;
  box-shadow: none;
}

.food-delete-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.food-delete-button:hover:not(:disabled),
.food-delete-button:focus-visible {
  border: 0;
  background: transparent;
  box-shadow: none;
}

.food-delete-button:active:not(:disabled) {
  border: 0;
  background: transparent;
  box-shadow: none;
  transform: scale(0.94);
}

.food-selection-backdrop {
  z-index: 1440;
}

.manual-food-backdrop {
  background: rgba(15, 24, 20, 0.44);
}

.manual-food-dialog {
  width: min(390px, 100%);
  border: 1px solid rgba(31, 122, 90, 0.16);
  border-radius: 8px;
  padding: 23px;
  background:
    linear-gradient(180deg, rgba(246, 251, 248, 0.98), rgba(255, 255, 255, 0.98) 42%),
    #fff;
  box-shadow: 0 26px 70px rgba(10, 24, 18, 0.26);
  opacity: 0.96;
  transform: translate3d(0, 8px, 0) scale(0.985);
  transition: opacity 190ms ease, transform 190ms cubic-bezier(0.22, 0.84, 0.2, 1);
}

.manual-food-backdrop.is-open .manual-food-dialog {
  opacity: 1;
  transform: translate3d(0, 0, 0) scale(1);
}

.manual-food-dialog h2 {
  margin: 0;
  color: var(--ink);
  font-size: 25px;
  line-height: 1.16;
}

.manual-food-dialog > p:not(.eyebrow):not(.manual-food-message) {
  margin: 10px 0 16px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 680;
  line-height: 1.55;
}

.manual-food-field {
  display: grid;
  gap: 8px;
}

.manual-food-field span {
  color: #52615a;
  font-size: 12px;
  font-weight: 820;
}

.manual-food-field input {
  width: 100%;
  min-height: 46px;
  border: 1px solid rgba(31, 122, 90, 0.14);
  border-radius: 8px;
  padding: 0 13px;
  background: rgba(248, 252, 250, 0.96);
  color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
  font: inherit;
  font-size: 16px;
  font-weight: 760;
  outline: none;
  transition: border-color 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

.manual-food-field input::placeholder {
  color: rgba(101, 113, 108, 0.48);
}

.manual-food-field input:focus {
  border-color: rgba(31, 122, 90, 0.34);
  background: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 0 0 3px rgba(31, 122, 90, 0.08);
}

.manual-food-message {
  min-height: 18px;
  margin: 10px 0 0;
  color: var(--log-accent);
  font-size: 12px;
  font-weight: 760;
  line-height: 1.5;
}

.manual-food-actions {
  margin-top: 15px;
}

.food-selection-dialog {
  width: min(620px, 100%);
  max-height: calc(100dvh - var(--modal-safe-top-gap) - var(--modal-safe-bottom-gap));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(31, 122, 90, 0.16);
  border-radius: 8px;
  padding: 22px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 30px 80px rgba(10, 24, 18, 0.28);
  opacity: 0.96;
  transform: translate3d(0, 8px, 0) scale(0.985);
  transition: opacity 190ms ease, transform 190ms cubic-bezier(0.22, 0.84, 0.2, 1);
  scrollbar-width: none;
}

.food-selection-backdrop.is-open .food-selection-dialog {
  opacity: 1;
  transform: translate3d(0, 0, 0) scale(1);
}

.food-selection-backdrop.is-closing {
  will-change: opacity;
}

.food-selection-backdrop.is-closing .food-selection-dialog {
  opacity: 1;
  transform: none;
}

.food-selection-backdrop.is-exiting {
  opacity: 0;
  transition: opacity 180ms ease;
}

.food-selection-dialog::-webkit-scrollbar,
.food-selection-list::-webkit-scrollbar {
  display: none;
}

.food-selection-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
}

.food-selection-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.food-selection-head h2 {
  margin: 0;
  color: var(--ink);
  font-size: 24px;
  line-height: 1.18;
}

.food-selection-manual-button {
  min-height: 34px;
  border: 1px solid rgba(111, 139, 125, 0.18);
  border-radius: 999px;
  padding: 0 12px;
  background: rgba(248, 251, 249, 0.92);
  color: var(--log-accent);
  box-shadow: none;
  font-size: 12px;
  font-weight: 820;
}

.food-selection-manual-button:hover:not(:disabled),
.food-selection-manual-button:focus-visible {
  border-color: rgba(111, 139, 125, 0.3);
  background: #fff;
  box-shadow: none;
  transform: none;
}

.modal-icon-button {
  width: 36px;
  min-width: 36px;
  height: 36px;
  min-height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(31, 122, 90, 0.12);
  border-radius: 999px;
  padding: 0;
  background: #f5faf7;
  color: var(--muted);
  box-shadow: none;
}

.modal-icon-button svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.3;
  stroke-linecap: round;
}

.modal-icon-button:hover:not(:disabled),
.modal-icon-button:focus-visible {
  background: #eef7f2;
  box-shadow: none;
  transform: none;
}

.food-selection-copy {
  margin: 8px 0 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.food-selection-list {
  min-height: 0;
  display: grid;
  gap: 7px;
  overflow-y: auto;
  padding-right: 2px;
  scrollbar-width: none;
}

.food-selection-item {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px 10px;
  align-items: center;
  border: 1px solid rgba(31, 122, 90, 0.12);
  border-radius: 8px;
  padding: 14px 10px 9px;
  background: #fbfdfc;
  transition: border-color 160ms ease, background-color 160ms ease;
}

.food-source-badge {
  position: absolute;
  top: -1px;
  right: -1px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 18px;
  border: 1px solid rgba(31, 122, 90, 0.16);
  border-radius: 0 8px 0 8px;
  padding: 0 7px;
  background: linear-gradient(135deg, #e9f7ef, #ffffff);
  color: var(--primary-strong);
  font-size: 10px;
  font-weight: 860;
  line-height: 1;
  pointer-events: none;
  box-shadow: 0 4px 10px rgba(25, 42, 35, 0.06);
}

.ai-generated-badge,
.food-result-item .ai-generated-badge {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 20px;
  border: 1px solid rgba(83, 96, 188, 0.2);
  border-radius: 999px;
  padding: 2px 8px;
  background: linear-gradient(135deg, #f0edff, #edf9f3);
  color: #60489b;
  font-size: 10px;
  font-weight: 900;
  line-height: 1.15;
  vertical-align: middle;
  white-space: nowrap;
}

.food-result-item .ai-generated-badge {
  margin-bottom: 3px;
}

.history-note .ai-generated-badge {
  margin-left: 5px;
}

.food-selection-item.is-selected {
  border-color: rgba(31, 122, 90, 0.28);
  background: #f1faf5;
}

.food-selection-item.needs-data {
  border-color: rgba(156, 108, 25, 0.16);
  background: #fffdf7;
}

.food-selection-check {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-width: 0;
  cursor: pointer;
}

.food-selection-check input {
  width: 17px;
  min-height: 17px;
  margin: 0;
  accent-color: var(--primary);
}

.food-selection-check strong,
.food-selection-check em,
.food-selection-data span,
.food-selection-total {
  overflow: hidden;
  text-overflow: ellipsis;
}

.food-selection-check strong {
  display: block;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.18;
  white-space: nowrap;
}

.food-selection-check em {
  display: block;
  margin-top: 1px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
  white-space: nowrap;
}

.food-selection-data {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 5px;
  overflow-x: auto;
  padding-bottom: 1px;
  scrollbar-width: none;
}

.food-selection-data::-webkit-scrollbar,
.food-selection-nutrition::-webkit-scrollbar {
  display: none;
}

.food-selection-data span {
  flex: 0 0 auto;
  border: 1px solid rgba(31, 122, 90, 0.1);
  border-radius: 999px;
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
  white-space: nowrap;
}

.food-selection-edit-button {
  flex: 0 0 auto;
  min-height: 26px;
  border: 1px solid rgba(31, 122, 90, 0.14);
  border-radius: 999px;
  padding: 0 10px;
  background: #f5fbf7;
  color: var(--primary-strong);
  box-shadow: none;
  font-size: 11px;
  font-weight: 820;
}

.food-selection-ai-button {
  position: relative;
  flex: 0 0 auto;
  min-height: 26px;
  border: 1px solid rgba(83, 116, 206, 0.16);
  border-radius: 999px;
  padding: 0 10px;
  background: linear-gradient(135deg, rgba(236, 243, 255, 0.96), rgba(241, 251, 247, 0.92));
  color: #42627e;
  box-shadow: none;
  font-size: 11px;
  font-weight: 830;
}

.food-selection-edit-button:hover:not(:disabled),
.food-selection-edit-button:focus-visible,
.food-selection-ai-button:hover:not(:disabled),
.food-selection-ai-button:focus-visible {
  background: #edf7f1;
  box-shadow: none;
  transform: none;
}

.food-selection-ai-button:hover:not(:disabled),
.food-selection-ai-button:focus-visible {
  border-color: rgba(83, 116, 206, 0.24);
  background: linear-gradient(135deg, rgba(229, 238, 255, 0.98), rgba(235, 250, 245, 0.94));
}

.food-selection-ai-button.is-loading {
  padding-right: 22px;
  color: #496782;
}

.food-selection-ai-button.is-loading::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 9px;
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: currentColor;
  box-shadow: -7px 0 0 rgba(73, 103, 130, 0.42), 7px 0 0 rgba(73, 103, 130, 0.28);
  transform: translateY(-50%);
  animation: foodAiPulse 860ms ease-in-out infinite;
}

.food-selection-ai-button:disabled {
  cursor: default;
  opacity: 0.72;
}

.food-portion-control {
  grid-column: 2;
  grid-row: 1;
  display: grid;
  grid-template-columns: 30px minmax(72px, 88px) 30px;
  gap: 6px;
  align-items: center;
}

.food-portion-control button {
  width: 30px;
  min-width: 30px;
  height: 30px;
  min-height: 30px;
  border-radius: 999px;
  padding: 0;
  background: #edf7f1;
  color: var(--primary-strong);
  box-shadow: none;
  font-size: 17px;
  line-height: 1;
}

.food-portion-control button svg {
  width: 16px;
  height: 16px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
}

.food-portion-control button:hover:not(:disabled),
.food-portion-control button:focus-visible {
  background: #e4f2eb;
  box-shadow: none;
  transform: none;
}

.food-portion-value {
  width: 100%;
  min-height: 30px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 3px;
  border: 1px solid rgba(31, 122, 90, 0.16);
  border-radius: 8px;
  padding: 0 8px;
  background: #fff;
}

.food-portion-control input {
  width: 100%;
  min-width: 0;
  min-height: 28px;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  font-weight: 760;
  line-height: 1;
  text-align: center;
  appearance: textfield;
  -moz-appearance: textfield;
}

.food-portion-control input::-webkit-inner-spin-button,
.food-portion-control input::-webkit-outer-spin-button {
  margin: 0;
  -webkit-appearance: none;
}

.food-portion-control small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
}

.food-selection-total {
  margin: 0;
  color: #52625b;
  font-size: 11px;
  font-weight: 720;
  line-height: 1.2;
}

.food-selection-nutrition {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: nowrap;
  gap: 5px;
  margin-top: 0;
  overflow-x: auto;
}

.food-candidate-editor {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
  border-top: 1px solid rgba(31, 122, 90, 0.1);
  padding-top: 8px;
}

.food-candidate-editor label {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
}

.food-candidate-editor input {
  width: 100%;
  min-height: 31px;
  border: 1px solid rgba(31, 122, 90, 0.16);
  border-radius: 8px;
  padding: 0 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 780;
}

.food-candidate-editor-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 7px;
}

.food-candidate-editor-actions button {
  min-height: 31px;
  border-radius: 8px;
  padding: 0 11px;
  font-size: 12px;
}

.food-selection-summary {
  margin-top: 14px;
  border: 1px solid rgba(31, 122, 90, 0.12);
  border-radius: 8px;
  padding: 10px 12px;
  background: #f3faf6;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.45;
}

.food-selection-message {
  min-height: 18px;
  margin: 8px 0 0;
  color: #b83d34;
  font-size: 12px;
}

.food-empty-state {
  min-height: 58px;
  display: grid;
  place-items: center;
  width: 100%;
  border: 1px dashed rgba(31, 122, 90, 0.16);
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 720;
}

.food-selection-loading {
  display: grid;
  justify-items: center;
  gap: 8px;
  min-height: 148px;
  border: 1px solid rgba(31, 122, 90, 0.12);
  border-radius: 8px;
  padding: 22px 16px;
  background: linear-gradient(180deg, #fbfdfc 0%, #f2faf5 100%);
  text-align: center;
}

.food-selection-loading .food-selection-spinner {
  width: 30px;
  height: 30px;
  border: 3px solid rgba(31, 122, 90, 0.14);
  border-top-color: var(--primary);
  border-radius: 999px;
  animation: foodSelectionSpin 820ms linear infinite;
}

.food-selection-loading strong {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 860;
}

.food-loading-dots {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: 2px;
}

.food-loading-dots i {
  display: block;
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.34;
  animation: foodLoadingDot 900ms ease-in-out infinite;
}

.food-loading-dots i:nth-child(2) {
  animation-delay: 120ms;
}

.food-loading-dots i:nth-child(3) {
  animation-delay: 240ms;
}

.food-selection-loading p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
  line-height: 1.45;
}

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

@keyframes foodLoadingDot {
  0%,
  80%,
  100% {
    opacity: 0.3;
    transform: translateY(0);
  }

  40% {
    opacity: 1;
    transform: translateY(-2px);
  }
}

@keyframes foodAiPulse {
  0%,
  100% {
    opacity: 0.42;
    transform: translateY(-50%) scale(0.85);
  }

  50% {
    opacity: 1;
    transform: translateY(-50%) scale(1);
  }
}

.capture-hint {
  min-height: 22px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.camera-settings-button {
  width: 100%;
  margin-top: 10px;
}

.weight-chart {
  min-height: 276px;
  border: 1px solid rgba(31, 122, 90, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 14px 38px rgba(25, 42, 35, 0.07);
  overflow: hidden;
}

.weight-chart .chart-frame,
.weight-chart .chart-empty {
  transition: opacity 180ms ease, transform 180ms ease;
}

.weight-chart.is-chart-entering .chart-frame,
.weight-chart.is-chart-entering .chart-empty {
  opacity: 0.001;
  transform: translate3d(0, 5px, 0);
}

.chart-frame {
  position: relative;
  padding-left: 48px;
}

.chart-frame.has-no-axis {
  padding-left: 0;
}

.chart-scroll {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}

.chart-y-axis {
  position: absolute;
  z-index: 2;
  top: 0;
  left: 0;
  bottom: 0;
  width: 48px;
  border-right: 1px solid rgba(223, 231, 226, 0.8);
  background: rgba(255, 255, 255, 0.94);
  color: var(--muted);
  pointer-events: none;
}

.chart-y-axis span {
  position: absolute;
  left: 9px;
  transform: translateY(-50%);
  font-size: 12px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.chart-scroll::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

.weight-chart svg {
  height: 276px;
  display: block;
  min-width: 100%;
}

.chart-day-label {
  fill: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.chart-weight-bar {
  transition: stroke 140ms ease, stroke-width 140ms ease, opacity 140ms ease;
}

.chart-weight-bar.is-prediction {
  filter: drop-shadow(0 0 8px var(--chart-prediction-glow));
}

.chart-hit-area {
  cursor: pointer;
  fill: rgba(0, 0, 0, 0.001);
  outline: none;
  pointer-events: all;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.chart-hit-area:focus,
.chart-hit-area:focus-visible {
  fill: transparent;
  outline: none;
}

.chart-detail {
  position: absolute;
  z-index: 4;
  top: 13px;
  left: calc(50% + 24px);
  transform: translate3d(-50%, 0, 0);
  min-height: 40px;
  min-width: min(260px, calc(100% - 16px));
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border: 1px solid rgba(31, 122, 90, 0.14);
  border-radius: 8px;
  padding: 7px 11px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--muted);
  box-shadow: 0 10px 28px rgba(25, 42, 35, 0.12);
  font-size: 12px;
  opacity: 0;
  visibility: hidden;
  white-space: nowrap;
  pointer-events: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  contain: layout paint;
  transition:
    opacity 190ms ease,
    visibility 0ms linear 190ms,
    background-color 190ms ease,
    box-shadow 190ms ease;
  will-change: opacity;
}

.chart-frame.has-no-axis .chart-detail {
  left: 50%;
}

.chart-detail.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translate3d(-50%, 0, 0);
  transition:
    opacity 160ms ease,
    background-color 190ms ease,
    box-shadow 190ms ease;
}

.chart-detail > span {
  transform: translate3d(0, 0, 0);
}

.chart-detail.is-content-switching > span {
  animation: chart-detail-content-switch 180ms ease both;
}

.chart-detail.is-content-switching > span:nth-child(2) {
  animation-delay: 16ms;
}

.chart-detail.is-content-switching > span:nth-child(3) {
  animation-delay: 28ms;
}

@keyframes chart-detail-content-switch {
  from {
    opacity: 0;
    transform: translate3d(0, 2px, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .chart-detail.is-content-switching > span {
    animation: none;
  }
}

.chart-detail-date {
  color: var(--ink);
  font-weight: 780;
}

.chart-detail strong {
  color: var(--primary-strong);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.chart-detail.is-prediction {
  border-color: var(--chart-prediction-soft);
  box-shadow: 0 14px 36px var(--chart-prediction-soft);
}

.chart-detail.is-prediction strong {
  color: var(--chart-prediction);
}

.chart-empty {
  height: 210px;
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
  padding: 24px;
}

.weight-chart .chart-empty {
  height: 276px;
}

/* The in-app large chart mirrors the native 1:1 WeightTrend widget hierarchy. */
.weight-chart.is-native-large-card {
  min-height: 398px;
  font-family: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.weight-trend-widget-card {
  min-height: 398px;
  height: 100%;
  display: grid;
  grid-template-rows: auto 34px minmax(126px, 1fr) auto auto;
  gap: 7px;
  padding: 18px;
}

.weight-trend-widget-head {
  min-width: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.weight-trend-widget-head > div:first-child {
  flex: 1 1 auto;
  min-width: 0;
  display: grid;
  gap: 0;
}

.weight-trend-widget-head span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
  line-height: 1.2;
}

.weight-trend-widget-metrics span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 760;
  line-height: 1.2;
}

.weight-trend-widget-head strong {
  color: var(--ink);
  font-size: 27px;
  font-weight: 880;
  line-height: 1.08;
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
}

.weight-trend-widget-brand {
  width: max-content;
  max-width: 92px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  justify-content: flex-end;
  gap: 4px;
  color: var(--muted);
  font-size: 11.2px;
  font-weight: 900;
  line-height: 1;
  text-align: right;
  white-space: nowrap;
}

.weight-trend-widget-brand > span {
  min-width: max-content;
  flex: 0 0 auto;
  font-family: inherit;
  font-size: 11.2px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0;
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
}

.weight-chart .weight-trend-widget-brand .weight-trend-widget-brand-icon {
  width: 11.2px;
  height: 11.2px;
  min-width: 0;
  max-width: 11.2px;
  flex: 0 0 11.2px;
  display: block;
  overflow: visible;
  fill: currentColor;
  stroke: none;
  shape-rendering: geometricPrecision;
}

.weight-trend-widget-selection-slot {
  position: relative;
  z-index: 3;
  min-width: 0;
  min-height: 34px;
}

.weight-trend-widget-selection-slot .chart-detail,
.weight-trend-widget-selection-slot .chart-detail.is-visible {
  top: 0;
  left: 50%;
  width: 100%;
  min-width: 0;
  min-height: 34px;
  justify-content: flex-start;
  gap: 10px;
  transform: translate3d(-50%, 0, 0);
  border-radius: 8px;
  padding: 5px 9px;
  box-shadow: none;
}

.weight-trend-widget-selection-slot .chart-detail-date {
  margin-right: auto;
}

.weight-trend-widget-chart {
  min-height: 150px;
  padding-left: 0;
}

.weight-trend-widget-chart .chart-scroll {
  height: 100%;
  overflow: hidden;
}

.weight-trend-widget-chart svg {
  width: 100% !important;
  height: 100%;
  min-width: 0;
}

.weight-chart.is-native-large-card .weight-trend-widget-chart svg {
  width: 100% !important;
  height: 100%;
}

.weight-trend-widget-chart .chart-detail {
  top: 4px;
  left: 50%;
  min-width: min(264px, calc(100% - 20px));
}

.weight-chart-reference {
  fill: none;
  stroke-width: 1.1;
  stroke-linecap: round;
  stroke-dasharray: 4 4;
  vector-effect: non-scaling-stroke;
}

.weight-chart-reference.is-gain {
  stroke: color-mix(in srgb, var(--chart-gain) var(--weight-chart-reference-line-mix, 28%), transparent);
}

.weight-chart-reference.is-loss {
  stroke: color-mix(in srgb, var(--chart-loss) var(--weight-chart-reference-line-mix, 28%), transparent);
}

.weight-chart-reference-label-bg.is-gain {
  fill: color-mix(in srgb, var(--chart-gain) var(--weight-chart-reference-label-mix, 12%), transparent);
}

.weight-chart-reference-label-bg.is-loss {
  fill: color-mix(in srgb, var(--chart-loss) var(--weight-chart-reference-label-mix, 12%), transparent);
}

.weight-chart-reference-label {
  font-size: 10px;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}

.weight-chart-reference-label.is-gain {
  fill: var(--chart-gain);
}

.weight-chart-reference-label.is-loss {
  fill: var(--chart-loss);
}

.weight-trend-widget-metrics {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.weight-trend-widget-metrics > div {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 2px;
}

.weight-trend-widget-metrics strong {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 12px;
  font-weight: 850;
  line-height: 1.18;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.weight-trend-widget-metrics strong.is-loss {
  color: var(--chart-loss);
}

.weight-trend-widget-metrics strong.is-gain {
  color: var(--chart-gain);
}

.weight-trend-widget-metrics strong.is-prediction,
.weight-trend-widget-foot .is-prediction {
  color: var(--chart-prediction);
}

.weight-trend-widget-foot {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 760;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.weight-trend-widget-foot-range {
  grid-column: 1 / span 2;
  min-width: 0;
  white-space: nowrap;
}

.weight-trend-widget-foot-forecast {
  grid-column: 4;
  min-width: 0;
  justify-self: start;
  white-space: nowrap;
}

.history-section {
  box-shadow: none;
}

.calendar-section {
  min-width: 0;
}

.weight-calendar {
  margin: 0;
  border: 1px solid rgba(38, 79, 64, 0.12);
  border-radius: 8px;
  padding: 10px 12px 12px;
  background: rgba(255, 255, 255, 0.76);
}

.calendar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.calendar-head span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.calendar-head strong {
  color: var(--ink);
  font-size: 12px;
}

.calendar-detail {
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 8px;
  border: 1px solid rgba(38, 79, 64, 0.1);
  border-radius: 8px;
  padding: 7px 10px;
  background: rgba(248, 251, 249, 0.92);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity 180ms ease, transform 180ms ease, background-color 180ms ease;
}

.calendar-detail.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.calendar-detail-date {
  color: var(--ink);
  font-weight: 820;
}

.calendar-detail strong {
  color: var(--primary-strong);
  font-variant-numeric: tabular-nums;
}

.calendar-weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 3px;
}

.calendar-weekdays {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.calendar-day {
  --calendar-day-font-size: 10px;
  width: 100%;
  height: 16.5px;
  min-height: 16.5px;
  min-width: 0;
  display: grid;
  place-items: center;
  box-sizing: border-box;
  border: 1px solid rgba(31, 122, 90, 0.08);
  border-radius: 5px;
  padding: 0;
  background: var(--day-color, rgba(224, 232, 227, 0.96));
  color: rgba(23, 32, 28, 0.82);
  box-shadow: none;
  cursor: default;
  font-size: var(--calendar-day-font-size);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

button.calendar-day {
  appearance: none;
  -webkit-appearance: none;
  min-height: 16.5px;
  border-radius: 5px;
  padding: 0;
  background: var(--day-color, rgba(224, 232, 227, 0.96));
  color: rgba(23, 32, 28, 0.82);
  box-shadow: none;
  cursor: pointer;
  font-family: inherit;
  font-size: var(--calendar-day-font-size);
  font-weight: inherit;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  white-space: normal;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

button.calendar-day:hover:not(:disabled),
button.calendar-day:focus-visible,
button.calendar-day:active:not(:disabled) {
  border-color: rgba(84, 121, 133, 0.38);
  background: var(--day-color, rgba(224, 232, 227, 0.96));
  box-shadow: inset 0 0 0 1px rgba(84, 121, 133, 0.14), 0 4px 10px rgba(84, 121, 133, 0.08);
  outline: none;
  transform: none;
  color: rgba(23, 32, 28, 0.88);
}

.calendar-day.is-selected {
  border-color: rgba(84, 121, 133, 0.68);
  background: var(--day-color, var(--calendar-selected-bg));
  box-shadow: inset 0 0 0 1px rgba(84, 121, 133, 0.38), 0 4px 12px rgba(84, 121, 133, 0.12);
  color: #14251f;
}

button.calendar-day.is-selected:hover:not(:disabled),
button.calendar-day.is-selected:focus-visible,
button.calendar-day.is-selected:active:not(:disabled) {
  border-color: rgba(84, 121, 133, 0.74);
  background: var(--day-color, var(--calendar-selected-bg));
  box-shadow: inset 0 0 0 1px rgba(84, 121, 133, 0.42), 0 5px 14px rgba(84, 121, 133, 0.14);
}

.calendar-day span,
.calendar-day small {
  display: block;
  font: inherit;
  line-height: 1;
}

.calendar-day small {
  display: none;
}

.calendar-day.is-up {
  border-color: rgba(191, 117, 106, 0.18);
}

.calendar-day.is-down {
  border-color: rgba(79, 148, 121, 0.2);
}

.calendar-day.is-empty {
  background: rgba(245, 248, 246, 0.82);
  color: rgba(101, 113, 108, 0.5);
  cursor: default;
}

.calendar-day.calendar-day-spacer {
  visibility: hidden;
  border-color: transparent;
  background: transparent;
  pointer-events: none;
}

.calendar-empty {
  min-height: 86px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
}

.goal-chart-section {
  min-width: 0;
}

.weight-goal-chart {
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(38, 79, 64, 0.12);
  border-radius: 8px;
  padding: 13px 14px 9px;
  background: rgba(255, 255, 255, 0.76);
}

.goal-chart-empty {
  min-height: 112px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.goal-chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 9px;
}

.goal-chart-head div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.goal-chart-head span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 740;
}

.goal-chart-head strong {
  min-width: 0;
  color: var(--ink);
  font-size: 15px;
  font-weight: 840;
  line-height: 1.2;
  letter-spacing: 0;
}

.goal-chart-head strong small {
  margin-left: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 720;
  white-space: nowrap;
}

.goal-chart-forecast-summary {
  flex: 0 0 auto;
  text-align: right;
}

.goal-chart-forecast-summary strong {
  font-size: 13px;
}

.goal-chart-metrics {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px 16px;
  margin-bottom: 1px;
}

.goal-chart-metric {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 740;
  line-height: 1.25;
  white-space: nowrap;
}

.goal-chart-metric::before {
  width: 21px;
  height: 0;
  flex: 0 0 21px;
  border-top: 2.5px solid var(--chart-gain);
  border-radius: 999px;
  content: "";
}

.goal-chart-metric.is-ideal::before {
  border-top-style: dashed;
}

.goal-chart-metric.is-trend::before {
  border-top-color: var(--chart-prediction);
  border-top-style: dashed;
}

.goal-chart-frame {
  position: relative;
  min-width: 0;
}

.goal-chart-scroll {
  width: 100%;
  overflow-x: hidden;
  overflow-y: hidden;
}

.goal-chart-scroll svg {
  width: 100%;
  height: 168px;
  display: block;
  min-width: 0;
}

.goal-chart-line {
  vector-effect: non-scaling-stroke;
  fill: none;
  stroke-width: 3.1;
  stroke-linecap: round;
}

.goal-chart-line.is-actual {
  stroke: var(--chart-selected);
}

.goal-chart-line.is-plan {
  stroke: var(--chart-gain);
  stroke-width: 2.6;
  stroke-dasharray: 5 5;
  opacity: 0.88;
}

.goal-chart-line.is-forecast {
  stroke: var(--chart-prediction);
  stroke-width: 2.8;
  stroke-dasharray: 8 7;
  filter: drop-shadow(0 0 8px var(--chart-prediction-glow));
}

.goal-chart-current-ring {
  fill: var(--chart-selected-soft);
  stroke: none;
}

.goal-chart-point circle {
  stroke: rgba(255, 255, 255, 0.92);
  stroke-width: 2.4;
}

.goal-chart-point-label {
  fill: var(--ink);
  font-size: 10.5px;
  font-weight: 760;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

.goal-chart-point.is-start circle {
  fill: var(--chart-selected);
}

.goal-chart-point.is-current circle {
  fill: var(--primary);
}

.goal-chart-point.is-target circle {
  fill: var(--chart-gain);
}

.goal-chart-point.is-predicted circle {
  fill: var(--chart-prediction);
}

@media (max-width: 520px) {
  .goal-chart-head {
    align-items: center;
    gap: 8px;
  }

  .goal-chart-head strong {
    font-size: 14px;
  }

  .goal-chart-head strong small {
    margin-left: 3px;
    font-size: 10px;
  }

  .goal-chart-metrics {
    column-gap: 12px;
  }

  .goal-chart-metric {
    font-size: 10.5px;
  }
}

html[data-theme^="glass-"] .weight-calendar,
html[data-theme^="glass-"] .weight-goal-chart {
  border-color: rgba(255, 255, 255, 0.58);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.46), rgba(255, 255, 255, 0.2)),
    radial-gradient(105% 115% at 8% 0%, rgba(255, 219, 246, 0.2), rgba(255, 255, 255, 0) 58%),
    radial-gradient(105% 115% at 96% 4%, rgba(184, 238, 255, 0.28), rgba(255, 255, 255, 0) 60%);
  box-shadow: var(--glass-shadow-soft);
  -webkit-backdrop-filter: blur(18px) saturate(1.18);
  backdrop-filter: blur(18px) saturate(1.18);
}

html[data-theme^="glass-"] .goal-chart-head span,
html[data-theme^="glass-"] .goal-chart-point-label {
  color: rgba(58, 76, 88, 0.68);
  fill: rgba(58, 76, 88, 0.68);
}

html[data-theme^="glass-"] .goal-chart-head strong small,
html[data-theme^="glass-"] .goal-chart-metric {
  color: rgba(58, 76, 88, 0.68);
}

html[data-theme^="glass-"] .calendar-detail {
  border-color: rgba(255, 255, 255, 0.52);
  background: rgba(255, 255, 255, 0.32);
  color: rgba(58, 76, 88, 0.74);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.54);
}

html[data-theme^="glass-"] .calendar-detail-date,
html[data-theme^="glass-"] .calendar-detail strong {
  color: #2f7280;
}

html[data-theme^="glass-"] .calendar-weekdays {
  color: rgba(58, 76, 88, 0.58);
}

html[data-theme^="glass-"] .calendar-day,
html[data-theme^="glass-"] button.calendar-day {
  border-color: rgba(86, 136, 167, 0.24);
  background: var(--day-color, rgba(255, 255, 255, 0.42));
  color: rgba(29, 40, 50, 0.82);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12);
}

html[data-theme^="glass-"] button.calendar-day:hover:not(:disabled),
html[data-theme^="glass-"] button.calendar-day:focus-visible,
html[data-theme^="glass-"] button.calendar-day:active:not(:disabled) {
  border-color: rgba(86, 136, 167, 0.48);
  background: var(--day-color, rgba(255, 255, 255, 0.42));
  box-shadow: 0 0 0 2px rgba(105, 183, 207, 0.16);
  color: rgba(29, 40, 50, 0.9);
}

html[data-theme^="glass-"] .calendar-day.is-selected {
  border-color: rgba(86, 136, 167, 0.82);
  background: var(--day-color, var(--calendar-selected-bg));
  box-shadow: 0 0 0 2px rgba(105, 183, 207, 0.2), 0 2px 8px rgba(87, 130, 158, 0.08);
  color: rgba(22, 33, 43, 0.95);
}

html[data-theme^="glass-"] button.calendar-day.is-selected:hover:not(:disabled),
html[data-theme^="glass-"] button.calendar-day.is-selected:focus-visible,
html[data-theme^="glass-"] button.calendar-day.is-selected:active:not(:disabled) {
  border-color: rgba(86, 136, 167, 0.82);
  background: var(--day-color, var(--calendar-selected-bg));
  box-shadow: 0 0 0 2px rgba(105, 183, 207, 0.24), 0 2px 8px rgba(87, 130, 158, 0.08);
}

html[data-theme^="glass-"] .calendar-day.is-up {
  border-color: rgba(223, 140, 166, 0.34);
  color: rgba(103, 46, 65, 0.86);
}

html[data-theme^="glass-"] .calendar-day.is-down {
  border-color: rgba(105, 183, 207, 0.36);
  color: rgba(36, 89, 108, 0.88);
}

html[data-theme^="glass-"] .calendar-day.is-empty {
  border-color: rgba(255, 255, 255, 0.26);
  background: rgba(255, 255, 255, 0.24);
  color: rgba(67, 82, 94, 0.48);
}

html[data-theme^="glass-"] .chart-y-axis {
  border-right-color: rgba(255, 255, 255, 0.5);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.24), rgba(255, 255, 255, 0.08)),
    radial-gradient(120% 100% at 0% 0%, rgba(255, 219, 246, 0.14), rgba(255, 255, 255, 0) 58%);
  color: rgba(67, 82, 94, 0.66);
  -webkit-backdrop-filter: blur(10px) saturate(1.08);
  backdrop-filter: blur(10px) saturate(1.08);
}

.history-heading-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.history-toggle-button {
  min-height: 34px;
  border: 1px solid rgba(31, 122, 90, 0.16);
  border-radius: 7px;
  padding: 0 14px;
  background: #f3f8f5;
  background-clip: padding-box;
  color: var(--primary-strong);
  box-shadow: none;
  font-size: 13px;
  overflow: hidden;
}

.history-toggle-button:hover:not(:disabled) {
  background: #eaf3ee;
  box-shadow: none;
  transform: none;
}

.history-toggle-button:active:not(:disabled) {
  background: #dfeee7;
  box-shadow: none;
  transform: scale(0.985);
}

.history-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.history-loader {
  min-height: 42px;
  display: grid;
  place-items: center;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.history-sentinel {
  height: 1px;
}

.history-item {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  column-gap: 14px;
  row-gap: 4px;
  align-items: start;
  min-height: 86px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

@supports (content-visibility: auto) {
  .history-list .history-item {
    content-visibility: auto;
    contain-intrinsic-size: 104px;
  }

  .community-detail-history-section .history-item {
    contain-intrinsic-size: 118px;
  }
}

.history-thumb {
  width: 72px;
  aspect-ratio: 3 / 4;
  height: auto;
  border-radius: 7px;
  background: #edf7fb;
  object-fit: cover;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.history-body-photo {
  width: 72px;
  aspect-ratio: 3 / 4;
  height: auto;
  border-radius: 8px;
  background: #edf7fb;
  object-fit: cover;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
  user-select: none;
  -webkit-user-drag: none;
}

.history-body-photo.is-empty {
  border: 1px solid var(--line);
}

.history-item.is-food {
  grid-template-columns: 72px minmax(0, 1fr);
  align-items: start;
}

.history-item.is-body-record,
.history-item.is-health-record {
  grid-template-columns: 72px minmax(0, 1fr);
  align-items: start;
}

.history-item.is-food .history-food-gallery {
  grid-column: 1;
  grid-row: 1;
}

.history-item.is-body-record .history-body-photo,
.history-item.is-health-record .history-health-thumb {
  grid-column: 1;
  grid-row: 1;
}

.history-food-gallery {
  position: relative;
  width: 72px;
  aspect-ratio: 1 / 1;
  overflow-x: auto;
  overflow-y: hidden;
  border-radius: 8px;
  background: #edf7fb;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  scrollbar-width: none;
}

.history-food-gallery::-webkit-scrollbar {
  display: none;
}

.history-food-gallery.is-empty {
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  background: #edf7fb;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.history-food-track {
  width: 100%;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  height: 100%;
}

.history-food-track img {
  width: 100%;
  height: 100%;
  flex: 0 0 100%;
  border: 0;
  border-radius: 8px;
  background: #edf7fb;
  object-fit: cover;
  box-shadow: none;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  user-select: none;
  -webkit-user-drag: none;
}

.history-main {
  min-width: 0;
}

.history-item.is-food .history-main {
  grid-column: 2;
  min-width: 0;
}

.history-item.is-body-record .history-main,
.history-item.is-health-record .history-main {
  grid-column: 2;
  min-width: 0;
}

.history-health-thumb {
  position: relative;
  overflow: hidden;
  grid-template-rows: minmax(0, 1fr) auto;
  align-items: center;
  justify-items: center;
  gap: 4px;
  padding: 8px 5px 6px;
  border: 1px solid rgba(75, 159, 178, 0.16);
  background:
    linear-gradient(145deg, rgba(237, 250, 253, 0.98), rgba(246, 241, 249, 0.94));
  color: #5166c6;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.86);
}

.history-health-thumb.is-workout {
  border-color: rgba(242, 91, 115, 0.16);
  background:
    linear-gradient(145deg, rgba(255, 246, 239, 0.98), rgba(235, 251, 252, 0.94));
  color: #e55368;
}

.history-health-thumb::after {
  display: none;
}

.history-health-icon-image {
  position: relative;
  z-index: 1;
  width: min(54px, 100%);
  height: 54px;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 5px 9px rgba(56, 76, 112, 0.16));
  user-select: none;
  -webkit-user-drag: none;
}

.history-health-thumb-label {
  position: relative;
  z-index: 1;
  color: rgba(31, 48, 55, 0.72);
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.03em;
}

.history-time {
  margin: 0;
  font-weight: 780;
}

.history-head {
  min-width: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.history-head .history-time {
  min-width: 0;
  padding-top: 3px;
}

.history-record-actions {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.history-note {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.history-mood {
  max-width: 46ch;
  margin: 4px 0 0;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.history-food-mood {
  margin-top: 8px;
  color: rgba(18, 31, 26, 0.82);
}

.history-weight {
  align-self: start;
  padding-top: 0;
  color: var(--primary-strong);
  font-size: 20px;
  font-weight: 820;
  white-space: nowrap;
}

.history-food-list {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.history-food-entry {
  max-width: 100%;
  border: 1px solid rgba(75, 159, 178, 0.12);
  border-radius: 8px;
  padding: 6px 7px;
  background: rgba(239, 250, 253, 0.82);
}

.history-food-entry > strong,
.history-food-entry > span,
.history-food-entry > small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-food-entry > strong {
  color: var(--ink);
  font-size: 12px;
  font-weight: 820;
}

.history-food-entry > span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 720;
}

.history-food-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 5px;
}

.history-food-summary strong,
.history-food-summary span {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  border-radius: 999px;
  padding: 3px 7px;
  white-space: nowrap;
}

.history-food-summary strong {
  background: var(--calorie-gold-soft, rgba(156, 108, 25, 0.1));
  color: var(--calorie-gold, #9c6c19);
  font-size: 12px;
  font-weight: 860;
}

.history-weight-summary strong {
  background: rgba(74, 147, 190, 0.13);
  color: #397c9f;
}

.history-health-summary strong {
  background: rgba(141, 131, 216, 0.14);
  color: #6b63a9;
}

.history-workout-summary strong {
  background: rgba(212, 170, 102, 0.16);
  color: #8a691f;
}

.history-food-summary span {
  background: rgba(75, 159, 178, 0.1);
  color: #607480;
  font-size: 11px;
  font-weight: 740;
}

.history-health-list {
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
}

.history-health-entry > strong,
.history-health-entry > span {
  white-space: normal;
  text-overflow: clip;
}

.history-food-list > span {
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid rgba(75, 159, 178, 0.12);
  border-radius: 999px;
  padding: 4px 8px;
  background: rgba(239, 250, 253, 0.82);
  color: var(--ink);
  font-size: 12px;
  font-weight: 760;
}

.history-food-processing {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  margin-top: 8px;
  border: 1px solid rgba(75, 159, 178, 0.14);
  border-radius: 13px;
  padding: 10px;
  background: rgba(232, 248, 252, 0.82);
}

.history-food-processing > span:nth-child(2) {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.history-food-processing strong,
.history-food-processing small {
  display: block;
}

.history-food-processing strong {
  color: var(--ink);
  font-size: 12px;
  line-height: 1.3;
}

.history-food-processing small {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}

.history-food-processing-icon {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border-radius: 11px;
  background: rgba(75, 159, 178, 0.13);
  color: var(--primary-strong);
  font-size: 14px;
  font-weight: 850;
}

.history-food-processing-icon i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  animation: foodAiPulse 900ms ease-in-out infinite;
}

.history-food-processing-icon i:nth-child(2) { animation-delay: 120ms; }
.history-food-processing-icon i:nth-child(3) { animation-delay: 240ms; }

.history-food-processing.is-failed {
  grid-template-columns: 34px minmax(0, 1fr) auto;
  border-color: rgba(186, 57, 43, 0.14);
  background: rgba(255, 242, 240, 0.72);
}

.history-food-processing.is-failed .history-food-processing-icon {
  background: rgba(186, 57, 43, 0.1);
  color: #ba392b;
}

.history-food-processing button {
  min-height: 30px;
  border: 0;
  border-radius: 999px;
  padding: 0 10px;
  background: rgba(186, 57, 43, 0.1);
  color: #a93529;
  box-shadow: none;
  font-size: 11px;
  font-weight: 800;
}

.history-food-list em {
  color: var(--muted);
  font-style: normal;
  font-weight: 700;
}

.history-food-calories {
  color: var(--calorie-gold, #9c6c19);
  font-size: 18px;
  font-weight: 860;
  white-space: nowrap;
}

.delete-record-button,
.edit-record-button {
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  z-index: 3;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  min-height: 30px;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #ba392b;
  padding: 0;
  overflow: hidden;
  box-shadow: none;
  pointer-events: auto;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.delete-record-button *,
.edit-record-button * {
  pointer-events: none;
}

.edit-record-button {
  color: var(--primary-strong);
}

.delete-record-button:hover:not(:disabled) {
  background: transparent;
  box-shadow: none;
}

.edit-record-button:hover:not(:disabled),
.edit-record-button:focus-visible,
.edit-record-button:active:not(:disabled) {
  border: 0;
  background: transparent;
  color: var(--primary-strong);
  box-shadow: none;
}

.delete-record-button:active:not(:disabled) {
  background: transparent;
  box-shadow: none;
  transform: scale(0.985);
}

.delete-record-button .record-delete-icon {
  width: 15px;
  height: 15px;
  display: block;
}

.edit-record-button .record-edit-icon {
  width: 15px;
  height: 15px;
  display: block;
}

.edit-record-button .record-edit-icon svg {
  width: 100%;
  height: 100%;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.delete-record-button .record-delete-icon svg {
  width: 100%;
  height: 100%;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

html[data-theme^="glass-"] .delete-record-button,
html[data-theme^="glass-"] .delete-record-button:focus:not(:focus-visible) {
  border: 0;
  background: transparent;
  color: #b94d52;
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

html[data-theme^="glass-"] .delete-record-button:hover:not(:disabled),
html[data-theme^="glass-"] .delete-record-button:focus-visible,
html[data-theme^="glass-"] .delete-record-button:active:not(:disabled) {
  border: 0;
  background: transparent;
  color: #a83f48;
  box-shadow: none;
}

html[data-theme^="glass-"] .edit-record-button,
html[data-theme^="glass-"] .edit-record-button:hover:not(:disabled),
html[data-theme^="glass-"] .edit-record-button:focus-visible,
html[data-theme^="glass-"] .edit-record-button:active:not(:disabled) {
  border: 0;
  background: transparent;
  color: #2f8393;
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

html[data-theme^="glass-"] .history-food-summary:not(.history-health-summary) strong,
html[data-theme^="glass-"] .history-food-calories {
  color: #a97724;
}

html[data-theme^="glass-"] .history-food-summary:not(.history-health-summary) strong {
  background: rgba(169, 119, 36, 0.12);
}

html[data-theme^="glass-"] .history-health-summary strong {
  color: #6b63a9;
}

html[data-theme^="glass-"] .history-workout-summary strong {
  color: #8a691f;
}

html[data-theme^="glass-"] .history-weight-summary strong {
  background: rgba(83, 158, 202, 0.16);
  color: #327894;
}
