.customer-content.library-width { max-width: 1160px; }
.customer-content.food-detail-width { max-width: 870px; }
.library-sr { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; }
.library-header { display: flex; align-items: center; justify-content: space-between; gap: 25px; padding: clamp(17px, 4vw, 36px); margin-bottom: 29px; border: 1px solid #dce8dd; border-radius: 18px; background: #f4f8f1; overflow: hidden; }
.library-header-main { min-width: 0; max-width: 530px; flex: 1; }
.library-header h1 { color: var(--deep); margin-bottom: 17px; font-size: clamp(32px, 4vw, 49px); }
.library-search { display: flex; align-items: center; gap: 9px; padding: 4px 4px 4px 12px; border: 1px solid #bcccbd; border-radius: 12px; background: #fff; transition: border-color .18s, box-shadow .18s; }
.library-search:focus-within { border-color: var(--green); box-shadow: 0 0 0 3px #137c481a; }
.library-search > .icon { color: var(--green); width: 19px; height: 19px; }
.library-search #food-query { flex: 1; min-width: 0; min-height: 42px; padding: 4px 0; border: 0; outline: none; color: var(--ink); background: transparent; }
.library-search button { min-height: 41px; }
.library-suggestions { display: flex; flex-wrap: wrap; gap: 5px 8px; margin-top: 12px; }
.library-suggestions a { display: inline-flex; align-items: center; min-height: 34px; padding: 4px 8px; border: 1px solid #cfdfd0; border-radius: 6px; font-size: 12px; font-weight: 730; transition: background .17s, color .17s, transform .17s; }
.library-suggestions a:hover { color: white; background: var(--deep); }
.library-suggestions a:active { transform: scale(.965); }
.library-cover { display: flex; align-items: center; justify-content: flex-end; width: min(36%, 390px); flex: none; padding: 12px 0 12px 12px; }
.library-cover img { width: 38%; aspect-ratio: 1; height: auto; border: 4px solid #fff; border-radius: 50%; box-shadow: 0 7px 22px #21463120; transform: translateY(-14px); }
.library-cover img + img { margin-left: -7%; }
.library-cover img:nth-child(2) { width: 43%; transform: translateY(12px); z-index: 1; }
.library-cover img:last-child { transform: translateY(-5px); }
.library-layout { display: grid; grid-template-columns: minmax(118px, 155px) minmax(0, 1fr); gap: clamp(16px, 3vw, 33px); align-items: start; }
.library-categories { position: sticky; top: 88px; max-height: calc(100dvh - 103px); overflow: auto; scrollbar-width: thin; padding: 3px 3px 5px; }
.library-categories nav { display: grid; gap: 3px; }
.library-categories a { min-height: 44px; display: flex; align-items: center; padding: 6px 11px; border-radius: 8px; color: #354a3d; font-size: 14px; font-weight: 710; transition: background .17s, color .17s, transform .17s; }
.library-categories a:hover { background: #eff5ef; }
.library-categories a[aria-current] { background: var(--deep); color: white; }
.library-categories a:active { transform: scale(.97); }
.library-results { min-width: 0; }
.library-results-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 3px 0 12px; }
.library-results-head h2 { overflow-wrap: anywhere; }
.library-results-head > span { font-size: 12px; font-weight: 680; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.library-kinds { display: flex; flex-wrap: wrap; gap: 5px 12px; margin-bottom: 11px; padding-bottom: 3px; border-bottom: 1px solid var(--line); }
.library-kinds a { display: flex; align-items: center; min-height: 36px; padding: 0 3px; border-bottom: 2px solid transparent; color: var(--muted); font-size: 13px; font-weight: 750; transition: border-color .18s, color .18s; }
.library-kinds a:hover, .library-kinds a[aria-current] { border-color: var(--green); color: var(--deep); }
.library-card-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 228px), 1fr)); list-style: none; padding: 0; margin: 0; gap: 8px; }
.library-card-list li { min-width: 0; }
.library-card { --thumb-size: 60px; display: grid; grid-template-columns: var(--thumb-size) minmax(0, 1fr) 15px; align-items: center; gap: 10px; min-height: 87px; height: 100%; padding: 8px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); transition: border-color .18s, background .18s, transform .18s; }
.library-card:hover { border-color: #8fbc9d; background: #f8fbf7; }
.library-card:active { transform: scale(.985); }
.library-card > .icon { width: 14px; height: 14px; color: #526f5d; transition: translate .18s var(--ease); }
.library-card:hover > .icon { translate: 2px; }
.library-thumb { display: grid; place-items: center; width: var(--thumb-size); height: var(--thumb-size); overflow: hidden; border-radius: 7px; background: #e9f1eb; color: #365f4a; }
.library-thumb[data-category="poultry"], .library-thumb[data-category="meat"], .library-thumb[data-category="eggs"] { background: #faeee6; color: #824a31; }
.library-thumb[data-category="fish"], .library-thumb[data-category="seafood"], .library-thumb[data-category="drinks"] { background: #eaf1f7; color: #336077; }
.library-thumb[data-category="grains"], .library-thumb[data-category="tubers"], .library-thumb[data-category="nuts"] { background: #f5efe0; color: #775d28; }
.library-thumb img { width: 100%; height: 100%; object-fit: cover; }
.library-card-body { display: grid; gap: 2px; line-height: 1.35; min-width: 0; }
.library-card-body strong { font-size: 14px; overflow-wrap: anywhere; }
.library-card-body > small { color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.library-card-energy { color: #157347; font-size: 14px; font-weight: 780; font-variant-numeric: tabular-nums; }
.library-card-energy small { color: var(--muted); font-size: 10px; }
.library-pages { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; margin-top: 14px; color: var(--muted); font-size: 12px; }
.library-pages .button { padding-inline: 9px; min-height: 39px; }
.library-credit { color: var(--muted); margin-top: 13px; font-size: 12px; }
.library-credit a, .food-origin a { text-decoration: underline; text-underline-offset: 2px; }
.library-empty { display: grid; justify-items: start; gap: 8px; border-top: 1px solid var(--line); padding: 24px 0; }
.library-empty .icon, .library-empty p { color: var(--muted); }

.food-identity { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 10px 0 18px; }
.food-identity-copy { min-width: 0; }
.food-identity h1 { color: var(--deep); font-size: clamp(26px, 4.7vw, 49px); overflow-wrap: anywhere; }
.food-identity p { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.food-portrait { flex: none; width: clamp(68px, 20vw, 142px); margin: 0; }
.food-portrait img { display: block; width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; border-radius: 11px; background: #e9f1eb; }
.food-portrait figcaption { margin-top: 4px; text-align: right; font-size: 11px; color: var(--muted); }
.food-photo-credit { overflow-wrap: anywhere; scroll-margin-top: 90px; }
.food-measure { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 9px; margin-bottom: 11px; }
.food-measure > label { display: flex; align-items: center; gap: 9px; font-weight: 730; }
.food-grams { display: flex; align-items: center; gap: 4px; padding: 4px 8px; min-height: 42px; color: var(--muted); font-size: 13px; background: #fff; border-radius: 8px; border: 1px solid var(--line); }
.food-grams:focus-within { border-color: var(--green); }
.food-grams #food-grams { width: 68px; min-height: 30px; padding: 3px 0; color: var(--deep); font-weight: 760; border: 0; outline: none; background: transparent; }
.food-presets { display: flex; flex-wrap: wrap; gap: 6px; }
.food-presets button { min-height: 40px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--deep); padding: 6px 9px; font-size: 13px; font-weight: 730; transition: background .18s, border-color .18s, transform .18s; }
.food-presets button:hover, .food-presets button[aria-pressed="true"] { background: var(--sage); border-color: #a9c7b1; }
.food-presets button:active { transform: scale(.97); }
.food-overview { display: grid; grid-template-columns: minmax(160px, .72fr) 1.28fr; gap: 24px; align-items: center; padding: clamp(17px, 4vw, 30px); color: #fff; background: #173d2f; border-radius: 14px; }
.food-energy { min-width: 0; font-variant-numeric: tabular-nums; }
.food-energy > span { color: #d9ebe0; font-size: 14px; font-weight: 730; }
.food-energy .icon { width: 17px; height: 17px; color: #ffd888; }
.food-energy div { line-height: 1; margin: 9px 0 5px; overflow-wrap: anywhere; }
.food-energy strong { font-size: clamp(33px, 6vw, 57px); }
.food-energy small { color: #d4e6d9; }
.food-macro-chart { min-width: 0; }
.food-macro-chart .macro-protein { --segment: #95d9a9; }
.food-macro-chart .macro-carbs { --segment: #f6cf85; }
.food-macro-chart .macro-fat { --segment: #9dcced; }
.food-chart-track { display: flex; height: 8px; border-radius: 6px; margin-bottom: 12px; overflow: hidden; background: #ffffff1a; }
.food-chart-track span { flex: 0 1 var(--share); background: var(--segment); animation: food-share .34s var(--ease) both; }
@keyframes food-share { from { opacity: 0; } to { opacity: 1; } }
.food-macro-chart dl { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0; }
.food-macro-chart dl > div { min-width: 0; padding-top: 3px; }
.food-macro-chart dt { color: var(--segment); font-size: 13px; font-weight: 730; }
.food-macro-chart dd { margin: 4px 0 0; font-size: 12px; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.food-macro-chart dd strong { font-size: 18px; }
.food-macro-chart dd small { display: block; color: #d4e6d9; margin-top: 4px; }
.food-breakdown, .food-related, .food-origin { margin-top: 23px; }
.food-related h2 { margin-bottom: 12px; }
.nutrient-group { border-bottom: 1px solid var(--line); }
.nutrient-group:first-of-type { border-top: 1px solid var(--line); }
.nutrient-group summary, .food-origin summary { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 48px; list-style: none; color: var(--deep); font-weight: 760; transition: background .17s; }
.nutrient-group summary::-webkit-details-marker, .food-origin summary::-webkit-details-marker { display: none; }
.nutrient-group summary:hover, .food-origin summary:hover { background: #f4f8f2; }
.nutrient-group summary .icon, .food-origin summary .icon { width: 17px; height: 17px; transition: rotate .18s var(--ease); }
.nutrient-group[open] summary .icon, .food-origin[open] summary .icon { rotate: 90deg; }
.nutrient-group[open] table, .food-origin[open] p { animation: reveal .2s var(--ease) both; }
.nutrient-group table { width: 100%; min-width: 0; table-layout: fixed; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.nutrient-group th, .nutrient-group td { text-align: right; padding: 8px 6px; border-bottom: 1px solid #edf2ee; font-size: 13px; }
.nutrient-group td { overflow-wrap: anywhere; }
.nutrient-group th:first-child { text-align: left; max-width: 55%; padding-left: 0; font-weight: 650; overflow-wrap: anywhere; }
.nutrient-group th:last-child, .nutrient-group td:last-child { padding-right: 0; }
.nutrient-group thead th, .nutrient-group td small { font-size: 11px; color: var(--muted); }
.nutrient-group thead th:nth-child(2) { width: 29%; }
.nutrient-group thead th:last-child { width: 19%; }
.nutrient-group tr:last-child > * { border-bottom: 0; }
.food-origin { border-top: 1px solid var(--line); }
.food-origin p { margin: 6px 0; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
@media (max-width: 760px) {
  .library-cover { width: 29%; }
  .library-layout { grid-template-columns: minmax(79px, 99px) minmax(0, 1fr); gap: 9px; }
  .library-categories { top: 64px; max-height: calc(100dvh - 132px); }
  .library-categories a { padding: 5px 6px; font-size: 12px; }
}
@media (max-width: 550px) {
  .library-header { margin-bottom: 15px; }
  .library-header h1 { margin-bottom: 11px; }
  .library-cover { display: none; }
  .library-card { --thumb-size: 50px; grid-template-columns: var(--thumb-size) minmax(0, 1fr) 11px; gap: 7px; min-height: 78px; padding: 6px; }
  .library-card-body strong { font-size: 13px; }
  .library-results-head { padding-bottom: 8px; }
  .food-overview { grid-template-columns: minmax(0, 1fr); gap: 13px; }
  .food-identity { padding-top: 3px; gap: 12px; }
}
