body {
    font-variant: small-caps;
  letter-spacing: 1px;
  font-family: 'Segoe UI', 'Inter', 'Roboto', sans-serif;
  max-width: 600px;
  margin: auto;
  padding: 20px;
  background-color: #f2f7fc;
}

.install-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin: 12px auto 18px;
  padding: 14px 16px;
  border: 1px solid #d6e4f5;
  border-radius: 16px;
  background: linear-gradient(180deg, #fbfdff 0%, #f3f8ff 100%);
  box-shadow: 0 10px 24px rgba(16, 30, 56, 0.08);
}

.install-banner p {
  margin: 4px 0 0;
  color: #66758f;
  font-size: 13px;
}

.install-banner-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.install-banner-actions button {
  width: auto;
  min-width: 100px;
  margin: 0;
}

.weight-header-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}


#weight-entry-form {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

#weight-entry-form input {
  flex: 1 1 180px;
  margin: 0;
}

#weight-entry-form button,
#weight-lock-btn {
  width: auto;
  min-width: 120px;
  margin: 0;
}

.weight-history-date {
  font-size: 12px;
  color: #66758f;
}

.planner-grid {
  margin-bottom: 12px;
}

.planner-grid select {
  margin: 0;
  border: 1px solid #cddcf2;
  border-radius: 12px;
  background: #fcfdff;
  color: #21304e;
  padding: 10px;
  box-sizing: border-box;
}

.planner-results {
  margin-top: 16px;
}

.planner-chart-wrap {
  margin-top: 12px;
  height: 300px;
}

h1, h2 {
  color: #3658a7;
}

input, button {
  margin: 8px 0;
  padding: 10px;
  width: 100%;
  box-sizing: border-box;
  font-size: 16px;
}

input {
  border: 1px solid #cddcf2;
  border-radius: 12px;
  background: #fcfdff;
  color: #21304e;
  box-shadow: inset 0 1px 2px rgba(16, 30, 56, 0.04);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

input:focus {
  outline: none;
  border-color: #6ca7ef;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(108, 167, 239, 0.18);
}

button {
  background-color: #3690f2;
  color: white;
  border: none;
  cursor: pointer;
  font-weight: bold;
}

button:hover {
  background-color: #2b76cc;
}

ul {
  list-style: none;
  padding: 0;
}

li {
  background: white;
  padding: 12px;
  border: 1px solid #d0e3f7;
  border-radius: 8px;
  margin-bottom: 10px;
  box-shadow: 0 2px 5px rgba(54, 162, 235, 0.08);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#total-calories {
  font-weight: bold;
  font-size: 18px;
  margin-top: 20px;
}

#login-btn {
  margin-bottom: 10px;
}

#remaining-calories {
  font-weight: bold;
  font-size: 18px;
  color: #3658a7;
  margin-top: 5px;
}

#meal-list button {
  margin-left: 0;
  padding: 5px 8px;
  border: none;
  font-size: 14px;
  cursor: pointer;
  border-radius: 4px;
}

#meal-list button:hover {
  opacity: 0.8;
}

.today-meal-info {
  display: grid;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.entry-intro {
  margin: 0 0 10px;
  color: #4f5d75;
}

.macro-inputs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.macro-input-field {
  display: grid;
  gap: 4px;
  font-size: 12px;
  color: #66758f;
}

.macro-input-field input {
  margin: 0;
  min-width: 10ch;
}

.estimate-photo-field {
  margin-top: 8px;
}

.estimate-photo-title {
  display: block;
  margin-bottom: 8px;
  color: #3658a7;
  font-size: 15px;
  font-weight: 600;
  font-variant: normal;
}

.photo-picker-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}

.photo-picker-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 48px;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid #d6e4f5;
  border-radius: 14px;
  background: linear-gradient(180deg, #fbfdff 0%, #eef5ff 100%);
  color: #3658a7;
  font-size: 14px;
  font-weight: 800;
  font-variant: normal;
  box-shadow: 0 4px 12px rgba(54, 88, 167, 0.1);
}

.photo-picker-btn:hover,
.photo-picker-btn:focus-visible {
  border-color: #9ab7ec;
  background: #eef5ff;
}

.photo-picker-icon {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  fill: #111;
}

.meal-photo-preview {
  position: relative;
  width: fit-content;
  max-width: 100%;
  margin: 10px 0;
}

.meal-photo-preview img {
  display: block;
  width: 100%;
  max-width: 220px;
  border-radius: 12px;
  border: 1px solid #d6e4f5;
  box-shadow: 0 6px 18px rgba(16, 30, 56, 0.1);
}

.meal-photo-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 999px;
  background: rgba(16, 30, 56, 0.82);
  color: #fff;
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 4px 12px rgba(16, 30, 56, 0.24);
}

.estimate-lock-note {
  margin: 10px 0;
  padding: 10px 12px;
  border: 1px solid #f0d7a1;
  border-radius: 10px;
  background: #fff8e6;
  color: #8a5a00;
  font-size: 13px;
}

.entry-methods {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  width: auto;
  gap: 0;
  margin: 8px 0 0;
  position: relative;
  z-index: 1;
  box-sizing: border-box;
}

.entry-method-btn {
  margin: 0;
  width: 100%;
  min-width: 0;
  padding: 9px 10px;
  border-radius: 0;
  background: linear-gradient(180deg, #edf4ff 0%, #dfeafb 100%);
  color: #3658a7;
  border: 1px solid #c9dcf8;
  border-bottom: none;
}

.entry-method-btn:first-child {
  border-top-left-radius: 14px;
}

.entry-method-btn:last-child {
  border-top-right-radius: 14px;
}

.entry-method-btn:hover {
  background: linear-gradient(180deg, #dfeafb 0%, #cfdef5 100%);
  color: #1f3f82;
}

.entry-method-btn.active {
  background: linear-gradient(180deg, #ffffff 0%, #f7fbff 100%);
  color: #244a8f;
  border-color: #cfdcf0;
  box-shadow: 0 -1px 0 rgba(255, 255, 255, 0.7), 0 8px 20px rgba(54, 88, 167, 0.06);
}

.entry-method-btn.active:hover {
  background: linear-gradient(180deg, #ffffff 0%, #f7fbff 100%);
  color: #244a8f;
}

.entry-panel {
  display: none;
  width: auto;
  margin: -1px 0 0;
  padding: 14px;
  border: 1px solid #d6e4f5;
  border-radius: 0 0 16px 16px;
  background: linear-gradient(180deg, #fbfdff 0%, #f4f9ff 100%);
  box-sizing: border-box;
}

.entry-panel.active {
  display: block;
}

.entry-help {
  margin-top: 0;
  color: #4f5d75;
}

#barcode-reader {
  scroll-margin-top: 24px;
}

.favorite-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0 10px;
  color: #4f5d75;
}

.favorite-action-btn {
  width: auto;
  min-width: 96px;
  height: 34px;
  margin: 0;
  padding: 0 12px;
  border-radius: 999px;
  background: #fff4d6;
  color: #8a5a00;
}

.favorite-action-btn:hover {
  background: #ffe8ad;
}

.favorite-action-btn.favorite-saved {
  background: #d9f3e2;
  color: #1f7a45;
}

.favorite-action-btn.favorite-saved:disabled {
  opacity: 1;
  cursor: default;
}

.favorite-toggle input {
  width: auto;
  margin: 0;
}

.favorite-list {
  display: grid;
  gap: 10px;
}

.favorite-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid #d6e4f5;
  border-radius: 12px;
  background: linear-gradient(180deg, #fbfdff 0%, #f3f8ff 100%);
}

.favorite-card-body {
  display: grid;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.favorite-card-head {
  display: flex;
  justify-content: flex-start;
  gap: 10px;
  align-items: center;
}

.favorite-card-name {
  font-weight: 700;
  color: #21304e;
}

.favorite-card-meta {
  color: #66758f;
  font-size: 13px;
}

.favorite-card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
  justify-content: flex-end;
  flex: 0 0 auto;
}

.favorite-card-actions button {
  margin: 0;
}

.app-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 18px 0 0;
  position: relative;
  z-index: 2;
}

.app-tab-btn {
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 12px 14px;
  border-radius: 16px 16px 0 0;
  background: linear-gradient(180deg, #edf4ff 0%, #dfeafb 100%);
  color: #3658a7;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  border: 1px solid #cfdcf0;
  border-bottom: none;
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.35);
}

.app-tab-btn:hover {
  background: linear-gradient(180deg, #dfeafb 0%, #cfdef5 100%);
  color: #1f3f82;
}

.app-tab-btn.active,
.app-tab-btn.active:hover {
  background: linear-gradient(180deg, #ffffff 0%, #f7fbff 100%);
  color: #244a8f;
  box-shadow: 0 -1px 0 rgba(255, 255, 255, 0.7), 0 8px 22px rgba(54, 88, 167, 0.08);
}

.app-tab-panel {
  display: none;
  position: relative;
  margin-top: -1px;
  padding: 18px;
  border: 1px solid #d6e4f5;
  border-radius: 0 0 18px 18px;
  background: linear-gradient(180deg, #fbfdff 0%, #f4f9ff 100%);
  box-shadow: 0 18px 36px rgba(16, 30, 56, 0.08);
}

.app-tab-panel.active {
  display: block;
}

.app-tab-panel .card {
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(208, 227, 247, 0.9);
  box-shadow: 0 8px 18px rgba(54, 162, 235, 0.06);
}

.app-tab-panel #card-progress {
  background: transparent;
  border: none;
  box-shadow: none;
}

.app-tab-panel #card-add-meal {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
  margin-left: -6px;
  margin-right: -6px;
}

.app-tab-panel #card-meals {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
  margin-left: -6px;
  margin-right: -6px;
}

.app-tab-panel #card-weight-tools {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
  margin-left: -14px;
  margin-right: -14px;
}

#card-add-meal .card-header {
  padding: 0 6px 6px;
}

#card-meals .card-header {
  padding: 0 6px 6px;
}

#card-weight-tools .card-header {
  padding: 0 14px 6px;
}

.app-tab-panel .card + .card {
  margin-top: 18px;
}

.favorite-empty {
  padding: 14px;
  border: 1px dashed #cddcf2;
  border-radius: 12px;
  color: #66758f;
  background: #f8fbff;
}

.meal-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: auto;
  gap: 0;
  margin: 8px 0 0;
  margin-bottom: 0;
  position: relative;
  z-index: 1;
  box-sizing: border-box;
}

.meal-tab-btn {
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 11px 14px;
  border-radius: 0;
  background: linear-gradient(180deg, #edf4ff 0%, #dfeafb 100%);
  color: #3658a7;
  border: 1px solid #cfdcf0;
  border-bottom: none;
}

.meal-tab-btn:first-child {
  border-top-left-radius: 14px;
}

.meal-tab-btn:last-child {
  border-top-right-radius: 14px;
}

.meal-tab-btn:hover {
  background: linear-gradient(180deg, #dfeafb 0%, #cfdef5 100%);
  color: #1f3f82;
}

.meal-tab-btn.active {
  background: linear-gradient(180deg, #ffffff 0%, #f7fbff 100%);
  color: #244a8f;
  box-shadow: 0 -1px 0 rgba(255, 255, 255, 0.7), 0 8px 20px rgba(54, 88, 167, 0.06);
}

.meal-tab-btn.active:hover {
  background: linear-gradient(180deg, #ffffff 0%, #f7fbff 100%);
  color: #244a8f;
}

.meal-tab-panel {
  display: none;
  margin-top: -1px;
  width: auto;
  margin-left: 0;
  margin-right: 0;
  padding: 16px;
  border: 1px solid #d6e4f5;
  border-radius: 0 0 16px 16px;
  background: linear-gradient(180deg, #fbfdff 0%, #f4f9ff 100%);
  box-sizing: border-box;
}

#card-meals.meals-tab-diary-active .meal-tab-panel.active {
  border-radius: 0 0 16px 16px;
}

#card-meals.meals-tab-today-active .meal-tab-panel.active {
  border-radius: 0 0 16px 16px;
}

.meal-tab-panel.active {
  display: block;
}

.weight-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: auto;
  gap: 0;
  margin: 8px 0 0;
  position: relative;
  z-index: 1;
  box-sizing: border-box;
}

.weight-tab-btn {
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 11px 14px;
  border-radius: 0;
  background: linear-gradient(180deg, #edf4ff 0%, #dfeafb 100%);
  color: #3658a7;
  border: 1px solid #cfdcf0;
  border-bottom: none;
}

.weight-tab-btn:first-child {
  border-top-left-radius: 14px;
}

.weight-tab-btn:last-child {
  border-top-right-radius: 14px;
}

.weight-tab-btn:hover {
  background: linear-gradient(180deg, #dfeafb 0%, #cfdef5 100%);
  color: #1f3f82;
}

.weight-tab-btn.active,
.weight-tab-btn.active:hover {
  background: linear-gradient(180deg, #ffffff 0%, #f7fbff 100%);
  color: #244a8f;
  box-shadow: 0 -1px 0 rgba(255, 255, 255, 0.7), 0 8px 20px rgba(54, 88, 167, 0.06);
}

.weight-tab-panel {
  display: none;
  margin-top: -1px;
  width: auto;
  margin-left: 0;
  margin-right: 0;
  padding: 16px;
  border: 1px solid #d6e4f5;
  border-radius: 0 0 16px 16px;
  background: linear-gradient(180deg, #fbfdff 0%, #f4f9ff 100%);
  box-sizing: border-box;
}

.weight-tab-panel.active {
  display: block;
}

.diary-controls {
  display: flex;
  justify-content: center;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.diary-search-input {
  margin: 0 0 16px;
}

.diary-date-jump {
  display: grid;
  gap: 6px;
  color: #4f5d75;
  font-size: 13px;
}

.diary-date-jump input {
  margin: 0;
}

.diary-pagination {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  justify-content: center;
}

.diary-pagination button {
  width: auto;
  min-width: 88px;
  margin: 0;
  padding: 9px 14px;
  border-radius: 999px;
  background: #eef4fb;
  color: #3658a7;
}

.diary-pagination button:hover {
  background: #ddeaf9;
}

.diary-pagination button:disabled {
  opacity: 0.5;
  cursor: default;
}

.chart-pagination {
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid #d6e4f5;
  border-radius: 12px;
  background: linear-gradient(180deg, #fbfdff 0%, #f3f8ff 100%);
}

.diary-page-info {
  font-size: 13px;
  color: #4f5d75;
  min-width: 110px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  white-space: nowrap;
  font-family: 'Segoe UI', 'Inter', 'Roboto', sans-serif;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.meal-log-empty {
  padding: 16px;
  border: 1px dashed #cddcf2;
  border-radius: 12px;
  color: #4f5d75;
  background: #f8fbff;
}

.today-meals-date {
  margin-bottom: 10px;
  font-size: 14px;
  font-weight: 700;
  color: #3658a7;
}

.today-meal-actions {
  display: flex;
  align-items: flex-end;
  flex-direction: column;
  flex: 0 0 auto;
  gap: 10px;
  justify-content: flex-start;
}

.qty-stepper {
  display: inline-flex;
  align-items: center;
  gap: 0;
  border: 1px solid #cddcf2;
  border-radius: 999px;
  overflow: hidden;
  background: #f8fbff;
}

.qty-stepper-btn {
  width: 32px;
  min-width: 32px;
  padding: 5px 0;
  margin: 0;
  border-radius: 0;
  background: transparent;
  color: #3658a7;
  font-size: 16px;
}

.qty-stepper-btn:hover {
  background: #e9f2ff;
}

.qty-badge,
.meal-qty {
  font-size: 13px;
  color: #3658a7;
  font-weight: 700;
}

.qty-badge {
  min-width: 34px;
  padding: 0 10px;
  text-align: center;
}

.meal-time {
  font-size: 12px;
  color: #66758f;
}

.meal-type-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.diary-day-type-summary {
  margin-top: 10px;
  margin-bottom: 0;
}

.meal-type-summary-item {
  padding: 10px 12px;
  border: 1px solid #d6e4f5;
  border-radius: 12px;
  background: linear-gradient(180deg, #fbfdff 0%, #f3f8ff 100%);
  text-align: center;
}

.meal-type-summary-label {
  display: block;
  font-size: 12px;
  color: #66758f;
  margin-bottom: 4px;
}

.meal-type-summary-value {
  display: block;
  font-weight: 700;
  color: #3658a7;
}

.meal-type-summary-macros {
  display: block;
  margin-top: 4px;
  font-size: 10px;
  font-weight: 700;
  color: #66758f;
  font-variant: normal;
  letter-spacing: 0;
  line-height: 1.25;
  white-space: nowrap;
}

.meal-type-select {
  width: auto;
  min-width: 96px;
  margin: 0;
  padding: 6px 8px;
  border: 1px solid #cddcf2;
  border-radius: 10px;
  background: #f8fbff;
  color: #3658a7;
  font-size: 12px;
  font-weight: 700;
}

.meal-macros {
  font-size: 12px;
  color: #3658a7;
}

.meal-macros.muted {
  color: #66758f;
}

.calorie-meter-stack {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

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

.split-meter {
  position: relative;
  height: 48px;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid #d2e0f2;
  background: #edf3fb;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.split-meter:focus,
.split-meter:focus-visible {
  outline: none;
  box-shadow: none;
}

.split-meter-segment {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 0;
  transition: width 0.35s ease;
}

.split-meter-right {
  right: 0;
}

.split-meter-calories .split-meter-left {
  background: linear-gradient(90deg, #6ca7ef 0%, #3658a7 100%);
}

.split-meter-calories .split-meter-right {
  background: linear-gradient(90deg, #d7e5f8 0%, #b9cff0 100%);
}

.split-meter-protein .split-meter-left {
  background: linear-gradient(90deg, #78d5c0 0%, #239f83 100%);
}

.split-meter-protein .split-meter-right {
  background: linear-gradient(90deg, #daf5ee 0%, #bfeadf 100%);
}

.split-meter-carbs .split-meter-left {
  background: linear-gradient(90deg, #f3cd6b 0%, #d69a1c 100%);
}

.split-meter-carbs .split-meter-right {
  background: linear-gradient(90deg, #fbefc8 0%, #f6e0a0 100%);
}

.split-meter-fat .split-meter-left {
  background: linear-gradient(90deg, #f59c84 0%, #da6544 100%);
}

.split-meter-fat .split-meter-right {
  background: linear-gradient(90deg, #fde0d6 0%, #f7c2b0 100%);
}

.split-meter-label {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 700;
  color: #183153;
  text-shadow: none;
  margin: 0;
  padding: 0;
}

.split-meter-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  min-width: 160px;
  padding: 0 14px;
  margin: 0;
  line-height: 1;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(2px);
  border-radius: 999px;
}

.split-meter-calories {
  height: 52px;
}

.action-icon-btn {
  width: 34px;
  min-width: 34px;
  height: 34px;
  padding: 0;
  margin: 0;
  border-radius: 999px;
  background: #eef4fb;
  color: #3658a7;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.action-icon-btn:hover {
  background: #ddeaf9;
}

.action-icon-btn.danger {
  background: #fff0ef;
  color: #b42318;
}

.action-icon-btn.danger:hover {
  background: #ffdcd7;
}

.action-icon-btn.add-btn {
  background: #e2f3e8;
  color: #1f7a45;
}

.action-icon-btn.add-btn:hover {
  background: #cfead9;
}

.save-action-btn {
  width: auto;
  min-width: 74px;
  margin: 0;
  padding: 8px 12px;
  border-radius: 999px;
}

.save-action-btn.cancel-btn {
  background: #eef4fb;
  color: #3658a7;
  border: 1px solid #c7d9f3;
}

.save-action-btn.cancel-btn:hover {
  background: #ddeaf9;
}

button:contains("🗑️") {
  background-color: #ff6666;
  color: white;
}

button:contains("✎") {
  background-color: #ffc107;
  color: black;
}


.google-signin-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: #fff;
  color: #3c4043;
  font-family: Roboto, sans-serif;
  font-weight: 500;
  font-size: 14px;
  padding: 10px 16px;
  border: 1px solid #dadce0;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.2s ease-in-out;
  white-space: nowrap;

  /* 🔥 Force fit-content width */
  width: fit-content;
  max-width: 100%;
  box-sizing: border-box;
}


.google-signin-btn img {
  height: 18px;
  width: 18px;
  display: inline-block;
  vertical-align: middle;
}


.google-signin-btn:hover {
  background-color: #f7f8f8;
}

.auth-bar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  position: relative;
}

.goal-chip {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid #d6e4f5;
  border-radius: 16px;
  background: linear-gradient(180deg, #fbfdff 0%, #f3f8ff 100%);
  box-shadow: 0 8px 18px rgba(16, 30, 56, 0.08);
}

.goal-chip-text {
  display: grid;
  gap: 2px;
  text-align: right;
}

.goal-chip-label {
  font-size: 11px;
  color: #66758f;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.goal-chip-value {
  font-size: 16px;
  font-weight: 700;
  color: #21304e;
}

.goal-chip-macros {
  font-size: 12px;
  color: #66758f;
}

/* ---- Goal chip expanded edit form ---- */
/* The form drops below the chip display row as a clean block panel.       */
/* .goal-chip switches to column layout when editing is active.            */

.goal-chip.editing {
  flex-direction: column;
  align-items: stretch;
  gap: 0;
}

.goal-chip.editing .goal-chip-text {
  padding-bottom: 12px;
  border-bottom: 1px solid #e4eef9;
  margin-bottom: 14px;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.goal-chip.editing .goal-chip-text .action-icon-btn {
  display: none;
}

.goal-chip-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

/* 4-column row: Calories | P | C | F */
.goal-chip-inputs-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 8px;
}

.goal-chip-macro-inputs {
  display: contents;
}

.goal-chip-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  font-variant: normal;
  color: #66758f;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.goal-chip-field input {
  margin: 0;
  width: 100%;
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  padding: 7px 6px;
  border-radius: 8px;
}

.goal-chip-form-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.goal-chip-form-actions button {
  width: auto;
  margin: 0;
  font-variant: normal;
}

#goal-chip-input {
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  margin: 0;
  padding: 7px 6px;
  border-radius: 8px;
  width: 100%;
}

.user-chip-text {
  display: grid;
  gap: 2px;
  text-align: left;
}

.avatar-btn {
  width: 48px;
  min-width: 48px;
  height: 48px;
  padding: 0;
  position: relative;
  border-radius: 999px;
  overflow: visible;
  background: linear-gradient(135deg, #3658a7 0%, #6ca7ef 100%);
  box-shadow: 0 6px 16px rgba(54, 88, 167, 0.2);
}

.avatar-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(54, 88, 167, 0.24);
}

.user-avatar {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 999px;
}

.friend-request-badge {
  position: absolute;
  top: -8px;
  right: -10px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: #b42318;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(180, 35, 24, 0.24);
}

.user-menu {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  min-width: 140px;
  background: #fff;
  border: 1px solid #d6e4f5;
  border-radius: 12px;
  box-shadow: 0 14px 30px rgba(16, 30, 56, 0.14);
  padding: 6px;
  z-index: 20;
}

.user-menu-item {
  width: 100%;
  background: transparent;
  color: #21304e;
  text-align: left;
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-variant: normal;
  letter-spacing: 0;
}

.user-menu-item:hover {
  background: #eef5ff;
}

.user-menu-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  color: #66758f;
  transition: color 0.2s ease;
}

.user-menu-item:hover .user-menu-icon {
  color: #3658a7;
}

.user-menu-label {
  flex: 1 1 auto;
  min-width: 0;
}

#logout-btn .user-menu-icon {
  color: #b42318;
}

#logout-btn:hover {
  background: #fff0ef;
  color: #b42318;
}

#logout-btn:hover .user-menu-icon {
  color: #b42318;
}

.menu-friend-request-badge {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: #b42318;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
}

.user-status {
  color: #21304e;
  font-size: 14px;
  font-weight: 700;
  margin: 0;
}

.user-email {
  color: #66758f;
  font-size: 12px;
  margin: 0;
}

#auth-buttons {
  position: relative;
}

.settings-btn {
  width: 42px;
  min-width: 42px;
  height: 42px;
  padding: 0;
  margin-left: 10px;
  border-radius: 999px;
  background-color: #3658a7;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.settings-modal {
  position: fixed;
  inset: 0;
  background: rgba(16, 30, 56, 0.45);
  padding: 20px;
  z-index: 1000;
}

.settings-panel {
  max-width: 900px;
  max-height: calc(100vh - 40px);
  overflow: auto;
  margin: 0 auto;
  background: #fff;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 18px 40px rgba(16, 30, 56, 0.2);
}

.settings-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: nowrap;
}

.settings-section {
  margin: 12px 0 18px;
  padding: 14px;
  background: #f8fbff;
  border: 1px solid #d6e4f5;
  border-radius: 12px;
}

.settings-section h3 {
  margin: 0 0 10px;
  color: #3658a7;
}

#settings-goal-form {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

#macro-backfill-form {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

#settings-goal-form input {
  flex: 1 1 220px;
  margin: 0;
}

#macro-backfill-form input {
  flex: 1 1 220px;
  margin: 0;
}

#settings-goal-form button {
  width: auto;
  min-width: 120px;
  margin: 0;
}

#macro-backfill-form button {
  width: auto;
  min-width: 180px;
  margin: 0;
}

.logs-meta,
.logs-error {
  font-size: 14px;
  color: #4f5d75;
}

.logs-error {
  color: #b42318;
}

.logs-list {
  margin-top: 16px;
  display: grid;
  gap: 12px;
}

.estimate-panel {
  max-width: 560px;
  position: relative;
}

#barcode-portion-modal .settings-panel-header.barcode-header,
#estimate-modal .settings-panel-header.estimate-header {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  position: static;
  padding-right: 0;
  margin-bottom: 18px;
}

#barcode-portion-modal .settings-panel-header.barcode-header h2,
#estimate-modal .settings-panel-header.estimate-header h2 {
  margin: 0;
  font-size: 18px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1 1 auto;
  min-width: 0;
}

#barcode-portion-modal .estimate-header-actions,
#estimate-modal .estimate-header-actions {
  display: flex;
  gap: 6px;
  flex: 0 0 auto;
  align-items: center;
  margin-left: auto;
}

#barcode-portion-modal .estimate-header-actions button,
#estimate-modal .estimate-header-actions button {
  width: auto;
  min-width: 0;
  min-height: 42px;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 0.9em;
  font-weight: 700;
  font-variant: normal;
  white-space: nowrap;
  line-height: 1.2;
}

#barcode-portion-modal .estimate-header-actions #barcode-portion-add-btn,
#estimate-modal .estimate-header-actions #estimate-add-btn {
  background: #3690f2;
  border: 1px solid #3690f2;
  color: #fff;
}

#barcode-portion-modal .estimate-header-actions #barcode-portion-add-btn:hover,
#estimate-modal .estimate-header-actions #estimate-add-btn:hover {
  background: #2b76cc;
  border-color: #2b76cc;
}

/* Force the meal-edit modal header onto one row with title left, buttons
   right. We need high-specificity overrides because:
     1. The global `input, button` rule sets width:100% which would
        otherwise cause the buttons to wrap onto separate lines.
     2. The mobile media query at @media (max-width: 640px) sets
        flex-direction: column on .settings-panel-header, which stacks
        the title above the buttons. We explicitly opt out of that here. */
#meal-edit-modal .settings-panel-header.meal-edit-header {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  position: static;
  padding-right: 0;
  margin-bottom: 14px;
}

#meal-edit-modal .settings-panel-header.meal-edit-header h2 {
  display: flex;
  align-items: center;
  min-height: 42px;
  margin: 0;
  font-size: 18px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
  flex: 0 1 auto;
  min-width: 0;
}

#meal-edit-modal .meal-edit-header-actions {
  display: flex;
  gap: 6px;
  flex: 0 0 auto;
  flex-wrap: nowrap;
  align-items: center;
  margin-left: auto; /* Pin to the right edge regardless of title width */
}

/* Both buttons share these dimensions so they look like a paired set. */
#meal-edit-modal .meal-edit-header-actions button {
  margin: 0;
  width: auto;
  min-width: 0;
  max-width: none;
  min-height: 42px;
  padding: 10px 14px;
  font-size: 0.9em;
  font-weight: 700;
  font-variant: normal;
  letter-spacing: 0;
  border-radius: 6px;
  cursor: pointer;
  flex: 0 0 auto;
  white-space: nowrap;
  line-height: 1.2;
}

#meal-edit-modal .meal-edit-header-actions .meal-edit-save-btn-top {
  background: #3658a7;
  color: #fff;
  border: 1px solid #3658a7;
}

#meal-edit-modal .meal-edit-header-actions .meal-edit-save-btn-top:hover {
  background: #2a4685;
  border-color: #2a4685;
}

#meal-edit-modal .meal-edit-header-actions .meal-edit-save-btn-top:disabled {
  background: #b8c2d8;
  border-color: #b8c2d8;
  cursor: not-allowed;
}

/* Override the inherited .toggle-btn appearance so the Close button matches
   the Save button shape — same padding, same border-radius. Keep the muted
   red palette so its destructive intent is still visually distinct. */
#meal-edit-modal .meal-edit-header-actions .toggle-btn {
  background-color: #fff0ef;
  color: #b42318;
  border: 1px solid #f4b4ab;
}

#meal-edit-modal .meal-edit-header-actions .toggle-btn:hover {
  background-color: #ffdcd7;
}

#barcode-portion-modal .settings-panel-header.barcode-header .toggle-btn,
#estimate-modal .settings-panel-header.estimate-header .toggle-btn {
  position: static;
}

#meal-edit-modal .settings-panel-header.meal-edit-header .toggle-btn {
  /* The new flex header keeps Close inline; stop absolute-positioning it. */
  position: static;
}

.estimate-result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 8px 0 16px;
}

.estimate-result-card {
  display: grid;
  gap: 4px;
  padding: 14px;
  border: 1px solid #d6e4f5;
  border-radius: 14px;
  background: linear-gradient(180deg, #fbfdff 0%, #f3f8ff 100%);
}

.estimate-name-field {
  margin: 0 0 12px;
}

.estimate-name-field input,
.estimate-edit-card input {
  margin: 0;
}

.estimate-edit-number {
  width: 100%;
  font-size: 22px;
  font-weight: 700;
  color: #21304e;
  background: transparent;
  border: none;
  padding: 0;
  box-shadow: none;
}

.estimate-edit-number:focus {
  box-shadow: none;
}

.meal-edit-card input {
  margin: 0;
}

.meal-edit-number {
  font-size: 22px;
  font-weight: 700;
  color: #21304e;
  background: transparent;
  border: none;
  padding: 0;
  box-shadow: none;
}

.meal-edit-number:focus {
  box-shadow: none;
}

.estimate-result-label {
  font-size: 11px;
  color: #66758f;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.estimate-result-value {
  font-size: 22px;
  font-weight: 700;
  color: #21304e;
}

.estimate-result-assumption {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #f8fbff;
  border: 1px solid #d6e4f5;
  color: #4f5d75;
}

.portion-choice-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 16px;
}

.portion-choice-btn {
  margin: 0;
  background: #eef4fb;
  color: #3658a7;
}

.portion-choice-btn.active,
.portion-choice-btn.active:hover {
  background: #3658a7;
  color: #fff;
}

.estimate-slider-field {
  margin-bottom: 16px;
}

.estimate-slider-field input {
  margin: 0;
}

.toast-message {
  position: fixed;
  left: 50%;
  top: 24px;
  bottom: auto;
  transform: translateX(-50%);
  z-index: 1200;
  padding: 12px 16px;
  border-radius: 999px;
  background: #3658a7;
  border: 1px solid rgba(255, 255, 255, 0.72);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 0 0 4px rgba(54, 88, 167, 0.22), 0 14px 34px rgba(16, 30, 56, 0.28);
}

.settings-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.settings-actions button {
  width: auto;
  min-width: 150px;
}

.log-entry {
  background: linear-gradient(180deg, #fbfdff 0%, #f3f8ff 100%);
  border: 1px solid #d6e4f5;
  border-radius: 12px;
  padding: 14px;
}

.log-entry-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.log-entry-status {
  font-weight: 700;
  color: #3658a7;
  text-transform: capitalize;
}

.log-entry-status.success {
  color: #157347;
}

.log-entry-status.error,
.log-entry-status.failed {
  color: #b42318;
}

.shared-over-text {
  color: #b42318;
  font-weight: 700;
}

.shared-alert-card {
  border-color: #f4b4ab;
  background: linear-gradient(180deg, #fff0ef 0%, #ffdcd7 100%);
}

.shared-progress-section {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #e4eef9;
}

.shared-progress-section:first-of-type {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.shared-progress-title {
  font-size: 12px;
  font-weight: 700;
  color: #3658a7;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

.friends-notification-card {
  border-left: 4px solid #3658a7;
}

.friends-notification-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 8px;
  border-radius: 999px;
  background: #eef4fb;
  color: #3658a7;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.friends-notification-tag-alert {
  background: #ffe5e2;
  color: #b42318;
}

.shared-progress-card {
  border-left: 4px solid #3658a7;
}

.highlight-request-section {
  border-color: #f4b4ab;
  background: linear-gradient(180deg, #fff0ef 0%, #ffdcd7 100%);
  box-shadow: 0 10px 22px rgba(180, 35, 24, 0.12);
}

.log-entry-status.rate-limited,
.log-entry-status.rejected {
  color: #9a6700;
}

.log-entry-summary {
  display: grid;
  gap: 8px;
}

.log-entry-row {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 8px;
  align-items: start;
  font-size: 14px;
}

.log-entry-label {
  font-weight: 700;
  color: #3658a7;
}

.log-entry-value {
  color: #24324a;
  word-break: break-word;
}

.log-entry pre {
  white-space: pre-wrap;
  word-break: break-word;
  background: #fff;
  border-radius: 8px;
  padding: 10px;
  margin: 8px 0 0;
  font-family: Consolas, monospace;
  font-size: 13px;
}

@media (max-width: 640px) {
  .settings-panel {
    padding: 16px;
  }

  .settings-panel-header {
    align-items: flex-start;
    flex-direction: column;
  }

  #barcode-portion-modal .settings-panel-header.barcode-header,
  #estimate-modal .settings-panel-header.estimate-header {
    align-items: center;
    flex-direction: row;
  }

  .auth-bar,
  .user-chip {
    width: 100%;
  }

  .auth-bar:has(.user-chip[style*="inline-flex"]) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
  }

  .user-chip {
    width: auto;
    min-width: 0;
    justify-content: flex-start;
  }

  .goal-chip {
    width: auto;
    max-width: calc(100% - 12px);
    margin-left: auto;
    justify-content: flex-end;
  }

  .goal-chip-text {
    text-align: right;
  }

  .goal-chip-form {
    width: 100%;
    justify-content: flex-end;
  }

  .goal-chip-macro-inputs {
    width: 100%;
    grid-template-columns: 1fr;
  }

  .entry-methods {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    width: auto;
    gap: 0;
    margin: 8px 0 0;
    box-sizing: border-box;
  }

  .app-tabs {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }

  .app-tab-btn {
    padding: 8px 10px;
    font-size: 14px;
  }

  .app-tab-panel {
    padding: 14px;
    border-radius: 0 0 14px 14px;
  }

  .progress-card {
    margin-left: -10px;
    margin-right: -10px;
  }

  .progress-card-header {
    padding: 16px 10px 6px;
  }

  .app-tab-panel #card-add-meal {
    margin-left: -10px;
    margin-right: -10px;
  }

  .app-tab-panel #card-meals {
    margin-left: -10px;
    margin-right: -10px;
  }

  .app-tab-panel #card-weight-tools {
    margin-left: -10px;
    margin-right: -10px;
  }

  #card-add-meal .card-header {
    padding: 0 10px 6px;
  }

  #card-meals .card-header {
    padding: 0 10px 6px;
  }

  #card-weight-tools .card-header {
    padding: 0 10px 6px;
  }

  .macro-inputs {
    grid-template-columns: 1fr;
  }

  .entry-method-btn {
    padding: 8px 7px;
    font-size: 13px;
  }

  .entry-panel {
    margin: -1px 0 0;
    padding: 12px;
    border-radius: 0 0 14px 14px;
  }

  .meal-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: auto;
    gap: 0;
    margin: 8px 0 0;
    box-sizing: border-box;
  }

  .meal-tab-panel {
    width: auto;
    margin-left: 0;
    margin-right: 0;
    padding: 14px;
    border-radius: 0 0 14px 14px;
    box-sizing: border-box;
  }

  .weight-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: auto;
    gap: 0;
    margin: 8px 0 0;
    box-sizing: border-box;
  }

  .weight-tab-btn {
    width: 100%;
    padding: 9px 10px;
    font-size: 14px;
  }

  .weight-tab-panel {
    width: auto;
    margin-left: 0;
    margin-right: 0;
    padding: 14px;
    border-radius: 0 0 14px 14px;
    box-sizing: border-box;
  }

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

  #card-meals.meals-tab-diary-active .meal-tab-panel.active {
    border-radius: 0 0 14px 14px;
  }

  #card-meals.meals-tab-today-active .meal-tab-panel.active {
    border-radius: 0 0 14px 14px;
  }

  .diary-controls,
  .diary-pagination {
    align-items: stretch;
  }

  .chart-wrap {
    height: 340px;
  }

  .diary-page-info {
    min-width: 0;
    width: 100%;
    text-align: left;
  }

  .meal-tab-btn {
    width: 100%;
    padding: 9px 10px;
    font-size: 14px;
  }

  .top-insights-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    margin: 8px 0 0;
    box-sizing: border-box;
  }

  .top-insight-tab-btn {
    width: 100%;
    min-width: 0;
    padding: 9px 10px;
    font-size: 14px;
  }

  #progress-card-content,
  #top-tab-calories,
  #top-tab-macros {
    margin: -1px 0 0;
    padding: 14px;
    border-radius: 0 0 14px 14px;
  }

  .macro-chart-tabs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .macro-chart-tab-btn {
    padding: 8px 8px;
    font-size: 13px;
  }

  .user-chip {
    justify-content: flex-start;
    margin-left: 0;
  }

  .user-chip-text {
    text-align: left;
  }

  .install-banner {
    flex-direction: column;
    align-items: flex-start;
  }

  .install-banner-actions {
    width: 100%;
  }

  .install-banner-actions button {
    width: 100%;
  }

  .favorite-card {
    align-items: flex-start;
    flex-direction: column;
  }

  .favorite-card-actions {
    width: 100%;
    justify-content: flex-end;
  }

  #weight-entry-form button,
  #weight-lock-btn {
    width: 100%;
  }

  .settings-actions button {
    width: 100%;
  }

  .estimate-result-grid {
    grid-template-columns: 1fr;
  }

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

  #settings-goal-form button {
    width: 100%;
  }

  .log-entry-row {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}

#logout-btn {
  margin-top: 10px;
  background-color: #f5f5f5;
  font-weight: 500;
  
}

.ai-text {
  
  letter-spacing: 1px;
  font-family: 'Segoe UI', 'Inter', 'Roboto', sans-serif;
}

.auto-add-label {
  display: inline-flex;
  align-items: center;
  gap: 0px;
  margin-top: 5px;
  
  
  cursor: pointer;
}

.card {
  background-color: #ffffff;
  border: 1px solid #ddd;
  border-radius: 12px;
  padding: 20px;
  margin: 20px auto;
  max-width: 600px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.card h2 {
  margin-top: 0;
  font-size: 1.5em;
  border-bottom: 1px solid #e0e0e0;
  padding-bottom: 10px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.meals-header-block {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}

.meals-left-summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: #e4f4ea;
  font-weight: 700;
  font-size: 14px;
  color: #1f7a45;
}

.progress-card {
  margin-top: 0;
  padding: 0;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  margin-left: -14px;
  margin-right: -14px;
}

.progress-card-header {
  align-items: flex-start;
  padding: 16px 14px 6px;
}

.progress-summary {
  margin: 6px 0 0;
  color: #4f5d75;
  font-size: 13px;
}

.top-insights-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  width: auto;
  gap: 0;
  margin: 8px 0 0;
  position: relative;
  z-index: 1;
  box-sizing: border-box;
}

.top-insight-tab-btn {
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 11px 14px;
  border-radius: 0;
  background: linear-gradient(180deg, #edf4ff 0%, #dfeafb 100%);
  color: #3658a7;
  border: 1px solid #cfdcf0;
  border-bottom: none;
}

.top-insight-tab-btn:first-child {
  border-top-left-radius: 14px;
}

.top-insight-tab-btn:last-child {
  border-top-right-radius: 14px;
}

.top-insight-tab-btn:hover {
  background: linear-gradient(180deg, #dfeafb 0%, #cfdef5 100%);
  color: #1f3f82;
}

.top-insight-tab-btn.active,
.top-insight-tab-btn.active:hover {
  background: linear-gradient(180deg, #ffffff 0%, #f7fbff 100%);
  color: #244a8f;
  box-shadow: 0 -1px 0 rgba(255, 255, 255, 0.7), 0 8px 20px rgba(54, 88, 167, 0.06);
}

.top-insight-panel {
  display: none;
}

.top-insight-panel.active {
  display: block;
}

#progress-card-content,
#top-tab-calories,
#top-tab-macros {
  width: auto;
  margin: -1px 0 0;
  padding: 16px;
  border: 1px solid #d6e4f5;
  border-radius: 0 0 16px 16px;
  background: linear-gradient(180deg, #fbfdff 0%, #f4f9ff 100%);
  box-sizing: border-box;
}

.macro-chart-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.macro-chart-tab-btn {
  width: 100%;
  margin: 0;
  padding: 9px 12px;
  border-radius: 999px;
  background: #eef4fb;
  color: #3658a7;
}

.macro-chart-tab-btn.active,
.macro-chart-tab-btn.active:hover {
  background: #3658a7;
  color: #fff;
}

.toggle-btn {
  font-size: 0.9em;
  padding: 4px 10px;
  background-color: #fff0ef;
  color: #b42318;
  border: 1px solid #f4b4ab;
  border-radius: 6px;
  cursor: pointer;
  max-width: 120px;
  width: fit-content;
}

.toggle-btn:hover {
  background-color: #ffdcd7;
}

.card-content {
  margin-top: 10px;
}

.chart-wrap {
  position: relative;
  height: 260px;
}


#clear-form-btn {
  
  background-color: #eee;
  color: #444;
  border: 1px solid #ccc;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  
}

#clear-form-btn:hover {
  background-color: #ddd;
}

.edit-name-input,
.edit-cal-input {
  width: auto;
  font-size: 1rem;
  line-height: 1.2;
  margin-right: 0;
  margin-top: 4px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #ffffff;
}

.edit-name-input {
  min-width: 18ch;
  max-width: 100%;
}

.edit-cal-input,
.edit-cal-input {
  min-width: 6ch;
}

.meal-log-group {
  margin-bottom: 16px;
  padding: 12px;
  border: 1px solid #d0e3f7;
  border-radius: 12px;
  background: linear-gradient(180deg, #fbfdff 0%, #f1f7ff 100%);
  box-shadow: 0 2px 5px rgba(54, 162, 235, 0.08);
}

.meal-log-group-head {
  width: 100%;
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
  color: #3658a7;
  padding-bottom: 10px;
  border-bottom: 1px solid #e4eef9;
  background: transparent;
  border: none;
  border-radius: 12px;
  padding: 0;
  text-align: left;
}

.meal-log-group-head:hover {
  background: #dce9fb;
}

.meal-log-group-head.collapsed {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.meal-log-group-head.collapsed:hover {
  background: #dce9fb;
}

.meal-log-group-top {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
}

.meal-log-group-title {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.meal-log-group-macros {
  font-size: 12px;
  color: #66758f;
}

.meal-log-group-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.meal-log-group-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  justify-content: flex-end;
}

.meal-log-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  font-size: 18px;
  font-weight: 700;
  color: #244a8f;
  background: #dce9fb;
  border: 1px solid #bfd3f3;
  border-radius: 999px;
  transition: transform 0.2s ease;
}

.meal-log-group-head.collapsed .meal-log-chevron {
  transform: rotate(0deg);
}

.meal-log-group.expanded .meal-log-chevron {
  transform: rotate(180deg);
}

.meal-log-day {
  display: grid;
  gap: 10px;
}

.meal-log-day[hidden] {
  display: none !important;
}

.meal-search-results {
  display: grid;
  gap: 16px;
  margin: 16px 0;
}

#global-search-input {
  margin: 0;
  border: 2px solid #bcd3f2;
  background: linear-gradient(180deg, #ffffff 0%, #f5f9ff 100%);
  box-shadow: 0 8px 20px rgba(54, 88, 167, 0.08);
}

#global-search-input:focus {
  border-color: #6ca7ef;
  box-shadow: 0 0 0 4px rgba(108, 167, 239, 0.18), 0 10px 24px rgba(54, 88, 167, 0.1);
}

.global-search-row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 0 0 16px;
}

.global-search-ai-btn {
  margin: 0 0 16px;
}

.global-search-row button {
  width: auto;
  min-width: 90px;
  margin: 0;
}

.add-food-date-row {
  margin: 0 0 12px;
}

.add-food-target-date {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding: 12px 14px;
  border: 2px solid #f4b4ab;
  border-radius: 12px;
  background: linear-gradient(180deg, #fff0ef 0%, #ffdcd7 100%);
  color: #b42318;
  font-weight: 700;
  box-shadow: 0 10px 22px rgba(180, 35, 24, 0.12);
}

.meal-search-section {
  display: grid;
  gap: 10px;
}

.meal-search-section-title {
  font-size: 13px;
  font-weight: 700;
  color: #3658a7;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.meal-search-list {
  display: grid;
  gap: 10px;
}

.meal-search-item {
  background: white;
  padding: 12px;
  border: 1px solid #d0e3f7;
  border-radius: 10px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.meal-search-date {
  width: 100%;
  font-size: 12px;
  color: #66758f;
}

.meal-log-group.collapsed .meal-log-day {
  display: none;
}

.meal-log-item {
  align-items: center;
}

.meal-log-info {
  display: grid;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.meal-log-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.meal-added-highlight {
  background: #fff7c7;
  border-color: #f0d96c;
  box-shadow: 0 0 0 3px rgba(240, 217, 108, 0.35), 0 8px 18px rgba(240, 217, 108, 0.2);
  transition: background-color 0.4s ease, box-shadow 0.4s ease, border-color 0.4s ease;
}

.meal-log-actions {
  display: flex;
  align-items: flex-end;
  flex-direction: column;
  flex: 0 0 auto;
  gap: 10px;
  margin-left: auto;
}

.meal-secondary-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.meal-log-actions-diary .meal-secondary-actions {
  width: 100%;
}

.meal-log-actions-diary .meal-secondary-actions:not(.meal-edit-actions) {
  justify-content: center;
}

.meal-log-actions-diary .meal-edit-actions {
  justify-content: flex-end;
}

.today-meal-actions .meal-secondary-actions,
.today-meal-actions .meal-edit-actions {
  width: 100%;
  justify-content: center;
}

.meal-time-wrap {
  display: flex;
  align-items: center;
}

.meal-name {
  min-width: 0;
}

.meal-name input,
.meal-calories input {
  display: block;
}

.edit-macro-grid {
  display: inline-grid;
  grid-template-columns: repeat(3, minmax(0, auto));
  gap: 8px;
  align-items: end;
}

.edit-macro-field {
  display: grid;
  gap: 3px;
  font-size: 11px;
  color: #66758f;
}

.edit-macro-field span {
  text-align: center;
}

.edit-macro-input {
  margin: 0;
  padding: 8px 10px;
  min-width: 7ch;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

.meal-name,
.meal-calories {
  margin-bottom: 2px;
}

@media (max-width: 640px) {
  .meal-log-group-head {
    gap: 8px;
  }

  .meal-log-group-title {
    flex-direction: column;
    align-items: flex-start;
  }

  .meal-log-group-top {
    grid-template-columns: 1fr auto;
    align-items: start;
  }

  .meal-log-meta {
    flex-direction: row;
    align-items: center;
    gap: 10px;
  }

  .meal-log-item {
    align-items: center;
  }

  .meal-log-actions {
    margin-left: 0;
    justify-content: flex-end;
    width: auto;
  }

  .today-meal-actions,
  .meal-log-actions {
    align-items: flex-end;
  }

  .edit-macro-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   Friends page redesign
   ============================================================ */

/* --- Notifications banner --- */
.friends-banner {
  margin: 4px 0 18px;
  border: 1px solid #f4b4ab;
  background: linear-gradient(180deg, #fff6f5 0%, #ffe8e3 100%);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 6px 16px rgba(180, 35, 24, 0.08);
}

.friends-banner-toggle {
  width: 100%;
  margin: 0;
  padding: 12px 14px;
  background: transparent;
  color: #8a2418;
  border: none;
  border-radius: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.friends-banner-toggle:hover {
  background: rgba(180, 35, 24, 0.06);
}

.friends-banner-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #d8412f;
  box-shadow: 0 0 0 4px rgba(216, 65, 47, 0.18);
  flex: 0 0 auto;
}

.friends-banner-label {
  flex: 1 1 auto;
}

.friends-banner-chevron {
  transition: transform 0.2s ease;
  font-size: 14px;
  flex: 0 0 auto;
}

.friends-banner.collapsed .friends-banner-chevron {
  transform: rotate(-90deg);
}

.friends-banner.collapsed .friends-banner-body {
  display: none;
}

.friends-banner-body {
  padding: 4px 12px 12px;
  display: grid;
  gap: 8px;
}

.friends-banner-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid #f4d2cd;
  border-radius: 10px;
  font-size: 14px;
}

.friends-banner-item-text {
  flex: 1 1 auto;
  color: #21304e;
  min-width: 0;
}

.friends-banner-item-text strong {
  color: #8a2418;
}

.friends-banner-item-actions {
  display: flex;
  gap: 6px;
  flex: 0 0 auto;
}

.friends-banner-item-actions button {
  margin: 0;
  width: auto;
  min-width: 0;
  padding: 6px 12px;
  font-size: 13px;
  border-radius: 8px;
}

.friends-banner-approve {
  background: #1f7a45;
}

.friends-banner-approve:hover {
  background: #176236;
}

.friends-banner-decline {
  background: #fff;
  color: #8a2418;
  border: 1px solid #f4b4ab;
}

.friends-banner-decline:hover {
  background: #fff0ef;
}

/* --- Friends info card --- */
.friends-info-card {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin: 4px 0 18px;
  padding: 14px 16px;
  border: 1px solid #c7d9f3;
  border-radius: 14px;
  background: linear-gradient(180deg, #f7fbff 0%, #eef4fb 100%);
  box-shadow: 0 6px 16px rgba(54, 88, 167, 0.08);
  font-variant: normal;
}

.friends-info-card.is-bottom {
  margin: 18px 0 0;
}

.friends-info-icon {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #3658a7;
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  font-family: Georgia, serif;
  line-height: 1;
}

.friends-info-content {
  display: grid;
  gap: 6px;
  flex: 1 1 auto;
  min-width: 0;
}

.friends-info-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.friends-info-content h3 {
  margin: 0;
  font-size: 15px;
  color: #21304e;
}

.friends-info-move-btn {
  width: auto;
  margin: 0;
  padding: 5px 9px;
  border-radius: 999px;
  background: #fff;
  color: #3658a7;
  border: 1px solid #c7d9f3;
  font-size: 12px;
  font-weight: 700;
  font-variant: normal;
  white-space: nowrap;
}

.friends-info-move-btn:hover {
  background: #eaf1fb;
}

.friends-info-content p {
  margin: 0;
  color: #52647f;
  font-size: 13px;
  line-height: 1.45;
}

.friends-info-content strong {
  color: #3658a7;
}

@media (max-width: 640px) {
  .friends-info-header {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* --- Friends section header --- */
.friends-section {
  margin: 0 0 8px;
}

.friends-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 6px 0 14px;
  flex-wrap: wrap;
}

.friends-section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: 18px;
  color: #21304e;
}

.friends-count-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: #eef4fb;
  color: #3658a7;
  font-size: 12px;
  font-weight: 700;
}

.friends-invite-btn {
  margin: 0;
  width: auto;
  min-width: 0;
  padding: 8px 14px;
  font-size: 14px;
  border-radius: 10px;
  background: #3658a7;
  color: #fff;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.friends-invite-btn:hover {
  background: #2a4685;
}

/* --- Inline invite panel --- */
.friends-invite-panel {
  margin: 0 0 16px;
  padding: 14px;
  background: #f8fbff;
  border: 1px solid #d6e4f5;
  border-radius: 12px;
}

.friends-invite-form {
  display: flex;
  gap: 10px;
  align-items: stretch;
  flex-wrap: wrap;
  margin: 0;
}

.friends-invite-form input {
  flex: 1 1 200px;
  margin: 0;
}

.friends-invite-form button {
  margin: 0;
  width: auto;
  min-width: 130px;
}

.friends-invite-status {
  margin: 10px 0 0;
  font-size: 13px;
  color: #4f5d75;
  min-height: 1em;
}

.friends-invite-status.error {
  color: #b42318;
}

.friends-invite-status.success {
  color: #157347;
}

.friends-sent-list {
  margin-top: 10px;
  display: grid;
  gap: 6px;
}

.friends-sent-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  background: #fff;
  border: 1px dashed #cddcf2;
  border-radius: 10px;
  font-size: 13px;
  color: #4f5d75;
}

.friends-sent-item-email {
  font-weight: 600;
  color: #21304e;
}

.friends-sent-item-tag {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #9a6700;
  background: #fff7e0;
  padding: 2px 8px;
  border-radius: 999px;
}

/* --- Friends list & friend card --- */
.friends-list {
  display: grid;
  gap: 12px;
}

.friend-card {
  position: relative;
  padding: 14px;
  background: #fff;
  border: 1px solid #e4eef9;
  border-radius: 14px;
  box-shadow: 0 4px 12px rgba(16, 30, 56, 0.04);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.friend-card:hover {
  box-shadow: 0 8px 22px rgba(16, 30, 56, 0.08);
  border-color: #d6e4f5;
}

.friend-card.has-alert {
  border-color: #f4d2cd;
  background: linear-gradient(180deg, #fffdfd 0%, #fff6f5 100%);
}

.friend-card-loading {
  opacity: 0.86;
}

.friend-card-loading-label {
  color: #66758f;
  font-size: 12px;
  font-weight: 700;
  font-variant: normal;
}

.loading-text,
.loading-pill {
  color: #9bb4d9;
}

.loading-bar::before {
  content: '';
  display: block;
  width: 42%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #dbe8f8 0%, #c7dcf7 100%);
}

.friend-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.friend-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  color: #fff;
  letter-spacing: 0;
  font-variant: normal;
  overflow: hidden;
  background: #6f8bcf;
  box-shadow: 0 2px 6px rgba(16, 30, 56, 0.12);
}

.friend-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.friend-identity {
  flex: 1 1 auto;
  min-width: 0;
}

.friend-name {
  font-weight: 700;
  color: #21304e;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant: normal;
  letter-spacing: 0;
}

.friend-email {
  font-size: 12px;
  color: #66758f;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant: normal;
  letter-spacing: 0;
}

.friend-card {
  font-variant: normal;
  letter-spacing: 0;
}

.friends-banner-item-text,
.friends-sent-item-email,
.friend-progress-label-value {
  font-variant: normal;
  letter-spacing: 0;
}

.friend-card-actions {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 6px;
}

.friend-status-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.friend-status-chip.warn {
  background: #fff0ef;
  color: #b42318;
  border: 1px solid #f4b4ab;
}

.friend-status-chip.ok {
  background: #e4f4ea;
  color: #1f7a45;
  border: 1px solid #b6dfc4;
}

.friend-status-chip.offtrack {
  background: #fff7e0;
  color: #9a6700;
  border: 1px solid #f2d28b;
}

.friend-status-chip.neutral {
  background: #eef4fb;
  color: #3658a7;
  border: 1px solid #cddcf2;
}

.dismiss-alert-inline {
  width: auto;
  margin: 12px 0 0;
  padding: 7px 12px;
  border: 1px solid #f4b4ab;
  border-radius: 999px;
  background: #fff;
  color: #b42318;
  font-size: 12px;
  font-weight: 800;
  font-variant: normal;
  letter-spacing: 0;
}

.dismiss-alert-inline:hover {
  background: #fff0ef;
}

/* Kebab menu button + dropdown */
.friend-kebab-btn {
  margin: 0;
  padding: 0;
  width: 32px;
  height: 32px;
  background: transparent;
  color: #66758f;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.friend-kebab-btn:hover {
  background: #f2f7fc;
  color: #21304e;
  border-color: #d6e4f5;
}

.friend-kebab-menu {
  position: absolute;
  top: 38px;
  right: 0;
  min-width: 160px;
  background: #fff;
  border: 1px solid #d6e4f5;
  border-radius: 10px;
  box-shadow: 0 12px 28px rgba(16, 30, 56, 0.14);
  padding: 4px;
  z-index: 50;
  display: none;
}

.friend-kebab-menu.open {
  display: block;
}

.friend-kebab-menu button {
  margin: 0;
  width: 100%;
  padding: 8px 12px;
  background: transparent;
  color: #21304e;
  text-align: left;
  font-size: 14px;
  border-radius: 6px;
  border: none;
  font-variant: normal;
  letter-spacing: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.friend-menu-action-icon {
  width: 16px;
  flex: 0 0 16px;
  color: #66758f;
  text-align: center;
  font-size: 15px;
  line-height: 1;
}

.friend-kebab-menu button.danger .friend-menu-action-icon {
  color: #b42318;
}

.friend-kebab-menu button:hover {
  background: #f2f7fc;
}

.friend-kebab-menu button.danger {
  color: #b42318;
}

.friend-kebab-menu button.danger:hover {
  background: #fff0ef;
}

/* --- Progress bars + macro pills --- */
.friend-progress-row {
  margin-bottom: 10px;
}

.friend-progress-row:last-child {
  margin-bottom: 0;
}

.friend-progress-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-size: 12px;
  margin-bottom: 4px;
}

.friend-progress-label-text {
  font-weight: 700;
  color: #66758f;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 11px;
}

.friend-progress-label-value {
  color: #21304e;
  font-weight: 600;
  font-size: 13px;
  font-variant: normal;
  letter-spacing: 0;
}

.friend-progress-label-value.over {
  color: #b42318;
}

.friend-progress-bar {
  position: relative;
  width: 100%;
  height: 10px;
  background: #eef4fb;
  border-radius: 999px;
  overflow: hidden;
}

.friend-progress-bar.small {
  height: 6px;
}

.friend-progress-bar-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: linear-gradient(90deg, #3690f2 0%, #3658a7 100%);
  border-radius: 999px;
  transition: width 0.3s ease, background 0.3s ease;
}

.friend-progress-bar-fill.warn {
  background: linear-gradient(90deg, #f4b400 0%, #d97706 100%);
}

.friend-progress-bar-fill.over {
  background: linear-gradient(90deg, #e85a4f 0%, #b42318 100%);
}

.friend-progress-bar-fill.muted {
  background: linear-gradient(90deg, #9bb4d9 0%, #6f8bcf 100%);
}

.friend-progress-bar-marker {
  position: absolute;
  top: -2px;
  bottom: -2px;
  width: 2px;
  background: rgba(33, 48, 78, 0.35);
  border-radius: 1px;
}

.friend-macro-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.friend-macro-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #f2f7fc;
  border: 1px solid #d6e4f5;
  font-size: 12px;
  color: #21304e;
  font-variant: normal;
  letter-spacing: 0;
}

.friend-macro-pill-label {
  font-weight: 700;
  color: #3658a7;
}

.friend-macro-pill.over {
  background: #fff0ef;
  border-color: #f4b4ab;
  color: #8a2418;
}

.friend-macro-pill.over .friend-macro-pill-label {
  color: #b42318;
}

/* --- Empty state --- */
.friends-empty-state {
  text-align: center;
  padding: 32px 16px;
  background: #f8fbff;
  border: 1px dashed #d6e4f5;
  border-radius: 14px;
}

.friends-empty-illustration {
  font-size: 40px;
  margin-bottom: 8px;
  font-variant: normal;
}

.friends-empty-state h4 {
  margin: 0 0 6px;
  font-size: 17px;
  color: #21304e;
}

.friends-empty-state p {
  margin: 0 0 16px;
  color: #66758f;
  font-size: 14px;
  max-width: 360px;
  margin-left: auto;
  margin-right: auto;
}

.friends-empty-cta {
  margin: 0;
  width: auto;
  min-width: 0;
  padding: 10px 22px;
  font-size: 14px;
}

@media (max-width: 480px) {
  .friend-card-head {
    flex-wrap: wrap;
  }

  .friend-card-actions {
    margin-left: auto;
  }

  .friends-banner-item {
    flex-wrap: wrap;
  }

  .friends-banner-item-actions {
    width: 100%;
    justify-content: flex-end;
  }
}

/* --- Accepted-friend toast (shared across pages) --- */
.accepted-friend-toast {
  position: fixed;
  left: 50%;
  top: 24px;
  transform: translate(-50%, -16px);
  z-index: 1300;
  max-width: 92vw;
  width: max-content;
  padding: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.24s ease, transform 0.24s ease;
}

.accepted-friend-toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
  pointer-events: auto;
}

.accepted-friend-toast-body {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: linear-gradient(180deg, #ffffff 0%, #f1fbf3 100%);
  border: 1px solid #b6dfc4;
  border-radius: 12px;
  box-shadow: 0 14px 32px rgba(16, 30, 56, 0.14);
  color: #21304e;
  font-size: 14px;
  font-variant: normal;
  letter-spacing: 0;
}

.accepted-friend-toast-emoji {
  font-size: 20px;
  flex: 0 0 auto;
  font-variant: normal;
}

.accepted-friend-toast-text {
  flex: 1 1 auto;
}

.accepted-friend-toast-text strong {
  color: #1f7a45;
}

.accepted-friend-toast-close {
  margin: 0;
  padding: 0;
  width: 26px;
  height: 26px;
  background: transparent;
  color: #66758f;
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.accepted-friend-toast-close:hover {
  background: #f2f7fc;
  color: #21304e;
  border-color: #d6e4f5;
}

/* ============================================================
   Admin page redesign
   ============================================================ */

.admin-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 4px 0 16px;
}

.admin-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 14px 10px;
  background: linear-gradient(180deg, #fbfdff 0%, #f3f8ff 100%);
  border: 1px solid #d6e4f5;
  border-radius: 12px;
  text-align: center;
}

.admin-stat-value {
  font-size: 22px;
  font-weight: 700;
  color: #21304e;
  font-variant: normal;
  letter-spacing: 0;
  line-height: 1.1;
}

.admin-stat-label {
  margin-top: 4px;
  font-size: 11px;
  font-weight: 700;
  color: #66758f;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.admin-controls {
  display: flex;
  gap: 10px;
  align-items: stretch;
  flex-wrap: wrap;
  margin: 0 0 8px;
}

.admin-search-input {
  flex: 1 1 220px;
  margin: 0;
}

.admin-sort {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.admin-sort-label {
  font-size: 11px;
  font-weight: 700;
  color: #66758f;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.admin-sort-select {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid #cddcf2;
  border-radius: 12px;
  background: #fcfdff;
  color: #21304e;
  font-size: 14px;
  font-variant: normal;
  letter-spacing: 0;
  box-sizing: border-box;
}

.admin-user-list {
  display: grid;
  gap: 12px;
  margin-top: 8px;
  font-variant: normal;
  letter-spacing: 0;
}

.admin-user-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: #fff;
  border: 1px solid #e4eef9;
  border-radius: 14px;
  box-shadow: 0 4px 12px rgba(16, 30, 56, 0.04);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
  font-variant: normal;
  letter-spacing: 0;
}

.admin-user-card:hover {
  box-shadow: 0 8px 22px rgba(16, 30, 56, 0.08);
  border-color: #d6e4f5;
}

.admin-user-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  color: #fff;
  font-variant: normal;
  letter-spacing: 0;
  overflow: hidden;
  background: #6f8bcf;
  box-shadow: 0 2px 6px rgba(16, 30, 56, 0.12);
}

.admin-user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.admin-user-identity {
  flex: 1 1 auto;
  min-width: 0;
}

.admin-user-name {
  font-weight: 700;
  color: #21304e;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-user-email {
  font-size: 12px;
  color: #66758f;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.admin-user-meta {
  margin-top: 6px;
  font-size: 11px;
  color: #8b97a8;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
}

.admin-user-meta-item {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
}

.admin-user-meta-label {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  color: #a3aec1;
  font-size: 10px;
}

.admin-user-status {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
  font-variant: normal;
}

.admin-user-status.today {
  background: #e4f4ea;
  color: #1f7a45;
  border: 1px solid #b6dfc4;
}

.admin-user-status.active {
  background: #eef4fb;
  color: #3658a7;
  border: 1px solid #cddcf2;
}

.admin-user-status.idle {
  background: #fff7e0;
  color: #9a6700;
  border: 1px solid #f1d77c;
}

.admin-user-status.inactive {
  background: #f2f5f9;
  color: #66758f;
  border: 1px solid #d6e0ec;
}

.admin-empty-list {
  text-align: center;
  padding: 28px 16px;
  background: #f8fbff;
  border: 1px dashed #d6e4f5;
  border-radius: 14px;
  color: #66758f;
  font-size: 14px;
}

@media (max-width: 480px) {
  .admin-stats {
    gap: 6px;
  }

  .admin-stat {
    padding: 10px 6px;
  }

  .admin-stat-value {
    font-size: 18px;
  }

  .admin-user-card {
    flex-wrap: wrap;
  }

  .admin-user-status {
    margin-left: auto;
  }
}

/* ============================================================
   Settings page redesign
   ============================================================ */

/* --- Profile preview --- */
.settings-preview {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: linear-gradient(180deg, #fbfdff 0%, #f3f8ff 100%);
  border: 1px solid #d6e4f5;
  border-radius: 14px;
  margin: 4px 0 18px;
  font-variant: normal;
  letter-spacing: 0;
}

.settings-preview-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 22px;
  color: #fff;
  font-variant: normal;
  letter-spacing: 0;
  overflow: hidden;
  background: #6f8bcf;
  box-shadow: 0 4px 10px rgba(16, 30, 56, 0.14);
}

.settings-preview-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.settings-preview-identity {
  flex: 1 1 auto;
  min-width: 0;
}

.settings-preview-name {
  font-weight: 700;
  color: #21304e;
  font-size: 17px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.settings-preview-email {
  margin-top: 2px;
  font-size: 13px;
  color: #66758f;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.settings-preview-meta {
  margin-top: 6px;
  font-size: 11px;
  color: #8b97a8;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
}

/* --- Section block --- */
.settings-block {
  margin: 0 0 18px;
  padding: 16px;
  background: #fff;
  border: 1px solid #e4eef9;
  border-radius: 14px;
  box-shadow: 0 4px 12px rgba(16, 30, 56, 0.04);
  font-variant: normal;
  letter-spacing: 0;
}

.settings-block:last-child {
  margin-bottom: 0;
}

.settings-block-danger {
  background: #fff;
  border-color: #f4d2cd;
}

.settings-block-header {
  margin: 0 0 12px;
}

.settings-block-title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: #3658a7;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.settings-block-help {
  margin: 4px 0 0;
  font-size: 13px;
  color: #66758f;
  font-variant: normal;
  letter-spacing: 0;
}

/* --- Form fields --- */
.settings-form {
  display: grid;
  gap: 12px;
}

.settings-field {
  display: grid;
  gap: 6px;
}

.settings-field-label {
  font-size: 11px;
  font-weight: 700;
  color: #66758f;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.settings-field input {
  margin: 0;
}

.settings-form-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.settings-form-actions button {
  margin: 0;
  width: auto;
  min-width: 140px;
}

/* --- Linked account info row --- */
.settings-info-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: #f8fbff;
  border: 1px solid #d6e4f5;
  border-radius: 12px;
}

.settings-info-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid #d6e4f5;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  overflow: hidden;
}

.settings-info-icon img {
  width: 20px;
  height: 20px;
  object-fit: contain;
  display: block;
}

.settings-info-content {
  flex: 1 1 auto;
  min-width: 0;
}

.settings-info-label {
  font-size: 11px;
  font-weight: 700;
  color: #66758f;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.settings-info-value {
  margin-top: 2px;
  color: #21304e;
  font-size: 14px;
  font-weight: 600;
  font-variant: normal;
  letter-spacing: 0;
  word-break: break-all;
}

.settings-info-tag {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: #e4f4ea;
  color: #1f7a45;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border: 1px solid #b6dfc4;
  font-variant: normal;
}

/* --- Quick links --- */
.settings-link-list {
  display: grid;
  gap: 8px;
}

.settings-link-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: #f8fbff;
  border: 1px solid #d6e4f5;
  border-radius: 12px;
  text-align: left;
  cursor: pointer;
  margin: 0;
  width: 100%;
  color: inherit;
  font-variant: normal;
  letter-spacing: 0;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.settings-link-row:hover {
  background: #eef4fb;
  border-color: #cddcf2;
}

.settings-link-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid #d6e4f5;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  font-size: 18px;
  font-variant: normal;
}

.settings-link-content {
  flex: 1 1 auto;
  min-width: 0;
}

.settings-link-title {
  font-weight: 700;
  color: #21304e;
  font-size: 14px;
}

.settings-link-help {
  margin-top: 2px;
  font-size: 12px;
  color: #66758f;
  font-weight: 400;
}

.settings-link-chevron {
  flex: 0 0 auto;
  color: #8b97a8;
  font-size: 22px;
  line-height: 1;
}

/* --- Sign out button --- */
.settings-signout-btn {
  margin: 0;
  width: auto;
  min-width: 140px;
  background: #fff;
  color: #b42318;
  border: 1px solid #f4b4ab;
}

.settings-signout-btn:hover {
  background: #fff0ef;
}

/* --- Delete account button (red, filled) --- */
.settings-delete-btn {
  margin: 0;
  width: auto;
  min-width: 140px;
  background: #b42318;
  color: #fff;
  border: 1px solid #b42318;
}

.settings-delete-btn:hover {
  background: #8a1a13;
  border-color: #8a1a13;
}

.settings-delete-btn:disabled {
  background: #f1d3d0;
  border-color: #f1d3d0;
  color: #fff;
  cursor: not-allowed;
}

/* --- Delete account modal --- */
.delete-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1500;
  background: rgba(16, 30, 56, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
}

.delete-modal {
  width: 100%;
  max-width: 460px;
  background: #fff;
  border-radius: 16px;
  border: 1px solid #f4d2cd;
  box-shadow: 0 24px 48px rgba(16, 30, 56, 0.32);
  overflow: hidden;
  font-variant: normal;
  letter-spacing: 0;
}

.delete-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid #f4d2cd;
  background: linear-gradient(180deg, #fff6f5 0%, #ffe8e3 100%);
}

.delete-modal-header h3 {
  margin: 0;
  color: #8a2418;
  font-size: 17px;
  font-weight: 700;
}

.delete-modal-close {
  margin: 0;
  width: 30px;
  height: 30px;
  padding: 0;
  background: transparent;
  color: #8a2418;
  border: none;
  border-radius: 6px;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.delete-modal-close:hover {
  background: rgba(180, 35, 24, 0.08);
}

.delete-modal-body {
  padding: 18px;
}

.delete-modal-body p {
  margin: 0 0 12px;
  color: #21304e;
  font-size: 14px;
}

.delete-modal-body p.delete-modal-warning {
  padding: 10px 12px;
  background: #fff0ef;
  border: 1px solid #f4b4ab;
  border-radius: 10px;
  color: #8a2418;
  font-size: 13px;
}

.delete-modal-list {
  margin: 0 0 14px;
  padding-left: 20px;
  color: #4f5d75;
  font-size: 14px;
  line-height: 1.6;
}

.delete-modal-list li {
  margin-bottom: 2px;
}

.delete-modal-confirm-label {
  display: block;
  margin: 14px 0 6px;
  font-size: 13px;
  color: #21304e;
}

#delete-modal-confirm-input {
  width: 100%;
  margin: 0;
  padding: 10px 12px;
  font-size: 16px;
  font-family: 'Consolas', 'Menlo', monospace;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border: 1px solid #f4b4ab;
  border-radius: 10px;
  background: #fff6f5;
  color: #21304e;
  box-sizing: border-box;
}

#delete-modal-confirm-input:focus {
  outline: none;
  border-color: #b42318;
  box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.12);
}

.delete-modal-progress {
  margin-top: 14px;
  padding: 10px 12px;
  background: #f8fbff;
  border: 1px solid #d6e4f5;
  border-radius: 10px;
  font-size: 13px;
  color: #4f5d75;
  font-family: 'Consolas', 'Menlo', monospace;
  white-space: pre-line;
  max-height: 160px;
  overflow-y: auto;
}

.delete-modal-progress.error {
  background: #fff0ef;
  border-color: #f4b4ab;
  color: #8a2418;
}

.delete-modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 14px 18px;
  border-top: 1px solid #f4d2cd;
  background: #fbfcfd;
}

.delete-modal-footer button {
  flex: 0 1 auto;
}

/* --- Save toast (settings-specific) --- */
.settings-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 16px);
  z-index: 1300;
  padding: 12px 18px;
  border-radius: 999px;
  background: #1f7a45;
  color: #fff;
  font-weight: 700;
  font-variant: normal;
  letter-spacing: 0;
  box-shadow: 0 14px 32px rgba(16, 30, 56, 0.18);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.24s ease, transform 0.24s ease;
}

.settings-toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
  pointer-events: auto;
}

.settings-toast.error {
  background: #b42318;
}

@media (max-width: 480px) {
  .settings-preview {
    flex-wrap: wrap;
  }

  .settings-info-row {
    flex-wrap: wrap;
  }

  .settings-info-tag {
    margin-left: auto;
  }
}

/* ============================================================
   Trend chart card (Calories / Macros under Progress tab)
   ============================================================ */

.trend-card {
  background: #fff;
  border: 1px solid #e4eef9;
  border-radius: 14px;
  box-shadow: 0 4px 12px rgba(16, 30, 56, 0.04);
  padding: 14px;
  font-variant: normal;
  letter-spacing: 0;
}

.trend-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.trend-card-title-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.trend-card-title {
  font-size: 15px;
  font-weight: 700;
  color: #21304e;
}

.trend-card-range {
  font-size: 12px;
  color: #66758f;
  font-variant: normal;
  letter-spacing: 0;
}

.trend-card-nav {
  display: flex;
  gap: 4px;
  flex: 0 0 auto;
}

.trend-nav-btn {
  margin: 0;
  width: 32px;
  height: 32px;
  padding: 0;
  background: #f2f7fc;
  color: #3658a7;
  border: 1px solid #d6e4f5;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.trend-nav-btn svg {
  width: 16px;
  height: 16px;
}

.trend-nav-btn:hover:not(:disabled) {
  background: #e4eef9;
  border-color: #bcd0ec;
}

.trend-nav-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

/* --- Stat row above chart --- */
.trend-card-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 4px 0 12px;
}

.trend-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 6px;
  background: linear-gradient(180deg, #fbfdff 0%, #f3f8ff 100%);
  border: 1px solid #e4eef9;
  border-radius: 10px;
  text-align: center;
}

.trend-stat-label {
  font-size: 10px;
  font-weight: 700;
  color: #66758f;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.trend-stat-value {
  margin-top: 2px;
  font-size: 16px;
  font-weight: 700;
  color: #21304e;
  font-variant: normal;
  letter-spacing: 0;
  line-height: 1.1;
}

.trend-stat-value.over {
  color: #b42318;
}

.trend-stat-value.under {
  color: #1f7a45;
}

/* --- Footer pill row --- */
.trend-card-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #eef4fb;
}

.trend-footer-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-variant: normal;
  border: 1px solid transparent;
}

.trend-footer-pill::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  transform: translateX(-50%) translateY(4px);
  width: max-content;
  max-width: min(260px, 80vw);
  padding: 8px 10px;
  border-radius: 10px;
  background: #21304e;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: 0;
  text-transform: none;
  text-align: center;
  box-shadow: 0 10px 24px rgba(16, 30, 56, 0.22);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease;
  z-index: 20;
}

.trend-footer-pill:hover::after,
.trend-footer-pill:focus::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.trend-footer-pill span {
  font-size: 13px;
  color: inherit;
}

.trend-footer-pill.ok {
  background: #e4f4ea;
  color: #1f7a45;
  border-color: #b6dfc4;
}

.trend-footer-pill.on-track {
  background: #eef4fb;
  color: #3658a7;
  border-color: #cddcf2;
}

.trend-footer-pill.over {
  background: #fff0ef;
  color: #b42318;
  border-color: #f4b4ab;
}

/* Macro chart tabs sit between header and stats; reduce existing margin */
#top-tab-macros .macro-chart-tabs {
  margin: 0 0 12px;
}

/* ============================================================
   Weight tab redesign
   ============================================================ */

/* --- Lock card (PIN setup / unlock) --- */
.weight-lock-card {
  text-align: center;
  padding: 28px 18px;
  background: linear-gradient(180deg, #fbfdff 0%, #f3f8ff 100%);
  border: 1px solid #d6e4f5;
  border-radius: 14px;
  font-variant: normal;
  letter-spacing: 0;
}

.weight-lock-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #eef4fb;
  color: #3658a7;
  margin-bottom: 12px;
  box-shadow: 0 4px 10px rgba(54, 88, 167, 0.12);
}

.weight-lock-icon svg {
  width: 26px;
  height: 26px;
}

.weight-lock-title {
  margin: 0 0 6px;
  color: #21304e;
  font-size: 18px;
  font-weight: 700;
}

.weight-lock-help {
  margin: 0 auto 16px;
  max-width: 340px;
  color: #66758f;
  font-size: 13px;
  line-height: 1.5;
}

.weight-lock-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: stretch;
  max-width: 340px;
  margin: 0 auto;
}

.weight-lock-form input {
  margin: 0;
  text-align: center;
  letter-spacing: 0.4em;
  font-size: 18px;
  font-family: 'Consolas', 'Menlo', monospace;
}

.weight-lock-form button {
  margin: 0;
  width: 100%;
  min-width: 0;
  padding: 12px 16px;
}

.weight-lock-status {
  margin: 14px 0 0;
  font-size: 13px;
  color: #4f5d75;
  min-height: 1em;
}

.weight-lock-status.error {
  color: #b42318;
}

/* --- Stats row --- */
.weight-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 4px 0 14px;
  font-variant: normal;
  letter-spacing: 0;
}

.weight-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px 8px;
  background: linear-gradient(180deg, #fbfdff 0%, #f3f8ff 100%);
  border: 1px solid #d6e4f5;
  border-radius: 12px;
  text-align: center;
}

.weight-stat-label {
  font-size: 10px;
  font-weight: 700;
  color: #66758f;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.weight-stat-value {
  margin-top: 2px;
  font-size: 19px;
  font-weight: 700;
  color: #21304e;
  line-height: 1.1;
}

.weight-stat-value.over {
  color: #b42318;
}

.weight-stat-value.under {
  color: #1f7a45;
}

.weight-stat-meta {
  margin-top: 3px;
  font-size: 11px;
  color: #8b97a8;
  font-weight: 600;
}

/* --- Quick-entry strip --- */
.weight-entry-form {
  display: flex;
  gap: 8px;
  align-items: stretch;
  margin: 0 0 14px;
  flex-wrap: wrap;
}

.weight-entry-form input[type="date"] {
  flex: 1 1 130px;
  margin: 0;
  font-variant: normal;
  letter-spacing: 0;
}

.weight-entry-form input[type="number"] {
  flex: 1 1 100px;
  margin: 0;
}

.weight-entry-form button {
  margin: 0;
  width: auto;
  min-width: 80px;
}

/* --- Chart card actions (avg toggle + lock button) --- */
.weight-chart-card {
  margin: 0 0 14px;
}

.weight-chart-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.weight-toggle-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #f2f7fc;
  border: 1px solid #d6e4f5;
  font-size: 11px;
  font-weight: 700;
  color: #3658a7;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: pointer;
  user-select: none;
  font-variant: normal;
}

.weight-toggle-pill input {
  width: 14px;
  height: 14px;
  margin: 0;
}

.weight-lock-btn-small {
  margin: 0;
  width: 32px;
  height: 32px;
  padding: 0;
  background: #f2f7fc;
  color: #66758f;
  border: 1px solid #d6e4f5;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.weight-lock-btn-small svg {
  width: 16px;
  height: 16px;
}

.weight-lock-btn-small:hover {
  background: #e4eef9;
  color: #21304e;
}

/* --- History cards --- */
.weight-history-block {
  margin-top: 18px;
}

.weight-history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 10px;
  flex-wrap: wrap;
}

.weight-history-title {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: #66758f;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.weight-history-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.weight-history-page-info {
  font-size: 12px;
  font-weight: 600;
  color: #66758f;
  font-variant: normal;
  letter-spacing: 0;
  min-width: 90px;
  text-align: center;
}

.weight-history-list {
  display: grid;
  gap: 8px;
  font-variant: normal;
  letter-spacing: 0;
}

.weight-history-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: #fff;
  border: 1px solid #e4eef9;
  border-radius: 12px;
}

.weight-history-card-date {
  flex: 1 1 auto;
  font-size: 13px;
  color: #66758f;
  font-weight: 600;
}

.weight-history-card-weight {
  flex: 0 0 auto;
  font-size: 16px;
  font-weight: 700;
  color: #21304e;
}

.weight-history-card-delta {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: #f2f7fc;
  color: #66758f;
  border: 1px solid #d6e4f5;
  min-width: 48px;
  justify-content: center;
}

.weight-history-card-delta.under {
  background: #e4f4ea;
  color: #1f7a45;
  border-color: #b6dfc4;
}

.weight-history-card-delta.over {
  background: #fff0ef;
  color: #b42318;
  border-color: #f4b4ab;
}

.weight-history-card-delete {
  margin: 0;
  width: 28px;
  height: 28px;
  padding: 0;
  background: transparent;
  color: #66758f;
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.weight-history-card-delete:hover {
  background: #fff0ef;
  color: #b42318;
  border-color: #f4b4ab;
}

.weight-history-empty {
  text-align: center;
  padding: 18px;
  background: #f8fbff;
  border: 1px dashed #d6e4f5;
  border-radius: 12px;
  color: #66758f;
  font-size: 13px;
}

/* ============================================================
   Calorie Calculator redesign
   ============================================================ */

.planner-form {
  display: grid;
  gap: 14px;
  margin: 0 0 14px;
  font-variant: normal;
  letter-spacing: 0;
}

.planner-section {
  padding: 14px;
  background: #f8fbff;
  border: 1px solid #d6e4f5;
  border-radius: 12px;
}

.planner-section-title {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 700;
  color: #3658a7;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.planner-section-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.planner-field {
  display: grid;
  gap: 5px;
  font-size: 13px;
  color: #21304e;
}

.planner-field-full {
  grid-column: 1 / -1;
}

.planner-field span,
.planner-field-label {
  font-size: 11px;
  font-weight: 700;
  color: #66758f;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.planner-field input,
.planner-field select {
  margin: 0;
  font-variant: normal;
  letter-spacing: 0;
}

/* --- Pace slider --- */
.planner-pace-block {
  margin-top: 12px;
}

.planner-pace-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}

.planner-pace-value {
  font-size: 14px;
  font-weight: 700;
  color: #3658a7;
}

.planner-pace-slider {
  width: 100%;
  margin: 0;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: linear-gradient(90deg, #cddcf2 0%, #cddcf2 100%);
  border-radius: 999px;
  outline: none;
  padding: 0;
}

.planner-pace-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  background: #3658a7;
  border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: 0 2px 6px rgba(54, 88, 167, 0.4);
  cursor: pointer;
}

.planner-pace-slider::-moz-range-thumb {
  width: 22px;
  height: 22px;
  background: #3658a7;
  border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: 0 2px 6px rgba(54, 88, 167, 0.4);
  cursor: pointer;
}

.planner-pace-ticks {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 10px;
  font-weight: 600;
  color: #8b97a8;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* --- Hero result + sub-stats --- */
.planner-results-card {
  margin-top: 16px;
}

.planner-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 22px 16px 18px;
  background: linear-gradient(180deg, #eef4fb 0%, #dde9fa 100%);
  border: 1px solid #cddcf2;
  border-radius: 16px;
  margin-bottom: 12px;
}

.planner-hero-label {
  font-size: 11px;
  font-weight: 700;
  color: #3658a7;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.planner-hero-value {
  margin-top: 6px;
  font-size: 38px;
  font-weight: 800;
  color: #21304e;
  font-variant: normal;
  letter-spacing: 0;
  line-height: 1;
}

.planner-hero-sub {
  margin-top: 8px;
  max-width: 340px;
  font-size: 13px;
  color: #4f5d75;
  font-variant: normal;
  letter-spacing: 0;
  line-height: 1.4;
}

.planner-substats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
  font-variant: normal;
  letter-spacing: 0;
}

.planner-substat {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 6px;
  background: #fff;
  border: 1px solid #e4eef9;
  border-radius: 10px;
  text-align: center;
}

.planner-substat-label {
  font-size: 10px;
  font-weight: 700;
  color: #66758f;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.planner-substat-value {
  margin-top: 2px;
  font-size: 14px;
  font-weight: 700;
  color: #21304e;
  line-height: 1.1;
}

.planner-substat-value.under {
  color: #1f7a45;
}

.planner-substat-value.over {
  color: #b42318;
}

.planner-apply-btn {
  margin: 0 0 6px;
  width: 100%;
  padding: 12px 14px;
  background: #1f7a45;
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.planner-apply-btn:hover {
  background: #176236;
}

.planner-apply-btn:disabled {
  background: #b8d4c2;
  cursor: not-allowed;
}

.planner-apply-status {
  margin: 0 0 14px;
  text-align: center;
  font-size: 12px;
  color: #4f5d75;
  min-height: 1em;
}

.planner-apply-status.success {
  color: #1f7a45;
  font-weight: 700;
}

.planner-apply-status.error {
  color: #b42318;
}

.planner-projection-card {
  margin-top: 4px;
}

.planner-save-note {
  margin: 12px 0 0;
  color: #66758f;
  font-size: 12px;
  font-variant: normal;
  letter-spacing: 0;
  line-height: 1.4;
  text-align: center;
}

@media (max-width: 480px) {
  .weight-stats {
    gap: 6px;
  }

  .weight-stat {
    padding: 10px 4px;
  }

  .weight-stat-value {
    font-size: 16px;
  }

  .planner-section-grid {
    grid-template-columns: 1fr;
  }

  .planner-substats {
    gap: 6px;
  }

  .planner-substat-value {
    font-size: 12px;
  }

  .planner-hero-value {
    font-size: 30px;
  }
}

