/* v102: readable first-screen density, scoped to the Diary. Never clamp food data. */
#historyView .diary-date-toolbar{padding:0 10px;margin:0 0 6px;gap:8px;border-radius:12px;min-height:44px}
#historyView .diary-date-caption{min-width:0}
#historyView #historyTitle{font-size:14px;line-height:17px;gap:4px}
#historyView #diarySelectedContext{font-size:12px;line-height:14px;margin:1px 0 0}
#historyView .history-date{position:relative;display:flex;justify-content:center;min-width:44px;width:44px;height:44px}
#historyView .history-date>span{font-size:0}
#historyView .history-date>span::after{content:'▦';font-size:26px;line-height:1;color:var(--ink)}
#historyView .history-date input[type="date"]{position:absolute;inset:0;width:44px;height:44px;min-height:44px;opacity:0;cursor:pointer;margin:0}
#historyView .history-date:focus-within{outline:2px solid var(--accent);outline-offset:2px;border-radius:8px}
#historyView .food-today{margin:0}
#historyView .food-day-total{padding:8px 10px;border-radius:12px;box-shadow:none;margin:0 0 5px}
#historyView .diary-energy{gap:6px}
#historyView .diary-energy>div{padding-right:5px}
#historyView .diary-energy span{font-size:11px;line-height:13px}
#historyView .food-day-total b{font-size:18px;line-height:22px;margin:1px 0 0}
#historyView .food-day-total b small{font-size:10px}
#historyView .diary-energy-track{height:3px;margin-top:5px}
#historyView .food-day-total dl{gap:5px;padding-top:4px;margin-top:4px}
#historyView .food-day-total dl>div{display:flex;align-items:baseline;flex-wrap:wrap;gap:3px}
#historyView .food-day-total dt,#historyView .food-day-total dd{font-size:12px;line-height:15px;margin:0}
#historyView .diary-goal-note{font-size:11px;line-height:13px;margin:3px 0 0}
#historyView .food-today-heading{margin:5px 3px 4px;gap:4px}
#historyView .food-today-heading h2,#historyView .food-today-heading h3{font-size:15px;line-height:19px}
#historyView .food-today-heading small{font-size:11px;line-height:15px}
#historyView .food-meal-card{padding:0 8px;border-radius:12px;box-shadow:none}
#historyView .food-today .food-entry-row{grid-template-columns:minmax(0,1fr) auto;column-gap:6px;row-gap:1px;min-height:44px;padding:4px 0;align-content:start}
#historyView .food-today-name{font-size:14px;line-height:16px;white-space:normal;overflow-wrap:anywhere}
#historyView .food-today-kcal{grid-column:2;grid-row:1;font-size:14px;line-height:16px;align-self:start}
#historyView .food-today-kcal small{font-size:11px}
#historyView .food-entry-details{grid-column:1/-1;grid-row:2;display:flex;flex-wrap:wrap;gap:0 7px;align-items:baseline;min-width:0}
#historyView .food-entry-portion,#historyView .food-entry-macros{font-size:12px;line-height:14px;min-width:0;overflow-wrap:anywhere}
#historyView .food-entry-macros{font-weight:600}
#historyView .food-entry-chevron{display:none}
#historyView .food-entry-count{font-size:11px;line-height:14px;margin-left:4px;padding:0 4px}
/* A reserved first-line slot keeps identical titles/wrapping with or without a photo.
   Photos are sibling buttons, never nested inside the entry button. */
#historyView .food-meal-card li{position:relative}
#historyView .food-today-name{text-indent:22px}
#historyView .food-entry-count{text-indent:0}
#historyView .food-entry-photos{position:absolute;left:0;top:0;display:block;width:22px;height:20px;padding:0;margin:0}
#historyView .food-today .food-entry-photos .food-today-photo{display:block;position:relative;width:22px;height:20px;min-height:20px;border-radius:3px}
#historyView .food-entry-photos .food-today-photo img{position:absolute;left:0;top:4px;width:16px;height:16px}
#historyView .food-photo-count{position:absolute;right:2px;top:10px;height:10px;min-width:9px;padding:0 1px;font-size:8px;line-height:10px;text-align:center;border-radius:3px;background:var(--surface);color:var(--ink);pointer-events:none}
#historyView .food-today-photo:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
#diaryEntryPhotos{display:flex;flex-wrap:wrap;gap:8px;margin:8px 0}
#diaryEntryPhotos:empty{display:none}
#diaryEntryPhotos .food-today-photo{width:44px;height:44px;min-height:44px;padding:0;border:0;border-radius:6px;overflow:hidden}
#diaryEntryPhotos img{display:block;width:100%;height:100%;object-fit:cover}
#historyView .diary-disclosure{padding:6px 10px;margin:5px 0 0;border-radius:10px}
#historyView .diary-disclosure>summary{font-size:13px;line-height:20px;min-height:24px}
#historyView #diaryTodayContext,#historyView #historyNutritionStatus{font-size:11px;line-height:14px;margin:4px 2px}
/* Compact diary header/content only. The shared navigation keeps its normal size. */
body:has(#historyView:not([hidden])) main{padding-bottom:calc(112px + env(safe-area-inset-bottom))}
@media(max-width:600px){
 body:has(#historyView:not([hidden]))>header{height:46px;min-height:46px;padding:1px 10px;gap:4px}
 body:has(#historyView:not([hidden])) main{padding-top:5px;padding-left:8px;padding-right:8px}
}

#historyView .diary-energy-green span{background:#258a60}
#historyView .diary-energy-yellow span{background:#d6a21f}
#historyView .diary-energy-red span{background:#e35a6d}
#diaryEntryProduct{overflow-wrap:anywhere}
#diaryEntryRepeat{width:100%;margin:8px 0 0}
#historyView .nutrition-history .food-entry-row{cursor:pointer}
