* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  color: #1f2933;
  background: #f7f8fa;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.card {
  width: min(100%, 420px);
  padding: 28px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 20px;
  box-shadow: 0 16px 40px rgba(31, 41, 51, 0.08);
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #0f766e;
}

h1 {
  margin: 0 0 12px;
  font-size: 1.7rem;
  line-height: 1.2;
}

.intro {
  margin: 0 0 24px;
  color: #52606d;
  line-height: 1.5;
}

.auth-form {
  display: grid;
  gap: 10px;
}

label {
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  padding: 12px 14px;
  font: inherit;
  border: 1px solid #cbd2d9;
  border-radius: 12px;
  background: #ffffff;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: 3px solid rgba(15, 118, 110, 0.18);
  border-color: #0f766e;
}

.button-row {
  display: flex;
  gap: 12px;
  margin-top: 12px;
}

button {
  width: 100%;
  padding: 12px 16px;
  font: inherit;
  font-weight: 700;
  color: #ffffff;
  background: #0f766e;
  border: 0;
  border-radius: 12px;
  cursor: pointer;
}

button:hover {
  background: #115e59;
}

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

button:disabled:hover {
  background: #0f766e;
}

.mobile-app {
  position: relative;
  width: min(100%, 480px);
  height: calc(100vh - 48px);
  min-height: 0;
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 18px 18px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 24px;
  box-shadow: 0 16px 40px rgba(31, 41, 51, 0.08);
}

.mobile-app:has(#add-entry-screen:not(.hidden) #draft-input-state:not(.hidden)) {
  gap: 0;
  padding: 0;
  overflow: hidden;
  background: #101820;
}

.mobile-app:has(#add-entry-screen:not(.hidden) #draft-edit-state:not(.hidden)) {
  gap: 0;
  padding: 0;
  overflow: hidden;
  background: #f7f8fa;
  border-color: #f7f8fa;
}

.app-header {
  position: absolute;
  top: 14px;
  right: 18px;
  z-index: 20;
  width: 32px;
  height: 32px;
}

.settings-button {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  color: #0f766e;
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  background: transparent;
  border-radius: 50%;
}

.settings-button:hover {
  color: #115e59;
  background: #f7f8fa;
}

.app-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.history-screen,
.favorites-screen,
.settings-screen {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 0;
  padding: 10px 2px 0;
  overflow: hidden;
}

.history-title,
.favorites-title,
.settings-title {
  flex: 0 0 auto;
  margin: 0;
  color: #52606d;
  font-size: 0.92rem;
  font-weight: 400;
  line-height: 1.15;
  text-align: center;
}

.meal-search-input {
  flex: 0 0 auto;
  height: 40px;
  min-height: 40px;
  margin-top: 4px;
  padding: 0 12px;
  color: #1f2933;
  font-size: 0.9rem;
  line-height: 1.2;
  background: #f7f8fa;
  border: 1px solid #d7e0e8;
  border-radius: 12px;
}

.meal-search-input::placeholder {
  color: #7b8794;
}

.history-status,
.favorites-status {
  flex: 0 0 auto;
  min-height: 1em;
  margin: 0;
  color: #52606d;
  font-size: 0.92rem;
  line-height: 1.3;
}

.history-status:empty,
.favorites-status:empty {
  min-height: 0;
}

.history-scroll-area,
.favorites-scroll-area {
  flex: 1;
  min-height: 0;
  padding: 2px 2px 2px;
  overflow-y: auto;
}

.history-day-list,
.favorites-list {
  display: grid;
  gap: 9px;
}

.meal-log-date-divider {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  margin: 4px 0 1px;
  color: #52606d;
  font-size: 0.72rem;
  line-height: 1.2;
  text-align: center;
}

.meal-log-date-divider::before,
.meal-log-date-divider::after {
  content: "";
  height: 1px;
  background: #e5e7eb;
}

.meal-log-card,
.favorite-card {
  position: relative;
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
}

.meal-log-card h3,
.favorite-card h3 {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  font-size: 1rem;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meal-card-row {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.meal-card-media {
  display: grid;
  align-items: start;
  width: 70px;
}

.meal-card-thumbnail {
  width: 70px;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 10px;
  background: #f7f8fa;
}

.meal-card-thumbnail-placeholder {
  display: block;
  width: 70px;
  height: 70px;
  visibility: hidden;
}

.meal-card-content {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.meal-log-card,
.favorite-card {
  cursor: pointer;
}

.meal-log-card:hover,
.meal-log-card:focus-visible,
.favorite-card:hover,
.favorite-card:focus-visible {
  border-color: #a7d8d2;
  outline: none;
  box-shadow: 0 8px 18px rgba(31, 41, 51, 0.08);
}

.meal-log-label {
  color: #0f766e;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.3;
}

.meal-log-macros {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin: 0;
}

.meal-log-macros div {
  display: grid;
  gap: 2px;
  min-height: 48px;
  padding: 6px 5px;
  text-align: center;
  background: #f7f8fa;
  border-radius: 10px;
}

.meal-log-macros dt {
  color: #52606d;
  font-size: 0.68rem;
  font-weight: 700;
}

.meal-log-macros dd {
  margin: 0;
  color: #1f2933;
  font-size: 0.88rem;
  font-weight: 700;
}

.meal-log-macro-primary dd {
  color: #0f766e;
  font-size: 1.12rem;
}

.meal-log-footer {
  display: grid;
  min-height: 1.15em;
  align-items: center;
  column-gap: 10px;
}

.meal-log-card-footer {
  position: relative;
  display: flex;
  justify-content: center;
  padding: 0 40px;
}

.favorite-card-footer {
  position: relative;
  grid-template-columns: minmax(0, 1fr);
  padding-right: 40px;
}

.meal-log-footer .meal-log-label {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  justify-self: start;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meal-log-card-footer .meal-log-label {
  position: absolute;
  left: 0;
  max-width: calc(50% - 36px);
}

.favorite-card-footer .meal-log-label {
  grid-column: 1;
}

.favorite-card-footer .meal-log-delete-button {
  position: absolute;
  right: 0;
}

.meal-log-time {
  margin: 0;
  color: #52606d;
  font-size: 0.82rem;
  line-height: 1.3;
  text-align: center;
  white-space: nowrap;
}

.meal-log-delete-button {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  color: #52606d;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1;
  background: transparent;
  border-radius: 50%;
}

.meal-log-card-footer .meal-log-delete-button {
  position: absolute;
  right: 0;
}

.meal-log-delete-button:hover {
  color: #b42318;
  background: #f7f8fa;
}

.history-empty-state,
.favorites-empty-state {
  display: grid;
  align-content: start;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 100%;
  padding-top: clamp(52px, 12dvh, 86px);
  text-align: center;
}

.history-empty-state h2,
.favorites-empty-state h2 {
  margin: 0;
  font-size: 1.25rem;
  line-height: 1.25;
  text-align: center;
}

.history-empty-state p,
.favorites-empty-state p {
  max-width: 280px;
  margin: 0 auto;
  color: #52606d;
  line-height: 1.5;
  text-align: center;
}

.history-empty-state .empty-state-kicker,
.favorites-empty-state .empty-state-kicker {
  color: #0f766e;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.settings-panel {
  display: grid;
  gap: 14px;
  padding: 12px;
}

.settings-panel p {
  margin: 0;
  color: #52606d;
  line-height: 1.5;
}

.settings-logout-button {
  min-height: 48px;
}

.favorite-details-dialog {
  width: min(100%, 480px);
  height: calc(100dvh - 48px);
  max-height: calc(100dvh - 48px);
  margin: auto;
  padding: 24px 16px;
  color: #1f2933;
  background: rgba(31, 41, 51, 0.36);
  border: 0;
  border-radius: 24px;
  box-shadow: none;
  overflow: hidden;
}

.favorite-details-dialog::backdrop {
  background: transparent;
}

.favorite-details-dialog[open] {
  display: grid;
  place-items: center;
}

.favorite-dialog-content {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.meal-detail-dialog-card {
  width: min(100%, 420px);
  height: min(calc(100% - 76px), 544px);
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 18px;
  box-shadow: 0 18px 48px rgba(31, 41, 51, 0.18);
}

.favorite-dialog-header {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 32px;
  align-items: start;
  gap: 10px;
}

.favorite-dialog-header h2 {
  margin: 0;
  font-size: 1.15rem;
  line-height: 1.2;
}

.favorite-dialog-close-button {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  color: #52606d;
  font-size: 1.15rem;
  font-weight: 400;
  line-height: 1;
  background: #f7f8fa;
  border-radius: 50%;
}

.favorite-dialog-close-button:hover {
  color: #b42318;
  background: #eef2f5;
}

.favorite-dialog-details,
.favorite-dialog-macros {
  display: grid;
  gap: 8px;
  margin: 0;
}

.favorite-dialog-details div,
.favorite-dialog-macros div {
  display: grid;
  gap: 3px;
  padding: 8px;
  background: #f7f8fa;
  border-radius: 10px;
}

.favorite-dialog-details dt,
.favorite-dialog-macros dt {
  color: #52606d;
  font-size: 0.72rem;
  font-weight: 700;
}

.favorite-dialog-details dd,
.favorite-dialog-macros dd {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 700;
}

.dialog-breakdown {
  white-space: pre-line;
  font-weight: 400;
  line-height: 1.4;
}

.dialog-image-strip {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 64px));
  gap: 8px;
}

.dialog-image-strip img {
  width: 64px;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  background: #f7f8fa;
}

.favorite-dialog-macros {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.favorite-dialog-macros div {
  min-height: 54px;
  text-align: center;
}

.favorite-dialog-macros div:first-child dd {
  color: #0f766e;
  font-size: 1.08rem;
}

.favorite-dialog-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}

.favorite-dialog-actions button {
  min-height: 48px;
}

.suggested-matches-content {
  position: relative;
  width: min(100%, 420px);
  grid-template-rows: auto minmax(0, 1fr) auto;
  max-height: min(calc(100% - 76px), 544px);
  overflow: hidden;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 18px;
  box-shadow: 0 18px 48px rgba(31, 41, 51, 0.18);
}

.suggested-matches-subtitle {
  margin: 4px 0 0;
  color: #52606d;
  font-size: 0.86rem;
  line-height: 1.35;
}

.suggested-matches-list {
  display: grid;
  gap: 10px;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.suggested-match-card {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 10px;
  padding: 10px;
  background: #f7f8fa;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  cursor: pointer;
}

.suggested-match-card:hover,
.suggested-match-card:focus-visible {
  border-color: #a7d8d2;
  outline: none;
  box-shadow: 0 8px 18px rgba(31, 41, 51, 0.08);
}

.suggested-match-media {
  width: 64px;
}

.suggested-match-thumbnail,
.suggested-match-thumbnail-placeholder {
  display: block;
  width: 64px;
  height: 64px;
  border-radius: 10px;
  background: #eef2f5;
  object-fit: cover;
}

.suggested-match-content {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.suggested-match-content h3,
.suggested-match-meta,
.suggested-match-macros,
.suggested-match-note {
  margin: 0;
}

.suggested-match-content h3 {
  min-width: 0;
  overflow: hidden;
  font-size: 0.98rem;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.suggested-match-meta,
.suggested-match-macros,
.suggested-match-note {
  color: #52606d;
  font-size: 0.82rem;
  line-height: 1.3;
}

.suggested-match-note {
  color: #b45309;
  font-weight: 700;
}

.suggested-matches-actions {
  position: sticky;
  bottom: 0;
  display: grid;
  padding-top: 4px;
  background: #ffffff;
}

.suggested-matches-actions button {
  min-height: 48px;
}

.suggested-match-detail {
  z-index: 1000;
}

.meal-detail-dialog-card .favorite-dialog-details {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.meal-detail-dialog-card .favorite-dialog-details > div {
  align-content: start;
  flex: 0 0 auto;
  min-height: auto;
}

.meal-detail-dialog-card .favorite-dialog-details > div:first-child {
  flex: 1 1 0;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  max-height: none;
  overflow: hidden;
}

.favorite-detail-card .favorite-dialog-details > div:first-child {
  min-height: 0;
  max-height: none;
}

.meal-detail-dialog-card .favorite-dialog-macros {
  flex: 0 0 auto;
  align-items: start;
}

.meal-detail-dialog-card .favorite-dialog-macros div {
  height: auto;
}

.meal-detail-dialog-card .favorite-dialog-actions {
  flex: 0 0 auto;
  margin-top: auto;
}

.meal-detail-dialog-card .dialog-breakdown {
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.draft-screen {
  position: relative;
  display: flex;
  min-height: 100%;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: inherit;
  background: #f7f8fa;
}

.draft-screen:has(#draft-input-state:not(.hidden)) {
  background: #101820;
}

.draft-form {
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  gap: 0;
  width: 100%;
  min-height: 100%;
}

.draft-message {
  position: absolute;
  top: 52px;
  right: 16px;
  left: 16px;
  z-index: 10;
  min-height: 1.15em;
  margin: 0;
  padding: 8px 10px;
  color: #b42318;
  font-size: 0.86rem;
  line-height: 1.3;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(229, 231, 235, 0.88);
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(31, 41, 51, 0.12);
}

.draft-message:empty {
  display: none;
  min-height: 0;
  padding: 0;
  border: 0;
}

.draft-screen textarea {
  resize: none;
}

.draft-input-state,
.draft-edit-state {
  display: grid;
  gap: 8px;
  min-height: 0;
  padding: 12px;
}

.draft-close-button {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 8;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  color: #52606d;
  font-size: 1.15rem;
  font-weight: 400;
  line-height: 1;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 50%;
  box-shadow: 0 8px 20px rgba(31, 41, 51, 0.18);
}

.draft-input-state .draft-close-button {
  top: 20px;
  right: 20px;
  left: auto;
}

.draft-input-state.preview-open .draft-close-button {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

.draft-close-button:hover {
  color: #b42318;
  background: #f7f8fa;
}

.draft-input-state {
  position: relative;
  isolation: isolate;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  align-content: stretch;
  padding: 0;
  overflow: hidden;
}

.draft-edit-state {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 24px 18px;
  overflow-y: auto;
  overflow-x: hidden;
  background: #f7f8fa;
}

.draft-edit-state #draft-edit-image-area,
.draft-edit-state .macro-fields,
.draft-edit-state .favorite-toggle,
.draft-edit-state .adjust-with-ai-row,
.draft-edit-state .draft-action-row {
  flex: 0 0 auto;
}

.draft-input-state .photo-placeholder {
  align-self: stretch;
  min-height: 0;
}

.photo-placeholder {
  position: relative;
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 150px;
  padding: 18px 14px;
  text-align: center;
  background: #ffffff;
  border: 1px dashed #a7d8d2;
  border-radius: 20px;
}

.draft-camera-area {
  z-index: 4;
  align-self: start;
  width: 100%;
  height: clamp(430px, 62vh, 560px);
  min-height: 0;
  margin: 0;
  padding: 0;
  overflow: visible;
  color: #ffffff;
  background: #1f2933;
  border: 0;
  border-radius: 0;
  grid-row: 1;
  grid-column: 1;
}

.draft-camera-preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: calc(100% + 72px);
  object-fit: cover;
}

.draft-camera-area.camera-ready {
  color: #ffffff;
}

.draft-camera-area.camera-ready::after {
  content: "";
  position: absolute;
  inset: 0 0 -72px;
  background: linear-gradient(
    180deg,
    rgba(31, 41, 51, 0.1) 0%,
    rgba(31, 41, 51, 0.08) 45%,
    rgba(31, 41, 51, 0.54) 100%
  );
}

.draft-camera-area > *:not(.draft-camera-preview) {
  position: relative;
  z-index: 1;
}

.draft-camera-area .photo-placeholder-icon {
  border-color: rgba(255, 255, 255, 0.86);
}

.draft-camera-area .photo-placeholder-icon::before {
  background: rgba(255, 255, 255, 0.86);
}

.draft-camera-area .photo-placeholder-icon::after {
  border-color: rgba(255, 255, 255, 0.86);
}

.draft-camera-area.camera-ready .photo-placeholder-icon,
.draft-camera-area.camera-ready p,
.draft-camera-area.camera-ready span {
  display: none;
}

.photo-placeholder-small {
  grid-template-columns: auto 1fr;
  justify-items: start;
  min-height: 52px;
  padding: 10px;
  text-align: left;
}

#draft-edit-image-area {
  display: block;
  min-height: 0;
  max-height: none;
  padding: 0;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 0;
}

#draft-edit-image-area.has-images {
  padding: 0;
}

#draft-edit-image-area .photo-placeholder-icon,
#draft-edit-image-area > span {
  display: none;
}

.photo-placeholder-small .photo-placeholder-icon {
  width: 36px;
  height: 28px;
  border-width: 2px;
}

.photo-placeholder-small .photo-placeholder-icon::before {
  top: -7px;
  left: 8px;
  width: 16px;
  height: 6px;
}

.photo-placeholder-small .photo-placeholder-icon::after {
  top: 6px;
  left: 11px;
  width: 9px;
  height: 9px;
  border-width: 2px;
}

.photo-placeholder-icon {
  width: 48px;
  height: 36px;
  border: 3px solid #0f766e;
  border-radius: 10px;
  position: relative;
}

.photo-placeholder-icon::before {
  content: "";
  position: absolute;
  top: -9px;
  left: 11px;
  width: 20px;
  height: 8px;
  background: #0f766e;
  border-radius: 8px 8px 0 0;
}

.photo-placeholder-icon::after {
  content: "";
  position: absolute;
  top: 8px;
  left: 15px;
  width: 12px;
  height: 12px;
  border: 3px solid #0f766e;
  border-radius: 50%;
}

.photo-placeholder p {
  margin: 0;
  color: #1f2933;
  font-weight: 700;
}

.photo-placeholder span {
  color: #52606d;
  font-size: 0.86rem;
  line-height: 1.35;
}

.draft-camera-area p {
  color: #ffffff;
}

.draft-camera-area span {
  color: rgba(255, 255, 255, 0.78);
}

.draft-camera-area .draft-camera-capture-button {
  position: absolute;
  left: 50%;
  bottom: clamp(18px, 6%, 32px);
  z-index: 3;
  transform: translateX(-50%);
  display: grid;
  place-items: center;
  width: 66px;
  height: 66px;
  min-height: 66px;
  padding: 0;
  overflow: hidden;
  color: transparent;
  font-size: 0;
  background: radial-gradient(
    circle,
    #ffffff 0 54%,
    transparent 55% 68%,
    rgba(255, 255, 255, 0.96) 69% 100%
  );
  border: 0;
  border-radius: 50%;
  box-shadow: none;
  cursor: pointer;
  transition: filter 160ms ease, transform 160ms ease;
}

.draft-camera-area .draft-camera-capture-button::before {
  content: none;
}

.draft-camera-area .draft-camera-capture-button.is-capturing {
  filter: brightness(1.12);
  transform: translateX(-50%) scale(0.92);
}

.draft-camera-area .draft-camera-capture-button:disabled {
  opacity: 0.84;
}

.draft-camera-area .draft-camera-capture-button:hover,
.draft-camera-area .draft-camera-capture-button:disabled:hover {
  background: radial-gradient(
    circle,
    #ffffff 0 54%,
    transparent 55% 68%,
    rgba(255, 255, 255, 0.96) 69% 100%
  );
}

.draft-camera-area.preview-open .draft-camera-capture-button,
.draft-camera-area.preview-open .draft-image-preview {
  opacity: 0.22;
  pointer-events: none;
}

.draft-image-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.draft-image-preview {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
}

.draft-camera-area .draft-image-preview {
  position: absolute;
  right: 18px;
  bottom: clamp(18px, 6%, 32px);
  z-index: 4;
  grid-template-columns: 1fr;
  grid-auto-flow: row;
  gap: 10px;
  width: 64px;
}

.draft-input-panel {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 6;
  display: grid;
  gap: 8px;
  align-self: end;
  grid-row: 1;
  grid-column: 1;
  margin: 0;
  padding: 18px 24px 20px;
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid rgba(229, 231, 235, 0.9);
  border-bottom: 0;
  border-radius: 28px 28px 0 0;
  box-shadow: 0 -18px 42px rgba(31, 41, 51, 0.2);
}

.photo-placeholder-small .draft-image-preview {
  grid-column: 1 / -1;
}

#draft-edit-image-area .draft-image-preview {
  grid-column: auto;
  grid-template-columns: repeat(2, 56px);
  gap: 8px;
  align-items: center;
  justify-content: start;
  width: fit-content;
}

#draft-edit-image-area .draft-image-preview img {
  width: 56px;
  height: 56px;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 10px;
  background: #f7f8fa;
}

.draft-image-preview img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 12px;
  background: #f7f8fa;
}

.draft-image-chip {
  position: relative;
  display: block;
  width: 64px;
  height: 64px;
  padding: 0;
  overflow: visible;
  background: transparent;
  border: 0;
  border-radius: 12px;
  cursor: pointer;
}

.draft-image-chip img {
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  border-radius: 14px;
  border: 2px solid rgba(255, 255, 255, 0.88);
  box-shadow: 0 8px 22px rgba(31, 41, 51, 0.25);
}

.draft-image-remove-button,
.draft-large-image-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #1f2933;
  font-weight: 800;
  background: #ffffff;
  border: 0;
  border-radius: 999px;
  box-shadow: 0 6px 16px rgba(31, 41, 51, 0.22);
  cursor: pointer;
}

.draft-image-remove-button {
  position: absolute;
  top: -7px;
  right: -7px;
  width: 22px;
  min-height: 22px;
  padding: 0;
  font-size: 1rem;
  line-height: 1;
}

.draft-camera-area .draft-large-image-preview {
  position: absolute;
  inset: 0;
  z-index: 9;
  display: grid;
  place-items: center;
  padding: 12px 12px 28px;
  background: rgba(0, 0, 0, 0.72);
  pointer-events: auto;
  cursor: zoom-out;
}

.draft-camera-area .draft-large-image-frame {
  position: relative;
  display: grid;
  place-items: center;
  width: calc(100% - 24px);
  max-height: calc(100% - 40px);
  aspect-ratio: 1 / 1;
  pointer-events: none;
  transform: translateY(-12px);
}

.draft-camera-area .draft-large-image-preview img {
  display: block;
  width: 100%;
  height: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  border-radius: 16px;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.34);
}

.estimate-placeholder {
  display: grid;
  gap: 8px;
}

.estimate-placeholder p {
  margin: 0;
  color: #52606d;
  font-size: 0.9rem;
  line-height: 1.4;
}

.estimate-placeholder .draft-helper-message-active {
  color: #b42318;
}

.estimate-placeholder .secondary-button:disabled:hover {
  background: #dff5f2;
}

.meal-detail-fields,
.macro-fields {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 10px;
  border: 1px solid #dff5f2;
  border-radius: 16px;
  background: #ffffff;
}

.meal-detail-fields {
  flex: 1 1 0;
  grid-template-rows: auto auto auto minmax(64px, 1fr) auto;
  min-height: 0;
  overflow: hidden;
}

.meal-detail-fields legend,
.macro-fields legend {
  padding: 0 4px;
  color: #0f766e;
  font-size: 0.9rem;
  font-weight: 700;
}

.meal-detail-fields textarea {
  height: 100%;
  min-height: 64px;
}

.draft-edit-state .meal-detail-fields input,
.draft-edit-state .meal-detail-fields select,
.draft-edit-state .macro-fields input {
  height: 44px;
  min-height: 44px;
  padding: 0 10px;
  font-size: 0.9rem;
  line-height: 1.2;
  border: 1px solid #cbd2d9;
  border-radius: 12px;
}

.meal-detail-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(96px, 0.65fr);
  gap: 10px;
}

.meal-detail-field {
  display: grid;
  gap: 5px;
}

.macro-fields label {
  display: grid;
  gap: 5px;
  color: #52606d;
  font-size: 0.82rem;
}

.macro-fields input {
  text-align: center;
}

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

.macro-row input {
  padding: 0 8px;
}

#draft-edit-state #food-name,
#draft-edit-state #meal-label,
#draft-edit-state #servings-multiplier,
#draft-edit-state #carbs,
#draft-edit-state #protein,
#draft-edit-state #fat,
#draft-edit-state #kcal,
#draft-edit-state #meal-breakdown {
  color: #1f2933;
  font-size: 0.9rem;
  font-weight: 400;
  line-height: 1.2;
}

#draft-edit-state #carbs,
#draft-edit-state #protein,
#draft-edit-state #fat,
#draft-edit-state #kcal {
  font-weight: 700;
}

#draft-edit-state #food-name,
#draft-edit-state #meal-label,
#draft-edit-state #servings-multiplier,
#draft-edit-state #carbs,
#draft-edit-state #protein,
#draft-edit-state #fat,
#draft-edit-state #kcal {
  height: 44px;
  min-height: 44px;
  max-height: 44px;
  padding-top: 0;
  padding-bottom: 0;
}

#draft-edit-state #meal-breakdown {
  height: 100%;
  min-height: 64px;
  overflow: auto;
}

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

.favorite-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  color: #52606d;
  font-size: 0.84rem;
}

.favorite-toggle .draft-message {
  position: static;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  margin: 0 0 0 auto;
  padding: 0;
  overflow-wrap: anywhere;
  color: #b42318;
  font-size: 0.82rem;
  line-height: 1.25;
  text-align: right;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.favorite-toggle-choice {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.favorite-toggle input {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.favorite-draft-status {
  color: #0f766e;
  font-weight: 700;
}

.adjust-with-ai-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

.adjust-with-ai-row button {
  min-height: 44px;
}

.draft-action-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  height: 56px;
  margin-top: 0;
}

.draft-action-row button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 56px;
  min-height: 56px;
  max-height: 56px;
  padding: 0 12px;
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.1;
  border-radius: 12px;
}

.draft-action-row .secondary-button {
  margin-top: 0;
}

.bottom-nav {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 104px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding-top: 6px;
}

.bottom-nav-link {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  color: #0f766e;
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.15;
  text-decoration: none;
}

.bottom-nav-link:last-child {
  justify-content: flex-end;
}

.bottom-nav-link:hover {
  color: #115e59;
}

.add-entry-button {
  min-height: 56px;
  padding: 12px 14px;
  border-radius: 999px;
  box-shadow: 0 10px 24px rgba(15, 118, 110, 0.22);
}

.secondary-button {
  color: #0f766e;
  background: #dff5f2;
}

.secondary-button:hover {
  background: #c8ebe7;
}

.status-message {
  min-height: 1.4em;
  margin: 18px 0 0;
  color: #52606d;
  line-height: 1.4;
}

.error-message {
  color: #b42318;
}

.hidden {
  display: none !important;
}

@media (max-width: 520px) {
  .app-shell {
    padding: 0;
  }

  .card {
    width: calc(100% - 32px);
  }

  .mobile-app {
    width: 100%;
    height: 100vh;
    max-height: 100vh;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .favorite-details-dialog {
    width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    padding: 16px;
    border-radius: 0;
  }
}
