/* Smart Nutrition v16.2.0 — Cronologia intelligente + Preferiti
   Layer additivo: memoria alimentare, preferiti e suggerimenti contestuali. */
:root{
  --sn162-ink:#10233f;
  --sn162-muted:#667b94;
  --sn162-blue:#2877f0;
  --sn162-blue-dark:#175fc6;
  --sn162-cyan:#36b9d6;
  --sn162-green:#1ca477;
  --sn162-yellow:#f4b942;
  --sn162-soft:#f5f9ff;
  --sn162-line:#dce8f5;
  --sn162-white:#fff;
  --sn162-shadow:0 22px 65px rgba(31,77,132,.12);
}

/* Pulsante memoria nella ricerca */
.sn162-memory-button{
  position:relative;
  flex:0 0 auto;
  min-width:42px!important;
  height:34px!important;
  padding:0 10px!important;
  display:inline-flex!important;
  align-items:center;
  justify-content:center;
  gap:5px;
  border:1px solid #dbe7f5!important;
  border-radius:11px!important;
  background:#f8fbff!important;
  color:#8597ad!important;
  -webkit-text-fill-color:#8597ad!important;
  box-shadow:none!important;
  font-size:15px!important;
  line-height:1!important;
  transition:.16s ease!important;
}
.sn162-memory-button b{
  min-width:15px;
  color:#6f8198!important;
  -webkit-text-fill-color:#6f8198!important;
  font-size:9px;
  font-weight:900;
  line-height:1;
}
.sn161-search.has-favorites .sn162-memory-button{
  border-color:#f1d799!important;
  background:#fff9ea!important;
  color:#e1a51f!important;
  -webkit-text-fill-color:#e1a51f!important;
}
.sn161-search.has-favorites .sn162-memory-button b{
  color:#9a6b07!important;
  -webkit-text-fill-color:#9a6b07!important;
}
.sn162-memory-button:hover,
.sn162-memory-button:focus-visible{
  transform:translateY(-1px)!important;
  border-color:#bcd4ef!important;
  background:#eef6ff!important;
  outline:none!important;
}

/* Riga risultato con preferito */
.sn161-food-result{
  position:relative;
  grid-template-columns:minmax(0,1fr) auto auto 36px!important;
  grid-template-areas:"main macros actions favorite";
}
.sn161-food-main{grid-area:main}
.sn161-macros{grid-area:macros}
.sn161-food-actions{grid-area:actions}
.sn162-favorite-toggle{
  grid-area:favorite;
  align-self:center;
  justify-self:end;
  width:34px!important;
  min-width:34px!important;
  height:34px!important;
  padding:0!important;
  display:grid!important;
  place-items:center;
  border:1px solid #dce8f5!important;
  border-radius:11px!important;
  background:#fff!important;
  color:#9aaabd!important;
  -webkit-text-fill-color:#9aaabd!important;
  box-shadow:none!important;
  font-size:17px!important;
  line-height:1!important;
  transition:.15s ease!important;
}
.sn162-favorite-toggle:hover{
  border-color:#efcf80!important;
  background:#fff9e8!important;
  color:#e1a21a!important;
  -webkit-text-fill-color:#e1a21a!important;
  transform:translateY(-1px)!important;
}
.sn162-favorite-toggle.is-favorite{
  border-color:#f0d184!important;
  background:linear-gradient(145deg,#fff7dd,#fffdf5)!important;
  color:#e2a51f!important;
  -webkit-text-fill-color:#e2a51f!important;
}
.sn161-food-result.is-favorite{
  border-color:#f1dfb4!important;
  background:linear-gradient(90deg,#fffdf7 0%,#fff 26%)!important;
}
.sn161-food-result.is-favorite:hover,
.sn161-food-result.is-favorite.is-selected{
  border-color:#e9cb7d!important;
  background:linear-gradient(90deg,#fff9e8 0%,#f8fbff 52%)!important;
}

/* Dashboard: I tuoi alimenti */
.sn162-smart-shelf{
  position:relative;
  overflow:hidden;
  margin:18px 0 24px;
  padding:0;
  border:1px solid rgba(203,220,239,.9);
  border-radius:26px;
  background:
    radial-gradient(circle at 95% -20%,rgba(54,185,214,.14),transparent 34%),
    radial-gradient(circle at -8% 105%,rgba(40,119,240,.10),transparent 35%),
    rgba(255,255,255,.92);
  box-shadow:0 18px 55px rgba(31,77,132,.08);
  color:var(--sn162-ink);
}
.sn162-smart-shelf::before{
  content:"";
  position:absolute;
  inset:0 0 auto 0;
  height:3px;
  background:linear-gradient(90deg,var(--sn162-blue),var(--sn162-cyan),var(--sn162-green));
}
.sn162-shelf-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:20px;
  padding:24px 25px 20px;
}
.sn162-shelf-head>div{min-width:0}
.sn162-shelf-head span{
  display:block;
  margin-bottom:7px;
  color:#3378c9;
  font-size:10px;
  font-weight:950;
  letter-spacing:.14em;
}
.sn162-shelf-head h2{
  margin:0!important;
  color:var(--sn162-ink)!important;
  -webkit-text-fill-color:var(--sn162-ink)!important;
  font-size:24px!important;
  font-weight:900!important;
  line-height:1.1!important;
  letter-spacing:-.035em!important;
}
.sn162-shelf-head p{
  margin:7px 0 0!important;
  color:var(--sn162-muted)!important;
  -webkit-text-fill-color:var(--sn162-muted)!important;
  font-size:12.5px!important;
  line-height:1.5!important;
}
.sn162-shelf-head>button{
  flex:0 0 auto;
  min-height:38px!important;
  padding:0 14px!important;
  border:1px solid #d7e6f7!important;
  border-radius:12px!important;
  background:rgba(255,255,255,.84)!important;
  color:#2d649e!important;
  -webkit-text-fill-color:#2d649e!important;
  box-shadow:none!important;
  font-size:11px!important;
  font-weight:900!important;
}
.sn162-shelf-head>button:hover{
  border-color:#b7d2ef!important;
  background:#f4f9ff!important;
  transform:translateY(-1px)!important;
}
.sn162-shelf-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  border-top:1px solid #e5eef8;
}
.sn162-shelf-column{
  min-width:0;
  padding:19px 20px 21px;
}
.sn162-shelf-column+ .sn162-shelf-column{border-left:1px solid #e5eef8}
.sn162-column-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin:0 3px 12px;
}
.sn162-column-head strong{
  color:#213c5d!important;
  -webkit-text-fill-color:#213c5d!important;
  font-size:12px;
  font-weight:900;
}
.sn162-column-head small{
  overflow:hidden;
  color:#8495a9!important;
  -webkit-text-fill-color:#8495a9!important;
  font-size:9.5px;
  font-weight:700;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.sn162-shelf-list{display:grid;gap:7px}
.sn162-shelf-food{
  min-width:0;
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  align-items:center;
  gap:8px;
  padding:7px 8px 7px 10px;
  border:1px solid transparent;
  border-radius:15px;
  background:rgba(247,250,254,.84);
  transition:border-color .15s ease,background .15s ease,transform .15s ease;
}
.sn162-shelf-food:hover{
  border-color:#d3e3f5;
  background:#fff;
  transform:translateY(-1px);
}
.sn162-shelf-main{
  min-width:0;
  min-height:44px!important;
  display:flex!important;
  align-items:center;
  gap:10px;
  padding:0!important;
  border:0!important;
  background:transparent!important;
  box-shadow:none!important;
  text-align:left!important;
}
.sn162-shelf-dot{
  flex:0 0 9px;
  width:9px;
  height:9px;
  border-radius:50%;
  background:linear-gradient(145deg,var(--sn162-blue),var(--sn162-cyan));
  box-shadow:0 0 0 5px rgba(40,119,240,.08);
}
.sn162-shelf-main>span:last-child{
  min-width:0;
  display:flex;
  flex-direction:column;
  gap:3px;
}
.sn162-shelf-main strong{
  overflow:hidden;
  color:#183553!important;
  -webkit-text-fill-color:#183553!important;
  font-size:11.5px;
  font-weight:850;
  line-height:1.25;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.sn162-shelf-main small{
  overflow:hidden;
  color:#7a8ca2!important;
  -webkit-text-fill-color:#7a8ca2!important;
  font-size:9.5px;
  font-weight:600;
  line-height:1.25;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.sn162-shelf-actions{display:flex;align-items:center;gap:4px}
.sn162-shelf-actions button{
  width:31px!important;
  min-width:31px!important;
  height:31px!important;
  min-height:31px!important;
  padding:0!important;
  display:grid!important;
  place-items:center;
  border:1px solid #dce8f5!important;
  border-radius:10px!important;
  background:#fff!important;
  color:#71869f!important;
  -webkit-text-fill-color:#71869f!important;
  box-shadow:none!important;
  font-size:14px!important;
  line-height:1!important;
}
.sn162-shelf-actions button:hover{
  border-color:#bfd7f1!important;
  background:#f2f8ff!important;
  color:#2877d8!important;
  -webkit-text-fill-color:#2877d8!important;
}
.sn162-shelf-actions button.is-favorite{
  border-color:#f0d184!important;
  background:#fff9e7!important;
  color:#dda018!important;
  -webkit-text-fill-color:#dda018!important;
}
.sn162-shelf-empty{
  width:100%;
  min-height:91px!important;
  display:grid!important;
  grid-template-columns:36px minmax(0,1fr);
  grid-template-rows:auto auto;
  align-items:center;
  column-gap:11px;
  padding:14px!important;
  border:1px dashed #cbdcee!important;
  border-radius:16px!important;
  background:rgba(248,251,255,.72)!important;
  color:#496581!important;
  box-shadow:none!important;
  text-align:left!important;
}
.sn162-shelf-empty>span{
  grid-row:1/3;
  width:36px;
  height:36px;
  display:grid;
  place-items:center;
  border-radius:12px;
  background:#edf5ff;
  color:#337bcf;
  font-size:18px;
}
.sn162-shelf-empty strong{
  align-self:end;
  color:#294a6c!important;
  -webkit-text-fill-color:#294a6c!important;
  font-size:11.5px;
  font-weight:850;
}
.sn162-shelf-empty small{
  align-self:start;
  margin-top:3px;
  color:#7b8da2!important;
  -webkit-text-fill-color:#7b8da2!important;
  font-size:9.5px;
  font-weight:600;
  line-height:1.35;
}
.sn162-shelf-empty:hover{
  border-color:#9ec4ed!important;
  background:#f3f8ff!important;
  transform:translateY(-1px)!important;
}

@media(max-width:1050px){
  .sn161-food-result{
    grid-template-columns:minmax(0,1fr) auto 36px!important;
    grid-template-areas:"main actions favorite";
  }
  .sn161-macros{display:none!important}
}

@media(max-width:760px){
  .sn162-shelf-grid{grid-template-columns:1fr}
  .sn162-shelf-column+ .sn162-shelf-column{border-left:0;border-top:1px solid #e5eef8}
  .sn162-smart-shelf{border-radius:22px}
  .sn162-shelf-head{padding:21px 18px 17px}
  .sn162-shelf-head h2{font-size:21px!important}
  .sn162-shelf-column{padding:17px 14px 18px}
}

@media(max-width:680px){
  .sn162-memory-button{
    min-width:36px!important;
    width:36px!important;
    height:34px!important;
    padding:0!important;
  }
  .sn162-memory-button b{display:none}
  .sn161-food-result{
    grid-template-columns:minmax(0,1fr) 34px!important;
    grid-template-areas:"main favorite" "actions actions";
  }
  .sn161-food-actions{padding-left:53px!important}
  .sn162-favorite-toggle{align-self:start}
  .sn162-shelf-head{align-items:center}
  .sn162-shelf-head>button{min-height:35px!important;padding:0 11px!important;font-size:10px!important}
  .sn162-shelf-head p{font-size:11.5px!important}
  .sn162-column-head{align-items:flex-start;flex-direction:column;gap:2px}
  .sn162-shelf-food{padding:7px 7px 7px 9px}
  .sn162-shelf-main strong{font-size:11px}
}

@media(max-width:430px){
  .sn162-shelf-head>button{font-size:0!important;width:38px!important;min-width:38px!important;padding:0!important}
  .sn162-shelf-head>button::before{content:"⌕";font-size:20px;color:#2d649e}
  .sn162-shelf-actions button{width:29px!important;min-width:29px!important;height:29px!important;min-height:29px!important}
}

@media(prefers-reduced-motion:reduce){
  .sn162-memory-button,.sn162-favorite-toggle,.sn162-shelf-food,.sn162-shelf-actions button,.sn162-shelf-empty,.sn162-shelf-head>button{transition:none!important}
}

/* v17 - Aggiunta sostituzione al diario */
.sn-swap-diary-action{display:grid;grid-template-columns:1fr;gap:8px;margin-top:14px}
.sn-swap-diary-action select{width:100%;background:#fff;color:#17324d;border:1px solid #bfd4e8;border-radius:10px;padding:10px}
.sn-swap-diary-action button{width:100%}
