/* Biblioteca › Nutrición › Pautas (S098-h): tarjetas con resumen visual,
   editor a pantalla completa del pane (comidas en bloques, macros en vivo),
   semana tipo calendario (7 columnas / swipe en móvil) y modal de asignar.
   Solo tokens del tenant; los colores de macros son los de Cocina (--nck-*). */

#tab-comidas[data-nut-tab="planes"] #nutrition-tab-lede { display: none; }

#nutrition-pane-planes.npl,
dialog.npl-modal,
.npl-menu {
  --npl-r: calc(16px * var(--radius-scale, 1));
  --npl-ease: cubic-bezier(0.16, 1, 0.3, 1);
  --npl-p: var(--nck-p, #22c55e);
  --npl-c: var(--nck-c, #38bdf8);
  --npl-g: var(--nck-g, #fb923c);
  --npl-line: var(--hairline, var(--border));
  --npl-soft: color-mix(in srgb, var(--text) 5%, transparent);
}

#tab-comidas #nutrition-pane-planes.npl { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
#tab-comidas #nutrition-pane-planes.npl[hidden] { display: none; }
#nutrition-pane-planes[data-npl-view="edit"] .npl-browse { display: none; }
#nutrition-pane-planes .npl-ed-root.hidden,
#nutrition-pane-planes .npl-ed-root[hidden] { display: none; }
.npl .nav-ico, .npl-modal .nav-ico, .npl-menu .nav-ico { width: 18px; height: 18px; flex: 0 0 auto; }
.npl-spacer { flex: 1 1 auto; }

/* ── Toolbar ───────────────────────────────────────────────────────── */
.npl-browse { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.npl-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.npl-seg {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: var(--npl-soft);
}
#nutrition-pane-planes .npl-seg-btn.libpane-kind {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  margin: 0;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 650;
  box-shadow: none;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease;
}
#nutrition-pane-planes .npl-seg-btn:hover { color: var(--text); }
#nutrition-pane-planes .npl-seg-btn.is-on {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12), 0 0 0 1px var(--npl-line);
}
.npl-seg-n { font-size: 0.72rem; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.npl-seg-n:empty { display: none; }

.npl-search { position: relative; display: flex; align-items: center; flex: 1 1 280px; max-width: 520px; min-width: 0; margin: 0; }
.npl-search--block { max-width: none; flex: 0 0 auto; width: 100%; }
.npl-search > .nav-ico { position: absolute; left: 13px; color: var(--muted); pointer-events: none; }
.npl-search input[type="search"] {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  margin: 0;
  padding: 0 14px 0 40px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.92rem;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}
.npl-search input[type="search"]:focus,
.npl-ed input:focus-visible,
.npl-ed textarea:focus-visible,
.npl-modal input:focus-visible {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent);
}
#tab-comidas .npl-create {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: auto;
  min-height: 44px;
  margin-left: auto;
  padding: 0 18px;
  border-radius: 999px;
  font-weight: 650;
}

.npl-filterbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.npl-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.npl-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  margin: 0;
  padding: 0 13px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
}
.npl-chip:hover { border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); }
.npl-chip.is-on {
  background: color-mix(in srgb, var(--primary) 14%, var(--surface));
  border-color: color-mix(in srgb, var(--primary) 55%, var(--border));
  color: var(--text);
}
.npl-chip-n { color: var(--muted); font-size: 0.74rem; font-variant-numeric: tabular-nums; }
.npl-sort-wrap { margin: 0 0 0 auto; }
.npl-sort {
  min-height: 34px;
  width: auto;
  margin: 0;
  padding: 0 30px 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background-color: var(--surface);
  color: var(--text);
  font-size: 0.82rem;
}
.npl-total { color: var(--muted); font-size: 0.82rem; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ── Tarjetas ──────────────────────────────────────────────────────── */
.npl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
  align-items: stretch;
}
.npl-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  padding: 16px 18px 14px;
  border: 1px solid var(--npl-line);
  border-radius: var(--npl-r);
  background: var(--surface);
  cursor: pointer;
  animation: npl-in 420ms var(--npl-ease) both;
  animation-delay: calc(var(--i, 0) * 28ms);
  transition: transform 200ms var(--npl-ease), box-shadow 200ms var(--npl-ease), border-color 160ms ease;
}
.npl-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--primary) 35%, var(--npl-line));
  box-shadow: 0 10px 28px -14px rgba(0, 0, 0, 0.35);
}
.npl-card:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.npl-card-top { display: flex; align-items: center; gap: 6px; min-height: 22px; }
.npl-card-name {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.npl-card-kcal { display: flex; align-items: baseline; gap: 6px; }
.npl-card-kcal strong { font-size: 1.75rem; font-weight: 750; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1; }
.npl-card-kcal span { color: var(--muted); font-size: 0.82rem; }
.npl-card-macros { display: flex; gap: 12px; flex-wrap: wrap; font-size: 0.82rem; font-variant-numeric: tabular-nums; color: var(--text); }
.npl-mt { display: inline-flex; align-items: center; gap: 4px; }
.npl-mt b { font-weight: 700; font-size: 0.72rem; }
.npl-mt-p { color: var(--nck-ink-p, var(--npl-p)); }
.npl-mt-c { color: var(--nck-ink-c, var(--npl-c)); }
.npl-mt-g { color: var(--nck-ink-g, var(--npl-g)); }
.npl-card-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding: 10px 76px 0 0;
  border-top: 1px solid var(--npl-line);
  color: var(--muted);
  font-size: 0.8rem;
}
.npl-foot-txt { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.npl-foot-txt .nav-ico { width: 15px; height: 15px; }
.npl-days { display: inline-flex; gap: 3px; }
.npl-days i {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: var(--npl-soft);
  color: var(--muted);
  font-size: 0.64rem;
  font-style: normal;
  font-weight: 700;
}
.npl-days i.is-on { background: color-mix(in srgb, var(--primary) 18%, transparent); color: var(--text); }
.npl-card-acts { position: absolute; right: 10px; bottom: 8px; display: flex; gap: 2px; }
.npl-card-act,
.npl-icon {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease;
}
.npl-card-act:hover, .npl-icon:hover { background: var(--npl-soft); color: var(--text); }
.npl-icon.is-danger:hover { color: var(--err, #dc2626); }
.npl-card-act:focus-visible, .npl-icon:focus-visible, .npl-chip:focus-visible, .npl-btn:focus-visible,
.npl-link:focus-visible, .npl-back:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
@media (hover: hover) {
  .npl-card-acts { opacity: 0; transition: opacity 160ms ease; }
  .npl-card:hover .npl-card-acts, .npl-card:focus-within .npl-card-acts { opacity: 1; }
}

.npl-type {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;
  background: var(--npl-soft);
  color: var(--muted);
}
.npl-type--d { background: color-mix(in srgb, var(--primary) 14%, transparent); color: color-mix(in srgb, var(--primary) 55%, var(--text)); }
.npl-type--w { background: color-mix(in srgb, var(--npl-c) 18%, transparent); color: var(--nck-ink-c, var(--text)); }
.npl-type--o { background: color-mix(in srgb, var(--npl-g) 18%, transparent); color: var(--nck-ink-g, var(--text)); }
.npl-who { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 0.78rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.npl-who .nav-ico { width: 15px; height: 15px; }

.npl-split {
  display: flex;
  width: 100%;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--npl-soft);
}
.npl-split i { display: block; width: var(--w); height: 100%; }
.npl-split i + i { margin-left: 2px; }
.npl-split-p { background: var(--npl-p); }
.npl-split-c { background: var(--npl-c); }
.npl-split-g { background: var(--npl-g); }

.npl-skel { pointer-events: none; min-height: 196px; }
.npl-skel i {
  display: block;
  height: 12px;
  border-radius: 8px;
  background: linear-gradient(90deg, var(--npl-soft) 25%, color-mix(in srgb, var(--text) 10%, transparent) 50%, var(--npl-soft) 75%);
  background-size: 200% 100%;
  animation: npl-shimmer 1.3s linear infinite;
}
.npl-skel i:nth-child(1) { width: 34%; }
.npl-skel i:nth-child(2) { width: 82%; height: 16px; }
.npl-skel i:nth-child(3) { width: 44%; height: 28px; }
.npl-skel i:nth-child(4) { width: 100%; margin-top: auto; }

.npl-empty {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 48px 20px;
  border: 1px dashed var(--border);
  border-radius: var(--npl-r);
  color: var(--muted);
  text-align: center;
}
.npl-empty strong { color: var(--text); font-size: 1rem; }
.npl-empty p { margin: 0; max-width: 42ch; font-size: 0.88rem; }
.npl-empty-ico { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 999px; background: var(--npl-soft); }
.npl-empty-ico .nav-ico { width: 26px; height: 26px; }
.npl-empty .npl-create { margin: 6px 0 0; }

/* ── Botones comunes ───────────────────────────────────────────────── */
.npl-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: auto;
  min-height: 42px;
  margin: 0;
  padding: 0 16px;
  border-radius: 999px;
  font-weight: 650;
  font-size: 0.88rem;
  cursor: pointer;
}
.npl-btn:not(.btn-primary) { border: 1px solid var(--border); background: var(--surface); color: var(--text); }
.npl-btn:not(.btn-primary):hover { border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); }
.npl-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.npl-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: auto;
  margin: 0;
  padding: 4px 2px;
  border: 0;
  background: none;
  color: color-mix(in srgb, var(--primary) 75%, var(--text));
  font-size: 0.84rem;
  font-weight: 650;
  cursor: pointer;
}
.npl-link:hover { text-decoration: underline; }
.npl-link.is-danger { color: var(--err, #dc2626); }
.npl-link .nav-ico { width: 16px; height: 16px; }

/* ── Editor ────────────────────────────────────────────────────────── */
.npl-ed { display: flex; flex-direction: column; gap: 16px; min-width: 0; padding-bottom: 24px; }
.npl-ed-head {
  position: sticky;
  top: 0;
  z-index: 6;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  background: color-mix(in srgb, var(--bg, var(--surface)) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--npl-line);
}
.npl-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: auto;
  min-height: 40px;
  margin: 0;
  padding: 0 12px 0 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
}
.npl-back .nav-ico { transform: rotate(90deg); }
.npl-ed-titles { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 2px 10px; min-width: 0; }
.npl-ed-titles .npl-type { grid-row: 1; }
#nutrition-pane-planes .npl-ed-name,
#nutrition-pane-planes .npl-ed-desc {
  width: 100%;
  min-width: 0;
  margin: 0;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
}
#nutrition-pane-planes .npl-ed-name { padding: 4px 8px; font-size: 1.3rem; font-weight: 750; letter-spacing: -0.01em; }
#nutrition-pane-planes .npl-ed-desc { grid-column: 2; padding: 2px 8px; font-size: 0.86rem; color: var(--muted); }
#nutrition-pane-planes .npl-ed-name:hover, #nutrition-pane-planes .npl-ed-desc:hover { border-color: var(--npl-line); }
.npl-ed-tools { display: flex; align-items: center; gap: 2px; }
.npl-save-state { margin-right: 6px; color: var(--muted); font-size: 0.78rem; white-space: nowrap; }
.npl-save-state.is-dirty { color: color-mix(in srgb, var(--npl-g) 70%, var(--text)); }
.npl-ed-cta { display: flex; gap: 8px; }
.npl-ed-cta .btn-primary { min-width: 110px; }
.npl-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: -6px 0 0;
  padding: 10px 14px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--primary) 9%, transparent);
  font-size: 0.86rem;
}

/* Resumen: anillo kcal + barras de macros vs objetivo */
.npl-sum {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px 22px;
  padding: 16px 20px;
  border: 1px solid var(--npl-line);
  border-radius: var(--npl-r);
  background: var(--surface);
}
.npl-ring { position: relative; width: 92px; height: 92px; }
.npl-ring svg { width: 100%; height: 100%; }
.npl-ring circle { fill: none; stroke-width: 7; }
.npl-ring-bg { stroke: var(--npl-soft); }
.npl-ring-fg { stroke: var(--primary); stroke-linecap: round; transition: stroke-dasharray 420ms var(--npl-ease); }
.npl-ring.is-over .npl-ring-fg { stroke: var(--err, #dc2626); }
.npl-ring > span { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; line-height: 1.1; }
.npl-ring strong { font-size: 1.15rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.npl-ring small { color: var(--muted); font-size: 0.7rem; }
.npl-sum-bars { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; min-width: 0; }
.npl-bar { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.npl-bar-top { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; font-size: 0.8rem; color: var(--muted); }
.npl-bar-top strong { color: var(--text); font-size: 0.95rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.npl-bar-top small { color: var(--muted); font-weight: 500; font-size: 0.75rem; }
.npl-bar-track { height: 8px; border-radius: 999px; background: var(--npl-soft); overflow: hidden; }
.npl-bar-track i { display: block; width: var(--w); height: 100%; border-radius: inherit; transition: width 420ms var(--npl-ease); }
.npl-bar--p .npl-bar-track i { background: var(--npl-p); }
.npl-bar--c .npl-bar-track i { background: var(--npl-c); }
.npl-bar--g .npl-bar-track i { background: var(--npl-g); }
.npl-bar.is-over .npl-bar-top strong { color: var(--err, #dc2626); }
.npl-sum-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.npl-sum-meta { color: var(--muted); font-size: 0.8rem; white-space: nowrap; }
.npl-goal-form {
  grid-column: 1 / -1;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 12px;
  border-top: 1px solid var(--npl-line);
}
.npl-goal-form label { display: grid; grid-template-columns: auto auto; align-items: center; gap: 2px 6px; margin: 0; }
.npl-goal-form label span { grid-column: 1 / -1; color: var(--muted); font-size: 0.75rem; font-weight: 600; }
#nutrition-pane-planes .npl-goal-form input { width: 92px; min-height: 40px; margin: 0; padding: 0 10px; border-radius: 10px; font-variant-numeric: tabular-nums; }
.npl-goal-form small { color: var(--muted); font-size: 0.75rem; }

/* Comidas en bloques */
.npl-meals { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; align-items: start; }
.npl-meal {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  padding: 12px 14px 14px;
  border: 1px solid var(--npl-line);
  border-radius: var(--npl-r);
  background: var(--surface);
  animation: npl-in 360ms var(--npl-ease) both;
  animation-delay: calc(var(--i, 0) * 30ms);
}
.npl-meal-head { display: flex; align-items: center; gap: 4px; }
.npl-grip { display: inline-grid; place-items: center; width: 22px; height: 34px; color: var(--muted); cursor: grab; opacity: 0.6; }
.npl-grip:hover { opacity: 1; }
#nutrition-pane-planes .npl-meal-name {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  padding: 5px 8px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  font-weight: 700;
  font-size: 0.98rem;
}
#nutrition-pane-planes .npl-meal-time {
  width: 104px;
  flex: 0 0 auto;
  margin: 0;
  padding: 4px 6px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: var(--npl-soft);
  color: var(--muted);
  font-size: 0.82rem;
}
#nutrition-pane-planes .npl-meal-name:hover, #nutrition-pane-planes .npl-meal-time:hover { border-color: var(--npl-line); }
.npl-meal-macros { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 6px 12px; }
.npl-meal-macros > strong { font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.npl-meal-macros small { color: var(--muted); font-weight: 500; font-size: 0.76rem; }
.npl-meal-mt { grid-column: 1 / -1; display: flex; gap: 12px; font-size: 0.78rem; font-variant-numeric: tabular-nums; }
.npl-opts { display: flex; gap: 4px; flex-wrap: wrap; }
.npl-opt {
  width: auto;
  min-height: 30px;
  margin: 0;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}
.npl-opt.is-on { background: var(--text); border-color: var(--text); color: var(--surface); }
.npl-items { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; }
.npl-item {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto 50px 28px;
  align-items: center;
  gap: 8px;
  padding: 7px 2px;
  border-top: 1px solid var(--npl-line);
  cursor: grab;
}
.npl-item:first-child { border-top: 0; }
.npl-item.is-new { animation: npl-flash 900ms ease; }
.npl-item-ico {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: color-mix(in srgb, var(--npl-p) 14%, transparent);
  color: var(--nck-ink-p, var(--text));
}
.npl-item-ico.is-recipe { background: color-mix(in srgb, var(--npl-g) 16%, transparent); color: var(--nck-ink-g, var(--text)); }
.npl-item-ico .nav-ico { width: 16px; height: 16px; }
.npl-item-name { display: flex; flex-direction: column; min-width: 0; }
.npl-item-name span {
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.npl-item-name small { color: var(--muted); font-size: 0.74rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.npl-qty { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.npl-qty button {
  width: 28px;
  height: 30px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 1rem;
  cursor: pointer;
}
.npl-qty button:hover { background: var(--npl-soft); }
#nutrition-pane-planes .npl-qty input {
  width: 40px;
  height: 30px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: center;
  font-size: 0.84rem;
  font-variant-numeric: tabular-nums;
}
.npl-item-kcal { text-align: right; font-size: 0.86rem; font-weight: 650; font-variant-numeric: tabular-nums; line-height: 1.1; }
.npl-item-kcal small { display: block; color: var(--muted); font-size: 0.68rem; font-weight: 500; }
.npl-item-del {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.npl-item-del:hover { color: var(--err, #dc2626); background: var(--npl-soft); }
.npl-item-del .nav-ico { width: 15px; height: 15px; }
.npl-meal-empty { margin: 0; padding: 10px 0; color: var(--muted); font-size: 0.84rem; text-align: center; }

.npl-add { position: relative; display: flex; align-items: center; }
.npl-add > .nav-ico { position: absolute; left: 12px; width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
#nutrition-pane-planes .npl-add-q {
  width: 100%;
  min-height: 40px;
  margin: 0;
  padding: 0 12px 0 36px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  font-size: 0.86rem;
}
.npl-add-q:focus { border-style: solid; }
.npl-add-pop {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  max-height: 320px;
  overflow-y: auto;
  padding: 5px;
  border: 1px solid var(--npl-line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 18px 44px -18px rgba(0, 0, 0, 0.45);
  animation: npl-pop 180ms var(--npl-ease);
}
.npl-add-pop[hidden] { display: none; }
.npl-add-opt {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin: 0;
  padding: 7px 8px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.npl-add-opt:hover, .npl-add-opt.is-active { background: var(--npl-soft); }
.npl-add-txt { display: flex; flex-direction: column; min-width: 0; }
.npl-add-txt span { font-size: 0.88rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.npl-add-txt small { color: var(--muted); font-size: 0.74rem; }
.npl-add-k { font-size: 0.84rem; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.npl-add-k small { color: var(--muted); font-weight: 500; }
.npl-add-none { margin: 0; padding: 12px; color: var(--muted); font-size: 0.84rem; text-align: center; }
#nutrition-pane-planes .npl-meal-note {
  width: 100%;
  min-height: 0;
  margin: 0;
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--npl-soft);
  color: var(--text);
  font-size: 0.84rem;
  resize: vertical;
}
.npl-meal-new {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 140px;
  padding: 16px;
  border: 1.5px dashed var(--border);
  border-radius: var(--npl-r);
}

/* Semana tipo calendario */
.npl-week-nav { display: none; }
.npl-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; align-items: stretch; }
.npl-day {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  min-height: 300px;
  padding: 10px;
  border: 1px solid var(--npl-line);
  border-radius: var(--npl-r);
  background: var(--surface);
  animation: npl-in 360ms var(--npl-ease) both;
  animation-delay: calc(var(--i, 0) * 30ms);
  scroll-margin: 12px;
}
.npl-day.is-free { background: transparent; border-style: dashed; }
.npl-day-head { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; padding: 2px 4px; }
.npl-day-head strong { font-size: 0.9rem; }
.npl-day-head span { color: var(--muted); font-size: 0.76rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.npl-day-empty {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  margin: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}
.npl-day-empty:hover { background: var(--npl-soft); color: var(--text); }
.npl-day-card {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  padding: 10px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--primary) 7%, transparent);
  cursor: grab;
}
.npl-day-name { font-size: 0.86rem; line-height: 1.3; overflow-wrap: anywhere; }
.npl-day-card .npl-card-macros { gap: 8px; font-size: 0.74rem; }
.npl-day-meals { display: flex; flex-direction: column; gap: 4px; margin: 0; padding: 6px 0 0; list-style: none; border-top: 1px solid var(--npl-line); }
.npl-day-meals li { display: flex; justify-content: space-between; gap: 6px; font-size: 0.76rem; }
.npl-day-meals span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.npl-day-meals small { color: var(--muted); font-variant-numeric: tabular-nums; }
.npl-day-acts { display: flex; flex-wrap: wrap; gap: 2px; }
.npl-day-acts button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: auto;
  min-height: 30px;
  margin: 0;
  padding: 0 7px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
}
.npl-day-acts button:hover { background: var(--npl-soft); color: var(--text); }
.npl-day-acts .nav-ico { width: 15px; height: 15px; }
@media (max-width: 1280px) {
  .npl-day-acts button span { display: none; }
}

/* Arrastrar y soltar */
.is-dragging { opacity: 0.45; }
.npl-meal.is-drop, .npl-day.is-drop, .npl-item.is-drop {
  outline: 2px dashed var(--primary);
  outline-offset: 2px;
}

/* Menú flotante (comida / copiar día) */
.npl-menu {
  position: fixed;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  min-width: 210px;
  padding: 6px;
  border: 1px solid var(--npl-line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 18px 44px -16px rgba(0, 0, 0, 0.45);
  animation: npl-pop 160ms var(--npl-ease);
}
.npl-menu > button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 38px;
  margin: 0;
  padding: 0 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: inherit;
  font-size: 0.86rem;
  text-align: left;
  cursor: pointer;
}
.npl-menu > button:hover, .npl-menu > button:focus-visible { background: var(--npl-soft); outline: none; }
.npl-menu > button.is-danger { color: var(--err, #dc2626); }
.npl-menu > button.is-flip .nav-ico { transform: rotate(90deg); }
.npl-menu > button[data-npl-menu="right"] .nav-ico { transform: rotate(-90deg); }
.npl-menu-title { margin: 4px 8px 8px; font-weight: 700; font-size: 0.86rem; }
.npl-menu-days { display: grid; grid-template-columns: repeat(3, auto); gap: 4px 12px; padding: 0 8px 8px; }
.npl-menu-days label { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-size: 0.86rem; cursor: pointer; }
.npl-menu-row { display: flex; align-items: center; gap: 10px; padding: 8px; border-top: 1px solid var(--npl-line); }
.npl-menu-row .btn-primary { width: auto; min-height: 34px; margin-left: auto; padding: 0 14px; border-radius: 999px; }

/* ── Modales (pauta del día / asignar) ─────────────────────────────── */
dialog.npl-modal { width: min(560px, calc(100vw - 32px)); }
dialog.npl-assign { width: min(640px, calc(100vw - 32px)); }
dialog.npl-modal .modal-body { display: flex; flex-direction: column; gap: 14px; }
.npl-pick-list { display: flex; flex-direction: column; gap: 6px; max-height: min(52vh, 440px); overflow-y: auto; }
.npl-pick-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px 12px;
  width: 100%;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--npl-line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.npl-pick-row:hover { border-color: color-mix(in srgb, var(--primary) 45%, var(--npl-line)); }
.npl-pick-row.is-on { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 8%, var(--surface)); }
.npl-pick-row .npl-split { grid-column: 1 / -1; height: 4px; }
.npl-pick-name { display: flex; flex-direction: column; min-width: 0; font-weight: 650; font-size: 0.9rem; }
.npl-pick-name small { color: var(--muted); font-weight: 500; font-size: 0.76rem; }
.npl-pick-k { color: var(--muted); font-size: 0.8rem; white-space: nowrap; }
.npl-pick-k strong { color: var(--text); font-size: 0.95rem; }

.npl-asg-sec { display: flex; flex-direction: column; gap: 10px; }
.npl-asg-sec h4 { margin: 0; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.npl-asg-sel { display: flex; flex-wrap: wrap; gap: 6px; }
.npl-asg-sel:empty { display: none; }
.npl-asg-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 4px 3px 3px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--primary) 14%, transparent);
  font-size: 0.82rem;
  font-weight: 600;
}
.npl-asg-pill i, .npl-asg-av {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: var(--primary);
  color: var(--tenant-primary-contrast, #fff);
  font-size: 0.66rem;
  font-style: normal;
  font-weight: 700;
}
.npl-asg-pill button { width: 22px; height: 22px; margin: 0; padding: 0; border: 0; border-radius: 999px; background: transparent; color: inherit; cursor: pointer; }
.npl-asg-list { display: flex; flex-direction: column; gap: 2px; max-height: 220px; overflow-y: auto; }
.npl-asg-row {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) 22px;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin: 0;
  padding: 7px 8px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.npl-asg-row:hover { background: var(--npl-soft); }
.npl-asg-row .npl-asg-av { width: 32px; height: 32px; background: var(--npl-soft); color: var(--text); font-size: 0.74rem; }
.npl-asg-row.is-on .npl-asg-av { background: var(--primary); color: var(--tenant-primary-contrast, #fff); }
.npl-asg-row span:nth-child(2) { display: flex; flex-direction: column; min-width: 0; }
.npl-asg-row strong { font-size: 0.88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.npl-asg-row small { color: var(--muted); font-size: 0.75rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.npl-asg-check { color: var(--primary); opacity: 0; transition: opacity 140ms ease; }
.npl-asg-row.is-on .npl-asg-check { opacity: 1; }
.npl-asg-skel {
  height: 44px;
  border-radius: 10px;
  background: linear-gradient(90deg, var(--npl-soft) 25%, color-mix(in srgb, var(--text) 10%, transparent) 50%, var(--npl-soft) 75%);
  background-size: 200% 100%;
  animation: npl-shimmer 1.3s linear infinite;
}
.npl-asg-dates { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.npl-asg-dates label { display: flex; flex-direction: column; gap: 4px; margin: 0; }
.npl-asg-dates span { color: var(--muted); font-size: 0.76rem; font-weight: 600; }
.npl-asg-dates input { min-height: 42px; margin: 0; border-radius: 10px; }
.npl-asg-days { display: flex; gap: 6px; }
.npl-asg-days[hidden] { display: none; }
.npl-dow {
  width: 38px;
  height: 38px;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-weight: 700;
  font-size: 0.8rem;
  cursor: pointer;
}
.npl-dow.is-on { background: var(--primary); border-color: var(--primary); color: var(--tenant-primary-contrast, #fff); }
.npl-asg-preview { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border-radius: 12px; background: var(--npl-soft); font-size: 0.86rem; }
.npl-asg-preview:empty { display: none; }
.npl-asg-sum { display: flex; align-items: center; gap: 8px; margin: 0; }
.npl-asg-conf { display: flex; flex-direction: column; gap: 4px; margin: 0; padding-left: 18px; color: color-mix(in srgb, var(--npl-g) 55%, var(--text)); }
.npl-asg-ok { margin: 0; color: color-mix(in srgb, var(--npl-p) 60%, var(--text)); }
.npl-asg-warn { margin: 0; color: var(--err, #dc2626); }
.npl-asg-current { display: flex; flex-direction: column; gap: 2px; }
.npl-asg-cur-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 0; border-top: 1px solid var(--npl-line); }
.npl-asg-cur-row:first-child { border-top: 0; }
.npl-asg-cur-row span { display: flex; flex-direction: column; min-width: 0; font-size: 0.86rem; }
.npl-asg-cur-row small { color: var(--muted); font-size: 0.76rem; }
dialog.npl-modal .modal-footer { display: flex; align-items: center; gap: 8px; }
dialog.npl-modal .modal-footer button { width: auto; }

/* ── Responsivo ────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .npl-week {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: minmax(230px, 1fr);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-bottom: 6px;
  }
  .npl-day { scroll-snap-align: start; }
  .npl-day-acts button span { display: inline; }
  .npl-sum { grid-template-columns: auto minmax(0, 1fr); }
  .npl-sum-side { grid-column: 1 / -1; flex-direction: row; align-items: center; justify-content: flex-start; gap: 14px; }
  .npl-ed-head { grid-template-columns: auto minmax(0, 1fr) auto; }
  .npl-ed-cta { grid-column: 1 / -1; justify-content: flex-end; }
}
@media (max-width: 600px) {
  .npl-toolbar { gap: 8px; }
  .npl-seg { order: 1; flex: 1 1 100%; }
  #nutrition-pane-planes .npl-seg-btn.libpane-kind { flex: 1 1 0; justify-content: center; }
  .npl-search { order: 2; flex: 1 1 0; }
  #tab-comidas .npl-create { order: 3; margin: 0; padding: 0 14px; }
  .npl-filterbar { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .npl-chips { flex-wrap: nowrap; }
  .npl-chip { white-space: nowrap; }
  .npl-grid { grid-template-columns: 1fr; gap: 10px; }
  .npl-card { padding: 14px 16px 12px; }

  .npl-ed-head { position: static; grid-template-columns: auto minmax(0, 1fr); gap: 8px; backdrop-filter: none; }
  .npl-ed-titles { grid-column: 1 / -1; grid-row: 2; grid-template-columns: minmax(0, 1fr); }
  .npl-ed-titles .npl-type { justify-self: start; }
  #nutrition-pane-planes .npl-ed-desc { grid-column: 1; }
  .npl-ed-name { font-size: 1.15rem; padding: 4px 4px; }
  .npl-ed-tools { grid-column: 2; grid-row: 1; justify-content: flex-end; }
  .npl-save-state { display: none; }
  .npl-ed-cta { grid-column: 1 / -1; }
  .npl-ed-cta .npl-btn { flex: 1 1 0; min-height: 46px; }

  .npl-sum { grid-template-columns: 1fr; padding: 14px; gap: 12px; justify-items: center; }
  .npl-sum-bars { width: 100%; grid-template-columns: 1fr; gap: 10px; }
  .npl-sum-side { justify-content: center; }
  .npl-goal-form { justify-content: center; }
  #nutrition-pane-planes .npl-goal-form input { width: 76px; }

  .npl-meals { grid-template-columns: 1fr; }
  #nutrition-pane-planes .npl-meal-time { width: 92px; }
  .npl-item { grid-template-columns: 28px minmax(0, 1fr) auto 26px; gap: 6px; }
  .npl-item-kcal { display: none; }
  .npl-qty button { width: 38px; height: 40px; }
  #nutrition-pane-planes .npl-qty input { width: 38px; height: 40px; }
  .npl-item-del { width: 36px; height: 40px; }
  .npl-grip { display: none; }

  .npl-week-nav { position: sticky; top: 0; z-index: 4; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
  .npl-week-nav button {
    flex: 1 0 auto;
    min-height: 36px;
    margin: 0;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
    font-size: 0.8rem;
    font-weight: 650;
  }
  .npl-week { grid-auto-columns: 85vw; gap: 10px; }
  .npl-day { min-height: 340px; }
  .npl-day-acts button { min-height: 40px; }

  .npl-asg-dates { grid-template-columns: 1fr; }
}

@keyframes npl-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes npl-pop { from { opacity: 0; transform: translateY(-4px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes npl-shimmer { to { background-position: -200% 0; } }
@keyframes npl-flash { from { background: color-mix(in srgb, var(--primary) 16%, transparent); } to { background: transparent; } }

@media (prefers-reduced-motion: reduce) {
  .npl-card, .npl-meal, .npl-day, .npl-add-pop, .npl-menu, .npl-item.is-new { animation: none; }
  .npl-card, .npl-ring-fg, .npl-bar-track i { transition: none; }
  .npl-card:hover { transform: none; }
  .npl-skel i, .npl-asg-skel { animation: none; }
}
