* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "DM Sans", system-ui, sans-serif;
  background: #abc0d4;
  color: #232424;
}

.container {
  width: min(1200px, 94vw);
  margin: 0 auto;
}

header.container {
  padding: 1.5rem 0 0.5rem;
}

.header-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.setup-welcome {
  border-color: #0095b3;
  background: linear-gradient(180deg, rgba(0, 149, 179, 0.08), transparent);
}

.setup-welcome h2 {
  color: #0095b3;
}

.sync-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.85rem;
  color: #475569;
  padding: 0.35rem 0.65rem;
  background: rgba(255, 255, 255, 0.65);
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  flex-shrink: 0;
  margin-top: 0.15rem;
}

.sync-indicator[hidden] {
  display: none !important;
}

.sync-indicator-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #94a3b8;
  flex-shrink: 0;
}

.sync-indicator.syncing .sync-indicator-dot {
  background: #3b82f6;
  animation: sync-pulse 1s ease-in-out infinite;
}

.sync-indicator.synced .sync-indicator-dot {
  background: #22c55e;
}

.sync-indicator.offline .sync-indicator-dot {
  background: #94a3b8;
}

.sync-indicator.error .sync-indicator-dot {
  background: #f59e0b;
}

.sync-indicator.conflict .sync-indicator-dot {
  background: #ef4444;
}

@keyframes sync-pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: 0.45;
    transform: scale(0.85);
  }
}

.tab-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid #d8dbe0;
  padding-bottom: 0.5rem;
}

.tab-btn {
  background: transparent;
  color: #d1d6db;
  border: 1px solid #2e3b4f;
  border-bottom-color: #626975;
  border-radius: 8px 8px 0 0;
  padding: 0.5rem 1rem;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: -1px;
}

.tab-btn:hover {
  color: #e7edf5;
  background: #d8dadf;
}

.tab-btn.active {
  background: #d3d5d9;
  color: #0095B3;
  border-color: #2e3b4f;
  border-bottom-color: #626975;
}

.day-tab-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.25rem 0 0.5rem;
  border-bottom: 1px solid #33445e;
  margin-bottom: 0.75rem;
  overflow-x: auto;
}

.day-tab-btn {
  background: #152132;
  color: #91a3ba;
  border: 1px solid #3c4d67;
  border-radius: 8px;
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.day-tab-btn:hover {
  color: #e7edf5;
  border-color: #5a7190;
}

.day-tab-btn.active {
  background: #0095B3;
  color: #10151a;
  border-color: #0095B3;
}

.day-tab-btn.excluded-from-shopping:not(.active) {
  opacity: 0.72;
  border-style: dashed;
}

.tab-panel[hidden] {
  display: none;
}

.tab-panel {
  min-width: 0;
}

.settings-status {
  padding: 0.5rem 0 1rem;
}

.file-input-wrap {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.file-input-wrap input[type="file"] {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

#backup-row {
  width: 100%;
  min-width: 0;
  align-items: flex-end;
}

#backup-row label {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.35rem;
  flex: 1 1 14rem;
  min-width: 0;
  max-width: 100%;
}

#backup-select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.recipe-search {
  width: 100%;
  max-width: 28rem;
}

.recipe-filter-row {
  gap: 0.4rem;
}

.recipe-filter-btn {
  background: #152132;
  color: #91a3ba;
  border: 1px solid #3c4d67;
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.recipe-filter-btn:hover {
  color: #e7edf5;
  border-color: #5a7190;
}

.recipe-filter-btn.active {
  background: #0095B3;
  color: #10151a;
  border-color: #0095B3;
}

.recipe-actions-row {
  align-items: center;
  gap: 0.5rem;
}

.recipe-new-category-input {
  width: min(11rem, 36vw);
  flex: 0 1 11rem;
}

.recipe-manage-toggle {
  white-space: nowrap;
}

.recipe-category-manage-panel {
  padding-top: 0.35rem;
}

.recipe-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.recipe-block {
  border: 1px solid #33445e;
  border-radius: 10px;
  background: #c2c6cb;
  overflow: hidden;
}

.recipe-block-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 0.75rem;
  background: #b8bcc2;
  border-bottom: 1px solid #33445e;
}

.recipe-block-header-line1 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
}

.recipe-block-header-line2 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.recipe-block.collapsed .recipe-block-header {
  border-bottom: none;
}

.recipe-toggle {
  background: transparent;
  border: 1px solid #3c4d67;
  border-radius: 6px;
  width: 2rem;
  height: 2rem;
  flex-shrink: 0;
  cursor: pointer;
  color: #232424;
  font-size: 0.85rem;
  line-height: 1;
}

.recipe-block-title-preview {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recipe-block-category {
  flex-shrink: 0;
  font-size: 0.8rem;
  color: #4a5568;
  background: #d8dbe0;
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
}

.recipe-block-meal-slot {
  flex-shrink: 0;
  font-size: 0.8rem;
  color: #2f4858;
  background: #c8dce8;
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
}

.recipe-delete {
  flex-shrink: 0;
  font-size: 0.85rem;
}

@media (max-width: 640px) {
  .recipe-block-header {
    flex-direction: column;
    align-items: stretch;
    gap: 0.4rem;
  }

  .recipe-block-header-line1 {
    flex: none;
    width: 100%;
  }

  .recipe-block-title-preview {
    white-space: normal;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    line-height: 1.3;
  }

  .recipe-block-header-line2 {
    flex-wrap: wrap;
    padding-left: calc(2rem + 0.5rem);
    gap: 0.35rem 0.5rem;
  }
}

.recipe-block-body {
  padding: 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.recipe-block.collapsed .recipe-block-body {
  display: none;
}

.recipe-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.92rem;
  min-width: 0;
}

.recipe-meta-row {
  display: grid;
  grid-template-columns: minmax(10rem, 2fr) minmax(7rem, 1fr) minmax(7rem, 1fr);
  gap: 0.65rem 1rem;
  align-items: end;
}

.recipe-title-input,
.recipe-category-select,
.recipe-meal-slot-select {
  width: 100%;
}

@media (max-width: 640px) {
  .recipe-meta-row {
    grid-template-columns: 1fr 1fr;
  }

  .recipe-meta-row .recipe-field-title {
    grid-column: 1 / -1;
  }
}

.recipe-field-procedure {
  min-width: 0;
}

.recipe-ingredients-section h4 {
  margin: 0;
}

.recipe-ingredients-hint {
  margin: 0;
  font-size: 0.9rem;
}

.recipe-meal-picker {
  margin-top: 0.25rem;
}

.recipe-converters-global {
  margin-top: 0.5rem;
}

.converter-details {
  padding: 0.55rem 0.75rem;
  border: 1px solid #c8ced8;
  border-radius: 8px;
  background: #eef1f5;
}

.recipe-block .converter-details {
  margin-top: 0.35rem;
  background: #f4f6f9;
  border-color: #d5dbe4;
}

.converter-details summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  list-style: none;
}

.converter-details summary::-webkit-details-marker {
  display: none;
}

.converter-details summary::before {
  content: "▸ ";
  display: inline-block;
  width: 1rem;
}

.converter-details[open] summary::before {
  content: "▾ ";
}

.converter-details[open] summary {
  margin-bottom: 0.35rem;
}

.converter-details-body {
  padding-top: 0.15rem;
}

.recipe-block .converter-panel {
  margin-top: 0;
  padding: 0;
  border: none;
  background: transparent;
}

.converter-panel {
  min-width: 0;
}

.converter-heading {
  margin: 0;
  font-size: 1rem;
}

.converter-hint {
  margin: 0;
  font-size: 0.85rem;
}

.converter-section-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: #242527;
}

.converter-row {
  align-items: end;
  gap: 0.5rem 0.75rem;
}

.converter-field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
  font-size: 0.85rem;
}

.converter-field select,
.converter-field input {
  min-width: 7rem;
  max-width: 100%;
}

.converter-field-amount input {
  width: 5.5rem;
}

.converter-result-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.75rem;
  font-size: 0.9rem;
  padding-bottom: 0.35rem;
}

.converter-result-label {
  color: #4a5568;
}

.converter-result-value {
  font-size: 1.05rem;
}

.converter-grain-results strong {
  font-weight: 700;
}

.converter-settings-block {
  margin-top: 1rem;
}

.converter-settings-block:first-child {
  margin-top: 0;
}

.converter-settings-header {
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.converter-settings-header h3 {
  margin: 0;
  font-size: 1rem;
}

.converter-settings-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  border: 1px solid #354863;
  border-radius: 8px;
  padding: 0.55rem 0.65rem;
  background: #d1d4d9;
}

.converter-settings-row {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.5rem 0.75rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid #aeb4bf;
}

.converter-settings-row:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.converter-settings-field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
  font-size: 0.85rem;
}

.converter-settings-field-label {
  font-weight: 600;
  color: #242527;
}

.converter-settings-field input {
  width: 100%;
  min-width: 0;
}

.converter-settings-name {
  min-width: 8rem;
}

.converter-settings-field-num {
  flex: 0 0 auto;
}

.converter-settings-num {
  width: 5.5rem;
  max-width: 100%;
}

.converter-settings-field-food {
  flex: 1 1 14rem;
  min-width: 12rem;
}

.converter-settings-food-cell {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

.converter-food-combobox {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  max-width: none;
}

.converter-food-combobox input {
  width: 100%;
  min-width: 0;
}

.converter-food-suggestions.food-suggestions {
  position: fixed;
  top: auto;
  left: auto;
  width: auto;
  min-width: 11rem;
  max-width: min(24rem, calc(100vw - 1rem));
}

.converter-settings-row.is-converter-food-search-open {
  position: relative;
  z-index: 50;
}

.converter-settings-delete {
  flex: 0 0 auto;
  align-self: end;
}

.converter-clear-food-link {
  flex: 0 0 auto;
  font-size: 0.82rem;
  padding: 0.1rem 0.35rem;
  white-space: nowrap;
}

.converter-clear-food-link.hidden {
  display: none;
}

.recipe-copy-paste {
  align-items: end;
}

.recipe-copy-portion-label {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.85rem;
}

.recipe-copy-portion-label select {
  min-width: 7.5rem;
}

.recipe-block:has(.food-combobox:focus-within),
.recipe-block:has(.food-suggestions:not([hidden])),
.recipe-block:has(.favourites-panel.is-open),
.recipe-block.is-favourites-open,
.recipe-block.is-search-open {
  z-index: 100;
}

.recipe-block:has(.favourites-panel.is-open) .recipe-meal-picker,
.recipe-block.is-favourites-open .recipe-meal-picker,
.recipe-block.is-search-open .recipe-meal-picker {
  z-index: 200;
}

.recipe-block .table-wrap {
  position: relative;
  z-index: 1;
  max-height: none;
  overflow-y: visible;
}

.recipe-block .table-wrap table {
  font-size: 0.82rem;
}

.recipe-block .table-wrap th,
.recipe-block .table-wrap td {
  padding: 0.18rem 0.45rem;
}

.recipe-block .table-wrap .ghost {
  padding: 0.15rem 0.45rem;
  font-size: 0.78rem;
}

.recipe-block .table-wrap th:first-child,
.recipe-block .table-wrap td:first-child {
  width: 1%;
  max-width: 14rem;
  padding-right: 0.55rem;
}

.recipe-block .table-wrap td:first-child {
  background: #c2c6cb;
  z-index: 1;
}

.recipe-block .table-wrap th:first-child {
  z-index: 2;
}

.recipe-block .table-wrap .grams-col {
  width: 1%;
  padding-left: 0.35rem;
  padding-right: 0.12rem;
}

.recipe-block .table-wrap .entry-grams-input {
  width: 4.5em;
  min-width: 4.5em;
  padding: 0.08rem 0.12rem;
  font-size: 0.82rem;
  text-align: right;
  -moz-appearance: textfield;
}

.recipe-block .table-wrap .entry-grams-input::-webkit-outer-spin-button,
.recipe-block .table-wrap .entry-grams-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.recipe-block.is-search-open {
  position: relative;
  z-index: 2;
}

.recipe-body-field {
  width: 100%;
  min-height: 4rem;
  resize: none;
  overflow: hidden;
  line-height: 1.45;
}

.recipe-category-manage-hint {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
}

.recipe-category-manage-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
  gap: 0.45rem;
}

.recipe-category-row {
  display: flex;
  gap: 0.35rem;
  align-items: center;
  min-width: 0;
}

.recipe-category-rename {
  flex: 1;
  min-width: 0;
  width: 0;
}

.recipe-category-delete {
  flex-shrink: 0;
  font-size: 0.8rem;
  padding: 0.35rem 0.55rem;
}

.meal-prep-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.meal-prep-section-header {
  margin-top: 0.35rem;
  padding: 0.35rem 0.65rem 0.1rem;
  font-size: 0.9rem;
  font-weight: 700;
  color: #242527;
  border-bottom: 1px solid #354863;
}

.meal-prep-section-header:first-child {
  margin-top: 0;
}

.meal-prep-header,
.meal-prep-row {
  display: grid;
  grid-template-columns: 3.2rem minmax(7rem, 0.95fr) minmax(12rem, 2.4fr) 5.5rem 4.5rem auto;
  gap: 0.6rem;
  align-items: start;
}

.meal-prep-header {
  padding: 0 0.65rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: #242527;
}

.meal-prep-row {
  padding: 0.65rem;
  border: 1px solid #354863;
  border-radius: 8px;
  background: #c2c6cb;
}

.meal-prep-row-done {
  background: #c5dcc5;
}

.meal-prep-name-cell {
  min-width: 0;
  padding-top: 0.15rem;
}

.meal-prep-name-cell .summary-actual-value {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.meal-prep-list .summary-actual-cell.is-tooltip-open {
  z-index: 100;
}

.meal-prep-list .summary-actual-cell.is-tooltip-open .summary-actual-tooltip {
  display: block !important;
  position: fixed;
  z-index: 10000;
  right: auto;
  top: 0;
  left: 0;
}

.meal-prep-list .summary-actual-cell:hover .summary-actual-tooltip,
.meal-prep-list .summary-actual-cell:focus-within .summary-actual-tooltip {
  display: none;
}

.meal-prep-order {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.meal-prep-move {
  padding: 0.15rem 0.4rem;
  min-width: 2rem;
  line-height: 1;
}

.meal-prep-name {
  font-weight: 600;
  padding-top: 0.15rem;
  word-break: break-word;
}

.meal-prep-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.meal-prep-field-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: #242527;
}

.meal-prep-row .meal-prep-field-label {
  display: none;
}

.meal-prep-comments {
  width: 100%;
  min-height: 3rem;
  resize: vertical;
  line-height: 1.4;
}

.meal-prep-netto {
  width: 100%;
  max-width: 5.5rem;
  padding: 0.35rem 0.4rem;
  text-align: right;
}

.meal-prep-grams {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.meal-prep-grams-value {
  padding-top: 0.35rem;
  font-weight: 600;
}

.meal-prep-done-btn {
  align-self: start;
  white-space: nowrap;
}

.meal-prep-metrics-row {
  display: contents;
}

@media (max-width: 860px) {
  .meal-prep-header {
    display: none;
  }

  .meal-prep-row {
    grid-template-columns: 3.2rem 1fr;
    grid-template-areas:
      "order name"
      "order prep"
      "order metrics";
  }

  .meal-prep-order {
    grid-area: order;
  }

  .meal-prep-name {
    grid-area: name;
  }

  .meal-prep-field:not(.meal-prep-netto-field) {
    grid-area: prep;
  }

  .meal-prep-metrics-row {
    display: flex;
    grid-area: metrics;
    align-items: flex-end;
    gap: 0.4rem 0.55rem;
    min-width: 0;
  }

  .meal-prep-metrics-row .meal-prep-netto-field {
    flex: 0 1 auto;
    min-width: 0;
  }

  .meal-prep-metrics-row .meal-prep-netto {
    width: 3.75rem;
    max-width: none;
    padding: 0.3rem 0.35rem;
  }

  .meal-prep-metrics-row .meal-prep-grams {
    flex: 0 0 auto;
    flex-direction: row;
    align-items: baseline;
    gap: 0.3rem;
    padding-bottom: 0.35rem;
  }

  .meal-prep-metrics-row .meal-prep-grams-value {
    padding-top: 0;
  }

  .meal-prep-metrics-row .meal-prep-done-btn {
    flex: 0 0 auto;
    margin-left: auto;
    padding: 0.3rem 0.45rem;
    font-size: 0.78rem;
    min-height: 2rem;
  }

  .meal-prep-row .meal-prep-field-label {
    display: block;
    font-size: 0.72rem;
  }
}

h1, h2, h3 {
  margin: 0;
}

h2 {
  font-size: 1.1rem;
}

.stack > * + * {
  margin-top: 1rem;
}

.stack-sm > * + * {
  margin-top: 0.6rem;
}

.card {
  background: #d1d4d9;
  border: 1px solid #2e3b4f;
  border-radius: 12px;
  padding: 1rem;
  min-width: 0;
  max-width: 100%;
}

.row-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
}

.row-wrap.tight {
  gap: 0.4rem;
}

.muted {
  color: #242527;
  font-size: 0.92rem;
}

button,
input,
select {
  font: inherit;
}

button {
  background: #0095B3;
  color: #10151a;
  border: none;
  border-radius: 8px;
  padding: 0.45rem 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

button.ghost {
  background: transparent;
  color: .muted#191a1b;
  border: 1px solid #3c4d67;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

button.ghost:disabled {
  color: #8a919a;
  border-color: #5a6270;
  background: transparent;
}

button.warn {
  background: #fca5a5;
}

input[type="text"],
input[type="number"],
input[type="date"],
input[type="file"],
select,
textarea {
  background: #ccced3;
  color: #262627;
  border: 1px solid #314058;
  border-radius: 8px;
  padding: 0.45rem 0.6rem;
}

.notes-field {
  width: 100%;
  min-height: 5rem;
  resize: vertical;
  line-height: 1.45;
}

label.stack-sm {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.75rem;
  font-size: 0.92rem;
}

.day-card {
  border: 1px solid #33445e;
  border-radius: 10px;
  padding: 0.8rem;
  background: #c2c6cb;
  min-width: 0;
  max-width: 100%;
}

.meal-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  min-width: 0;
}

.meal-card {
  border: 1px solid #34465f;
  border-radius: 10px;
  padding: 0.65rem;
  background: #d6d8db;
  overflow: visible;
  position: relative;
  z-index: 1;
  min-width: 0;
  max-width: 100%;
}

.meal-card:has(.food-combobox:focus-within),
.meal-card:has(.food-suggestions:not([hidden])),
.meal-card:has(.favourites-panel.is-open),
.meal-card.is-favourites-open,
.meal-card.is-search-open {
  z-index: 100;
}

.meal-card:has(.food-suggestions:not([hidden])) .meal-picker,
.meal-card:has(.favourites-panel.is-open) .meal-picker,
.meal-card.is-favourites-open .meal-picker,
.meal-card.is-search-open .meal-picker {
  z-index: 200;
}

.meal-picker {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-start;
  gap: 0.5rem;
  position: relative;
  z-index: 10;
}

.meal-card .table-wrap {
  position: relative;
  z-index: 1;
  max-height: none;
  overflow-y: visible;
}

.meal-card .table-wrap table {
  font-size: 0.82rem;
}

.meal-card .table-wrap th,
.meal-card .table-wrap td {
  padding: 0.18rem 0.45rem;
}

.meal-card .table-wrap .ghost {
  padding: 0.15rem 0.45rem;
  font-size: 0.78rem;
}

.meal-card .table-wrap th:first-child,
.meal-card .table-wrap td:first-child {
  width: 1%;
  max-width: 14rem;
  padding-right: 0.55rem;
}

.meal-card .table-wrap .grams-col {
  width: 1%;
  padding-left: 0.35rem;
  padding-right: 0.12rem;
}

.meal-card .entry-grams-input {
  width: 3.25em;
  min-width: 0;
  padding: 0.08rem 0.12rem;
  font-size: 0.82rem;
  -moz-appearance: textfield;
}

.meal-card .entry-grams-input::-webkit-outer-spin-button,
.meal-card .entry-grams-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.food-combobox {
  position: relative;
  flex: 1 1 14rem;
  max-width: 20rem;
  min-width: 11rem;
  z-index: 3;
}

.favourites-picker {
  position: relative;
  flex: 0 0 auto;
  z-index: 4;
}

.favourites-toggle {
  white-space: nowrap;
}

.favourites-panel {
  position: absolute;
  top: calc(100% + 0.25rem);
  left: 0;
  width: min(22rem, 88vw);
  z-index: 1000;
  margin: 0;
  background: #ccced3;
  color: #262627;
  border: 1px solid #314058;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}

.favourites-panel[hidden] {
  display: none !important;
}

.favourites-list {
  list-style: none;
  margin: 0;
  padding: 0.25rem 0;
  max-height: 320px;
  overflow-y: auto;
  scrollbar-gutter: stable;
}

.favourites-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.6rem;
}

.favourites-item-label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex: 1 1 auto;
  min-width: 0;
  cursor: pointer;
}

.favourites-item-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.favourites-grams-input {
  width: 3.25em;
  flex: 0 0 3.25em;
  min-width: 0;
  padding: 0.1rem 0.15rem;
  text-align: right;
  -moz-appearance: textfield;
}

.favourites-grams-input::-webkit-outer-spin-button,
.favourites-grams-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.favourites-empty {
  padding: 0.6rem 0.75rem;
}

.favourites-actions {
  padding: 0.5rem 0.6rem 0.6rem;
  border-top: 1px solid #314058;
  background: #c2c6cb;
}

.favourites-list::-webkit-scrollbar {
  width: 8px;
}

.favourites-list::-webkit-scrollbar-track {
  background: transparent;
  margin: 6px 0;
}

.favourites-list::-webkit-scrollbar-thumb {
  background: #8b9099;
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.food-combobox input[type="text"] {
  width: 100%;
}

.food-suggestions {
  position: absolute;
  top: calc(100% + 0.25rem);
  left: 0;
  width: 100%;
  min-width: 11rem;
  max-width: 20rem;
  z-index: 1000;
  margin: 0;
  background: #ccced3;
  color: #262627;
  border: 1px solid #314058;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}

.food-suggestions-list {
  list-style: none;
  margin: 0;
  padding: 0.25rem 0;
  max-height: 220px;
  overflow-y: auto;
  scrollbar-gutter: stable;
}

.food-suggestions-list::-webkit-scrollbar {
  width: 8px;
}

.food-suggestions-list::-webkit-scrollbar-track {
  background: transparent;
  margin: 6px 0;
}

.food-suggestions-list::-webkit-scrollbar-thumb {
  background: #8b9099;
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.food-suggestion {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  color: inherit;
  border: none;
  border-radius: 0;
  padding: 0.45rem 0.65rem;
  font-weight: 400;
  cursor: pointer;
}

.food-suggestion:hover,
.food-suggestion:focus {
  background: #b8bcc4;
  outline: none;
}

.meal-picker input[data-role="grams-input"] {
  width: 6.5rem;
  flex: 0 0 6.5rem;
}

.entry-grams-input {
  width: 3.25em;
  padding: 0.1rem 0.15rem;
  text-align: right;
}

.meal-picker > button {
  flex: 0 0 auto;
  align-self: flex-start;
}

@media (max-width: 540px) {
  .meal-picker {
    flex-wrap: wrap;
  }

  .food-combobox {
    flex: 1 1 100%;
    max-width: none;
  }

  .favourites-panel {
    width: min(20rem, 80vw);
  }

  .food-suggestions {
    max-width: none;
  }
}

.table-wrap {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: auto;
  border: 1px solid #354863;
  border-radius: 8px;
  max-height: 280px;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: #8b9099 transparent;
}

.table-wrap::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.table-wrap::-webkit-scrollbar-track {
  background: transparent;
  margin: 6px;
}

.table-wrap::-webkit-scrollbar-thumb {
  background: #8b9099;
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.table-wrap::-webkit-scrollbar-corner {
  background: transparent;
}

.table-wrap table {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

table {
  border-collapse: collapse;
  font-size: 0.86rem;
  table-layout: auto;
}

th,
td {
  border-bottom: 1px solid #2b3a50;
  padding: 0.35rem 0.5rem;
  text-align: left;
  white-space: nowrap;
  vertical-align: middle;
}

th {
  background: #bec1c8;
  position: sticky;
  top: 0;
  z-index: 1;
}

.table-wrap th:first-child,
.table-wrap td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  box-shadow: 2px 0 6px rgba(0, 0, 0, 0.1);
}

.table-wrap th:first-child {
  z-index: 4;
  background: #bec1c8;
}

.meal-card .table-wrap td:first-child {
  background: #d6d8db;
  z-index: 1;
}

.meal-card .table-wrap th:first-child {
  z-index: 2;
}

.meal-card-header {
  align-items: center;
  gap: 0.5rem;
}

.meal-copy-paste {
  flex: 0 0 auto;
  margin-left: auto;
}

.meal-copy-btn-active {
  background: #0095B3;
  color: #10151a;
  border-color: #0095B3;
}

.meal-paste-btn:disabled,
.meal-copy-btn:disabled {
  opacity: 0.4;
}

.meal-copy-status {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin: 0 0 0.5rem;
  padding: 0.45rem 0.55rem 0.45rem 0.65rem;
  border-left: 3px solid #0095B3;
  background: rgba(0, 149, 179, 0.1);
  border-radius: 0 6px 6px 0;
  font-size: 0.84rem;
}

.meal-copy-status-text {
  flex: 1 1 auto;
  margin: 0;
  min-width: 0;
}

.meal-copy-status-dismiss {
  flex: 0 0 auto;
  padding: 0.1rem 0.4rem;
  font-size: 1rem;
  line-height: 1.1;
}

@media (max-width: 540px) {
  .meal-card-header {
    flex-wrap: wrap;
  }

  .meal-copy-paste {
    margin-left: 0;
    width: 100%;
  }
}

.day-card .table-wrap td:first-child {
  background: #c2c6cb;
}

.day-card .day-summary-table .summary-group-header .summary-group-label {
  background: #adb2bb;
}

.day-card .day-summary-table .summary-nutrient-row td:first-child {
  background: #c2c6cb;
}

.card .table-wrap td:first-child {
  background: #d1d4d9;
}

.table-wrap tbody tr:hover td:first-child {
  filter: brightness(0.97);
}

th.num,
td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

th.action-col,
td.action-col {
  text-align: center;
}

.day-summary .table-wrap {
  max-height: none;
  overflow-x: auto;
  overflow-y: visible;
}

.shopping-list-wrap.table-wrap {
  max-height: none;
  overflow-y: visible;
  overflow-x: hidden;
  max-width: 50%;
}

@media (max-width: 640px) {
  .shopping-list-wrap.table-wrap {
    max-width: 100%;
  }
}

.shopping-list-wrap.table-wrap table {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  table-layout: fixed;
}

.shopping-list-wrap th:first-child,
.shopping-list-wrap td:first-child {
  position: static;
  box-shadow: none;
}

.shopping-list-wrap col.shopping-grams-col {
  width: 4.25rem;
}

.shopping-list-wrap col.shopping-price-col {
  width: 4.25rem;
}

.shopping-list-wrap col.shopping-action-col {
  width: 4.75rem;
}

.shopping-list-wrap .shopping-name-col {
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.shopping-list-wrap .shopping-grams-col,
.shopping-list-wrap .shopping-price-col,
.shopping-list-wrap .action-col {
  white-space: nowrap;
}

.shopping-row-done td,
.card .table-wrap .shopping-row-done td:first-child {
  background: #c5dcc5;
}

.shopping-done-btn {
  min-width: 3.5rem;
  padding: 0.35rem 0.55rem;
  font-size: 0.82rem;
}

.day-summary {
  border-top: 1px solid #324560;
  padding-top: 0.6rem;
  min-width: 0;
  max-width: 100%;
}

.day-summary-header {
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
}

.day-summary-header h3 {
  margin: 0;
}

.day-summary-subtitle {
  margin: 0 0 0.5rem;
}

.day-summary-mode-btn {
  font-size: 0.82rem;
  padding: 0.35rem 0.65rem;
}

.day-summary-table .summary-group-header td {
  padding: 0;
  background: #adb2bb;
}

.day-summary-table .summary-group-header .summary-group-label {
  position: sticky;
  left: 0;
  z-index: 3;
  background: #adb2bb;
  box-shadow: 2px 0 6px rgba(0, 0, 0, 0.1);
}

.day-summary-table .summary-group-header .summary-group-fill {
  padding: 0;
  border-bottom: 1px solid #2b3a50;
}

.day-summary-table .summary-group-header .summary-group-toggle {
  width: auto;
  white-space: nowrap;
}

.summary-group-toggle {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  color: inherit;
  border: none;
  border-radius: 0;
  padding: 0.5rem 0.65rem;
  font-weight: 600;
  cursor: pointer;
}

.summary-group-toggle:hover,
.summary-group-toggle:focus {
  background: #7fa6e4;
  outline: none;
}

.summary-group-toggle .muted {
  font-weight: 400;
}

.day-summary-table .summary-nutrient-row td:first-child {
  padding-left: 1.25rem;
}

.target-pct-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.85rem;
  margin: 0.35rem 0 0.65rem;
  font-size: 0.78rem;
}

.target-pct-legend-item::before {
  content: "";
  display: inline-block;
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 999px;
  margin-right: 0.35rem;
  vertical-align: middle;
  background: currentColor;
}

.target-pct-cell {
  min-width: 9rem;
}

.target-pct-visual {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  justify-content: flex-end;
  width: 100%;
}

.target-pct-bar {
  flex: 1 1 auto;
  max-width: 5.5rem;
  height: 0.55rem;
  background: rgba(16, 21, 26, 0.12);
  border-radius: 999px;
  overflow: hidden;
}

.target-pct-fill {
  display: block;
  height: 100%;
  width: calc(var(--pct, 0) * 1%);
  max-width: 100%;
  border-radius: 999px;
}

.target-pct-label {
  flex: 0 0 auto;
  min-width: 3.1rem;
  font-variant-numeric: tabular-nums;
  font-size: 0.82rem;
  color: #262627;
}

.target-pct-visual.target-pct-low .target-pct-fill,
.target-pct-legend-item.target-pct-low {
  color: #5e4b9a;
}

.target-pct-visual.target-pct-mid .target-pct-fill,
.target-pct-legend-item.target-pct-mid {
  color: #b8860b;
}

.target-pct-visual.target-pct-good .target-pct-fill,
.target-pct-legend-item.target-pct-good {
  color: #2d8a4e;
}

.target-pct-visual.target-pct-over .target-pct-fill,
.target-pct-legend-item.target-pct-over {
  color: #c0392b;
}

.target-pct-visual.target-pct-low .target-pct-fill,
.target-pct-visual.target-pct-mid .target-pct-fill,
.target-pct-visual.target-pct-good .target-pct-fill,
.target-pct-visual.target-pct-over .target-pct-fill {
  background: currentColor;
}

.target-pct-over .target-pct-fill {
  width: 100%;
}

.summary-actual-cell {
  position: relative;
}

.summary-actual-cell.is-tooltip-open {
  z-index: 100;
}

.day-summary .summary-actual-cell.is-tooltip-open .summary-actual-tooltip {
  display: block !important;
  position: fixed;
  z-index: 10000;
  right: auto;
  top: 0;
  left: 0;
}

.summary-actual-value {
  cursor: help;
  border-bottom: 1px dotted rgba(38, 38, 39, 0.45);
}

.summary-actual-over-max {
  color: #c0392b;
  font-weight: 600;
}

.summary-actual-over-max.summary-actual-value {
  border-bottom-color: rgba(192, 57, 43, 0.55);
}

.summary-actual-cell:hover .summary-actual-over-max.summary-actual-value,
.summary-actual-cell:focus-within .summary-actual-over-max.summary-actual-value {
  border-bottom-color: rgba(192, 57, 43, 0.85);
}

.summary-actual-cell:hover .summary-actual-value,
.summary-actual-cell:focus-within .summary-actual-value {
  border-bottom-color: rgba(38, 38, 39, 0.75);
}

.summary-actual-tooltip {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 0.35rem);
  z-index: 30;
  min-width: 14rem;
  max-width: 22rem;
  padding: 0.55rem 0.65rem;
  background: #ffffff;
  color: #262627;
  border: 1px solid #b8bcc4;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  text-align: left;
  font-size: 0.78rem;
  line-height: 1.35;
}

.summary-actual-cell:hover .summary-actual-tooltip,
.summary-actual-cell:focus-within .summary-actual-tooltip {
  display: block;
}

.day-summary .summary-actual-cell:hover .summary-actual-tooltip,
.day-summary .summary-actual-cell:focus-within .summary-actual-tooltip {
  display: none;
}

.summary-actual-tooltip-title {
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: #262627;
}

.summary-source-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.summary-source-list li {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.2rem 0;
  border-top: 1px solid rgba(38, 38, 39, 0.1);
}

.summary-source-list li:first-child {
  border-top: none;
  padding-top: 0;
}

.summary-source-name {
  flex: 1 1 auto;
  min-width: 0;
}

.summary-source-meta {
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
  color: #4a5568;
  white-space: nowrap;
}

.pill {
  display: inline-block;
  background: #2a3a52;
  color: #bfd0e6;
  border-radius: 999px;
  padding: 0.15rem 0.5rem;
  font-size: 0.75rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  border: 1px solid #3b4e68;
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  background: #b7b9bc;
  font-size: 0.8rem;
}

.meal-slots-summary {
  font-size: 0.9rem;
  line-height: 1.5;
}

.meal-slots-toolbar {
  position: relative;
  z-index: 20;
}

.meal-slots-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  min-width: 0;
}

.meal-slot-column {
  border: 1px solid #34465f;
  border-radius: 10px;
  padding: 0.65rem;
  background: #d6d8db;
  min-width: 0;
}

.meal-slot-column-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.meal-slot-column-header h3 {
  font-size: 0.95rem;
}

.meal-slot-foods {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.meal-slot-food-chip {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem 0.4rem;
  border: 1px solid #314058;
  border-radius: 8px;
  background: #ccced3;
  font-size: 0.82rem;
  min-width: 0;
}

.meal-slot-food-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meal-slot-food-remove {
  flex: 0 0 auto;
  padding: 0.1rem 0.35rem;
  font-size: 0.75rem;
  line-height: 1.2;
}

.meal-slot-empty {
  font-size: 0.82rem;
  padding: 0.25rem 0.1rem;
}

.meal-slots-unassigned {
  margin-top: 0.25rem;
}

.meal-slots-unassigned h3 {
  font-size: 0.95rem;
  margin-bottom: 0.35rem;
}

.meal-slots-unassigned-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.meal-slots-unassigned-chip {
  font-size: 0.8rem;
  padding: 0.2rem 0.5rem;
  border: 1px dashed #3c4d67;
  border-radius: 999px;
  background: #c8cbd0;
}

.meal-slots-favourites-picker {
  position: relative;
  flex: 0 0 auto;
  z-index: 30;
}

.meal-slots-favourites-panel {
  position: absolute;
  top: calc(100% + 0.25rem);
  left: 0;
  width: min(22rem, 88vw);
  z-index: 1000;
  margin: 0;
  background: #ccced3;
  color: #262627;
  border: 1px solid #314058;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}

.meal-slots-favourites-panel[hidden] {
  display: none !important;
}

.meal-slots-favourites-list {
  list-style: none;
  margin: 0;
  padding: 0.25rem 0;
  max-height: 280px;
  overflow-y: auto;
}

.meal-slots-favourite-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.6rem;
}

.meal-slots-favourite-label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex: 1 1 auto;
  min-width: 0;
  cursor: pointer;
}

.meal-slots-favourite-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meal-slots-favourites-actions {
  padding: 0.5rem 0.6rem 0.6rem;
  border-top: 1px solid #314058;
  background: #c2c6cb;
}

.meal-slots-add-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.meal-slots-add-buttons button {
  font-size: 0.78rem;
  padding: 0.35rem 0.55rem;
}

.meal-slot-notice {
  font-size: 0.84rem;
  margin: 0.4rem 0 0;
  padding: 0.4rem 0.55rem;
  border-left: 3px solid #b8860b;
  background: rgba(184, 134, 11, 0.12);
  border-radius: 0 6px 6px 0;
}

.meal-slot-suggest-btn {
  align-self: flex-start;
  font-size: 0.82rem;
  padding: 0.25rem 0.55rem;
}

.meal-slots-suggestions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.meal-slot-suggest-header h3 {
  margin: 0;
  font-size: 0.95rem;
}

.meal-slot-suggest-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 0.65rem;
}

.meal-suggestion-card {
  margin: 0;
  padding: 0.55rem 0.65rem;
  border: 1px solid #d8dbe0;
  border-radius: 8px;
  background: #fff;
}

.meal-suggestion-card-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.6rem;
}

.meal-suggestion-card-header h4 {
  margin: 0;
  font-size: 0.88rem;
}

.meal-suggestion-meta {
  font-size: 0.78rem;
}

.meal-suggestion-items {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.meal-suggestion-item {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.82rem;
}

.meal-suggestion-food-name {
  padding: 0.08rem 0.35rem;
  border-radius: 4px;
}

.meal-suggestion-grams {
  flex-shrink: 0;
  color: #5a6573;
}

.meal-suggestion-copy {
  align-self: flex-start;
  font-size: 0.82rem;
}

.meal-suggestion-actions {
  margin-top: 0.15rem;
}

.meal-slots-priorities-card {
  padding: 0.55rem 0.65rem;
  border: 1px solid #d8dbe0;
  border-radius: 8px;
  background: #f7f8fa;
}

.meal-slots-priorities-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
}

.meal-slots-priorities-header h3 {
  margin: 0;
  font-size: 0.92rem;
}

.meal-day-planner-details {
  margin-top: 0.35rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid #d8dbe0;
  border-radius: 8px;
  background: #f7f8fa;
}

.meal-day-planner-details summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  list-style: none;
}

.meal-day-planner-details summary::-webkit-details-marker {
  display: none;
}

.meal-day-planner-details summary::before {
  content: "▸ ";
  display: inline-block;
  width: 1rem;
}

.meal-day-planner-details[open] summary::before {
  content: "▾ ";
}

.meal-day-planner-details[open] summary {
  margin-bottom: 0.45rem;
}

.meal-day-planner-section h4,
.meal-day-plan-result-header h4 {
  margin: 0;
  font-size: 0.88rem;
}

.meal-day-planner-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
  gap: 0.45rem 0.65rem;
}

.meal-day-planner-field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.8rem;
}

.meal-day-planner-field input {
  width: 100%;
}

.meal-day-planner-hint {
  margin: 0;
  font-size: 0.82rem;
}

.meal-day-plan-result {
  padding-top: 0.35rem;
  border-top: 1px solid #d8dbe0;
}

.meal-day-plan-result-header {
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1rem;
}

.meal-day-plan-day-select {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.85rem;
}

.meal-day-plan-day-select select {
  min-width: 11rem;
}

.meal-day-plan-save-notice {
  margin: 0;
  padding: 0.45rem 0.65rem;
  border-radius: 6px;
  font-size: 0.88rem;
  color: #1e4d2b;
  background: #e6f4ea;
  border: 1px solid #b7dfc4;
}

.planning-flash {
  margin-bottom: 0.65rem;
}

.meal-day-plan-summary {
  margin: 0;
  font-size: 0.9rem;
}

.meal-day-plan-day-block {
  padding-top: 0.65rem;
  border-top: 1px solid #d8dbe0;
}

.meal-day-plan-day-block:first-of-type {
  padding-top: 0;
  border-top: none;
}

.meal-suggest-preset-label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.85rem;
}

.meal-suggest-weights {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 0.45rem 0.75rem;
}

.meal-suggest-weight-label {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.8rem;
}

.meal-suggest-weight-label input[type="range"] {
  width: 100%;
}

.meal-slot-suggest-block {
  margin-top: 0.35rem;
}

.meal-slots-saved-details {
  margin-top: 0.65rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2, var(--bg));
}

.meal-slots-saved-details summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  list-style: none;
}

.meal-slots-saved-details summary::-webkit-details-marker {
  display: none;
}

.meal-slots-saved-details summary::before {
  content: "▸ ";
  display: inline-block;
  width: 1rem;
}

.meal-slots-saved-details[open] summary::before {
  content: "▾ ";
}

.meal-slots-saved-details[open] summary {
  margin-bottom: 0.35rem;
}

.meal-slots-saved-group h4 {
  margin: 0;
  font-size: 0.88rem;
}

.meal-saved-card h4 {
  font-size: 0.88rem;
}

@media (max-width: 900px) {
  .meal-slots-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 540px) {
  .meal-slots-favourites-panel {
    width: min(20rem, 80vw);
  }

  .meal-slots-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.settings-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.settings-section-header h2,
.settings-section-header h3 {
  margin: 0;
}

.settings-section-toggle {
  flex: 0 0 auto;
  white-space: nowrap;
}

.settings-section-body[hidden] {
  display: none;
}

.food-editor-search-label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  max-width: 20rem;
}

.food-color-legend {
  border: 1px solid #c8ced8;
  border-radius: 8px;
  padding: 0.45rem 0.75rem;
  background: #eef1f5;
}

.food-color-legend[hidden] {
  display: none !important;
}

.food-color-legend summary {
  cursor: pointer;
  font-size: 0.92rem;
  font-weight: 600;
  color: #232424;
  user-select: none;
}

.food-color-legend-body {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin-top: 0.55rem;
}

.food-color-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.food-color-swatch {
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 4px;
  border: 1px solid rgba(15, 23, 42, 0.22);
  flex-shrink: 0;
}

.food-color-hex {
  font-size: 0.84rem;
  font-family: ui-monospace, "Cascadia Code", "Consolas", monospace;
}

.food-editor-layout {
  display: grid;
  grid-template-columns: minmax(10rem, 16rem) minmax(0, 1fr);
  gap: 0.85rem;
  align-items: start;
}

.food-editor-list-wrap {
  min-width: 0;
}

.food-editor-list-count {
  margin: 0 0 0.35rem;
  font-size: 0.84rem;
}

.food-editor-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  max-height: 22rem;
  overflow-y: auto;
  border: 1px solid #354863;
  border-radius: 8px;
  padding: 0.35rem;
  background: #c2c6cb;
}

.food-editor-list-item {
  display: block;
  width: 100%;
  text-align: left;
  background: #d1d4d9;
  color: #232424;
  border: 1px solid #8a919a;
  border-radius: 6px;
  padding: 0.35rem 0.5rem;
  font-size: 0.78rem;
  font-weight: 400;
  line-height: 1.35;
  white-space: normal;
  word-break: break-word;
  cursor: pointer;
}

.food-editor-list-item:hover {
  border-color: #0095B3;
}

.food-editor-list-item.is-active {
  background: #0095B3;
  color: #10151a;
  border-color: #0095B3;
}

.food-editor-detail {
  min-width: 0;
  padding: 0.55rem;
  border: 1px solid #354863;
  border-radius: 8px;
  background: #c2c6cb;
  font-size: 0.78rem;
}

.food-editor-detail h3,
.food-editor-detail h4 {
  margin: 0;
  font-size: 0.92rem;
}

.food-editor-detail input[type="text"],
.food-editor-detail input[type="number"] {
  padding: 0.22rem 0.38rem;
  font-size: 0.78rem;
}

.food-editor-detail-header {
  align-items: center;
  justify-content: space-between;
}

.food-editor-primary-row {
  display: grid;
  grid-template-columns: minmax(4.5rem, 6.5rem) minmax(0, 1fr);
  gap: 0.45rem;
  align-items: end;
}

.food-editor-id-field input[readonly] {
  font-variant-numeric: tabular-nums;
}

.food-editor-save-flash {
  align-self: center;
  font-size: 0.84rem;
  font-weight: 600;
  color: #10151a;
  background: rgba(0, 149, 179, 0.35);
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.food-editor-save-flash.is-visible {
  opacity: 1;
}

.food-editor-detail label,
.food-editor-meta-field {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.food-editor-detail label > span,
.food-editor-meta-field > span,
.food-editor-nutrient-field > span {
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.2;
}

.food-editor-meta-grid,
.food-editor-nutrient-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.35rem;
  align-items: stretch;
}

.food-editor-nutrient-field,
.food-editor-meta-field {
  height: 100%;
}

.food-editor-nutrient-field > span,
.food-editor-meta-field > span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.food-editor-nutrient-field > input,
.food-editor-meta-field > input[type="text"] {
  margin-top: auto;
}

.food-editor-checkbox-field > input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  margin-top: auto;
  align-self: flex-start;
}

.food-editor-nutrients h4 {
  margin-top: 0.25rem;
}

.food-editor-intake {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.food-editor-intake-row {
  display: grid;
  grid-template-columns: minmax(8rem, 1.2fr) repeat(3, minmax(5rem, 1fr)) auto;
  gap: 0.5rem;
  align-items: stretch;
  padding: 0.45rem 0;
  border-bottom: 1px solid #354863;
}

.food-editor-intake-name {
  font-weight: 600;
  padding-bottom: 0.35rem;
  word-break: break-word;
}

.food-editor-intake-row label {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
  font-size: 0.78rem;
}

.food-editor-intake-row label > span {
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.2;
}

.food-editor-intake-row label > input[type="number"],
.food-editor-intake-row label > input[type="text"] {
  margin-top: auto;
  padding: 0.22rem 0.38rem;
  font-size: 0.78rem;
}

.food-editor-intake-checkbox-field > span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.food-editor-intake-checkbox-field > input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  margin-top: auto;
  align-self: flex-start;
}

@media (max-width: 900px) {
  .food-editor-layout {
    grid-template-columns: 1fr;
  }

  .food-editor-list {
    max-height: 12rem;
  }

  .food-editor-primary-row {
    grid-template-columns: 1fr;
  }

  .food-editor-meta-grid,
  .food-editor-nutrient-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .food-editor-intake-row {
    grid-template-columns: 1fr 1fr;
  }

  .food-editor-intake-name {
    grid-column: 1 / -1;
  }
}

@media (min-width: 901px) and (max-width: 1100px) {
  .food-editor-meta-grid,
  .food-editor-nutrient-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.wellness-date-row {
  align-items: end;
}

.wellness-section h3 {
  margin: 0;
  font-size: 1rem;
}

.wellness-intake-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(5.5rem, 1fr));
  gap: 0.75rem 1rem;
}

.wellness-metric-label {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 0.15rem;
}

.wellness-metric-value {
  font-size: 1.1rem;
  font-weight: 600;
}

.wellness-intake-note {
  margin-top: 0.5rem;
  margin-bottom: 0;
}

.wellness-log-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
  gap: 0.75rem 1rem;
}

.wellness-log-grid label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.wellness-history-wrap {
  margin-top: 0.25rem;
}

.wellness-history-table {
  min-width: 42rem;
}

.wellness-history-table th,
.wellness-history-table td {
  white-space: nowrap;
}

.wellness-history-table .action-col {
  width: 1%;
}

@media (max-width: 600px) {
  .wellness-log-grid {
    grid-template-columns: 1fr;
  }
}

.wellness-chart-controls {
  align-items: end;
  gap: 0.75rem 1rem;
  margin-bottom: 0.25rem;
}

.wellness-chart-range-note {
  font-size: 0.85rem;
}

.wellness-charts {
  gap: 0.35rem;
}

.wellness-chart {
  margin: 0;
  padding: 0.35rem 0.45rem;
  border: 1px solid #d8dbe0;
  border-radius: 8px;
  background: #f7f8fa;
}

.wellness-chart-empty {
  min-height: 4rem;
}

.wellness-chart-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.65rem;
  margin: 0 0 0.2rem;
}

.wellness-chart-title {
  font-size: 0.85rem;
  font-weight: 600;
}

.wellness-chart-meta {
  font-size: 0.72rem;
  font-weight: 600;
  color: #0095B3;
}

.wellness-chart-axes {
  font-size: 0.68rem;
  color: #5a6573;
}

.wellness-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  font-size: 0.72rem;
  color: #5a6573;
}

.wellness-chart-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.wellness-chart-legend-swatch {
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 999px;
  flex-shrink: 0;
}

.wellness-chart-svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: 118px;
}

.wellness-chart-svg-scatter {
  max-height: 264px;
}

.wellness-scatter-controls {
  align-items: end;
  gap: 0.75rem 1rem;
  margin-bottom: 0.35rem;
}

.wellness-chart-axis-title {
  fill: #5a6573;
  font-size: 9px;
  font-weight: 600;
  font-family: "DM Sans", system-ui, sans-serif;
}

.wellness-chart-x-axis-title {
  font-size: 10px;
}

.wellness-chart-grid {
  stroke: #e2e5ea;
  stroke-width: 1;
}

.wellness-chart-x-grid {
  stroke: #eceff3;
  stroke-width: 1;
}

.wellness-chart-x-tick {
  stroke: #b8bec8;
  stroke-width: 1;
}

.wellness-chart-axis-line {
  stroke: #c5cad3;
  stroke-width: 1;
}

.wellness-chart-axis {
  fill: #5a6573;
  font-size: 10px;
  font-family: "DM Sans", system-ui, sans-serif;
}

.wellness-chart-x-label {
  font-size: 9px;
}

.wellness-chart-line {
  vector-effect: non-scaling-stroke;
}

.wellness-chart-dot {
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}

.wellness-chart-hit {
  cursor: pointer;
}

.wellness-chart-tooltip {
  position: fixed;
  z-index: 1000;
  max-width: 14rem;
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  background: #1e293b;
  color: #f8fafc;
  font-size: 0.75rem;
  line-height: 1.35;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.25);
}

.wellness-chart-tooltip-date {
  display: block;
  font-weight: 600;
  margin-bottom: 0.1rem;
}

.wellness-chart-tooltip-value {
  display: block;
  color: #e2e8f0;
}

.cloud-sync-legacy {
  margin-top: 0.75rem;
  padding-top: 0.5rem;
  border-top: 1px solid #d8dbe0;
}

.cloud-sync-legacy summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.cloud-sync-legacy[open] summary {
  margin-bottom: 0.75rem;
}

.sync-alert-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1200;
  padding: 0.65rem 0 calc(0.65rem + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid #f59e0b;
  background: #fef3c7;
  box-shadow: 0 -4px 18px rgba(15, 23, 42, 0.14);
}

.sync-alert-bar[hidden] {
  display: none !important;
}

.sync-alert-bar-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
}

body.sync-alert-open {
  padding-bottom: calc(5.75rem + env(safe-area-inset-bottom, 0px));
}

.sync-alert-message {
  flex: 1 1 12rem;
  margin: 0;
  font-size: 0.88rem;
  color: #92400e;
}

.sync-alert-actions {
  gap: 0.4rem;
}

.sync-alert-actions button {
  font-size: 0.85rem;
  padding: 0.3rem 0.65rem;
}
