/* Ferro App — design system dal file XD "ferro_app" + catalogo cartaceo */
@font-face { font-family: 'Bebas'; src: url('/assets/fonts/BebasNeue-Regular.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: 'Barlow'; src: url('/assets/fonts/Barlow-Regular.ttf') format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Barlow'; src: url('/assets/fonts/Barlow-Medium.ttf') format('truetype'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Barlow'; src: url('/assets/fonts/Barlow-SemiBold.ttf') format('truetype'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Barlow'; src: url('/assets/fonts/Barlow-Bold.ttf') format('truetype'); font-weight: 700; font-display: swap; }

:root {
  --brown: #3b3323;      /* marrone scuro splash/login */
  --brown-2: #4a4437;
  --cream: #f0ead9;
  --paper: #f7f3ea;
  --sandbg: #ede7dc;     /* sfondo dashboard */
  --ocra: #d89a3d;       /* beer */
  --ocra-soft: #e8c89b;
  --bordeaux: #5c302c;   /* wine */
  --teal: #74a69b;       /* spirits */
  --taupe: #b3a28f;      /* no alcohol */
  --ink: #3b3323;
  --ink-soft: #7a715e;
  --line: #d8cfb8;
  --ok: #5a7d46;
  --err: #a33c2f;
  --radius: 22px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Barlow', -apple-system, sans-serif;
  background: var(--sandbg);
  color: var(--ink);
  min-height: 100vh;
  font-size: 15px;
}
h1, h2, h3, .bebas { font-family: 'Bebas', 'Barlow', sans-serif; letter-spacing: .5px; font-weight: 400; }
a { color: inherit; }
.hide { display: none !important; }
.muted { color: var(--ink-soft); }
.only-mobile { display: none; }

/* ---------- topbar ---------- */
.topbar {
  background: var(--brown);
  color: var(--cream);
  display: flex; align-items: center; gap: 26px;
  padding: 0 22px;
  height: 58px;
  position: sticky; top: 0; z-index: 50;
}
.topbar .brand img { height: 36px; display: block; }
.topbar nav { display: flex; gap: 4px; flex: 1; }
.topbar nav a {
  color: var(--cream); text-decoration: none; padding: 8px 14px; border-radius: 999px;
  font-weight: 500; font-size: 14.5px; opacity: .85;
}
.topbar nav a.on, .topbar nav a:hover { background: rgba(240, 234, 217, .14); opacity: 1; }
.badge {
  background: var(--ocra); color: var(--brown);
  border-radius: 999px; font-size: 11.5px; font-weight: 700;
  padding: 1px 7px; margin-left: 4px; vertical-align: 2px;
}
/* ---------- ricerca globale topbar ---------- */
.gsearch { position: relative; width: 320px; max-width: 34vw; }
.gsearch input {
  width: 100%; border: 0; border-radius: 999px; padding: 9px 18px;
  background: rgba(240, 234, 217, .14); color: var(--cream);
  font-family: 'Barlow'; font-size: 14px; outline: none; transition: background .12s ease;
}
.gsearch input::placeholder { color: rgba(240, 234, 217, .55); }
.gsearch input:focus { background: rgba(240, 234, 217, .96); color: var(--ink); }
.gsearch input:focus::placeholder { color: var(--ink-soft); }
.gsearch-drop {
  position: absolute; top: 46px; right: 0; width: 430px; max-width: 92vw;
  background: var(--paper); border-radius: 18px; box-shadow: 0 14px 40px rgba(30, 24, 12, .35);
  max-height: min(560px, 78vh); overflow: auto; z-index: 200; padding: 8px;
}
.gs-item {
  display: flex; gap: 12px; align-items: center; padding: 8px 10px; border-radius: 12px;
  cursor: pointer; color: var(--ink); text-decoration: none;
}
.gs-item:hover, .gs-item.sel { background: var(--cream); }
.gs-photo { width: 38px; height: 52px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.gs-photo img { max-width: 38px; max-height: 52px; object-fit: contain; }
.gs-photo .ph-mini { width: 24px; height: 44px; font-size: 15px; }
.gs-body { flex: 1; min-width: 0; }
.gs-brand { display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .6px; color: var(--ink-soft); }
.gs-name { display: block; font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gs-meta { display: block; font-size: 11.5px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gs-cat { font-size: 10px; text-transform: uppercase; letter-spacing: .5px; padding: 2px 8px; border-radius: 999px; color: #fff; flex-shrink: 0; }
.gs-cat.c-beer { background: var(--ocra); }
.gs-cat.c-wine { background: var(--bordeaux); }
.gs-cat.c-spirits { background: var(--teal); }
.gs-cat.c-noalcohol { background: var(--taupe); }
.gs-cat.c-other { background: var(--brown-2); }
.gs-all {
  display: block; text-align: center; padding: 10px; font-size: 13px; font-weight: 600;
  color: var(--brown); border-top: 1px solid var(--line); margin-top: 4px; cursor: pointer;
  text-decoration: none;
}
.gs-empty { padding: 18px; text-align: center; color: var(--ink-soft); font-size: 13.5px; }

.userbox { display: flex; align-items: center; gap: 12px; font-size: 13.5px; opacity: .9; }
.userbox .logout { text-decoration: underline; text-underline-offset: 3px; }

main { max-width: 1180px; margin: 0 auto; padding: 26px 20px 60px; }

/* ---------- login (schermata XD "Hello!") ---------- */
body.bare { background: var(--brown); }
.login-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-inner { width: 100%; max-width: 380px; color: var(--cream); }
.login-logo { height: 44px; margin-bottom: 70px; }
.hello { font-family: 'Barlow'; font-weight: 400; font-size: 52px; margin: 0 0 34px; color: var(--cream); }
.login-inner label { display: block; font-size: 13px; margin-bottom: 26px; opacity: .95; }
.login-inner input {
  width: 100%; background: transparent; border: 0; border-bottom: 1px solid rgba(240,234,217,.55);
  color: var(--cream); font-size: 17px; padding: 9px 2px; outline: none; border-radius: 0;
}
.login-inner input:focus { border-bottom-color: var(--cream); }
.login-error { background: rgba(163,60,47,.25); border: 1px solid rgba(163,60,47,.6); padding: 9px 13px; border-radius: 10px; margin-bottom: 20px; font-size: 14px; }
.login-foot { margin-top: 60px; font-size: 12px; opacity: .55; }

.btn-pill {
  display: inline-block; background: var(--cream); color: var(--brown);
  border: 0; border-radius: 999px; padding: 12px 34px;
  font-family: 'Barlow'; font-weight: 600; font-size: 15px; cursor: pointer;
  text-decoration: none; transition: transform .06s ease;
}
.btn-pill:active { transform: scale(.97); }
.btn-pill.dark { background: var(--brown); color: var(--cream); }
.btn-pill.ocra { background: var(--ocra); color: var(--brown); }
.linklike { background: none; border: 0; padding: 0; font: inherit; color: var(--ink-soft); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.linklike.danger { color: var(--err); }

/* ---------- dashboard (schermata XD selezioni) ---------- */
.dash { max-width: 620px; margin: 0 auto; }
.dash-hi { font-size: 15px; color: var(--ink-soft); margin: 6px 2px 18px; }
.cat-cards { display: flex; flex-direction: column; gap: 16px; }
.cat-card {
  border-radius: var(--radius); padding: 26px 26px 22px; color: #fff;
  text-decoration: none; position: relative; min-height: 84px;
  display: flex; flex-direction: column; justify-content: center;
  transition: transform .08s ease, box-shadow .08s ease;
}
.cat-card:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(59,51,35,.18); }
.cat-name { font-family: 'Bebas'; font-size: 30px; line-height: .95; letter-spacing: 1px; }
.cat-meta { font-size: 13px; opacity: .85; margin-top: 7px; }
.cat-arrow { position: absolute; right: 24px; top: 50%; transform: translateY(-50%); font-size: 34px; opacity: .9; }
.cat-wine { background: var(--bordeaux); }
.cat-spirits { background: var(--teal); }
.cat-beer { background: var(--ocra); }
.cat-noalcohol { background: var(--taupe); }
.cat-other { background: var(--brown-2); margin-top: 16px; }
.cat-card.is-empty { opacity: .55; pointer-events: none; }

/* ---------- catalogo ---------- */
.cat-hero {
  border-radius: var(--radius); padding: 26px 28px; margin-bottom: 20px; color: #fff;
  display: flex; align-items: center; gap: 22px; flex-wrap: wrap;
  background: var(--brown);
}
.hero-beer { background: var(--ocra); }
.hero-wine { background: var(--bordeaux); }
.hero-spirits { background: var(--teal); }
.hero-noalcohol { background: var(--taupe); }
.hero-other { background: var(--brown-2); }
.cat-hero h1 { margin: 0; font-size: 34px; line-height: .95; }
.hero-search { flex: 1; min-width: 220px; }
.hero-search input {
  width: 100%; border: 0; border-radius: 999px; padding: 12px 20px; font-size: 15px;
  font-family: 'Barlow'; background: rgba(255,255,255,.92); color: var(--ink); outline: none;
}
.filters-toggle { display: none; }

.catalog-body { display: grid; grid-template-columns: 250px 1fr; gap: 24px; align-items: start; }
.filters {
  background: var(--paper); border-radius: var(--radius); padding: 18px;
  position: sticky; top: 76px; max-height: calc(100vh - 96px); overflow: auto;
}
.filters-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.fgroup { border-top: 1px solid var(--line); padding: 11px 0; }
.flabel { font-weight: 600; font-size: 13px; margin-bottom: 7px; }
.fgroup select, .frange input {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px;
  background: #fff; font-family: 'Barlow'; font-size: 14px; color: var(--ink);
}
.frange { display: flex; gap: 8px; align-items: center; }
/* filtri a chip */
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip-f {
  border: 1.5px solid var(--line); background: #fff; color: var(--brown-2);
  border-radius: 999px; padding: 6px 13px; font-family: 'Barlow'; font-size: 13px;
  font-weight: 500; cursor: pointer; line-height: 1.1;
  display: inline-flex; align-items: center; gap: 7px;
  transition: background var(--t-fast) ease, color var(--t-fast) ease,
    border-color var(--t-fast) ease, transform var(--t-fast) var(--ease-spring);
}
.chip-f:hover { border-color: var(--brown); transform: translateY(-1px); }
.chip-f:active { transform: scale(.95); }
.chip-f .n { font-size: 10.5px; color: var(--ink-soft); font-weight: 600; }
.chip-f.on { background: var(--brown); border-color: var(--brown); color: var(--cream); }
.chip-f.on .n { color: var(--ocra-soft); }
.fmore { font-size: 12.5px; margin-top: 7px; display: inline-block; }

/* infinite scroll */
.scroll-sentinel { height: 60px; display: flex; align-items: center; justify-content: center; }
.loader-dots { display: inline-flex; gap: 7px; }
.loader-dots i {
  width: 9px; height: 9px; border-radius: 50%; background: var(--brown);
  animation: dotPulse 1s ease-in-out infinite;
}
.loader-dots i:nth-child(2) { animation-delay: .16s; }
.loader-dots i:nth-child(3) { animation-delay: .32s; }
@keyframes dotPulse { 0%, 100% { transform: scale(.6); opacity: .4; } 50% { transform: scale(1); opacity: 1; } }

.results-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 12px; }
.results-bar select { padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line); background: #fff; font-family: 'Barlow'; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 16px; }
.pcard {
  background: var(--paper); border-radius: var(--radius); padding: 16px;
  display: flex; flex-direction: column; position: relative; cursor: pointer;
  transition: transform .08s ease, box-shadow .08s ease;
}
.pcard:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(59,51,35,.13); }
.pcard .photo { height: 150px; display: flex; align-items: center; justify-content: center; margin-bottom: 12px; }
.pcard .photo img { max-height: 150px; max-width: 100%; object-fit: contain; }
.ph-mini {
  width: 58px; height: 110px; background: var(--cream); border: 1px solid var(--line); border-radius: 6px;
  font-family: 'Bebas'; font-size: 34px; color: var(--taupe);
  display: flex; align-items: center; justify-content: center;
}
.pcard .brand { font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--ink-soft); }
.pcard .name { font-weight: 600; font-size: 15.5px; line-height: 1.25; margin: 2px 0 8px; }
.pcard .tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: auto; }
.tag {
  background: var(--cream); border-radius: 999px; padding: 2.5px 9px; font-size: 11.5px; color: var(--brown-2);
}
.tag.abv { background: var(--ocra-soft); font-weight: 600; }
.pcard .addbtn {
  position: absolute; top: 12px; right: 12px;
  width: 34px; height: 34px; border-radius: 999px; border: 0; cursor: pointer;
  background: var(--brown); color: var(--cream); font-size: 20px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.pcard .addbtn.in { background: var(--ok); }
.pager { display: flex; gap: 8px; justify-content: center; margin-top: 26px; flex-wrap: wrap; }
.pager button {
  border: 1px solid var(--line); background: var(--paper); border-radius: 10px;
  padding: 8px 14px; cursor: pointer; font-family: 'Barlow'; font-size: 14px;
}
.pager button.cur { background: var(--brown); color: var(--cream); border-color: var(--brown); }
.results-empty { padding: 60px 0; text-align: center; color: var(--ink-soft); }

/* ---------- modal ---------- */
.modal-back {
  position: fixed; inset: 0; background: rgba(40,33,20,.55); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 18px;
}
.modal {
  background: var(--paper); border-radius: var(--radius); max-width: 720px; width: 100%;
  max-height: 90vh; overflow: auto; padding: 26px; position: relative;
}
.modal.small { max-width: 440px; }
.modal-close { position: absolute; top: 14px; right: 16px; border: 0; background: none; font-size: 19px; cursor: pointer; color: var(--ink-soft); }
.modal h2 { margin-top: 0; }
.modal label { display: block; font-size: 13.5px; font-weight: 600; margin: 12px 0 4px; }
.modal input, .modal textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  font-family: 'Barlow'; font-size: 14.5px; background: #fff;
}
.modal-actions { margin-top: 18px; }
.send-result { margin-top: 12px; font-size: 14px; }
.send-result.ok { color: var(--ok); }
.send-result.err { color: var(--err); }

/* dettaglio prodotto nel modal */
.pd { display: grid; grid-template-columns: 190px 1fr; gap: 22px; }
.pd .pd-photo { display: flex; align-items: flex-start; justify-content: center; }
.pd .pd-photo img { max-width: 100%; max-height: 320px; object-fit: contain; }
.pd h2 { font-size: 30px; margin: 0 0 2px; }
.pd .pd-brand { text-transform: uppercase; letter-spacing: .8px; font-size: 12.5px; color: var(--ink-soft); }
.pd .pd-desc { font-size: 14px; line-height: 1.5; margin: 10px 0; }
.pd .attrs { display: flex; gap: 26px; margin: 12px 0; flex-wrap: wrap; }
.pd .attrs .k { font-weight: 700; font-size: 12.5px; }
.pd .attrs .v { font-size: 13.5px; }
.vtable { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 13.5px; }
.vtable th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .5px;
  color: var(--paper); background: var(--brown); padding: 5px 10px;
}
.vtable th:first-child { border-radius: 8px 0 0 8px; }
.vtable th:last-child { border-radius: 0 8px 8px 0; }
.vtable td { padding: 7px 10px; border-bottom: 1px solid var(--line); }
.vtable td.code { font-weight: 700; }
.pd-id { font-size: 11.5px; color: var(--ink-soft); margin-top: 10px; }

/* ---------- lista ---------- */
.listpage { max-width: 760px; margin: 0 auto; }
.list-head { display: flex; align-items: baseline; gap: 14px; }
.list-head h1 { font-size: 36px; margin: 0 0 14px; }
.card-box { background: var(--paper); border-radius: var(--radius); padding: 20px; margin-bottom: 18px; }
.lm-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.lm-row label { font-size: 12.5px; font-weight: 600; }
.lm-row input {
  width: 100%; margin-top: 4px; padding: 9px 11px; border: 1px solid var(--line);
  border-radius: 10px; font-family: 'Barlow'; font-size: 14px; background: #fff;
}
.list-items { display: flex; flex-direction: column; gap: 10px; }
.list-item {
  background: var(--paper); border-radius: 16px; padding: 12px 14px;
  display: flex; align-items: center; gap: 14px;
}
.li-photo { width: 52px; text-align: center; }
.li-photo img { max-height: 64px; max-width: 52px; object-fit: contain; }
.li-photo .ph-mini { width: 34px; height: 62px; font-size: 20px; margin: 0 auto; }
.li-body { flex: 1; }
.li-brand { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--ink-soft); }
.li-name { font-weight: 600; }
.li-meta { display: flex; gap: 12px; font-size: 12.5px; color: var(--ink-soft); margin-top: 2px; }
.li-remove { border: 0; background: none; color: var(--err); font-size: 16px; cursor: pointer; padding: 8px; }
.list-actions { display: flex; align-items: center; gap: 16px; margin-top: 22px; flex-wrap: wrap; }
.chk { font-size: 13px; color: var(--ink-soft); display: flex; gap: 6px; align-items: center; }
.pdf-result { margin-top: 16px; font-size: 14.5px; }
.pdf-result a { font-weight: 600; }
.empty-state { text-align: center; padding: 50px 0; color: var(--ink-soft); }
.empty-state .btn-pill { margin-top: 12px; }

/* ---------- admin ---------- */
.adminpage h1 { font-size: 36px; }
.adminpage h2 { font-size: 24px; margin-top: 0; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; margin-bottom: 16px; }
.table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .5px; color: var(--ink-soft); padding: 6px 8px; border-bottom: 2px solid var(--line); }
.table td { padding: 7px 8px; border-bottom: 1px solid var(--line); }
.grid-form { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; align-items: end; }
.grid-form label { font-size: 12.5px; font-weight: 600; }
.grid-form input, .grid-form select {
  width: 100%; margin-top: 4px; padding: 9px 11px; border: 1px solid var(--line);
  border-radius: 10px; font-family: 'Barlow'; font-size: 14px; background: #fff;
}
.grid-form .btn-pill { justify-self: start; }
.inline { display: inline; }
.flash { border-radius: 12px; padding: 10px 16px; margin-bottom: 16px; }
.flash.ok { background: #dfe8d4; color: var(--ok); }
.flash.err { background: #f0d9d4; color: var(--err); }
.smtp-test { display: flex; gap: 10px; align-items: center; margin-top: 14px; flex-wrap: wrap; }
.smtp-test input { padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; font-family: 'Barlow'; }
.import-log { background: var(--cream); border-radius: 10px; padding: 12px; font-size: 12px; white-space: pre-wrap; }

/* ============================================================
   MOTION LAYER — token di movimento del design system
   (solo movimento: colori e grafica invariati)
   ============================================================ */
:root {
  --t-fast: 150ms;
  --t-med: 280ms;
  --t-slow: 480ms;
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --ease-spring: cubic-bezier(.34, 1.6, .64, 1);
}

/* entrata pagina */
main { animation: pageIn var(--t-slow) var(--ease-out) backwards; }
@keyframes pageIn {
  from { opacity: 0; transform: translateY(14px); }
}

/* ---------- bottoni: lift, glow brand, ripple ---------- */
.btn-pill {
  position: relative; overflow: hidden;
  transition: transform var(--t-fast) var(--ease-spring), box-shadow var(--t-med) var(--ease-out);
}
.btn-pill:hover { transform: translateY(-2px) scale(1.02); box-shadow: 0 8px 20px rgba(59, 51, 35, .28); }
.btn-pill:active { transform: translateY(0) scale(.95); }
.btn-pill.ocra:hover { box-shadow: 0 8px 24px rgba(216, 154, 61, .5); }
.btn-pill:disabled { transform: none; box-shadow: none; opacity: .7; }

.ripple {
  position: absolute; border-radius: 50%; pointer-events: none;
  background: currentColor; opacity: .25; transform: scale(0);
  animation: ripple .55s var(--ease-out) forwards;
}
@keyframes ripple { to { transform: scale(2.8); opacity: 0; } }

/* ---------- bottone + / ✓ sulle card ---------- */
.pcard .addbtn { transition: transform var(--t-fast) var(--ease-spring), background var(--t-med) ease; }
.pcard .addbtn:hover { transform: scale(1.14) rotate(90deg); }
.pcard .addbtn.in:hover { transform: scale(1.14); }
.pcard .addbtn.in { animation: pop .45s var(--ease-spring), ping .55s var(--ease-out); }
@keyframes pop { 0% { transform: scale(.5); } 60% { transform: scale(1.28); } 100% { transform: scale(1); } }
@keyframes ping {
  from { box-shadow: 0 0 0 0 rgba(90, 125, 70, .55); }
  to { box-shadow: 0 0 0 16px rgba(90, 125, 70, 0); }
}

/* ---------- card prodotto: entrata a cascata + hover vivo ---------- */
.pcard {
  animation: cardIn .5s var(--ease-out) backwards;
  animation-delay: calc(var(--i, 0) * 35ms);
  transition: transform var(--t-med) var(--ease-spring), box-shadow var(--t-med) var(--ease-out);
}
@keyframes cardIn { from { opacity: 0; transform: translateY(18px) scale(.97); } }
.pcard:hover { transform: translateY(-5px); box-shadow: 0 14px 30px rgba(59, 51, 35, .16); }
.pcard .photo img { transition: transform var(--t-slow) var(--ease-out); }
.pcard:hover .photo img { transform: scale(1.07) rotate(-1.2deg); }

/* ---------- dashboard: shine sweep + freccia ---------- */
.cat-card { overflow: hidden; animation: cardIn .55s var(--ease-out) backwards; }
.cat-cards .cat-card:nth-child(1) { animation-delay: 40ms; }
.cat-cards .cat-card:nth-child(2) { animation-delay: 110ms; }
.cat-cards .cat-card:nth-child(3) { animation-delay: 180ms; }
.cat-cards .cat-card:nth-child(4) { animation-delay: 250ms; }
.cat-card::after {
  content: ''; position: absolute; top: 0; left: -80%; width: 45%; height: 100%;
  background: linear-gradient(105deg, transparent, rgba(255, 255, 255, .22), transparent);
  transform: skewX(-20deg); transition: left .7s var(--ease-out); pointer-events: none;
}
.cat-card:hover::after { left: 135%; }
.cat-card:hover { transform: translateY(-3px) scale(1.012); box-shadow: 0 14px 34px rgba(59, 51, 35, .24); }
.cat-arrow { transition: transform var(--t-med) var(--ease-spring); }
.cat-card:hover .cat-arrow { transform: translateY(-50%) translateX(7px) scale(1.15); }

/* ---------- modal: entrata spring, uscita fluida ---------- */
.modal-back { animation: fadeIn var(--t-med) ease backwards; }
@keyframes fadeIn { from { opacity: 0; } }
.modal { animation: modalIn .42s var(--ease-spring) backwards; }
@keyframes modalIn { from { opacity: 0; transform: translateY(28px) scale(.93); } }
.modal-back.closing { animation: fadeOut .22s ease forwards; }
.modal-back.closing .modal { animation: modalOut .22s ease forwards; }
@keyframes fadeOut { to { opacity: 0; } }
@keyframes modalOut { to { opacity: 0; transform: translateY(14px) scale(.96); } }
.modal-close { transition: transform var(--t-fast) var(--ease-spring), color var(--t-fast); }
.modal-close:hover { transform: rotate(90deg) scale(1.15); color: var(--ink); }

/* ---------- ricerca globale: dropdown spring + focus ring ---------- */
.gsearch input { transition: background var(--t-med) ease, box-shadow var(--t-med) var(--ease-out), color var(--t-fast); }
.gsearch input:focus { box-shadow: 0 0 0 4px rgba(216, 154, 61, .3); }
.gsearch-drop { transform-origin: top right; animation: dropIn .32s var(--ease-spring) backwards; }
@keyframes dropIn { from { opacity: 0; transform: translateY(-10px) scale(.95); } }
.gs-item { transition: background var(--t-fast) ease, transform var(--t-fast) var(--ease-out); }
.gs-item:hover, .gs-item.sel { transform: translateX(4px); }

/* hero search del catalogo */
.hero-search input { transition: box-shadow var(--t-med) var(--ease-out), transform var(--t-med) var(--ease-spring); }
.hero-search input:focus { box-shadow: 0 6px 24px rgba(30, 24, 12, .25); transform: scale(1.012); }

/* ---------- badge lista: pop quando cambia ---------- */
.badge { transition: transform var(--t-fast); }
.badge.bpop { animation: badgePop .5s var(--ease-spring); }
@keyframes badgePop { 0% { transform: scale(1); } 45% { transform: scale(1.55); } 100% { transform: scale(1); } }

/* ---------- toast feedback ---------- */
.toast {
  position: fixed; bottom: 28px; left: 50%; z-index: 400;
  background: var(--brown); color: var(--cream);
  padding: 12px 24px; border-radius: 999px; font-weight: 600; font-size: 14px;
  box-shadow: 0 14px 34px rgba(30, 24, 12, .35);
  display: flex; align-items: center; gap: 9px;
  animation: toastIn .45s var(--ease-spring) backwards;
}
.toast .t-ico { color: var(--ocra); font-size: 16px; }
.toast.out { animation: toastOut .3s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateX(-50%) translateY(24px) scale(.85); } to { transform: translateX(-50%); } }
@keyframes toastOut { from { transform: translateX(-50%); } to { opacity: 0; transform: translateX(-50%) translateY(14px); } }

/* ---------- skeleton loading griglia ---------- */
.sk-card { background: var(--paper); border-radius: var(--radius); padding: 16px; }
.sk {
  border-radius: 8px;
  background: linear-gradient(90deg, var(--cream) 25%, #fdfaf3 37%, var(--cream) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.15s linear infinite;
}
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }

/* ---------- lista: rimozione fluida ---------- */
.list-item { animation: cardIn .4s var(--ease-out) backwards; transition: opacity .3s ease, transform .3s var(--ease-out), height .3s var(--ease-out), padding .3s ease, margin .3s ease; }
.list-item.removing { opacity: 0; transform: translateX(34px); }

/* ---------- login: entrata + underline animata ---------- */
.login-inner { animation: pageIn .6s var(--ease-out) backwards; }
.login-inner input {
  background-image: linear-gradient(var(--cream), var(--cream));
  background-repeat: no-repeat; background-position: left bottom; background-size: 0% 2px;
  transition: background-size .4s var(--ease-out);
}
.login-inner input:focus { background-size: 100% 2px; }

/* ---------- filtri: drawer mobile + hover voci ---------- */
.fopt { transition: transform var(--t-fast) var(--ease-out), color var(--t-fast); }
.fopt:hover { transform: translateX(3px); }
.pager button { transition: transform var(--t-fast) var(--ease-spring), background var(--t-fast), color var(--t-fast); }
.pager button:hover { transform: translateY(-2px); }
.li-remove { transition: transform var(--t-fast) var(--ease-spring), color var(--t-fast); }
.li-remove:hover { transform: scale(1.3) rotate(90deg); }

/* accessibilità: rispetta chi disattiva le animazioni */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* ---------- torna su ---------- */
#back-top {
  position: fixed; right: 22px; bottom: 26px; z-index: 70;
  width: 46px; height: 46px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--brown); color: var(--cream);
  box-shadow: 0 10px 26px rgba(30, 24, 12, .32);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transform: translateY(16px) scale(.8); pointer-events: none;
  transition: opacity var(--t-med) ease, transform var(--t-med) var(--ease-spring);
}
#back-top.show { opacity: 1; transform: none; pointer-events: auto; }
#back-top:hover { transform: translateY(-3px) scale(1.06); }
#back-top:active { transform: scale(.92); }
#back-top svg { width: 20px; height: 20px; }

/* ---------- bottom bar mobile (stile web-app) ---------- */
.bottombar { display: none; }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .only-mobile { display: inline; }
  /* header snello: solo logo + esci, navigazione nella bottom bar */
  .topbar { gap: 10px; padding: 0 14px; height: 52px; }
  .topbar .brand img { height: 26px; }
  .topbar nav { display: none; }
  .userbox span { display: none; }
  .userbox .logout { font-size: 13px; }
  main { padding-bottom: 92px; }

  .bottombar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 80;
    background: var(--brown); color: var(--cream);
    padding: 6px 6px calc(8px + env(safe-area-inset-bottom));
    box-shadow: 0 -8px 24px rgba(30, 24, 12, .28);
    animation: bbIn .45s var(--ease-out) backwards;
  }
  @keyframes bbIn { from { transform: translateY(100%); } }
  .bb-item {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
    background: none; border: 0; color: var(--cream); opacity: .62;
    font-family: 'Barlow'; font-size: 10.5px; font-weight: 600; letter-spacing: .3px;
    text-decoration: none; padding: 7px 0 4px; border-radius: 14px; position: relative;
    cursor: pointer; transition: opacity var(--t-fast) ease, transform var(--t-fast) var(--ease-spring);
  }
  .bb-item svg { width: 22px; height: 22px; }
  .bb-item.on { opacity: 1; color: var(--ocra); }
  .bb-item:active { transform: scale(.92); }
  .bb-badge { position: absolute; top: 1px; right: calc(50% - 24px); }
  #back-top { bottom: calc(96px + env(safe-area-inset-bottom)); right: 14px; width: 42px; height: 42px; }

  /* griglia catalogo: 2 prodotti per riga */
  .grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .pcard { padding: 11px; border-radius: 16px; }
  .pcard .photo { height: 108px; margin-bottom: 8px; }
  .pcard .photo img { max-height: 108px; }
  .pcard .ph-mini { width: 44px; height: 84px; font-size: 24px; }
  .pcard .brand { font-size: 10px; }
  .pcard .name { font-size: 13px; margin: 2px 0 6px; }
  .tag { font-size: 10px; padding: 2px 7px; }
  .pcard .addbtn { width: 30px; height: 30px; font-size: 17px; top: 8px; right: 8px; }

  /* ricerca globale mobile: si apre dal tasto Cerca */
  .gsearch { display: none; }
  .gsearch.open-m {
    display: block; position: fixed; top: 0; left: 0; right: 0; z-index: 90;
    background: var(--brown); padding: 12px 14px; width: auto; max-width: none;
    animation: dropIn .3s var(--ease-out) backwards;
  }
  .gsearch.open-m input { background: rgba(240, 234, 217, .96); color: var(--ink); }
  .gsearch.open-m .gsearch-drop { top: 62px; left: 8px; right: 8px; width: auto; max-width: none; }
  .catalog-body { grid-template-columns: 1fr; }
  .filters {
    position: fixed; inset: 0; z-index: 90; border-radius: 0; max-height: none;
    display: none; padding-top: 70px;
  }
  .filters.open { display: block; animation: drawerIn .35s var(--ease-out) backwards; }
  @keyframes drawerIn { from { opacity: 0; transform: translateY(6%); } }
  .filters-toggle {
    display: inline-block; border: 0; border-radius: 999px; padding: 11px 20px;
    font-family: 'Barlow'; font-weight: 600; background: rgba(255,255,255,.92); cursor: pointer;
  }
  .lm-row, .grid-form { grid-template-columns: 1fr; }
  .pd { grid-template-columns: 1fr; }
  .pd .pd-photo img { max-height: 200px; }
  .cat-hero h1 { font-size: 27px; }
}
