/* Nutrition v2 — saisie éclair et suivi, inspirés de MacroFactor, dans la DA Summit.
   Scoped to the Nutrition view; tokens come from nutrition-glass.css and app-nav.css. */
body[data-view="nutrition"] main { max-width: 1180px; padding: 0 24px 120px; }
.nx-units[hidden], .nx-after[hidden] { display: none; }
.nx, .nx-sheet { --nx-r: 26px; --nx-green: #13805b; --nx-green-bg: #13805b1a; --nx-orange-bg: #b4520f1a; color: var(--ink); }
html[data-today-theme="dark"] .nx, html[data-today-theme="dark"] .nx-sheet { --nx-green: #5fd3a3; --nx-green-bg: #5fd3a31f; --nx-orange-bg: #f3a56b1f; }
.nx .wellness-icon, .nx-sheet .wellness-icon { width: 20px; height: 20px; }
.nx p { margin: 0; }

/* En-tête */
.nx-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 22px 4px 14px; }
.nx-title h1 { margin: 0; font-size: 34px; font-weight: 800; letter-spacing: -1.2px; line-height: 1.05; }
.nx-title.is-row { display: flex; align-items: center; gap: 10px; }
.nx-title.is-row h1 { font-size: 28px; }
.nx-date { margin-top: 4px !important; color: var(--muted); font-size: 13.5px; font-weight: 600; }
.nx-head-tools { display: flex; align-items: center; gap: 8px; }
.nx-icon-btn { position: relative; display: inline-grid; place-items: center; flex-shrink: 0; width: 44px; height: 44px; padding: 0; border: 1px solid var(--nav-edge); border-radius: 50%; background: var(--nav-glass); color: var(--ink); box-shadow: var(--nav-inset); backdrop-filter: blur(20px) saturate(170%); -webkit-backdrop-filter: blur(20px) saturate(170%); cursor: pointer; transition: transform .4s var(--nav-ease), background .3s; }
.nx-icon-btn:hover { background: var(--nav-glass-hi); }
.nx-icon-btn:active { transform: scale(.94); }
.nx-icon-btn.is-plain { border-color: transparent; background: var(--nt-hair); box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
.nx-icon-btn input[type="date"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.nx-icon-btn.has-dot::after { content: ''; position: absolute; top: 8px; right: 8px; width: 9px; height: 9px; border: 2px solid var(--page); border-radius: 50%; background: var(--nt-blue); }
.nx-add-top { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 18px 0 14px; border: 0; border-radius: 999px; background: var(--nt-blue); color: #fff; font: inherit; font-size: 14px; font-weight: 750; box-shadow: 0 14px 28px -14px #0866ffb3; cursor: pointer; transition: transform .4s var(--nav-ease), filter .3s; }
.nx-add-top:hover { filter: brightness(1.06); }
.nx-add-top:active { transform: scale(.97); }
.nx-add-top .wellness-icon { width: 18px; height: 18px; }

/* Mise en page */
.nx-layout { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 18px; align-items: start; }
.nx-col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.nx-card { position: relative; padding: 18px; border: 5px solid var(--nav-glass); border-radius: var(--nx-r); background: var(--nt-core) padding-box; box-shadow: 0 0 0 1px var(--nav-edge), var(--nav-shadow); backdrop-filter: blur(26px) saturate(170%); -webkit-backdrop-filter: blur(26px) saturate(170%); }
.nx-card.is-small { padding: 14px 16px; }
.nx-eyebrow { color: var(--muted); font-size: 11.5px; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; }
.nx-kicker { color: var(--muted); font-size: 13px; font-weight: 700; }
.nx-big { color: var(--ink); display: flex; align-items: baseline; gap: 6px; margin-top: 2px !important; font-size: 44px; font-weight: 800; letter-spacing: -1.8px; line-height: 1; font-variant-numeric: tabular-nums; }
.nx-big small, .nx-mid small { color: var(--muted); font-size: 15px; font-weight: 650; letter-spacing: 0; }
.nx-big.is-blue { color: var(--nav-link); }
.nx-mid { color: var(--ink); margin-top: 4px !important; font-size: 26px; font-weight: 800; letter-spacing: -.8px; font-variant-numeric: tabular-nums; }
.nx-note { margin-top: 8px !important; color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.nx-help { margin: 8px 2px 0 !important; color: var(--muted); font-size: 12.5px; line-height: 1.45; text-align: center; }
.nx-help.is-left { text-align: left; font-weight: 700; }
.nx-empty { margin: 6px 2px !important; color: var(--muted); font-size: 14px; line-height: 1.5; }
.nx-error { margin-top: 8px !important; color: var(--nt-orange); font-size: 13px; font-weight: 650; }
.nx-source { margin-top: 4px !important; padding: 0 4px; color: var(--muted); font-size: 12px; }
.nx-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.nx-row.is-start { justify-content: flex-start; align-items: baseline; }
.nx-link { white-space: nowrap; color: var(--nav-link); font-size: 13px; font-weight: 700; text-decoration: none; }

/* Semaine */
.nx-days { display: grid; grid-template-columns: 34px repeat(7, minmax(0, 1fr)) 34px; align-items: center; gap: 2px; padding: 6px; border: 1px solid var(--nav-edge); border-radius: 24px; background: var(--nav-glass); box-shadow: var(--nav-inset), var(--nav-shadow); backdrop-filter: blur(26px) saturate(170%); -webkit-backdrop-filter: blur(26px) saturate(170%); }
.nx-week-btn { display: grid; place-items: center; width: 34px; height: 44px; padding: 0; border: 0; border-radius: 14px; background: transparent; color: var(--muted); cursor: pointer; }
.nx-week-btn .wellness-icon { width: 16px; height: 16px; }
.nx-week-btn:hover { background: var(--nt-hair); color: var(--ink); }
.nx-day { display: flex; flex-direction: column; align-items: center; gap: 4px; min-height: 66px; padding: 6px 0; border: 0; border-radius: 16px; background: transparent; color: var(--muted); font: inherit; font-size: 11px; font-weight: 650; cursor: pointer; transition: background .35s var(--nav-ease); }
.nx-day:hover { background: var(--nt-hair); }
.nx-day.is-on { background: var(--nav-glass-hi); color: var(--ink); box-shadow: 0 6px 16px -10px #0d2a5a59; }
.nx-day.is-today .nx-day-name { color: var(--nav-link); }
.nx-mini { --p: 0%; --c: var(--nt-blue); position: relative; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; }
.nx-mini::before { content: ''; position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(var(--c) var(--p), var(--nt-track) 0); -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3.5px)); mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3.5px)); }
.nx-mini.is-over { --c: var(--nt-orange); }
.nx-mini span { position: relative; color: var(--ink); font-size: 12.5px; font-weight: 750; font-variant-numeric: tabular-nums; }
.nx-day.is-future .nx-mini::before { background: var(--nt-hair); }
.nx-day.is-future .nx-mini span { color: var(--muted); }

/* Il te reste */
.nx-left { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.nx-facts { color: var(--muted); font-size: 12.5px; font-weight: 600; line-height: 1.45; text-align: right; font-variant-numeric: tabular-nums; }
.nx-kbar { height: 10px; margin-top: 14px; overflow: hidden; border-radius: 99px; background: var(--nt-track); }
.nx-kbar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #4f95ff, var(--nt-blue)); transform-origin: left; }
.nx-kbar.is-over span { background: linear-gradient(90deg, var(--nt-blue), var(--nt-orange)); }
.nx-macs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
.nx-mac p { color: var(--muted); font-size: 12px; font-weight: 700; }
.nx-mac b { display: block; margin-top: 2px; font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; }
.nx-mac b small { color: var(--muted); font-size: 12px; font-weight: 600; }
.nx-mac i { --w: 0%; --c: var(--nt-blue); position: relative; display: block; height: 5px; margin-top: 6px; overflow: hidden; border-radius: 9px; background: var(--nt-track); }
.nx-mac i::after { content: ''; position: absolute; inset: 0 auto 0 0; width: var(--w); border-radius: inherit; background: var(--c); }
.nx-mac.is-gold i { --c: var(--nt-gold); }
.nx-mac.is-violet i { --c: var(--nt-violet); }
.nx-sum-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--nt-line); }
.nx-status { max-width: 62%; min-height: 44px; padding: 0 26px 0 12px; border: 0; border-radius: 999px; background: var(--nt-hair); color: var(--ink); font: inherit; font-size: 13px; font-weight: 650; cursor: pointer; }

/* Démarrer / répéter */
.nx-reps { display: grid; gap: 8px; margin-top: 10px; }
.nx-rep { display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 8px 8px 8px 10px; border: 1px solid var(--nav-edge); border-radius: 18px; background: var(--nav-glass-hi); }
.nx-tile { display: grid; place-items: center; flex-shrink: 0; width: 46px; height: 46px; overflow: hidden; border-radius: 14px; background: var(--nt-soft); color: var(--nav-link); }
.nx-tile img { width: 100%; height: 100%; object-fit: cover; }
.nx-tile.is-small { width: 38px; height: 38px; border-radius: 12px; }
.nx-tile.is-ghost { opacity: .55; filter: saturate(.6); }
.nx-meal-copy { display: flex; flex: 1; flex-direction: column; min-width: 0; text-align: left; }
.nx-meal-copy strong { overflow: hidden; color: var(--ink); font-size: 15px; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.nx-meal-copy span { overflow: hidden; color: var(--muted); font-size: 12.5px; text-overflow: ellipsis; white-space: nowrap; }
.nx-plus { display: grid; place-items: center; flex-shrink: 0; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: var(--nt-soft); color: var(--nav-link); cursor: pointer; transition: transform .35s var(--nav-ease), background .3s; }
.nx-plus:hover { background: var(--nt-soft-2); }
.nx-plus:active { transform: scale(.9); }
.nx-plus .wellness-icon { width: 19px; height: 19px; }
.nx-plus.is-done { background: var(--nt-blue); color: #fff; }
.nx-chip-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 14px; border: 0; border-radius: 999px; background: var(--nt-hair); color: var(--ink); font: inherit; font-size: 13px; font-weight: 700; white-space: nowrap; cursor: pointer; transition: background .3s; }
.nx-chip-btn:hover { background: var(--nt-soft); }
.nx-chip-btn .wellness-icon { width: 16px; height: 16px; color: var(--nav-link); }
.nx-chip-btn.is-strong { background: var(--nt-blue); color: #fff; }
.nx-chip-btn.is-danger { color: var(--nt-orange); }
.nx-chip-btn.is-danger .wellness-icon { color: var(--nt-orange); }
.nx-chip-btn input[type="date"] { position: absolute; inset: 0; width: 100%; opacity: 0; cursor: pointer; }
.nx-chip-btn.is-select { appearance: none; -webkit-appearance: none; padding-right: 14px; text-align: center; }

/* Ligne de temps */
.nx-tl { display: flex; flex-direction: column; gap: 8px; }
.nx-time { margin: 6px 0 -2px 6px !important; color: var(--muted); font-size: 12px; font-weight: 750; font-variant-numeric: tabular-nums; }
.nx-swipe { position: relative; overflow: hidden; border-radius: 22px; }
.nx-swipe-acts { position: absolute; inset: 0 0 0 auto; display: flex; visibility: hidden; }
.nx-swipe.is-swiped .nx-swipe-acts { visibility: visible; }
.nx-swipe-acts button { display: grid; place-content: center; justify-items: center; gap: 4px; width: 74px; border: 0; color: #fff; font: inherit; font-size: 11.5px; font-weight: 750; cursor: pointer; }
.nx-swipe-acts .wellness-icon { width: 18px; height: 18px; }
.nx-swipe-acts .is-blue { background: var(--nt-blue); }
.nx-swipe-acts .is-violet { background: var(--nt-violet); }
.nx-meal { position: relative; z-index: 1; display: flex; align-items: center; gap: 12px; width: 100%; min-height: 66px; padding: 10px 16px 10px 10px; border: 1px solid var(--nav-edge); border-radius: 22px; background: var(--nav-glass-hi); color: var(--ink); font: inherit; text-align: left; box-shadow: var(--nav-inset); backdrop-filter: blur(24px) saturate(170%); -webkit-backdrop-filter: blur(24px) saturate(170%); cursor: pointer; touch-action: pan-y; transition: transform .45s var(--nav-ease), background .3s; }
html[data-today-theme="dark"] .nx-meal { background: #0d2536; }
.nx-meal > b { flex-shrink: 0; font-size: 16px; font-weight: 800; font-variant-numeric: tabular-nums; }
.nx-meal > b::after { content: ' kcal'; color: var(--muted); font-size: 11px; font-weight: 650; }
.nx-swipe.is-swiped .nx-meal { transform: translateX(-148px); }
.nx-meal.is-empty { border-style: dashed; border-color: var(--nt-line); background: transparent; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; cursor: default; padding-right: 8px; }
.nx-meal.is-empty .nx-meal-copy span { white-space: normal; }
.nx-meal-wrap { display: flex; flex-direction: column; border-radius: 22px; background: var(--nt-core); box-shadow: 0 0 0 1px var(--nav-edge); }
.nx-meal-panel { padding: 6px 14px 14px; }
.nx-items { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.nx-items li { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 40px; border-bottom: 1px solid var(--nt-line); }
.nx-items li span { display: flex; flex-direction: column; min-width: 0; font-size: 14px; font-weight: 650; }
.nx-items li small { color: var(--muted); font-size: 12px; font-weight: 550; }
.nx-items li em { flex-shrink: 0; color: var(--muted); font-size: 13px; font-style: normal; font-weight: 650; font-variant-numeric: tabular-nums; }
.nx-meal-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.nx-planned { display: grid; gap: 8px; }
.nx-plan { display: flex; align-items: center; gap: 8px; }
.nx-library { margin-top: 18px; }

/* Bouton flottant */
.nx-fab { position: fixed; right: max(18px, env(safe-area-inset-right)); bottom: calc(var(--bottom-nav-space, 24px) + 14px); z-index: 30; display: none; align-items: center; gap: 8px; min-height: 56px; padding: 0 22px 0 18px; border: 0; border-radius: 999px; background: var(--nt-blue); color: #fff; font: inherit; font-size: 16px; font-weight: 750; box-shadow: 0 18px 34px -14px #0866ffc7; cursor: pointer; transition: transform .4s var(--nav-ease); }
.nx-fab:active { transform: scale(.96); }
.nx-fab .wellness-icon { width: 20px; height: 20px; }

/* Feuilles (B, C, D) */
.nx-sheet { width: min(560px, calc(100vw - 32px)); max-width: none; max-height: min(860px, calc(100dvh - 48px)); margin: auto; padding: 0; overflow: hidden; border: 1px solid var(--nav-edge); border-radius: 30px; background: var(--page); color: var(--ink); box-shadow: 0 40px 120px -40px #0a1f4699; }
.nx-sheet::backdrop { background: #07102a59; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.nx-sheet-inner > * { flex-shrink: 0; }
.nx-sheet-inner { display: flex; flex-direction: column; max-height: inherit; padding: 8px 16px 16px; overflow-y: auto; overscroll-behavior: contain; }
.nx-grab { display: none; width: 40px; height: 5px; margin: 0 auto 8px; border-radius: 9px; background: var(--nt-line); }
.nx-sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 48px; }
.nx-sheet-hint { flex: 1; color: var(--muted); font-size: 12.5px; font-weight: 600; text-align: center; }
.nx-slot { position: relative; display: inline-flex; align-items: center; gap: 4px; min-height: 44px; padding: 0 12px 0 16px; border-radius: 999px; background: var(--nt-soft); color: var(--nav-link); font-size: 15px; font-weight: 750; cursor: pointer; }
.nx-slot select { appearance: none; -webkit-appearance: none; border: 0; background: transparent; color: inherit; font: inherit; cursor: pointer; }
.nx-slot .wellness-icon { width: 15px; height: 15px; pointer-events: none; }
.nx-search { display: flex; align-items: center; gap: 10px; min-height: 52px; margin-top: 8px; padding: 0 16px; border: 1.5px solid var(--nt-blue); border-radius: 18px; background: var(--nt-core); box-shadow: 0 0 0 4px var(--nt-soft); }
.nx-search .wellness-icon { width: 20px; height: 20px; color: var(--muted); }
.nx-sheet .nx-search input { flex: 1; width: auto; min-width: 0; min-height: 48px; margin: 0; padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; color: var(--ink); font: inherit; font-size: 16px; outline: none; }
.nx-tools { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.nx-tool { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 70px; padding: 8px 4px; border: 1px solid var(--nav-edge); border-radius: 18px; background: var(--nav-glass-hi); color: var(--ink); font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; transition: transform .35s var(--nav-ease), background .3s; }
.nx-tool:active { transform: scale(.96); }
.nx-tool .wellness-icon { width: 22px; height: 22px; color: var(--nav-link); }
.nx-tool.is-ai .wellness-icon { color: var(--nt-violet); }
.nx-tabs { display: flex; gap: 4px; margin-top: 14px; padding: 4px; overflow-x: auto; border-radius: 999px; background: var(--nt-hair); scrollbar-width: none; }
.nx-tabs::-webkit-scrollbar { display: none; }
.nx-tabs button { flex: 1 0 auto; min-height: 44px; padding: 0 12px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font: inherit; font-size: 13px; font-weight: 700; white-space: nowrap; cursor: pointer; }
.nx-tabs button.is-on { background: var(--nt-core); color: var(--ink); box-shadow: 0 4px 12px -8px #0d2a5a73; }
.nx-foods { display: flex; flex-direction: column; gap: 2px; margin-top: 8px; min-height: 120px; }
.nx-food { display: flex; align-items: center; gap: 8px; padding: 4px 0; border-bottom: 1px solid var(--nt-line); }
.nx-food-name { display: flex; flex: 1; flex-direction: column; align-items: flex-start; min-width: 0; min-height: 52px; justify-content: center; padding: 4px 6px; border: 0; border-radius: 12px; background: transparent; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.nx-food-name:hover { background: var(--nt-hair); }
.nx-food-name strong { max-width: 100%; overflow: hidden; font-size: 15px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.nx-food-name span { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.nx-food.is-picked .nx-food-name strong { color: var(--nav-link); }
.nx-bar-host { display: contents; }
.nx-sheet .nx-search input:focus, .nx-sheet .nx-search input:focus-visible { outline: none; }
.nx-basket { position: sticky; bottom: -16px; display: flex; align-items: center; gap: 12px; margin: 12px -16px -16px; padding: 12px 16px calc(14px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--nt-line); background: color-mix(in srgb, var(--page) 88%, transparent); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
.nx-basket-copy { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.nx-basket-copy strong { font-size: 15px; font-weight: 800; font-variant-numeric: tabular-nums; }
.nx-basket-copy span { color: var(--muted); font-size: 12.5px; }
.nx-cta { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; padding: 0 20px; border: 0; border-radius: 999px; background: var(--nt-blue); color: #fff; font: inherit; font-size: 15px; font-weight: 750; white-space: nowrap; box-shadow: 0 14px 28px -14px #0866ffc2; cursor: pointer; transition: transform .35s var(--nav-ease), opacity .3s; }
.nx-cta:active { transform: scale(.97); }
.nx-cta:disabled { opacity: .45; box-shadow: none; cursor: default; }
.nx-cta.is-wide { width: 100%; margin-top: 14px; }
.nx-cta.is-quiet { background: var(--nt-hair); color: var(--ink); box-shadow: none; }
.nx-cta .wellness-icon { width: 18px; height: 18px; }
.nx-tool-pane { margin-top: 8px; }
.nx-tool-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }

/* C · Quantité */
.nx-qty-title { display: flex; flex: 1; flex-direction: column; align-items: center; min-width: 0; text-align: center; }
.nx-qty-title strong { max-width: 100%; overflow: hidden; font-size: 16px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.nx-qty-title span { color: var(--muted); font-size: 12px; }
.nx-qty { display: flex; align-items: baseline; justify-content: center; gap: 6px; margin-top: 10px; }
.nx-sheet .nx-qty input { width: 4ch; max-width: 70%; min-height: 0; margin: 0; padding: 0; border: 0; border-radius: 0; box-shadow: none; border-bottom: 2px dashed transparent; background: transparent; color: var(--ink); font: inherit; font-size: 60px; font-weight: 800; letter-spacing: -2.4px; line-height: 1.05; text-align: center; font-variant-numeric: tabular-nums; outline: none; }
.nx-sheet .nx-qty input:focus { outline: none;  border-bottom-color: var(--nt-soft-2); }
.nx-qty span { color: var(--muted); font-size: 18px; font-weight: 650; }
.nx-units { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 10px; }
.nx-unit { min-height: 44px; padding: 0 14px; border: 0; border-radius: 999px; background: var(--nt-hair); color: var(--ink); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.nx-unit.is-on { background: var(--ink); color: var(--page); }
.nx-presets { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; margin-top: 12px; }
.nx-presets button { min-height: 46px; border: 0; border-radius: 14px; background: var(--nt-hair); color: var(--ink); font: inherit; font-size: 15px; font-weight: 750; font-variant-numeric: tabular-nums; cursor: pointer; }
.nx-presets button.is-on { background: var(--ink); color: var(--page); }
.nx-sheet .nx-range { --w: 0%; width: 100%; height: 44px; min-height: 0; margin: 8px 0 0; padding: 0; border: 0; border-radius: 0; box-shadow: none; background: transparent; cursor: pointer; -webkit-appearance: none; appearance: none; }
.nx-range::-webkit-slider-runnable-track { height: 6px; border-radius: 9px; background: linear-gradient(90deg, var(--nt-blue) var(--w), var(--nt-track) var(--w)); }
.nx-range::-moz-range-track { height: 6px; border-radius: 9px; background: var(--nt-track); }
.nx-range::-moz-range-progress { height: 6px; border-radius: 9px; background: var(--nt-blue); }
.nx-range::-webkit-slider-thumb { width: 28px; height: 28px; margin-top: -11px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 0 0 2px var(--nt-blue), 0 6px 14px -6px #081e46; -webkit-appearance: none; appearance: none; }
.nx-range::-moz-range-thumb { width: 28px; height: 28px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 0 0 2px var(--nt-blue), 0 6px 14px -6px #081e46; }
.nx-impact { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-top: 14px; }
.nx-impact div { padding: 10px 6px; border-radius: 14px; background: var(--nt-hair); text-align: center; }
.nx-impact b { display: block; font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; }
.nx-impact div.is-blue b { color: var(--nav-link); }
.nx-impact span { color: var(--muted); font-size: 11px; font-weight: 650; }
.nx-after { margin-top: 12px; padding: 12px 14px; border-radius: 18px; background: var(--nt-soft); }
.nx-after .nx-kbar { margin-top: 8px; }
.nx-after-title { font-size: 13px; font-weight: 750; }

/* D · Dire ou écrire */
.nx-text { display: flex; flex-direction: column; }
.nx-said-input { width: 100%; min-height: 84px; margin-top: 10px; padding: 14px 16px; border: 1.5px solid var(--nt-blue); border-radius: 20px; background: var(--nt-core); color: var(--ink); font: inherit; font-size: 16px; line-height: 1.45; resize: vertical; box-shadow: 0 0 0 4px var(--nt-soft); outline: none; }
.nx-said-row { display: flex; justify-content: flex-end; margin-top: 12px; }
.nx-said { max-width: 86%; padding: 12px 16px; border-radius: 20px 20px 6px 20px; background: var(--nt-blue); color: #fff; font-size: 15px; font-weight: 550; line-height: 1.45; box-shadow: 0 12px 26px -14px #0866ffb3; }
.nx-parsed-list { display: grid; gap: 8px; margin-top: 8px; }
.nx-parsed { display: grid; gap: 8px; padding: 10px 10px 10px 14px; border: 1px solid var(--nav-edge); border-radius: 18px; background: var(--nav-glass-hi); }
.nx-parsed.is-check { border-color: color-mix(in srgb, var(--nt-orange) 55%, transparent); }
.nx-parsed.is-off { opacity: .55; }
.nx-parsed-top { display: flex; align-items: center; gap: 10px; }
.nx-parsed-copy { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.nx-parsed-copy strong { font-size: 14.5px; font-weight: 750; }
.nx-parsed-copy span { color: var(--muted); font-size: 12.5px; }
.nx-parsed-top input[type="checkbox"] { width: 24px; height: 24px; margin: 10px; accent-color: var(--nt-blue); }
.nx-conf { display: inline-flex; align-items: center; min-height: 26px; padding: 0 10px; border-radius: 999px; font-size: 11.5px; font-weight: 750; white-space: nowrap; }
.nx-conf.is-ok { background: var(--nx-green-bg); color: var(--nx-green); }
.nx-conf.is-check { background: var(--nx-orange-bg); color: var(--nt-orange); }
.nx-question { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.nx-question > span { width: 100%; font-size: 13px; font-weight: 700; }
.nx-grams { display: inline-flex; align-items: center; gap: 6px; width: max-content; padding: 0 12px; border-radius: 12px; background: var(--nt-hair); color: var(--muted); font-size: 13px; font-weight: 650; }
.nx-grams input { width: 70px; min-height: 44px; border: 0; background: transparent; color: var(--ink); font: inherit; font-size: 15px; font-weight: 750; text-align: right; outline: none; }
.nx-cands { min-height: 44px; padding: 0 12px; border: 1px solid var(--nt-line); border-radius: 12px; background: var(--nt-core); color: var(--ink); font: inherit; font-size: 13px; }
.nx-text-again { display: flex; align-items: flex-end; gap: 10px; margin-top: 12px; }
.nx-text-again .nx-said-input { min-height: 56px; margin-top: 0; }
.nx-text > .nx-chip-btn { align-self: flex-start; margin-top: 8px; }
.nx-mic-row { display: flex; justify-content: center; margin-top: 18px; }
.nx-mic-wrap { display: flex; align-items: center; justify-content: center; gap: 14px; }
.nx-mic { display: grid; place-items: center; width: 68px; height: 68px; padding: 0; border: 0; border-radius: 50%; background: var(--nt-blue); color: #fff; box-shadow: 0 0 0 10px var(--nt-soft), 0 18px 34px -12px #0866ffbf; cursor: pointer; transition: transform .35s var(--nav-ease); }
.nx-mic .wellness-icon { width: 28px; height: 28px; }
.nx-mic.is-small { width: 52px; height: 52px; box-shadow: 0 0 0 6px var(--nt-soft); }
.nx-mic.is-small .wellness-icon { width: 22px; height: 22px; }
.nx-mic[aria-pressed="true"] { background: var(--nt-orange); box-shadow: 0 0 0 10px var(--nx-orange-bg); }
.nx-wave { display: flex; align-items: center; gap: 3px; height: 30px; }
.nx-wave i { width: 4px; height: 30%; border-radius: 4px; background: var(--nt-blue); animation: nx-wave 1.1s cubic-bezier(.45,0,.55,1) var(--d, 0s) infinite; }
@keyframes nx-wave { 0%, 100% { height: 25%; } 50% { height: 100%; } }

/* F · Tendances / G · Revue */
.nx.is-sub { max-width: 760px; margin: 0 auto; }
.nx-seg { display: flex; gap: 4px; padding: 4px; border: 1px solid var(--nav-edge); border-radius: 999px; background: var(--nav-glass); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); }
.nx-seg button { flex: 1; min-height: 44px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font: inherit; font-size: 13.5px; font-weight: 700; cursor: pointer; }
.nx-seg button.is-on { background: var(--nav-glass-hi); color: var(--ink); box-shadow: 0 4px 12px -8px #0d2a5a73; }
.nx-trends { display: grid; gap: 12px; margin-top: 12px; }
.nx-duo { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.nx-delta { display: inline-flex; align-items: center; min-height: 28px; padding: 0 12px; border-radius: 999px; background: var(--nt-hair); color: var(--muted); font-size: 12.5px; font-weight: 750; white-space: nowrap; font-variant-numeric: tabular-nums; }
.nx-trend { height: 160px; margin-top: 12px; }
.nx-trend svg { width: 100%; height: 100%; overflow: visible; }
.nx-trend .gl { fill: none; stroke: var(--nt-line); vector-effect: non-scaling-stroke; }
.nx-trend .pts { fill: none; stroke: var(--muted); stroke-width: 7; stroke-linecap: round; opacity: .45; vector-effect: non-scaling-stroke; }
.nx-trend .tl { fill: none; stroke: var(--nt-blue); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.nx-plot { position: relative; margin-top: 12px; }
.nx-bars { display: flex; gap: 8px; }
.nx-bar-col { display: flex; flex: 1; flex-direction: column; align-items: center; gap: 6px; }
.nx-bar-area { display: flex; align-items: flex-end; justify-content: center; width: 100%; height: 110px; }
.nx-bar-area i { display: block; width: 100%; max-width: 32px; border-radius: 9px 9px 5px 5px; background: var(--nt-blue); transform-origin: bottom; }
.nx-bar-area i.is-partial { background: var(--nt-soft-2); }
.nx-bar-col span { color: var(--muted); font-size: 11px; font-weight: 650; }
.nx-bar-overlay { position: absolute; top: 0; right: 0; left: 0; height: 110px; pointer-events: none; }
.nx-target { position: absolute; right: 0; left: 0; border-top: 1.5px dashed var(--muted); opacity: .6; }
.nx-pico { display: flex; align-items: flex-start; gap: 14px; margin-top: 4px; }
.nx-pico img { flex-shrink: 0; width: 56px; height: 56px; object-fit: contain; }
.nx-pico p { font-size: 14.5px; font-weight: 550; line-height: 1.5; }
.nx-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.nx-pill { display: inline-flex; align-items: center; min-height: 26px; padding: 0 10px; border-radius: 999px; background: var(--nx-orange-bg); color: var(--nt-orange); font-size: 12px; font-weight: 700; }
.nx-pill.is-ok { background: var(--nx-green-bg); color: var(--nx-green); }
.nx.is-sub > .nx-card { margin-top: 12px; }
.nx-old { color: var(--muted); font-size: 20px; font-weight: 700; }
.nx-review-acts { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; margin-top: 16px; }

/* Mouvement léger */
@media (prefers-reduced-motion: no-preference) {
  .nx.is-entering .nx-head, .nx.is-entering .nx-col > *, .nx.is-entering .nx-tl > *, .nx.is-entering .nx-trends > *, .nx.is-entering > .nx-card, .nx.is-entering > .nx-seg { animation: nx-rise .7s var(--nav-ease) both; }
  .nx.is-entering .nx-col > :nth-child(2), .nx.is-entering .nx-tl > :nth-child(2), .nx.is-entering .nx-trends > :nth-child(2) { animation-delay: .06s; }
  .nx.is-entering .nx-col > :nth-child(3), .nx.is-entering .nx-tl > :nth-child(3), .nx.is-entering .nx-trends > :nth-child(3) { animation-delay: .12s; }
  .nx.is-entering .nx-tl > :nth-child(n+4) { animation-delay: .18s; }
  .nx.is-entering .nx-kbar span { animation: nx-grow 1s var(--nav-ease) .2s both; }
  .nx.is-entering .nx-bar-area i { animation: nx-rise-y .9s var(--nav-ease) .15s both; }
  .nx-sheet.is-entering { animation: nx-pop .5s var(--nav-ease) both; }
  .nx-sheet.is-entering::backdrop { animation: nx-fade .4s ease both; }
}
body[data-today-motion="none"] .nx *, body[data-today-motion="none"] .nx-sheet, body[data-today-motion="none"] .nx-sheet * { animation: none !important; transition: none !important; }
@media (prefers-reduced-motion: reduce) { .nx-wave i { animation: none; height: 60%; } .nx-meal, .nx-swipe .nx-meal { transition: none; } }
@keyframes nx-rise { from { opacity: 0; transform: translateY(12px); } }
@keyframes nx-grow { from { transform: scaleX(0); } }
@keyframes nx-rise-y { from { transform: scaleY(0); } }
@keyframes nx-pop { from { opacity: 0; transform: translateY(18px) scale(.98); } }
@keyframes nx-fade { from { opacity: 0; } }
@keyframes nx-sheet-up { from { transform: translateY(100%); } }

/* Mobile */
@media (max-width: 900px) {
  .nx-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  body[data-view="nutrition"] main { padding: 0 14px calc(var(--bottom-nav-space, 90px) + 90px); }
  .nx-head { padding: 14px 2px 10px; }
  .nx-title h1 { font-size: 30px; }
  .nx-add-top { display: none; }
  .nx-fab { display: inline-flex; }
  .nx-days { grid-template-columns: repeat(7, minmax(0, 1fr)); padding: 4px; }
  .nx-week-btn { display: none; }
  .nx-big { font-size: 40px; }
  .nx-sheet { width: 100vw; max-height: calc(100dvh - 40px); margin: auto 0 0; border-radius: 28px 28px 0 0; border-bottom: 0; }
  .nx-grab { display: block; }
  .nx-sheet-inner { padding-bottom: 0; }
  .nx-basket { bottom: 0; margin-bottom: 0; }
  @media (prefers-reduced-motion: no-preference) { .nx-sheet.is-entering { animation: nx-sheet-up .45s var(--nav-ease) both; } }
  .nx-review-acts { grid-template-columns: 1fr; }
}
@media (max-width: 380px) {
  .nx-tools { gap: 6px; }
  .nx-tool { font-size: 11px; }
  .nx-tabs button { font-size: 12px; }
}

/* Global button hovers (styles.css) must not repaint these controls. */
.nx .nx-meal:hover, .nx .nx-meal:focus { background: var(--nav-glass-hi); color: var(--ink); }
html[data-today-theme="dark"] .nx .nx-meal:hover, html[data-today-theme="dark"] .nx .nx-meal:focus { background: #112c40; }
.nx .nx-meal.is-empty:hover { background: transparent; }
.nx-sheet .nx-tool:hover { background: var(--nav-glass); }
.nx-sheet .nx-tabs button:hover { background: var(--nt-hair); color: var(--ink); }
.nx-sheet .nx-tabs button.is-on:hover { background: var(--nt-core); }
.nx-sheet .nx-unit:hover, .nx-sheet .nx-presets button:hover { background: var(--nt-soft); color: var(--ink); }
.nx-sheet .nx-unit.is-on:hover, .nx-sheet .nx-presets button.is-on:hover { background: var(--ink); color: var(--page); }
.nx-cta:hover, .nx-fab:hover, .nx-mic:hover { background: var(--nt-blue); filter: brightness(1.06); }
.nx-cta.is-quiet:hover { background: var(--nt-soft); filter: none; }
.nx-seg button:hover { background: var(--nt-hair); color: var(--ink); }
.nx-seg button.is-on:hover { background: var(--nav-glass-hi); }
.nx-swipe-acts .is-blue:hover { background: var(--nt-blue); }
.nx-swipe-acts .is-violet:hover { background: var(--nt-violet); }
.nx-chip-btn.is-strong:hover { background: var(--nt-blue); }
.nx-plus.is-done:hover { background: var(--nt-blue); }
.nx-mic[aria-pressed="true"]:hover { background: var(--nt-orange); }
.nx button:hover, .nx-sheet button:hover { box-shadow: none; }
.nx .nx-day.is-on:hover { background: var(--nav-glass-hi); }
.nx .nx-chip-btn.is-select { width: auto; min-height: 44px; margin: 0; padding: 0 16px; border: 0; border-radius: 999px; background: var(--nt-hair); color: var(--ink); font: inherit; font-size: 13px; font-weight: 700; box-shadow: none; }
.nx-sheet .nx-slot select { width: auto; min-height: 44px; margin: 0; padding: 0 2px; border: 0; border-radius: 0; background: transparent; box-shadow: none; color: inherit; font: inherit; outline: none; }
.nx-sheet .nx-slot:focus-within { box-shadow: 0 0 0 3px var(--nt-soft-2); }
.nx-tool-pane .fields { display: grid; gap: 10px; }
.nx-tool-pane label { color: var(--muted); font-size: 12.5px; font-weight: 650; }
.nx-tool-pane input:not([type="checkbox"]), .nx-tool-pane select { width: 100%; min-height: 44px; border: 1px solid var(--nt-line); border-radius: 12px; background: var(--nt-core); color: var(--ink); }
.nx-tool-pane button { min-height: 44px; margin-top: 8px; border-radius: 999px; }
.nx-tool-pane .help { color: var(--muted); font-size: 12.5px; line-height: 1.5; }

/* Global label margins (styles.css) must not shift these controls. */
.nx label.nx-icon-btn, .nx label.nx-chip-btn, .nx-sheet .nx-qty, .nx-sheet .nx-search, .nx-sheet .nx-grams { margin: 0; }

/* Calorie bar split by macro energy */
.nx-kbar .nx-kbar-fill.is-split { display: flex; gap: 2px; background: none; }
.nx-kbar-fill.is-split i { display: block; flex-shrink: 0; height: 100%; border-radius: 2px; }
.nx-kbar-fill.is-split i:first-child { border-radius: 99px 2px 2px 99px; }
.nx-kbar-fill.is-split i:last-child { border-radius: 2px 99px 99px 2px; }
.nx-kbar-fill.is-split i:only-child { border-radius: 99px; }
.nx-kbar-fill i.is-p { background: var(--nt-blue); }
.nx-kbar-fill i.is-c { background: var(--nt-gold); }
.nx-kbar-fill i.is-f { background: var(--nt-violet); }
.nx-kbar-fill i.is-o { background: var(--nt-soft-2); }
.nx-kbar.is-over { box-shadow: inset 0 0 0 1.5px var(--nt-orange); }

/* Meal details unfold in place */
.nx-meal-wrap { border-radius: 22px; background: transparent; box-shadow: 0 0 0 1px transparent; transition: background .4s var(--nav-ease), box-shadow .4s var(--nav-ease); }
.nx-meal-wrap.is-open { background: var(--nt-core); box-shadow: 0 0 0 1px var(--nav-edge); }
.nx-fold { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .45s var(--nav-ease); }
.nx-meal-wrap.is-open .nx-fold { grid-template-rows: 1fr; }
.nx-fold > .nx-meal-panel { min-height: 0; overflow: hidden; padding: 0 14px; opacity: 0; transition: opacity .3s ease; }
.nx-meal-wrap.is-open .nx-fold > .nx-meal-panel { opacity: 1; }
.nx-fold .nx-items { margin-top: 6px; }
.nx-fold .nx-meal-actions { margin-bottom: 14px; }

/* Meal slot chip and picker */
.nx-sheet .nx-slot { border: 0; font: inherit; font-size: 15px; font-weight: 750; cursor: pointer; }
.nx-sheet .nx-slot:hover { background: var(--nt-soft-2); color: var(--nav-link); }
.nx-slot[aria-expanded="true"] .wellness-icon { transform: rotate(180deg); }
.nx-slot .wellness-icon { transition: transform .35s var(--nav-ease); }
.nx-slots { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .35s var(--nav-ease); }
.nx-slots.is-open { grid-template-rows: 1fr; }
.nx-slot-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; min-height: 0; overflow: hidden; }
.nx-slots.is-open .nx-slot-row { padding: 8px 0 4px; }
.nx-sheet .nx-slot-opt { min-height: 44px; padding: 0 6px; border: 0; border-radius: 14px; background: var(--nt-hair); color: var(--ink); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.nx-sheet .nx-slot-opt:hover { background: var(--nt-soft); color: var(--ink); }
.nx-sheet .nx-slot-opt.is-on, .nx-sheet .nx-slot-opt.is-on:hover { background: var(--nt-blue); color: #fff; }

/* Sheet content slides instead of reloading */
.nx-sheet { position: fixed; transition: height .35s var(--nav-ease); }
.nx-sheet-inner.is-leaving { position: absolute; inset: 0 0 auto; pointer-events: none; }
@media (prefers-reduced-motion: no-preference) {
  .nx-sheet-inner.is-leaving.to-left { animation: nx-out-left .32s var(--nav-ease) both; }
  .nx-sheet-inner.is-leaving.to-right { animation: nx-out-right .32s var(--nav-ease) both; }
  .nx-sheet-inner.is-coming.from-right { animation: nx-in-right .36s var(--nav-ease) both; }
  .nx-sheet-inner.is-coming.from-left { animation: nx-in-left .36s var(--nav-ease) both; }
}
@keyframes nx-out-left { to { opacity: 0; transform: translateX(-28%); } }
@keyframes nx-out-right { to { opacity: 0; transform: translateX(28%); } }
@keyframes nx-in-right { from { opacity: 0; transform: translateX(28%); } }
@keyframes nx-in-left { from { opacity: 0; transform: translateX(-28%); } }
