/* 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;
  /* alone ocra appena percettibile dietro il form */
  background:
    radial-gradient(52% 42% at 50% 38%, rgba(216, 154, 61, .16), transparent 70%),
    radial-gradient(38% 30% at 78% 88%, rgba(216, 154, 61, .07), transparent 72%);
}
.login-inner { width: 100%; max-width: 380px; color: var(--cream); }
.login-logo { height: 44px; margin-bottom: 56px; }
.hello { font-family: 'Barlow'; font-weight: 400; font-size: 52px; margin: 0 0 6px; color: var(--cream); }
.login-sub { font-size: 14px; color: rgba(240, 234, 217, .58); margin: 0 0 30px; }

/* ---------- campo form (login) ---------- */
.field { position: relative; margin-bottom: 14px; }
.field input {
  width: 100%; padding: 23px 46px 9px 45px;
  background: rgba(240, 234, 217, .07);
  border: 1.5px solid rgba(240, 234, 217, .17); border-radius: 16px;
  color: var(--cream); font-family: 'Barlow'; font-size: 16px; outline: none;
  transition: background var(--t-med) ease, border-color var(--t-med) ease, box-shadow var(--t-med) ease;
}
.field input:hover { background: rgba(240, 234, 217, .1); border-color: rgba(240, 234, 217, .3); }
.field input:focus {
  background: rgba(240, 234, 217, .12); border-color: var(--ocra);
  box-shadow: 0 0 0 4px rgba(216, 154, 61, .22);
}
.field label {
  position: absolute; left: 46px; top: 50%; transform: translateY(-50%);
  color: rgba(240, 234, 217, .55); font-size: 15px; pointer-events: none;
  transition: top var(--t-med) var(--ease-out), font-size var(--t-med) var(--ease-out),
    color var(--t-med) ease, transform var(--t-med) var(--ease-out), letter-spacing var(--t-med) ease;
}
.field input:focus + label,
.field input:not(:placeholder-shown) + label {
  top: 13px; transform: none; font-size: 10px; letter-spacing: .9px;
  text-transform: uppercase; font-weight: 600; color: var(--ocra);
}
.field .f-ico {
  position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
  width: 19px; height: 19px; color: rgba(240, 234, 217, .45); pointer-events: none;
  transition: color var(--t-med) ease, transform var(--t-fast) var(--ease-spring);
}
.field:focus-within .f-ico { color: var(--ocra); transform: translateY(-50%) scale(1.08); }
.f-toggle {
  position: absolute; right: 7px; top: 50%; transform: translateY(-50%);
  width: 34px; height: 34px; border: 0; border-radius: 50%; cursor: pointer;
  background: transparent; color: rgba(240, 234, 217, .5);
  display: flex; align-items: center; justify-content: center;
  transition: color var(--t-fast) ease, background var(--t-fast) ease, transform var(--t-fast) var(--ease-spring);
}
.f-toggle svg { width: 19px; height: 19px; }
.f-toggle:hover { color: var(--cream); background: rgba(240, 234, 217, .1); }
.f-toggle:active { transform: translateY(-50%) scale(.88); }
.login-btn { width: 100%; margin-top: 12px; padding: 14px 34px; font-size: 15.5px; }

/* ---------- autofill: via il riquadro azzurro del browser ---------- */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active,
textarea:-webkit-autofill,
select:-webkit-autofill {
  -webkit-text-fill-color: var(--ink);
  -webkit-box-shadow: 0 0 0 100px #fff inset;
  box-shadow: 0 0 0 100px #fff inset;
  caret-color: var(--ink);
  transition: background-color 600000s 0s;
}
/* login: la superficie del campo, non l'azzurro del browser */
.login-inner input:-webkit-autofill,
.login-inner input:-webkit-autofill:hover,
.login-inner input:-webkit-autofill:active {
  -webkit-text-fill-color: var(--cream);
  -webkit-box-shadow: 0 0 0 100px #484030 inset;
  box-shadow: 0 0 0 100px #484030 inset;
  caret-color: var(--cream);
  border-radius: 16px;
}
.login-inner input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--cream);
  -webkit-box-shadow: 0 0 0 4px rgba(216, 154, 61, .22), 0 0 0 100px #4d442f inset;
  box-shadow: 0 0 0 4px rgba(216, 154, 61, .22), 0 0 0 100px #4d442f inset;
  caret-color: var(--cream);
}
/* ricerca in topbar: fondo scuro */
.gsearch input:-webkit-autofill,
.gsearch input:-webkit-autofill:hover,
.gsearch input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--cream);
  -webkit-box-shadow: 0 0 0 100px #4a4437 inset;
  box-shadow: 0 0 0 100px #4a4437 inset;
  caret-color: var(--cream);
}
.login-error {
  display: flex; align-items: center; gap: 9px;
  background: rgba(163, 60, 47, .22); border: 1.5px solid rgba(163, 60, 47, .55);
  color: #f2cfc8; padding: 11px 15px; border-radius: 14px; margin-bottom: 18px; font-size: 13.5px;
  animation: shakeIn .5s var(--ease-out);
}
.login-error svg { width: 17px; height: 17px; flex-shrink: 0; }
@keyframes shakeIn {
  0% { opacity: 0; transform: translateY(-6px); }
  40% { opacity: 1; transform: translateX(-5px); }
  60% { transform: translateX(4px); }
  80% { transform: translateX(-2px); }
  100% { transform: none; }
}
.login-foot { margin-top: 42px; font-size: 12px; opacity: .45; }
.login-back {
  display: inline-block; margin-top: 18px; font-size: 13.5px;
  color: rgba(240, 234, 217, .62); text-decoration: none;
  border-bottom: 1px solid rgba(240, 234, 217, .28); padding-bottom: 1px;
  transition: color .2s, border-color .2s;
}
.login-back:hover { color: var(--cream); border-color: rgba(240, 234, 217, .6); }

.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; }
/* dashboard: PDF macro per categoria */
.dash-pdf { margin-top: 26px; }
.dash-pdf-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.dash-pdf-head strong { color: var(--brown); font-size: 15px; }
.dash-pdf-head .muted { font-size: 12.5px; color: var(--ink-soft); }
.pdf-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pdf-card { text-align: left; border: 1.5px solid var(--line); background: var(--paper); border-radius: 14px; padding: 13px 15px; cursor: pointer; display: flex; flex-direction: column; gap: 3px; transition: transform .08s, box-shadow .08s, border-color .1s; }
.pdf-card:not(:disabled):hover { transform: translateY(-2px); box-shadow: 0 8px 18px rgba(59,51,35,.12); border-color: var(--ocra); }
.pdf-card:disabled { opacity: .5; cursor: default; }
.pdf-card .pdf-cat { font-weight: 700; color: var(--brown); font-size: 14px; }
.pdf-card .pdf-n { font-size: 11.5px; color: var(--ink-soft); }
@media (max-width: 480px) { .pdf-cards { grid-template-columns: 1fr; } }
.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; }
.facet-search { width: 100%; box-sizing: border-box; border: 1.5px solid var(--line); border-radius: 9px; padding: 6px 10px; font-family: 'Barlow'; font-size: 12.5px; margin-bottom: 8px; }
.facet-search:focus { outline: none; border-color: var(--ocra); }
/* selezione multipla dai risultati */
.results-bar #sel-toggle { margin-left: auto; margin-right: 12px; }
.pcard .selbox { position: absolute; top: 10px; left: 10px; width: 22px; height: 22px; border-radius: 6px; border: 2px solid var(--line); background: #fff; cursor: pointer; z-index: 3; display: none; padding: 0; }
.catalog.selecting .pcard .selbox { display: block; }
.pcard.picked .selbox { background: var(--brown); border-color: var(--brown); }
.pcard.picked .selbox::after { content: '✓'; color: var(--cream); font-size: 13px; font-weight: 700; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.pcard.picked { outline: 2.5px solid var(--brown); outline-offset: -1px; }
.selbar { position: fixed; left: 50%; transform: translateX(-50%); bottom: 20px; z-index: 60; display: flex; align-items: center; gap: 16px; background: var(--cream); border: 1px solid var(--line); box-shadow: 0 12px 34px rgba(59,51,35,.24); border-radius: 999px; padding: 10px 18px; }
.selbar #selbar-count { font-weight: 700; color: var(--brown); font-size: 13.5px; }
.selbar .btn-pill.sm { padding: 7px 16px; }
@media (max-width: 640px) { .selbar { bottom: 78px; width: calc(100% - 24px); justify-content: space-between; gap: 8px; padding: 10px 12px; } }
.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 minmax(0, 1fr); gap: 22px; }
.pd > div { min-width: 0; }
.pd h2 { overflow-wrap: anywhere; }
.vtable-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.pd .pd-photo { position: relative; display: flex; align-items: flex-start; justify-content: center; }
.pd .pd-photo[data-zoom] { cursor: zoom-in; }
.pd .pd-photo img { max-width: 100%; max-height: 320px; object-fit: contain; }
.pd .pd-photo .bj-zoomic { position: absolute; right: 4px; top: 4px; width: 24px; height: 24px; border-radius: 7px; background: rgba(59, 51, 35, .78); color: #fff; font-size: 14px; line-height: 24px; text-align: center; opacity: .85; transition: opacity .15s; pointer-events: none; }
.pd .pd-photo:hover .bj-zoomic { opacity: 1; }
.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 .pd-ferm { font-size: 13.5px; line-height: 1.5; margin: 8px 0; }
.pd .pd-ferm .pd-ferm-l { font-weight: 700; font-size: 12.5px; margin-right: 4px; }
.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; }
/* scelta finale: presentazione vs preventivo */
.gen-choice { display: flex; gap: 8px; margin-top: 26px; border-bottom: 1px solid var(--line); padding-bottom: 0; }
.gen-tab { appearance: none; border: 1px solid var(--line); border-bottom: none; background: #fbf7ef;
  padding: 9px 18px; border-radius: 10px 10px 0 0; font: inherit; font-size: 14px; cursor: pointer; color: var(--ink-soft); }
.gen-tab.on { background: var(--brown, #3b3323); color: #f4ede1; border-color: var(--brown, #3b3323); font-weight: 600; }
.qf { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--ink-soft); }
.qf select { font: inherit; font-size: 14px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px;
  background: #fff; min-width: 170px; max-width: 260px; }
/* pannello preventivo: cerca il cliente (AJAX) → gli sconti arrivano dalla sua anagrafica */
.qt-pane { margin-top: 20px; display: flex; flex-direction: column; gap: 18px; max-width: 720px; }
.qt-pane .qt-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.qt-pane #qt-hint { font-size: 12.5px; }
.qt-field { display: flex; flex-direction: column; gap: 7px; }
.qt-search { position: relative; }
.qt-search input[type="search"] {
  width: 100%; max-width: 460px; padding: 11px 16px; border: 1px solid var(--line); border-radius: 999px;
  font-family: 'Barlow'; font-size: 14.5px; background: #fff; color: var(--ink);
}
.qt-search input[type="search"]:focus { outline: none; border-color: var(--ocra); box-shadow: 0 0 0 3px rgba(216,154,61,.18); }
.qt-results {
  position: absolute; z-index: 40; top: calc(100% + 6px); left: 0; width: 100%; max-width: 460px;
  background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
  box-shadow: 0 14px 40px rgba(59,51,35,.18); max-height: 320px; overflow-y: auto;
}
.qt-res {
  display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; width: 100%; text-align: left;
  padding: 10px 14px; border: 0; border-bottom: 1px solid var(--line); background: none;
  font-family: 'Barlow'; cursor: pointer;
}
.qt-res:last-child { border-bottom: 0; }
.qt-res:hover { background: var(--paper); }
.qt-res-name { grid-column: 1; grid-row: 1; font-size: 14.5px; font-weight: 600; color: var(--ink); }
.qt-res-sub { grid-column: 1; grid-row: 2; font-size: 12.5px; color: var(--ink-soft); }
/* senza grid-column esplicito lo sconto finiva in colonna 1, spingendo il nome a destra */
.qt-res-disc { grid-column: 2; grid-row: 1 / span 2; align-self: center; text-align: right;
  font-size: 14px; font-weight: 700; color: var(--brown); white-space: nowrap; }
.qt-res-empty { padding: 14px; font-size: 14px; color: var(--ink-soft); }
.qt-picked {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 12px 16px; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; max-width: 640px;
}
.qt-picked-name { font-size: 15.5px; font-weight: 700; }
.qt-picked-disc { font-size: 14px; color: var(--ink-soft); }
.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; }

/* ---------- tab carrello / storico ---------- */
.tabs { display: flex; gap: 8px; margin: 0 0 18px; }
.tab {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 20px; border-radius: 999px; text-decoration: none;
  background: var(--paper); color: var(--brown-2); font-weight: 600; font-size: 14px;
  border: 1.5px solid transparent;
  transition: background var(--t-fast) ease, color var(--t-fast) ease, transform var(--t-fast) var(--ease-spring);
}
.tab:hover { transform: translateY(-1px); border-color: var(--line); }
.tab.on { background: var(--brown); color: var(--cream); }
.tab .badge { background: var(--ocra); color: var(--brown); }
.tab.on .badge { background: var(--ocra); color: var(--brown); }

/* ---------- storico ---------- */
.hist-list { display: flex; flex-direction: column; gap: 12px; }
.hist-item {
  display: flex; align-items: center; gap: 16px; margin-bottom: 0; padding: 14px 16px;
  animation: cardIn .4s var(--ease-out) backwards;
  transition: opacity .3s ease, transform .3s var(--ease-out);
}
.hist-item.restoring { opacity: .55; transform: scale(.99); }
.hist-thumbs { display: flex; align-items: center; gap: 2px; width: 132px; flex-shrink: 0; }
.hist-thumbs img { width: 32px; max-height: 54px; object-fit: contain; }
.hist-thumbs .ph-mini {
  width: 40px; height: 54px; font-size: 15px; font-family: 'Barlow'; font-weight: 700;
}
.hist-body { flex: 1; min-width: 0; }
.hist-top { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; font-size: 12px; }
.chip-status {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 999px; letter-spacing: .2px;
}
.chip-status svg { width: 12px; height: 12px; }
.chip-status.st-sent { background: #dfe8d4; color: var(--ok); }
.chip-status.st-dl { background: var(--ocra-soft); color: #6d4c14; }
.hist-title { font-weight: 600; font-size: 15.5px; }
.hist-meta { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12.5px; color: var(--ink-soft); margin-top: 2px; }
.hist-actions { display: flex; flex-direction: column; gap: 7px; flex-shrink: 0; }
.btn-pill.sm { padding: 8px 16px; font-size: 13px; }
.btn-pill.sm:not(.dark) { background: var(--cream); }

/* ---------- 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;
}
/* le checkbox non devono ereditare width:100% (spingeva l'etichetta "attivo" a fondo riga) */
.grid-form input[type="checkbox"] {
  width: 17px; height: 17px; margin-top: 0; padding: 0; flex: 0 0 auto;
  accent-color: var(--brown); cursor: pointer;
}
.grid-form .chk { align-self: center; }
.grid-form .btn-pill { justify-self: start; }
.inline { display: inline; }
/* selettore sconto a pulsanti (scheda cliente + preventivo) */
.disc-field { display: flex; flex-direction: column; gap: 7px; }
.disc-lab { font-size: 12.5px; font-weight: 600; color: var(--ink); }
.disc-picker { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.disc-pill {
  appearance: none; border: 1.5px solid var(--line); background: #fff; color: var(--ink);
  font-family: 'Barlow'; font-size: 15px; font-weight: 600; padding: 9px 17px;
  border-radius: 999px; cursor: pointer; transition: all .12s; min-width: 62px;
}
.disc-pill:hover { border-color: var(--ocra); background: #fffdf8; }
.disc-pill.on { background: var(--brown); border-color: var(--brown); color: var(--cream); }
/* specificità alta: dentro .grid-form la regola generica `input{width:100%}` lo allargherebbe a tutta riga */
.disc-picker input.disc-other {
  width: 104px; margin-top: 0; padding: 8px 12px; border: 1.5px dashed var(--line); border-radius: 999px;
  font-family: 'Barlow'; font-size: 14px; background: #fff; color: var(--ink);
}
.disc-picker input.disc-other:focus { outline: none; border-style: solid; border-color: var(--ocra); }
/* clienti: barra di ricerca AJAX */
.cust-search { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.cust-search input[type="search"] {
  flex: 1 1 340px; max-width: 520px; padding: 10px 14px; border: 1px solid var(--line);
  border-radius: 999px; font-family: 'Barlow'; font-size: 14.5px; background: #fff; color: var(--ink);
}
.cust-search input[type="search"]:focus { outline: none; border-color: var(--ocra); box-shadow: 0 0 0 3px rgba(216, 154, 61, .18); }
.cust-search input::placeholder { color: var(--ink-soft); opacity: .7; }
#cust-table td.nowrap { white-space: nowrap; }
#cust-table .linklike { margin-right: 8px; }
/* admin: scontistica — righe-form vere (NON <form> dentro <tr>: l'HTML lo vieta e il parser
   riassocia tutti gli input al primo form, così "salva" su una riga salvava i dati di un'altra) */
#scontistica .sc-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; align-items: start; }
#scontistica .sc-head, #scontistica .sc-row {
  display: grid; grid-template-columns: 92px 1fr 54px 132px; gap: 10px; align-items: center;
}
#scontistica .sc-row-pm, #scontistica .sc-cols > div:last-child .sc-head {
  grid-template-columns: 1fr 92px 54px 132px;
}
#scontistica .sc-head { font-size: 11.5px; text-transform: uppercase; letter-spacing: .5px; color: var(--ink-soft);
  font-weight: 600; padding: 0 2px 7px; border-bottom: 2px solid var(--line); }
#scontistica .sc-row { padding: 7px 0; border-bottom: 1px solid var(--line); }
#scontistica .sc-row input[type="text"], #scontistica .sc-row input:not([type]) {
  width: 100%; padding: 8px 11px; border: 1px solid var(--line); border-radius: 10px;
  font-family: 'Barlow'; font-size: 14px; background: #fff; color: var(--ink);
}
#scontistica .sc-row input:not([type]):focus { outline: none; border-color: var(--ocra); box-shadow: 0 0 0 3px rgba(216,154,61,.18); }
#scontistica .sc-row input::placeholder { color: var(--ink-soft); opacity: .6; }
#scontistica .sc-chk { display: flex; align-items: center; justify-content: center; }
#scontistica .sc-chk input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--brown); cursor: pointer; margin: 0; }
#scontistica .sc-act { display: flex; gap: 12px; justify-content: flex-end; white-space: nowrap; }
#scontistica .sc-new { border-bottom: none; }
#scontistica .sc-new input { border-style: dashed; }
#scontistica textarea {
  width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px;
  font-family: 'Barlow'; font-size: 14px; background: #fff; color: var(--ink); resize: vertical;
}
#scontistica textarea:focus { outline: none; border-color: var(--ocra); box-shadow: 0 0 0 3px rgba(216,154,61,.18); }
#scontistica h3 { margin: 20px 0 10px; }
@media (max-width: 900px) { #scontistica .sc-cols { grid-template-columns: 1fr; } }
.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; }

/* ============================================================
   ANAGRAFICA
   ============================================================ */
.anag-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.anag-title { display: flex; align-items: baseline; gap: 12px; }
.anag-title h1 { font-size: 34px; margin: 0; }
.anag-bar { position: sticky; top: 58px; z-index: 30; background: var(--sandbg); padding: 10px 0 12px; display: flex; flex-direction: column; gap: 10px; }
.anag-bar #anag-q {
  width: 100%; border: 1.5px solid var(--line); border-radius: 999px; padding: 12px 20px;
  font-family: 'Barlow'; font-size: 15px; background: #fff; outline: none;
}
.anag-bar #anag-q:focus { border-color: var(--ocra); box-shadow: 0 0 0 4px rgba(216,154,61,.18); }

.anag-list { display: flex; flex-direction: column; gap: 9px; }
.anag-row {
  display: flex; align-items: center; gap: 15px; background: var(--paper);
  border-radius: 16px; padding: 11px 15px; cursor: pointer;
  transition: transform var(--t-fast) var(--ease-out), box-shadow var(--t-fast) var(--ease-out);
}
.anag-row:hover { transform: translateX(3px); box-shadow: 0 6px 18px rgba(59,51,35,.12); }
.a-photo { width: 46px; height: 62px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; position: relative; }
.a-photo img { max-width: 46px; max-height: 62px; object-fit: contain; }
.a-photo .ph-mini { width: 34px; height: 56px; font-size: 18px; }
.a-manual { position: absolute; top: -4px; right: -6px; background: var(--ok); color: #fff; width: 16px; height: 16px; border-radius: 50%; font-size: 9px; display: flex; align-items: center; justify-content: center; }
.a-main { flex: 1; min-width: 0; }
.a-brand { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--ink-soft); }
.a-edited { background: var(--ocra-soft); color: #6d4c14; padding: 1px 6px; border-radius: 999px; font-size: 9px; letter-spacing: .3px; }
.anag-row.off { opacity: .48; filter: grayscale(.6); }
.anag-row.off:hover { opacity: .75; }
.a-off { background: #c0392b; color: #fff; padding: 1px 6px; border-radius: 999px; font-size: 9px; letter-spacing: .3px; }
.pcard-price { margin-top: 5px; font-weight: 700; font-size: 12.5px; color: #b26a12; }
.vtable td.price { font-weight: 700; white-space: nowrap; color: #6d4c14; }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(224px, 1fr)); gap: 14px; margin: 8px 0; }
.tpl-card { border: 1px solid var(--line, #e4e4e8); border-radius: 14px; padding: 14px; background: #fff; display: flex; flex-direction: column; gap: 10px; }
.tpl-h { font-weight: 700; font-size: 15px; }
.dropzone { display: block; border: 2px dashed #d8cfb8; border-radius: 12px; padding: 16px 12px; text-align: center; cursor: pointer; transition: .15s; background: #faf8f2; }
.dropzone:hover { border-color: #d89a3d; background: #f7f0e0; }
.dropzone.over { border-color: #d89a3d; background: #f2e7cf; }
.dropzone.has { border-style: solid; border-color: #7aa05a; background: #f0f6ea; }
.dz-in { display: flex; flex-direction: column; align-items: center; gap: 3px; color: #9a8f76; }
.dz-in svg { color: #b8a888; }
.dz-t { font-weight: 600; font-size: 12.5px; color: #6d5f45; }
.dz-s { font-size: 11px; }
.dz-file { font-size: 11.5px; color: #1f9d45; font-weight: 600; word-break: break-all; }
/* .gen-cat usa .btn-pill.dark: niente colori riscritti a mano, così resta allineato agli altri
   pulsanti della stessa sezione ("Genera tutti") anche se cambiano i token del tema. */
.gen-cat { margin-top: auto; font-size: 13px; padding: 10px 12px; }
.a-name { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.a-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 3px; align-items: center; }
.a-cat { font-size: 10px; text-transform: uppercase; letter-spacing: .4px; color: #fff; padding: 2px 8px; border-radius: 999px; }
.a-cat.c-beer { background: var(--ocra); } .a-cat.c-wine { background: var(--bordeaux); }
.a-cat.c-spirits { background: var(--teal); } .a-cat.c-noalcohol { background: var(--taupe); } .a-cat.c-other { background: var(--brown-2); }
.a-tag { font-size: 11px; background: var(--cream); color: var(--brown-2); padding: 2px 8px; border-radius: 999px; }
.a-codes { font-size: 11px; color: var(--ink-soft); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.a-edit { flex-shrink: 0; border: 1.5px solid var(--line); background: #fff; border-radius: 999px; padding: 7px 15px; font-family: 'Barlow'; font-weight: 600; font-size: 13px; cursor: pointer; color: var(--brown); }

/* riga anagrafica: Modifica + attiva/disattiva */
.a-actions { flex-shrink: 0; display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.a-toggle { border: 1.5px solid #d9b3ad; background: #fff; color: #a6382a; border-radius: 999px;
  padding: 5px 15px; font-family: 'Barlow'; font-weight: 600; font-size: 12px; cursor: pointer; }
.a-toggle:hover { background: #fdf1ef; }
.a-toggle.is-off { border-color: #b3d3b6; color: #2f6b32; }
.a-toggle.is-off:hover { background: #f0f7f0; }
.a-toggle:disabled { opacity: .6; cursor: default; }
@media (max-width: 560px) { .a-actions { flex-direction: row; } }

/* pallini e asterischi della disponibilità (legenda catalogo birre) */
.disp-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; vertical-align: baseline; }
.disp-ast { margin-right: 5px; font-weight: 700; }

/* scheda prodotto: disponibilità / testata fusto / vuoto, subito sotto la tabella dei formati */
.pd-extra { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 10px; font-size: 13px; color: #5c5341; }
.pd-x { display: inline-flex; align-items: center; gap: 2px; }
.pd-x b { font-weight: 600; color: var(--brown); margin-right: 3px; }

/* drawer editing */
.drawer-back { position: fixed; inset: 0; background: rgba(40,33,20,.55); z-index: 100; display: flex; justify-content: flex-end; animation: fadeIn var(--t-med) ease backwards; }
.drawer { background: var(--sandbg); width: 640px; max-width: 96vw; height: 100%; overflow: auto; padding: 26px; position: relative; animation: drawerSlide .34s var(--ease-out) backwards; }
@keyframes drawerSlide { from { transform: translateX(40px); opacity: 0; } }
.ed-cols { display: grid; grid-template-columns: 160px 1fr; gap: 22px; margin-top: 8px; }
.ed-photo-col { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.ed-photo { position: relative; width: 150px; height: 200px; background: var(--paper); border-radius: 14px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.ed-photo[data-zoom] { cursor: zoom-in; }
.ed-photo img { max-width: 140px; max-height: 190px; object-fit: contain; }
.ed-photo .bj-zoomic { position: absolute; right: 5px; bottom: 5px; width: 22px; height: 22px; border-radius: 7px; background: rgba(59, 51, 35, .78); color: #fff; font-size: 13px; line-height: 22px; text-align: center; opacity: 0; transition: opacity .15s; pointer-events: none; }
.ed-photo:hover .bj-zoomic { opacity: 1; }
.ed-shoot { cursor: pointer; text-align: center; }
.ed-msg { font-size: 12px; text-align: center; color: var(--ink-soft); min-height: 16px; }
/* slot foto (fronte/retro/pack) + annata */
.ed-slot { display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 10px 0; border-top: 1px dashed var(--line); width: 100%; }
.ed-slot:first-of-type { border-top: 0; }
.ed-slot-l { font-size: 10.5px; text-transform: uppercase; letter-spacing: .5px; color: var(--ink-soft); font-weight: 700; }
.ed-slot-year { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center; }
.ed-slot-year .ed-year-in { width: 62px; border: 1.5px solid var(--line); border-radius: 8px; padding: 4px 7px; font-family: 'Barlow'; font-size: 12px; text-align: center; }
.ed-slot-year .ed-year-in:focus { outline: none; border-color: var(--ocra); }
.ed-slot-year .chk.sm { font-size: 11px; }
.ed-slot-year .ed-year-apply { font-weight: 700; color: var(--brown); }
.ed-still-chk { margin-bottom: 2px; }
.ed-year { width: 100%; text-align: left; margin: 4px 0 2px; }
.ed-year-row { display: flex; align-items: center; gap: 14px; margin-top: 3px; }
.ed-hint { display: block; font-size: 10px; color: var(--ink-soft); margin-top: 4px; line-height: 1.3; }
/* galleria scheda prodotto (fronte + retro + pack) */
.pd-media { display: flex; flex-direction: column; gap: 12px; align-items: center; }
.pd-thumbs { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.pd-thumb { position: relative; width: 70px; cursor: zoom-in; text-align: center; }
.pd-thumb img { width: 70px; height: 78px; object-fit: contain; background: var(--paper); border-radius: 9px; }
.pd-thumb > span:not(.bj-zoomic) { display: block; font-size: 9.5px; color: var(--ink-soft); margin-top: 2px; text-transform: uppercase; letter-spacing: .3px; }
.pd-thumb .bj-zoomic { position: absolute; right: 3px; top: 3px; width: 16px; height: 16px; border-radius: 5px; background: rgba(59,51,35,.75); color: #fff; font-size: 10px; line-height: 16px; text-align: center; }
/* riepilogo upload massivo */
.bulk-summary { background: var(--paper); border-radius: 12px; padding: 11px 15px; font-size: 13px; color: var(--brown); margin: 4px 0 14px; }
.bulk-summary .s-ok { color: var(--ok); font-weight: 700; }
.bulk-summary .s-exact { color: #2f6b32; font-weight: 700; }
.bulk-summary .s-no { color: var(--err); }
.ed-fields { display: flex; flex-direction: column; }
.ed-l { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--ink-soft); margin: 12px 0 5px; }
.ed-in { border: 1.5px solid var(--line); border-radius: 11px; padding: 9px 12px; font-family: 'Barlow'; font-size: 14.5px; background: #fff; outline: none; width: 100%; box-sizing: border-box; }
.ed-in:focus { border-color: var(--ocra); box-shadow: 0 0 0 3px rgba(216,154,61,.16); }
.ed-two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ed-vars { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-top: 4px; }
.ed-vars th { text-align: left; font-size: 10px; text-transform: uppercase; color: var(--paper); background: var(--brown); padding: 4px 8px; }
.ed-vars td { padding: 5px 8px; border-bottom: 1px solid var(--line); }
.ed-save { margin-top: 20px; display: flex; align-items: center; gap: 14px; }
.ed-save #ed-msg { color: var(--ok); font-weight: 600; }

/* ============================================================
   UPLOAD MASSIVO
   ============================================================ */
.dropzone { display: block; border: 2.5px dashed var(--line); border-radius: 22px; padding: 46px 24px; text-align: center; cursor: pointer; background: var(--paper); transition: border-color var(--t-fast) ease, background var(--t-fast) ease; }
.dropzone:hover, .dropzone.over { border-color: var(--ocra); background: #fbf7ee; }
.dz-inner { display: flex; flex-direction: column; align-items: center; gap: 7px; color: var(--ink-soft); }
.dz-inner svg { width: 40px; height: 40px; color: var(--ocra); margin-bottom: 4px; }
.dz-inner strong { font-size: 18px; color: var(--brown); }
.bulk-progress { margin: 18px 0; }
.bp-bar { height: 8px; background: var(--cream); border-radius: 999px; overflow: hidden; }
.bp-bar span { display: block; height: 100%; width: 0; background: var(--ocra); border-radius: 999px; transition: width .4s var(--ease-out); }
#bp-text { display: block; margin-top: 7px; font-size: 13px; color: var(--ink-soft); }
.bulk-actions { display: flex; align-items: center; gap: 18px; margin: 8px 0 16px; flex-wrap: wrap; }
.bulk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.bj { background: var(--paper); border-radius: 16px; padding: 12px; display: flex; flex-direction: column; gap: 10px; animation: cardIn .4s var(--ease-out) backwards; }
.bj.is-done { opacity: .7; }
.bj-photo { position: relative; width: 74px; height: 92px; flex-shrink: 0; background: #fff; border-radius: 10px; display: flex; align-items: center; justify-content: center; overflow: hidden; cursor: zoom-in; }
.bj-photo img { max-width: 74px; max-height: 92px; object-fit: contain; }
/* foto raggruppate per articolo (fronte/retro/pack) */
.bj-faces { display: flex; gap: 8px; flex-wrap: wrap; }
.bj-face { position: relative; width: 74px; height: 92px; flex: none; background: #fff; border-radius: 10px; overflow: hidden; cursor: zoom-in; }
.bj-face img { width: 100%; height: 100%; object-fit: contain; }
.bj-face.done { outline: 2px solid var(--ok); outline-offset: -2px; }
.bj-facelbl { position: absolute; bottom: 0; left: 0; right: 0; background: rgba(59, 51, 35, .74); color: #fff; font-size: 9px; text-align: center; padding: 1.5px 0; letter-spacing: .2px; }
.bj-face .bj-zoomic { position: absolute; right: 3px; top: 3px; width: 16px; height: 16px; border-radius: 5px; background: rgba(59, 51, 35, .7); color: #fff; font-size: 10px; line-height: 16px; text-align: center; opacity: 0; transition: opacity .15s; }
.bj-face:hover .bj-zoomic { opacity: 1; }
.bj-year { display: flex; align-items: center; gap: 12px; margin-top: 8px; flex-basis: 100%; }
.bj-year-in { width: 82px; border: 1.5px solid var(--line); border-radius: 8px; padding: 5px 9px; font-family: 'Barlow'; font-size: 12.5px; }
.bj-year-in:focus { outline: none; border-color: var(--ocra); }
.chk.sm { font-size: 11.5px; }
.bj-zoomic { position: absolute; right: 3px; bottom: 3px; width: 18px; height: 18px; border-radius: 6px; background: rgba(59, 51, 35, .78); color: #fff; font-size: 11px; line-height: 18px; text-align: center; opacity: 0; transition: opacity .15s; pointer-events: none; }
.bj-photo:hover .bj-zoomic { opacity: 1; }
.bj-body { flex: 1; min-width: 0; }
.bj-label { font-size: 11px; color: var(--ink-soft); margin-bottom: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bj-prod { line-height: 1.2; }
.bj-brand { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: .4px; color: var(--ink-soft); }
.bj-name { display: block; font-weight: 600; font-size: 14px; }
.bj-prod.bj-none { color: var(--err); font-size: 13px; font-weight: 600; }
.bj-conf { display: inline-block; background: var(--ocra-soft); color: #6d4c14; font-size: 10px; font-weight: 700; padding: 1px 7px; border-radius: 999px; margin-top: 3px; }
.bj-code { display: inline-block; background: #e7f0e4; color: #2f6b32; font-size: 10px; font-weight: 700; padding: 1px 7px; border-radius: 999px; margin: 3px 0 0 5px; }
/* formati/codici a catalogo dell'articolo abbinato: si leggono a colpo d'occhio prima di confermare */
.bj-info { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.bj-meta { font-size: 10.5px; color: var(--muted); font-style: italic; align-self: center; }
.bj-fmt { display: inline-block; background: #f2ede2; color: #6b5c40; border: 1px solid #e3d9c6; font-size: 10px; font-weight: 600; padding: 1px 6px; border-radius: 4px; }
.bj-res-txt { display: block; }
.bj-res .bj-info { margin-top: 2px; }
.bj-res .bj-fmt { font-size: 9.5px; padding: 0 5px; }
.bj-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; }
.bj-applied { color: var(--ok); font-weight: 700; font-size: 13px; margin-top: 8px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.bj-applied .retry { color: var(--brown); font-weight: 600; }
/* stato "in elaborazione AI" durante lo still-life (~10s) */
.bj-processing { position: relative; }
.bj-processing::after {
  content: attr(data-msg); position: absolute; inset: 0; z-index: 2;
  background: rgba(247, 243, 234, .9); border-radius: 16px;
  display: flex; align-items: center; justify-content: center; text-align: center;
  padding: 0 14px; font-size: 12.5px; font-weight: 600; color: var(--brown);
  animation: pulseMsg 1.2s ease-in-out infinite;
}
@keyframes pulseMsg { 0%, 100% { opacity: .72; } 50% { opacity: 1; } }
.bj-search { flex-basis: 100%; margin-top: 6px; }
.bj-search input { width: 100%; border: 1.5px solid var(--line); border-radius: 10px; padding: 7px 11px; font-family: 'Barlow'; font-size: 13px; box-sizing: border-box; }
.bj-results { max-height: 160px; overflow: auto; margin-top: 4px; }
.bj-res { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; border: 0; background: none; font-family: inherit; color: var(--brown); padding: 6px 9px; font-size: 12.5px; border-radius: 8px; cursor: pointer; }
.bj-res:hover { background: var(--cream); }
/* alternative: classifica dei prodotti più vicini, cliccabili */
.bj-alts { flex-basis: 100%; margin-top: 8px; border-top: 1px dashed var(--line); padding-top: 8px; }
.bj-alts-t { font-size: 11px; color: var(--ink-soft); margin-bottom: 4px; }
.bj-rank { flex: none; width: 18px; height: 18px; border-radius: 50%; background: var(--brown); color: var(--cream); font-size: 10.5px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
/* lightbox: ingrandimento foto scontornata — sfondo PANNA come le card del catalogo
   (così si vede il prodotto com'è nell'app, non la scacchiera della trasparenza) */
#lightbox { position: fixed; inset: 0; z-index: 9999; display: none; align-items: center; justify-content: center; padding: 24px; background: rgba(30, 26, 18, .82); backdrop-filter: blur(3px); cursor: zoom-out; animation: lbIn .18s ease-out; }
#lightbox.on { display: flex; }
#lightbox img {
  max-width: min(92vw, 640px); max-height: 88vh; object-fit: contain; border-radius: 14px;
  background: var(--paper);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .5);
}
.lb-close { position: absolute; top: 18px; right: 20px; width: 42px; height: 42px; border-radius: 50%; border: none; background: rgba(255, 255, 255, .16); color: #fff; font-size: 20px; cursor: pointer; transition: background .15s; }
.lb-close:hover { background: rgba(255, 255, 255, .3); }
/* scarica il PNG (trasparente) dell'immagine ingrandita */
.lb-dl {
  position: absolute; bottom: 26px; left: 50%; transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  padding: 11px 22px; border-radius: 999px; border: none;
  background: var(--cream); color: var(--ink); font-family: 'Barlow'; font-size: 14.5px; font-weight: 600;
  text-decoration: none; box-shadow: 0 6px 22px rgba(0, 0, 0, .35); transition: transform .12s, background .15s;
}
.lb-dl:hover { background: #fff; transform: translateX(-50%) translateY(-2px); }
@keyframes lbIn { from { opacity: 0; } to { opacity: 1; } }

@media (max-width: 700px) {
  .ed-cols { grid-template-columns: 1fr; }
  .ed-photo-col { flex-direction: row; flex-wrap: wrap; justify-content: flex-start; }
  .drawer { padding: 20px 16px; }
  .anag-bar { top: 52px; }
}

/* ============================================================
   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 a cascata ---------- */
.login-inner { animation: pageIn .6s var(--ease-out) backwards; }
.login-logo { animation: pageIn .5s var(--ease-out) backwards; animation-delay: 60ms; }
.hello, .login-sub { animation: pageIn .5s var(--ease-out) backwards; animation-delay: 130ms; }
.login-form .field { animation: pageIn .5s var(--ease-out) backwards; }
.login-form .field:nth-of-type(1) { animation-delay: 200ms; }
.login-form .field:nth-of-type(2) { animation-delay: 270ms; }
.login-btn { animation: pageIn .5s var(--ease-out) backwards; animation-delay: 340ms; }

/* ---------- 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; }
  /* bottombar con 5 voci (admin): un filo più compatta */
  .bottombar { padding-left: 2px; padding-right: 2px; }
  .bb-item { font-size: 9.5px; padding: 7px 0 4px; gap: 2px; }
  .bb-item svg { width: 21px; height: 21px; }

  /* anagrafica / upload su mobile */
  .anag-head { gap: 10px; }
  .anag-head h1, .anag-title h1 { font-size: 26px; }
  .anag-head .btn-pill { width: 100%; text-align: center; }
  .anag-row { gap: 11px; padding: 10px 12px; }
  .a-edit { padding: 6px 12px; font-size: 12px; }
  .bulk-grid { grid-template-columns: 1fr; }
  .dropzone { padding: 34px 16px; }

  /* 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; }
  .hist-item { flex-wrap: wrap; gap: 12px; }
  .hist-thumbs { width: auto; }
  .hist-body { flex: 1 1 55%; }
  .hist-actions { flex-direction: row; width: 100%; }
  .hist-actions .btn-pill { flex: 1; text-align: center; }
  .pd { grid-template-columns: minmax(0, 1fr); }
  .pd .pd-photo img { max-height: 200px; }
  .cat-hero h1 { font-size: 27px; }
}
/* Telefoni: scheda prodotto a schermo pieno, contenuto che sta tutto in larghezza (niente scroll orizzontale) */
@media (max-width: 560px) {
  .modal-back { padding: 0; align-items: stretch; }
  .modal { max-width: 100%; width: 100%; max-height: 100vh; min-height: 100vh; border-radius: 0; padding: 16px 14px 26px; }
  .modal.small { max-width: 100%; }
  .pd h2 { font-size: 22px; line-height: 1.2; }
  .pd .attrs { gap: 16px; }
  .vtable { font-size: 12px; }
  .vtable th, .vtable td { padding: 6px 7px; }
}
.pdf-result .pdf-split { list-style: none; margin: 8px 0 0; padding: 0; }
.pdf-result .pdf-split li { margin: 4px 0; }
.pdf-result .pdf-split a { font-weight: 600; }
.hist-meta .hist-by { background: #efe7d8; color: #6b5d3f; font-weight: 600; padding: 1px 8px; border-radius: 999px; font-size: 12px; }

/* coda di elaborazione foto: le conferme non bloccano più la pagina */
.queue-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 12px 0 4px; padding: 11px 16px; border-radius: 14px;
  background: #fdf6e6; border: 1px solid var(--ocra-soft); font-size: 14px; color: var(--ink);
}
.queue-bar .q-err { color: var(--err); font-weight: 600; }
.q-spin {
  width: 15px; height: 15px; border-radius: 50%; flex: 0 0 auto;
  border: 2.5px solid var(--ocra-soft); border-top-color: var(--ocra); animation: qspin .8s linear infinite;
}
@keyframes qspin { to { transform: rotate(360deg); } }
.bj.bj-queued { opacity: .82; outline: 2px dashed var(--ocra-soft); outline-offset: -2px; }
.bj.bj-queued::after {
  content: attr(data-msg); position: absolute; top: 8px; right: 10px; z-index: 3;
  background: var(--ocra); color: #fff; font-size: 11.5px; font-weight: 700;
  padding: 3px 10px; border-radius: 999px;
}

/* barra "lavori recenti": rientrando nella pagina si ritrova il lavoro lasciato a metà */
.jobs-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 14px 0 4px; }
.jobs-bar .jb-lab { font-size: 11.5px; text-transform: uppercase; letter-spacing: .5px; color: var(--ink-soft); font-weight: 700; }
.jb-item {
  display: flex; flex-direction: column; gap: 1px; text-align: left; cursor: pointer;
  padding: 8px 14px; border-radius: 12px; border: 1px solid var(--line); background: #fff; font-family: 'Barlow';
}
.jb-item:hover { border-color: var(--ocra); }
.jb-item.on { background: var(--brown); border-color: var(--brown); }
.jb-item.on .jb-when, .jb-item.on .jb-n, .jb-item.on .jb-st { color: var(--cream); }
.jb-item.open:not(.on) { border-color: var(--ocra); background: #fdf6e6; }
.jb-when { font-size: 11px; color: var(--ink-soft); }
.jb-n { font-size: 14px; font-weight: 700; color: var(--ink); }
.jb-st { font-size: 11.5px; color: var(--ink-soft); }

/* stato della singola faccia nella griglia foto */
.bj-face.queued { opacity: .7; }
.bj-facest {
  position: absolute; top: 6px; left: 6px; z-index: 2;
  background: var(--ocra); color: #fff; font-size: 10.5px; font-weight: 700;
  padding: 2px 8px; border-radius: 999px;
}
.bj-facest.err { background: var(--err); }

/* collegamento del cliente alla selezione (vale anche per il PDF di presentazione) */
.lm-cust { display: flex; flex-direction: column; gap: 7px; margin-top: 14px; }
.lm-cust .qt-search input[type="search"] { max-width: 420px; }
.lm-cust .qt-results { max-width: 420px; }

/* upload massivo: foto originale accanto al risultato elaborato */
.bj-pair { display: flex; align-items: center; gap: 5px; }
.bj-pair .bj-arrow { color: var(--ink-soft); font-size: 15px; flex: none; }
.bj-pair .bj-face.orig { width: 62px; height: 78px; opacity: .92; }
.bj-pair .bj-face.orig .bj-facelbl { font-size: 9px; }

/* AI non disponibile: avviso FISSO in cima alla griglia. Le foto restano caricate, si riprende da qui. */
.ai-down { display: flex; align-items: center; gap: 12px; margin: 10px 0 14px;
  padding: 12px 14px; border-radius: 10px; background: #fdf3e3; border: 1px solid #e8c98d; }
.ai-down-ico { font-size: 22px; line-height: 1; }
.ai-down-txt { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.ai-down-txt strong { color: #8a5a12; font-size: 14px; }
.ai-down-sub { color: #7a6a52; font-size: 12.5px; }
.ai-down .btn-pill { flex: 0 0 auto; }
@media (max-width: 560px) { .ai-down { flex-wrap: wrap; } .ai-down .btn-pill { width: 100%; } }

/* Backup database in Admin: pulsanti, esito e elenco degli archivi */
.bk-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.bk-msg { font-size: 13px; color: var(--muted); }
.bk-msg.ok { color: #2f6b32; font-weight: 600; }
.bk-msg.ko { color: var(--err); font-weight: 600; }
.bk-list { display: flex; flex-direction: column; gap: 3px; max-height: 260px; overflow-y: auto;
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fbf9f5; }
.bk-row { display: flex; justify-content: space-between; gap: 12px; font-size: 12.5px; padding: 2px 0; }
.bk-nome { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: #4a4132; }
@media (max-width: 560px) { .bk-row { flex-direction: column; gap: 0; } }

/* Admin a schede: barra in alto, un pannello visibile alla volta */
.admin-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 2px 0 18px; }
.admin-tabs button { border: 1.5px solid var(--line, #e4e4e8); background: #fff; color: var(--brown);
  border-radius: 999px; padding: 9px 18px; font-family: 'Barlow'; font-weight: 600; font-size: 14px;
  cursor: pointer; transition: .15s; }
.admin-tabs button:hover { border-color: var(--ocra); }
.admin-tabs button.on { background: var(--brown); border-color: var(--brown); color: var(--cream); }
.admin-tab { display: none; }
.admin-tab.on { display: block; animation: fadeIn .18s ease; }

/* Colonne premio del cliente (OBY…): righe nome + % nel form Clienti */
.bonus-rows { display: flex; flex-direction: column; gap: 6px; margin: 6px 0 8px; }
.bonus-row { display: flex; gap: 8px; align-items: center; }
.bonus-row input[name="bonus_label[]"] { flex: 1 1 auto; min-width: 0; }
.bonus-row input[name="bonus_pct[]"] { width: 90px; flex: 0 0 auto; }

/* Cataloghi PDF scaricabili in Admin: stato per categoria + azioni */
.cat-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.cat-card-pdf { justify-content: space-between; }
.cat-state { font-size: 12.5px; line-height: 1.5; }
.cat-warn { color: #b26a12; font-weight: 600; }
.cat-btns { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.cat-btns .gen-cat { flex: 1 1 100%; }
.cat-btns .cat-dl { text-decoration: none; }
