:root {
  --verde: #1f6f43; --verde-chiaro: #e4f2e9; --testo: #1c2420; --muto: #5c6b63;
  --bordo: #d9dfda; --sfondo: #f6f7f4; --rosso: #b3261e; --ambra: #8a5a00; --ambra-chiaro: #fdf1d8;
}
* { box-sizing: border-box; }
html { scroll-padding-top: 230px; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--sfondo); color: var(--testo); font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
#top { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; background: var(--verde); color: #fff; }
#top .link { color: #fff; }
main { max-width: 720px; margin: 0 auto; padding: 16px 16px 110px; }
h1 { font-size: 1.35rem; margin: 8px 0 4px; }
h2 { font-size: 1.05rem; margin: 0 0 4px; overflow-wrap: anywhere; }
p { margin: 4px 0 12px; }
.muted { color: var(--muto); font-size: .92rem; }
button, .btn { min-height: 48px; padding: 10px 16px; border-radius: 10px; border: 1px solid var(--bordo); background: #fff; color: var(--testo); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
button.primary, .btn.primary { background: var(--verde); border-color: var(--verde); color: #fff; }
button.link { min-height: 40px; border: 0; background: none; text-decoration: underline; font-weight: 500; padding: 4px; }
button:disabled { opacity: .55; cursor: default; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, a:focus-visible { outline: 3px solid #0b57d0; outline-offset: 2px; }
label { display: block; margin: 12px 0 4px; font-weight: 600; }
input, textarea, select { width: 100%; min-height: 48px; padding: 10px 12px; border: 1px solid #aeb8b1; border-radius: 10px; background: #fff; font: inherit; color: inherit; }
textarea { min-height: 130px; }
.card { background: #fff; border: 1px solid var(--bordo); border-radius: 14px; padding: 12px; margin: 12px 0; }
.product { display: grid; grid-template-columns: 72px 1fr; gap: 12px; }
.product img, .noimg { width: 72px; height: 72px; object-fit: cover; border-radius: 10px; background: var(--verde-chiaro); }
.choices { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.choices button { min-height: 52px; padding: 6px 4px; font-size: .84rem; line-height: 1.15; }
.choices button[aria-pressed="true"] { background: var(--verde); border-color: var(--verde); color: #fff; }
.choices button.no[aria-pressed="true"] { background: var(--rosso); border-color: var(--rosso); }
.choices button.pausa[aria-pressed="true"] { background: var(--ambra); border-color: var(--ambra); }
.row { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; align-items: center; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; background: var(--ambra-chiaro); color: var(--ambra); font-size: .8rem; font-weight: 600; }
.badge.ok { background: var(--verde-chiaro); color: var(--verde); }
.progress { height: 10px; border-radius: 9px; background: #e3e7e3; overflow: hidden; }
.progress div { height: 100%; background: var(--verde); }
.fab { position: fixed; left: 16px; right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); z-index: 4; max-width: 688px; margin: 0 auto; }
.fab button { width: 100%; min-height: 56px; font-size: 1.05rem; box-shadow: 0 4px 14px rgba(0,0,0,.25); }
.warn { padding: 10px 12px; border-radius: 10px; background: var(--ambra-chiaro); color: #5f3e00; font-size: .93rem; }
.search { position: sticky; top: 56px; z-index: 3; margin: 12px -16px 0; padding: 4px 16px 10px; background: var(--sfondo); border-bottom: 1px solid var(--bordo); }
.search label { margin-top: 4px; }
.filters { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 8px; }
.filters button { min-height: 44px; padding: 6px 4px; font-size: .85rem; }
.filters button[aria-pressed="true"] { background: var(--verde); border-color: var(--verde); color: #fff; }
.qty { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 4px 8px; justify-content: space-between; align-items: center; padding: 8px 10px; border-radius: 10px; background: var(--verde-chiaro); font-size: .92rem; }
form.qty { display: block; }
form.qty label { margin: 0 0 2px; }
form.qty p { margin: 0 0 8px; }
.qty-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.thumbs img { width: 92px; height: 92px; object-fit: cover; border-radius: 10px; }
.thumb { display: grid; justify-items: center; }
.photo-btn { display: block; min-height: 0; padding: 0; border: 0; background: none; border-radius: 10px; cursor: zoom-in; }
.product .photo-btn { width: 72px; height: 72px; }
.product .photo-btn img { object-fit: contain; background: #fff; border: 1px solid var(--bordo); }
.showcase-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin: 8px 0; }
.showcase-opt { display: grid; gap: 6px; }
.showcase .photo-btn img { width: 100%; height: 170px; object-fit: contain; background: #fff; border: 1px solid var(--bordo); border-radius: 10px; }
.showcase-opt > button[aria-pressed="true"] { background: var(--verde); border-color: var(--verde); color: #fff; }
.viewer { position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: #000; overflow: auto; }
.viewer::backdrop { background: #000; }
.viewer img { display: block; width: 100%; height: auto; max-width: 900px; margin: 0 auto 8px; }
.viewer-close { position: sticky; top: 8px; z-index: 1; display: flex; margin: 8px 8px 8px auto; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.actions > * { flex: 1 1 140px; }
fieldset { border: 0; padding: 0; margin: 12px 0 0; }
legend { font-weight: 600; padding: 0; }
.radio { display: flex; align-items: center; gap: 10px; margin: 6px 0; font-weight: 500; min-height: 44px; }
.radio input { width: 22px; min-height: 22px; }
#toast { position: fixed; left: 16px; right: 16px; bottom: 84px; z-index: 30; max-width: 560px; margin: 0 auto; padding: 12px 14px; border-radius: 10px; background: #1c2420; color: #fff; text-align: center; }

#camera { position: fixed; inset: 0; z-index: 20; background: #000; overflow: hidden; }
#video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
#frame { position: absolute; top: 8%; left: 9%; right: 9%; bottom: 205px; border: 5px solid #fff; border-radius: 18px; box-shadow: 0 0 0 100vmax rgba(0,0,0,.38); transition: border-color .15s; }
#frame.good { border-color: #24d366; box-shadow: 0 0 0 100vmax rgba(0,0,0,.25), 0 0 22px #24d366; }
#hint { position: absolute; left: 16px; right: 16px; bottom: 150px; margin: 0; padding: 8px 12px; text-align: center; color: #fff; font-weight: 600; background: rgba(0,0,0,.6); border-radius: 10px; }
#hint.good { background: #137a3b; }
.cam-bar { position: absolute; left: 0; right: 0; bottom: max(24px, env(safe-area-inset-bottom)); display: flex; justify-content: space-around; align-items: center; }
.round { width: 52px; min-height: 52px; height: 52px; padding: 0; border-radius: 50%; background: rgba(255,255,255,.2); border: 0; color: #fff; font-size: 1.2rem; }
.round.placeholder { visibility: hidden; }
#shoot { width: 84px; height: 84px; min-height: 84px; padding: 0; border-radius: 50%; background: #fff; border: 5px solid #bbb; color: #111; font-size: .85rem; }
#shoot.good { border-color: #24d366; background: #d9fbe6; }
@media (prefers-reduced-motion: reduce) { #frame { transition: none; } }
