@font-face {
  font-family: 'DM Sans';
  src: url('dm-sans-latin.woff2') format('woff2');
  font-style: normal;
  font-weight: 100 1000;
  font-display: swap;
}
@font-face {
  font-family: 'Bricolage Grotesque';
  src: url('bricolage-grotesque-latin.woff2') format('woff2');
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
}
@font-face {
  font-family: 'Food Icons';
  src: url('food-icons.woff2') format('woff2');
  font-display: block;
}

:root {
  color-scheme: light;
  --bg: #f7f6fa;
  --paper: #fff;
  --ink: #20172a;
  --muted: #685e73;
  --line: #e8e2ed;
  --violet: #5c4191;
  --lavender: #eee8f8;
  --lime: #e4f778;
  --danger: #a32c49;
  --warning: #785116;
  --shadow: 0 12px 34px #29193712;
  --font: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --display: 'Bricolage Grotesque', var(--font);
  --gutter: clamp(16px, 4.65vw, 28px);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-padding-bottom: 95px; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font: 1rem/1.45 var(--font);
  -webkit-tap-highlight-color: transparent;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .42; cursor: default; }
:focus-visible { outline: 2px solid var(--violet); outline-offset: 3px; }
h1, h2, h3, p, dl, dd { margin: 0; }
h1, h2 { font-family: var(--display); }
h1 { font-size: clamp(2rem, 9vw, 2.9rem); font-weight: 750; letter-spacing: -.052em; line-height: 1.02; }
h2 { font-size: clamp(1.23rem, 5.3vw, 1.47rem); font-weight: 720; letter-spacing: -.038em; line-height: 1.15; }
h3 { font-size: 1rem; font-weight: 700; }
.muted { color: var(--muted); font-size: .875rem; }
.full { width: 100%; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.shell { width: min(100%, 1040px); margin-inline: auto; }
.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(9px + env(safe-area-inset-top)) var(--gutter) 10px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font: 760 1.42rem/1 var(--display);
  letter-spacing: -.065em;
}
.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: #2b1f3a;
  box-shadow: 0 3px 7px #32223d21;
}
.brand-mark i { width: 4px; height: 9px; border-radius: 4px; background: var(--lime); transform: rotate(-12deg); }
.brand-mark i:nth-child(2) { height: 17px; }
.brand-mark i:nth-child(3) { height: 12px; }
.account-menu { position: relative; z-index: 5; }
.account-menu summary {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  color: var(--violet);
  font-size: .9rem;
  font-weight: 750;
  background: var(--lavender);
  border: 1px solid #e9e0f5;
  border-radius: 50%;
  cursor: pointer;
  list-style: none;
}
.account-menu summary::-webkit-details-marker { display: none; }
.account-menu form {
  position: absolute;
  right: 0;
  top: calc(100% + 7px);
  padding: 4px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
  box-shadow: var(--shadow);
}
.sign-out, .text-button {
  min-height: 44px;
  padding: 4px 11px;
  border: 0;
  border-radius: 9px;
  color: var(--violet);
  background: transparent;
  font-size: .875rem;
  font-weight: 690;
}
.sign-out { white-space: nowrap; }
main { min-width: 0; padding: 0 var(--gutter) calc(96px + env(safe-area-inset-bottom)); }
.day-heading { display: flex; align-items: end; justify-content: space-between; gap: 8px; margin: 9px 0 15px; }
.day-heading > div:first-child { min-width: 0; }
.day-heading p { margin-top: 4px; }
.calendar-controls {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  min-height: 44px;
  padding: 1px 2px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
}
.icon-button {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  padding: 0;
  color: var(--ink);
  border: 0;
  border-radius: 13px;
  background: transparent;
}
.calendar-picker { position: relative; color: var(--violet); cursor: pointer; }
.calendar-picker input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.calendar-picker input::-webkit-calendar-picker-indicator { position: absolute; inset: 0; width: auto; height: auto; cursor: pointer; }
.calendar-picker:focus-within { outline: 2px solid var(--violet); outline-offset: -2px; }

.summary {
  --hero: #241a32;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: 17px 17px 15px;
  color: #fcf9ff;
  background-color: var(--hero);
  background-image:
    linear-gradient(90deg, #241a32 0%, #241a32ee 35%, #241a3255 67%, #241a3230 100%),
    linear-gradient(0deg, #241a32 4%, #241a32aa 43%, transparent 86%),
    url('market-still-life.webp');
  background-size: cover;
  background-position: center, center, center 44%;
  border: 1px solid #352646;
  border-radius: 25px;
  box-shadow: 0 12px 27px #2a1c3e24;
}
.summary-main { display: flex; align-items: start; justify-content: space-between; gap: 5px; }
.summary-main > div:first-child { min-width: 0; }
.summary-main h2 { color: #e6ddef; font: 650 .88rem/1.25 var(--font); letter-spacing: .005em; }
.summary-states { display: grid; flex: 0 1 auto; justify-items: end; gap: 4px; }
.summary-state {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  max-width: 100%;
  border: 1px solid #efe1ff48;
  border-radius: 15px;
  background: #211829e0;
  color: #f5edff;
  font-size: .72rem;
  font-weight: 700;
  line-height: 1.15;
  text-align: right;
}
.summary-state[data-state='complete'] { border-color: #e4f77850; color: #e4f778; }
#nutrient-status { background: #382539eb; border-color: #f4c48b64; color: #ffdaac; }
.energy { display: flex; flex-wrap: wrap; align-items: baseline; gap: 1px 5px; margin: 7px 0 13px; }
.energy strong {
  color: #fff;
  font: 770 clamp(2.15rem, 12.3vw, 4.1rem)/.99 var(--display);
  font-variant-numeric: lining-nums tabular-nums;
  letter-spacing: -.075em;
  white-space: nowrap;
}
.energy span { color: #eee4fa; font-size: .82rem; font-weight: 650; }
.energy strong[data-compact='true'] { font-size: clamp(1.85rem, 9vw, 3.4rem); }
.macros {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr) minmax(0, .82fr);
  padding: 9px 10px;
  border: 1px solid #ede0ff20;
  border-radius: 14px;
  background: #51416070;
}
.macros > div + div { border-left: 1px solid #ede0ff25; padding-left: 11px; }
.macros dt { display: flex; align-items: center; gap: 5px; color: #e4d9ee; font-size: .81rem; font-weight: 580; }
.macros dt::before { content: ''; flex: 0 0 6px; width: 6px; height: 6px; border-radius: 50%; background: var(--marker); }
.macro-protein { --marker: #cfb6ff; }
.macro-carbs { --marker: #e4f778; }
.macro-fat { --marker: #ffb9a3; }
.macros dd { color: #fff; font-size: 1.05rem; font-weight: 710; font-variant-numeric: tabular-nums; white-space: nowrap; }

.quick-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 12px; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 8px 13px;
  border: 1px solid transparent;
  border-radius: 15px;
  font-size: .95rem;
  font-weight: 730;
  line-height: 1.2;
  text-align: center;
}
.primary { color: #fff; background: #49336e; }
.secondary { color: var(--ink); background: var(--paper); border-color: var(--line); }
.danger { background: var(--danger); color: #fff; }
.remove-button { color: var(--danger); }
.quick-actions .button { min-height: 51px; }
#scan-open { color: #282337; background: var(--lime); border-color: #d8ec6b; box-shadow: 0 3px 8px #889a2923; }
#search-open .icon { color: var(--violet); }

.icon { display: inline-grid; place-items: center; width: 1em; height: 1em; flex: 0 0 auto; font-size: 21px; }
.icon::before { font: 400 1em/1 'Food Icons'; }
.calendar-icon::before { content: '\ea53'; }
.prev-icon::before { content: '\ea60'; }
.next-icon::before { content: '\ea61'; }
.barcode-icon::before { content: '\ebc6'; }
.search-icon::before { content: '\eb1c'; }
.list-icon::before { content: '\ebe1'; }
.pending-icon::before { content: '\ea70'; }
.log-icon::before { content: '\eb96'; }
.plus-icon::before { content: '\eb0b'; }
.breakfast-icon::before { content: '\ef1c'; }
.lunch-icon::before { content: '\eb30'; }
.dinner-icon::before { content: '\eaf8'; }
.snack-icon::before { content: '\fdb1'; }
.recipe-icon::before { content: '\f4fa'; }
.food-icon::before { content: '\eaff'; }

.quick-foods, .meals { min-width: 0; margin-top: 21px; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 9px; }
.section-period { flex: 0 0 auto; color: var(--muted); font-size: .78rem; font-weight: 680; }
.quick-items {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: calc((100% - 8px) / 2);
  align-items: stretch;
  gap: 8px;
  padding: 3px;
  margin: -3px;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scroll-snap-type: x proximity;
  scroll-padding-inline: 3px;
  scrollbar-width: none;
}
.quick-items::-webkit-scrollbar { display: none; }
.quick-items:has(.quick-item:nth-child(3)) { grid-auto-columns: max(146px, 45%); }
.quick-item {
  display: grid;
  align-content: start;
  min-width: 0;
  min-height: 86px;
  gap: 6px;
  padding: 8px 10px 9px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--paper);
  text-align: left;
  scroll-snap-align: start;
}
.quick-item-meta { display: flex; align-items: center; justify-content: space-between; }
.product-visual {
  position: relative;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  overflow: hidden;
  border-radius: 11px;
  color: var(--violet);
  background: var(--lavender);
}
.product-visual .icon { font-size: 19px; }
.product-visual .product-thumbnail { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 55%; opacity: 0; }
.product-visual.has-image .product-thumbnail { opacity: 1; }
.product-visual.has-image .icon { visibility: hidden; }
.quick-item-meta .product-visual { width: 52px; height: 46px; }
.quick-count { color: var(--violet); font-size: .8rem; font-weight: 760; font-variant-numeric: tabular-nums; }
.quick-item-name {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  overflow-wrap: anywhere;
  font-size: .9rem;
  font-weight: 710;
  letter-spacing: -.015em;
  line-height: 1.2;
}
.meal-items { overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: var(--paper); }
.meal-card + .meal-card { border-top: 1px solid var(--line); }
.meal-header { display: flex; align-items: center; gap: 9px; min-height: 49px; padding: 2px 7px 2px 10px; }
.meal-header h3 { flex: 1; letter-spacing: -.027em; }
.meal-glyph { display: grid; place-items: center; flex: 0 0 31px; height: 31px; border-radius: 10px; color: #75442a; background: #fbe8da; }
.meal-glyph .icon { font-size: 18px; }
.meal-lunch .meal-glyph { color: #4d5d23; background: #eef5d5; }
.meal-dinner .meal-glyph { color: var(--violet); background: var(--lavender); }
.meal-snack .meal-glyph { color: #85432e; background: #f9e2dc; }
.meal-add { display: grid; place-items: center; flex: 0 0 44px; height: 44px; padding: 0; color: var(--violet); border: 0; border-radius: 12px; background: transparent; }
.meal-add .icon { width: 29px; height: 29px; border: 1px solid #ebe4f5; border-radius: 50%; background: #f6f1fd; font-size: 17px; }
.meal-rows { padding-inline: 10px; }
.meal-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 46px;
  padding: 7px 4px 8px 41px;
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  text-align: left;
}
.entry-description { display: grid; gap: 1px; min-width: 0; }
.entry-name { overflow-wrap: anywhere; font-size: .91rem; font-weight: 700; }
.entry-description .muted { font-size: .81rem; }
.entry-value { flex: 0 0 auto; text-align: right; white-space: nowrap; font-size: .83rem; font-variant-numeric: tabular-nums; }
.entry-value.needs-review { color: var(--warning); font-weight: 680; }
.day-status-form { display: grid; justify-items: start; gap: 8px; margin-top: 13px; }
.day-status-form .button { min-height: 44px; }

.nav-bar {
  position: fixed;
  z-index: 10;
  bottom: calc(8px + env(safe-area-inset-bottom));
  left: 50%;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  width: min(440px, calc(100% - 24px));
  gap: 3px;
  padding: 4px;
  transform: translateX(-50%);
  border: 1px solid #e7e1ec;
  border-radius: 22px;
  background: #ffffffee;
  box-shadow: 0 8px 27px #25163320;
  backdrop-filter: blur(14px);
}
.nav-bar button {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 2px;
  min-height: 49px;
  min-width: 0;
  padding: 3px 3px 2px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 17px;
  font-size: .74rem;
  font-weight: 690;
  line-height: 1.15;
  white-space: nowrap;
}
.nav-bar .icon { font-size: 19px; }
.nav-bar button[aria-current='page'] { color: #4c327d; background: var(--lavender); font-weight: 780; }
#pending-badge { display: inline-block; min-width: 15px; padding: 1px 4px; border-radius: 8px; color: #694615; background: #fae8c8; font-size: .65rem; line-height: 1.1; text-align: center; }

@media (hover: hover) {
  .quick-item:hover, .secondary:hover { border-color: #d7c9e7; background: #fbf8ff; }
  .icon-button:hover, .meal-add:hover, .text-button:hover, .sign-out:hover { background: #f5f0fb; }
  .primary:hover { background: #573f80; }
  #scan-open:hover { background: #eaff81; }
}

@media (max-width: 355px) {
  .summary { padding-inline: 12px; }
  .macros { padding-inline: 7px; }
  .macros > div + div { padding-left: 6px; }
  .macros dt { gap: 3px; font-size: .74rem; }
  .meal-row { padding-left: 33px; }
  .entry-value.needs-review { max-width: 88px; white-space: normal; line-height: 1.15; }
  .quick-items:has(.quick-item:nth-child(3)) { grid-auto-columns: max(134px, 46%); }
}
@media (min-width: 675px) {
  .masthead { padding-top: calc(17px + env(safe-area-inset-top)); }
  .quick-items:has(.quick-item:nth-child(3)) { grid-auto-columns: max(155px, 30%); }
  .summary { padding: 21px; }
  .energy { margin-bottom: 18px; }
}
@media (min-width: 900px) {
  #diary {
    display: grid;
    grid-template: 'date date' auto 'summary meals' auto 'actions meals' auto 'quick meals' 1fr '. end' auto / minmax(0, 1fr) minmax(0, .93fr);
    align-items: start;
    column-gap: 22px;
  }
  #diary .day-heading { grid-area: date; margin-bottom: 17px; }
  .summary { grid-area: summary; }
  .quick-actions { grid-area: actions; }
  .quick-foods { grid-area: quick; }
  .quick-items:has(.quick-item:nth-child(3)) { grid-auto-columns: max(150px, 40%); }
  .meals { grid-area: meals; margin-top: 0; }
  .day-status-form { grid-area: end; }
}
