/* ---------- Font locali (nessuna richiesta esterna) ---------- */
@font-face {
    font-family: "Fraunces";
    font-style: normal;
    font-weight: 500 700;
    font-display: swap;
    src: url("fonts/fraunces.woff2") format("woff2");
}
@font-face {
    font-family: "Fraunces";
    font-style: italic;
    font-weight: 500 700;
    font-display: swap;
    src: url("fonts/fraunces-italic.woff2") format("woff2");
}
@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url("fonts/inter.woff2") format("woff2");
}

/* ==========================================================================
   Carne di selvaggina — stile
   Palette: crema caldo + verde bosco + rame. Font: Fraunces (titoli) / Inter.
   ========================================================================== */

:root {
    --bg: #f5efe4;
    --bg-deep: #ece3d3;
    --paper: #fffdf9;
    --ink: #1c1a16;
    --ink-soft: #4a463f;
    --muted: #7d766b;
    --line: #e4dbcb;
    --forest: #1b2f23;
    --forest-2: #29473a;
    --moss: #5f8a6b;
    --moss-soft: #e7efe8;
    --copper: #b4572c;
    --copper-dark: #93441f;
    --copper-soft: #f7e6dc;
    --danger: #a43a2a;
    --danger-soft: #fbeae6;
    --radius: 18px;
    --radius-sm: 12px;
    --shadow: 0 1px 2px rgba(28,26,22,.05), 0 12px 32px -12px rgba(28,26,22,.18);
    --font-display: "Fraunces", Georgia, "Times New Roman", serif;
    --font-body: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--font-display); font-weight: 700; letter-spacing: -.01em; margin: 0; }
p { margin: 0; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--forest-2); }

/* ---------- Hero ---------- */
.hero {
    background:
        radial-gradient(900px 380px at 15% -10%, rgba(95,138,107,.35), transparent 60%),
        radial-gradient(700px 320px at 95% 110%, rgba(180,87,44,.30), transparent 60%),
        var(--forest);
    color: #f4efe6;
    position: relative;
    overflow: hidden;
}
.hero::after {
    /* grana leggera */
    content: "";
    position: absolute; inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.06'/%3E%3C/svg%3E");
    pointer-events: none;
}
.hero-inner {
    position: relative;
    width: min(1080px, calc(100% - 40px));
    margin: 0 auto;
    padding: 64px 0 56px;
}
.eyebrow {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: #d9c9a8;
    border: 1px solid rgba(217,201,168,.35);
    border-radius: 999px;
    padding: 7px 14px;
}
.hero h1 {
    font-size: clamp(44px, 8vw, 92px);
    line-height: .95;
    margin: 0 0 18px;
    color: #fbf7ef;
}
.hero h1 em { font-style: italic; font-weight: 500; color: #e6c98f; }
.lead { font-size: clamp(16px, 2vw, 19px); color: rgba(244,239,230,.8); max-width: 44ch; }
.pills {
    list-style: none;
    padding: 0;
    margin: 28px 0 0;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.pills li {
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.14);
    backdrop-filter: blur(6px);
    border-radius: 999px;
    padding: 9px 16px;
    font-size: 14px;
    color: rgba(244,239,230,.85);
}
.pills b { color: #fff; font-weight: 700; margin-right: 6px; }

/* ---------- Layout ---------- */
.page {
    width: min(1080px, calc(100% - 40px));
    margin: -28px auto 0;
    position: relative;
}
.layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 28px;
    align-items: start;
}
.col-side { position: sticky; top: 20px; }

/* ---------- Blocchi ---------- */
.block {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 28px;
    margin-bottom: 22px;
}
.block-head {
    display: flex;
    gap: 16px;
    align-items: center;
    margin-bottom: 22px;
}
.block-head h2 { font-size: 26px; }
.block-head p { color: var(--muted); font-size: 14px; }
.step {
    flex-shrink: 0;
    width: 40px; height: 40px;
    display: grid; place-items: center;
    border-radius: 50%;
    background: var(--forest);
    color: #f3e7cf;
    font-family: var(--font-display);
    font-size: 19px;
    font-weight: 700;
}

/* ---------- Prodotti ---------- */
.products {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}
.product {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 18px;
    padding: 18px 18px 16px;
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    background: #fff;
    transition: border-color .18s, box-shadow .18s, background .18s;
}
.product:hover { border-color: #cdbfa6; }
.product.is-selected {
    border-color: var(--moss);
    background: linear-gradient(180deg, #f6faf6, #fff 60%);
    box-shadow: 0 0 0 4px rgba(95,138,107,.14);
}
.product h3 { font-size: 21px; margin-bottom: 4px; }
.product .pack { color: var(--ink-soft); font-size: 14px; }
.product .unit { color: var(--muted); font-size: 12.5px; margin-top: 6px; }

.stepper {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    border: 1.5px solid var(--line);
    border-radius: 999px;
    background: var(--bg);
    padding: 3px;
}
.product.is-selected .stepper { border-color: var(--moss); background: var(--moss-soft); }
.stepper button {
    width: 38px; height: 38px;
    border: 0;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0,0,0,.08);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    color: var(--forest);
    transition: background .15s, transform .1s;
}
.stepper button:hover { background: var(--forest); color: #fff; }
.stepper button:active { transform: scale(.94); }
.stepper input {
    width: 52px;
    border: 0;
    background: transparent;
    text-align: center;
    font-weight: 700;
    font-size: 18px;
    -moz-appearance: textfield;
}
.stepper input::-webkit-outer-spin-button,
.stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper input:focus { outline: none; }

/* ---------- Avvisi ---------- */
.notice {
    display: flex;
    gap: 14px;
    margin-top: 20px;
    padding: 16px 18px;
    border-radius: var(--radius-sm);
    background: var(--copper-soft);
    border-left: 4px solid var(--copper);
}
.notice svg { width: 22px; height: 22px; flex-shrink: 0; fill: var(--copper); margin-top: 2px; }
.notice strong { display: block; margin-bottom: 4px; }
.notice p { font-size: 14.5px; color: var(--ink-soft); }
.notice.frozen { background: #e8eef4; border-left-color: #5b7fa3; margin-top: 0; margin-bottom: 22px; }
.notice.frozen svg { fill: #5b7fa3; }

.alert {
    background: var(--danger-soft);
    border: 1px solid #f0c9c1;
    border-left: 4px solid var(--danger);
    color: #6e2418;
    border-radius: var(--radius-sm);
    padding: 16px 18px;
    margin-bottom: 22px;
}
.alert ul { margin: 8px 0 0; padding-left: 20px; }
.alert li { font-size: 14.5px; }

/* ---------- Campi ---------- */
.fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.fields label { display: flex; flex-direction: column; gap: 7px; }
.fields label > span { font-size: 13.5px; font-weight: 600; color: var(--ink-soft); }
.fields label > span small { font-weight: 400; color: var(--muted); margin-left: 4px; }
.fields .full { grid-column: 1 / -1; }
.fields input, .fields textarea {
    width: 100%;
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 13px 14px;
    background: #fff;
    transition: border-color .15s, box-shadow .15s;
}
.fields input:focus, .fields textarea:focus {
    outline: none;
    border-color: var(--forest-2);
    box-shadow: 0 0 0 4px rgba(41,71,58,.12);
}
.fields textarea { resize: vertical; min-height: 88px; }
.fields ::placeholder { color: #b3ab9d; }

/* ---------- Riepilogo ---------- */
.summary {
    background: var(--forest);
    color: #f1ebe0;
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: 0 20px 40px -18px rgba(27,47,35,.6);
}
.summary h2 { font-size: 22px; color: #fff; margin-bottom: 14px; }
.lines {
    list-style: none;
    margin: 0 0 14px;
    padding: 0 0 14px;
    border-bottom: 1px dashed rgba(255,255,255,.2);
    min-height: 32px;
}
.lines li {
    display: flex;
    gap: 10px;
    padding: 5px 0;
    font-size: 14.5px;
}
.lines .q { font-weight: 700; color: #e6c98f; min-width: 30px; }
.lines .n { flex: 1; }
.lines .k { color: rgba(241,235,224,.65); font-variant-numeric: tabular-nums; }
.lines .empty { color: rgba(241,235,224,.5); font-style: italic; }
.totals { margin: 0; }
.totals div { display: flex; justify-content: space-between; align-items: baseline; padding: 5px 0; font-size: 14.5px; }
.totals dt { color: rgba(241,235,224,.7); }
.totals dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.totals .grand { margin-top: 8px; padding-top: 12px; border-top: 1px solid rgba(255,255,255,.15); }
.totals .grand dt { color: #fff; font-weight: 600; }
.totals .grand dd { font-family: var(--font-display); font-size: 28px; color: #e6c98f; }

.cta, .button {
    display: block;
    width: 100%;
    margin-top: 18px;
    border: 0;
    border-radius: 999px;
    padding: 15px 22px;
    background: var(--copper);
    color: #fff;
    font-weight: 700;
    font-size: 16px;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: background .15s, transform .1s, box-shadow .15s;
    box-shadow: 0 8px 20px -8px rgba(180,87,44,.7);
}
.cta:hover, .button:hover { background: var(--copper-dark); }
.cta:active { transform: translateY(1px); }
.cta:disabled { opacity: .6; cursor: wait; }
.fine { margin-top: 12px; font-size: 12.5px; color: rgba(241,235,224,.55); text-align: center; }

.foot {
    text-align: center;
    color: var(--muted);
    font-size: 13px;
    padding: 36px 0 40px;
}

.hp { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Pagina conferma ---------- */
.confirm-wrap {
    width: min(560px, calc(100% - 40px));
    margin: 60px auto;
}
.confirm {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 44px 36px;
    text-align: center;
}
.confirm-icon {
    width: 68px; height: 68px;
    margin: 0 auto 20px;
    border-radius: 50%;
    display: grid; place-items: center;
    background: var(--moss-soft);
    color: var(--forest-2);
}
.confirm-icon svg { width: 34px; height: 34px; stroke: currentColor; fill: none; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.confirm h1 { font-size: 34px; margin-bottom: 10px; }
.confirm .muted { color: var(--muted); font-size: 14.5px; }
.confirm .code {
    display: inline-block;
    margin: 14px 0 22px;
    padding: 8px 16px;
    border-radius: 999px;
    background: var(--bg);
    font-weight: 700;
    letter-spacing: .08em;
}
.recap { width: 100%; border-collapse: collapse; margin: 0 0 20px; text-align: left; font-size: 15px; }
.recap td { padding: 10px 6px; border-bottom: 1px solid var(--line); }
.recap td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.recap .total td { border-bottom: 0; font-weight: 700; padding-top: 14px; }
.recap small { color: var(--muted); font-weight: 500; }
.confirm .button { margin-top: 24px; background: var(--forest); box-shadow: none; }
.confirm .button:hover { background: var(--forest-2); }

/* ---------- Admin ---------- */
.admin-wrap { width: min(1200px, calc(100% - 40px)); margin: 0 auto 50px; }
.admin-bar {
    background: var(--forest);
    color: #f1ebe0;
    padding: 22px 0;
    margin-bottom: 28px;
}
.admin-bar-inner {
    width: min(1200px, calc(100% - 40px));
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}
.admin-bar h1 { font-size: 26px; color: #fff; }
.admin-bar p { color: rgba(241,235,224,.65); font-size: 13.5px; }
.admin-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.admin-actions .button {
    width: auto; margin: 0;
    padding: 10px 18px; font-size: 14px;
    box-shadow: none;
}
.admin-actions .ghost { background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.2); }
.admin-actions .ghost:hover { background: rgba(255,255,255,.2); }

.login { width: min(420px, calc(100% - 40px)); margin: 70px auto; }
.login .block { padding: 36px; }
.login h1 { font-size: 30px; margin-bottom: 20px; }
.login form { display: flex; flex-direction: column; gap: 14px; }
.login label { display: flex; flex-direction: column; gap: 7px; font-size: 13.5px; font-weight: 600; color: var(--ink-soft); }
.login input { border: 1.5px solid var(--line); border-radius: var(--radius-sm); padding: 13px 14px; }
.login input:focus { outline: none; border-color: var(--forest-2); box-shadow: 0 0 0 4px rgba(41,71,58,.12); }
.login .button { margin-top: 6px; }
.error-text { color: var(--danger); font-weight: 600; font-size: 14px; margin-bottom: 4px; }

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}
.stats > div {
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 16px;
    display: flex; flex-direction: column; gap: 2px;
}
.stats span { color: var(--muted); font-size: 12.5px; text-transform: uppercase; letter-spacing: .06em; }
.stats strong { font-family: var(--font-display); font-size: 28px; line-height: 1.1; }
.stats small { color: var(--muted); font-size: 12px; }
.stat-total { background: var(--forest) !important; color: #fff; }
.stat-total strong { color: #e6c98f; }
.stat-total span, .stat-total small { color: rgba(241,235,224,.65); }

.table-card { padding: 8px; overflow: hidden; }
.table-wrap { overflow-x: auto; }
.orders { width: 100%; border-collapse: collapse; font-size: 14px; }
.orders th, .orders td { padding: 13px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.orders th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); white-space: nowrap; background: var(--bg); }
.orders th:first-child { border-radius: 10px 0 0 10px; }
.orders th:last-child { border-radius: 0 10px 10px 0; }
.orders .num { text-align: right; font-variant-numeric: tabular-nums; }
.orders tbody tr:hover { background: #faf7f1; }
.orders tbody tr:last-child td { border-bottom: 0; }
.orders .note { color: var(--muted); }
.orders .muted { color: var(--muted); }
.orders a { color: var(--forest-2); text-decoration: none; }
.orders a:hover { text-decoration: underline; }
.status-form select {
    border: 1.5px solid var(--line);
    border-radius: 999px;
    padding: 7px 12px;
    font-size: 13px;
    font-weight: 600;
    background: #fff;
    cursor: pointer;
}
tr.status-confermato select { border-color: var(--moss); background: var(--moss-soft); color: #244a32; }
tr.status-parzialmente-confermato select { border-color: #d9b45c; background: #fbf3dc; color: #6b5313; }
tr.status-annullato { opacity: .55; }
tr.status-annullato select { background: #f3f0ea; text-decoration: line-through; }
.empty-state { padding: 40px; text-align: center; color: var(--muted); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .layout { grid-template-columns: 1fr; }
    .col-side { position: static; }
    .summary { position: sticky; bottom: 12px; z-index: 5; }
}

@media (max-width: 640px) {
    .hero-inner { width: calc(100% - 32px); padding: 44px 0 40px; }
    .page, .admin-wrap, .admin-bar-inner { width: calc(100% - 24px); }
    .page { margin-top: -20px; }
    .block { padding: 20px 16px; border-radius: 16px; }
    .block-head h2 { font-size: 22px; }
    .products { grid-template-columns: 1fr; }
    .product { flex-direction: row; align-items: center; }
    .fields { grid-template-columns: 1fr; }
    .fields .full { grid-column: auto; }
    .summary { padding: 18px; border-radius: 16px; }
    .lines { display: none; }
    .totals div { padding: 3px 0; }
    .totals .grand dd { font-size: 24px; }
    .confirm { padding: 32px 20px; }
}

/* Ritocchi mobile */
.product-info { flex: 1 1 auto; min-width: 0; }
@media (max-width: 640px) {
    .eyebrow { font-size: 11px; letter-spacing: .1em; padding: 6px 12px; }
    .product .unit { white-space: nowrap; }
}

/* Prodotti: una colonna, card compatte */
.products { grid-template-columns: 1fr; gap: 10px; }
.product {
    flex-direction: row;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
}
.product h3 { font-size: 18px; margin-bottom: 1px; }
.product .pack { font-size: 13.5px; }
.product .unit { font-size: 12px; margin-top: 2px; }
.stepper { align-self: center; padding: 2px; }
.stepper button { width: 34px; height: 34px; font-size: 20px; }
.stepper input { width: 44px; font-size: 16px; }

/* Badge hero: stile "dato" con separatore */
.pills { margin-top: 30px; gap: 0; }
.pills li {
    background: none;
    border: 0;
    border-radius: 0;
    backdrop-filter: none;
    padding: 4px 28px 4px 0;
    margin-right: 28px;
    border-right: 1px solid rgba(230,201,143,.3);
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}
.pills li:last-child { border-right: 0; margin-right: 0; padding-right: 0; }
.pills strong {
    font-family: var(--font-display);
    font-size: 26px;
    font-weight: 700;
    color: #e6c98f;
    margin: 0;
}
.pills span {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: rgba(244,239,230,.6);
    margin-top: 4px;
}
@media (max-width: 640px) {
    .pills li { padding-right: 20px; margin-right: 20px; }
    .pills strong { font-size: 22px; }
}

/* ---------- Mobile: riepilogo come barra compatta fissa in basso ---------- */
@media (max-width: 900px) {
    .col-side { display: contents; }
    .summary {
        position: sticky;
        bottom: 10px;
        z-index: 20;
        display: grid;
        grid-template-columns: 1fr auto;
        align-items: center;
        gap: 0 14px;
        padding: 12px 14px 12px 18px;
        border-radius: 16px;
        box-shadow: 0 10px 30px -8px rgba(27,47,35,.55);
    }
    .summary h2, .lines, .fine, .totals div:first-child { display: none; }
    .totals { display: flex; flex-wrap: wrap; gap: 2px 18px; }
    .totals div { flex-direction: column; align-items: flex-start; padding: 0; gap: 0; }
    .totals dt { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
    .totals dd { font-size: 15px; }
    .totals .grand { margin: 0; padding: 0; border: 0; }
    .totals .grand dt { color: rgba(241,235,224,.7); font-weight: 500; }
    .totals .grand dd { font-size: 24px; line-height: 1.1; }
    .cta { width: auto; margin: 0; padding: 13px 20px; font-size: 15px; white-space: nowrap; }
    .stepper button { width: 40px; height: 40px; }
    .stepper input { width: 46px; }
}
@media (max-width: 360px) {
    .totals { gap: 0 12px; }
    .totals .grand dd { font-size: 20px; }
    .cta { padding: 12px 14px; font-size: 14px; }
}

/* ---------- Scadenza ---------- */
.pills li.deadline strong { color: #fff; }
.pills li.deadline span { color: #e6c98f; }
.closed {
    text-align: center;
    padding: 48px 28px;
    max-width: 560px;
    margin: 0 auto 22px;
}
.closed-icon {
    width: 64px; height: 64px;
    margin: 0 auto 18px;
    border-radius: 50%;
    display: grid; place-items: center;
    background: var(--copper-soft);
}
.closed-icon svg { width: 32px; height: 32px; fill: var(--copper); }
.closed h2 { font-size: 30px; margin-bottom: 12px; }
.closed p { margin-bottom: 10px; }
.closed .muted { color: var(--muted); font-size: 14px; }

/* ---------- Admin: scadenza, flash, gestione richiesta ---------- */
.flash {
    padding: 13px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 18px;
    font-weight: 600;
    font-size: 14.5px;
}
.flash-ok { background: var(--moss-soft); color: #244a32; border-left: 4px solid var(--moss); }
.flash-err { background: var(--danger-soft); color: #6e2418; border-left: 4px solid var(--danger); }

.deadline-block { padding: 20px 28px; }
.deadline-form {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}
.deadline-form h2 { font-size: 20px; margin-bottom: 2px; }
.deadline-form .muted { font-size: 14px; color: var(--muted); }
.closed-label { color: var(--danger); }
.deadline-controls { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.deadline-controls input[type="datetime-local"] {
    border: 1.5px solid var(--line);
    border-radius: 999px;
    padding: 9px 14px;
    background: #fff;
    font-size: 14px;
}
.button.small { width: auto; margin: 0; padding: 9px 16px; font-size: 14px; box-shadow: none; }
.button.ghost-dark { background: #fff; color: var(--forest); border: 1.5px solid var(--line); }
.button.ghost-dark:hover { background: var(--bg); border-color: #cdbfa6; }
.button.ghost-dark.is-open { background: var(--forest); color: #fff; border-color: var(--forest); }

.stats small b { color: var(--forest); font-weight: 700; }
.stat-total small b { color: #e6c98f; }

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    background: var(--bg);
    color: var(--ink-soft);
}
.badge.status-nuovo { background: #e8eef4; color: #2f4e6d; }
.badge.status-confermato { background: var(--moss-soft); color: #244a32; }
.badge.status-parzialmente-confermato { background: #fbf3dc; color: #6b5313; }
.badge.status-annullato { background: #f3f0ea; color: var(--muted); text-decoration: line-through; }
tr.status-annullato td { opacity: .6; }
tr.is-highlight td { background: #fbf3dc; }
.qty-changed s { color: var(--muted); }
.qty-changed b { color: var(--copper); }

.manage-row td { background: #faf7f1; padding: 18px 16px 20px; border-bottom: 2px solid var(--line); }
.manage-grid {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) minmax(280px, 1.2fr);
    gap: 24px;
}
.manage h3 { font-size: 16px; margin-bottom: 8px; }
.manage-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 7px 0;
    border-bottom: 1px dashed var(--line);
    font-size: 14px;
    font-weight: 600;
}
.manage-line small { font-weight: 400; margin-left: 4px; }
.manage-line input {
    width: 72px;
    border: 1.5px solid var(--line);
    border-radius: 999px;
    padding: 7px 10px;
    text-align: center;
    font-weight: 700;
    background: #fff;
}
.manage-side { display: flex; flex-direction: column; gap: 12px; }
.manage-side label { display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; font-weight: 600; color: var(--ink-soft); }
.manage-side select, .manage-side textarea {
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    background: #fff;
    font-weight: 400;
}
.manage-side textarea { resize: vertical; }
.manage-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.manage-line input:focus, .manage-side select:focus, .manage-side textarea:focus, .deadline-controls input:focus {
    outline: none;
    border-color: var(--forest-2);
    box-shadow: 0 0 0 4px rgba(41,71,58,.12);
}

@media (max-width: 760px) {
    .manage-grid { grid-template-columns: 1fr; }
    .deadline-block { padding: 18px 16px; }
}

/* ---------- Mini chiave per l'area admin ---------- */
.foot { display: flex; align-items: center; justify-content: center; gap: 14px; }
.admin-key {
    display: inline-grid;
    place-items: center;
    width: 30px; height: 30px;
    border-radius: 50%;
    color: #b9b1a3;
    opacity: .55;
    transition: opacity .15s, color .15s, background .15s;
}
.admin-key svg { width: 15px; height: 15px; fill: currentColor; }
.admin-key:hover, .admin-key:focus-visible { opacity: 1; color: var(--forest); background: var(--bg-deep); outline: none; }

/* Badge scadenza: etichetta sopra, valore sotto ("richieste entro / oggi alle 19:00") */
.pills li.deadline { flex-direction: column-reverse; }
.pills li.deadline span { margin-top: 0; margin-bottom: 4px; }
@media (max-width: 640px) {
    .pills { row-gap: 0; }
    .pills li:nth-child(2) { border-right: 0; }
    .pills li.deadline {
        flex-basis: 100%;
        margin: 16px 0 0;
        padding: 14px 0 0;
        border-right: 0;
        border-top: 1px solid rgba(230,201,143,.3);
    }
}

/* ---------- Preferenza animale ---------- */
.tag {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--copper-soft);
    color: var(--copper-dark);
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: .02em;
    vertical-align: 1px;
}
.choice { border: 0; padding: 0; margin: 0; min-width: 0; }
.choice legend { font-size: 13.5px; font-weight: 600; color: var(--ink-soft); padding: 0; margin-bottom: 8px; }
.choice legend small { font-weight: 400; color: var(--muted); margin-left: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips label { position: relative; cursor: pointer; }
.chips input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chips span {
    display: inline-block;
    padding: 9px 16px;
    border: 1.5px solid var(--line);
    border-radius: 999px;
    background: #fff;
    font-size: 14px;
    font-weight: 600;
    color: var(--ink-soft);
    transition: border-color .15s, background .15s, color .15s;
}
.chips label:hover span { border-color: #cdbfa6; }
.chips input:checked + span { background: var(--forest); border-color: var(--forest); color: #fff; }
.chips input:focus-visible + span { box-shadow: 0 0 0 4px rgba(41,71,58,.15); }
.badge-animal { background: var(--copper-soft); color: var(--copper-dark); }
.animals-summary { margin: -8px 0 16px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 14px; }

/* ---------- "Perché la selvaggina" (solo desktop) ---------- */
.why {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px 24px;
    margin-bottom: 18px;
}
.why h2 { font-size: 20px; margin-bottom: 14px; }
.why ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 13px; }
.why li { display: flex; gap: 11px; align-items: flex-start; }
.why svg { width: 17px; height: 17px; flex-shrink: 0; margin-top: 3px; fill: var(--moss); }
.why strong { display: block; font-size: 14.5px; margin-bottom: 2px; }
.why div { font-size: 13.5px; line-height: 1.45; color: var(--muted); }
.why-note { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--muted); }

@media (max-width: 900px) {
    .why { display: none; }
}

/* ---------- Preferenza animale per taglio ---------- */
.product { flex-direction: column; align-items: stretch; gap: 0; }
.product-row { display: flex; align-items: center; gap: 14px; }
.product-info { flex: 1 1 auto; min-width: 0; }
.product-animal {
    border: 0;
    border-top: 1px dashed var(--line);
    margin: 12px 0 0;
    padding: 12px 0 2px;
    min-width: 0;
}
.product.is-selected .product-animal { border-top-color: #cfe0d3; }
.product-animal[hidden] { display: none; }
.product-animal legend {
    padding: 0;
    margin-bottom: 8px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--muted);
}
.product-animal legend small { font-weight: 500; letter-spacing: 0; text-transform: none; margin-left: 4px; }
.chips-sm span { padding: 6px 13px; font-size: 13.5px; }
.lines .n em { font-style: normal; color: #e6c98f; opacity: .8; font-size: 13px; }

/* ---------- Admin: stato e-mail e riepilogo per animale ---------- */
.warn-text { color: #ffc98c; }
.mail-state {
    display: inline-block;
    margin-top: 5px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 700;
    white-space: nowrap;
}
.mail-state.sent { background: var(--moss-soft); color: #2c5a3c; }
.mail-state.pending { background: #fde7d6; color: #92430f; }
.mail-state.none { background: var(--bg); color: var(--muted); font-weight: 500; }
.mail-info {
    margin: 4px 0 10px;
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--bg);
    font-size: 13px;
    color: var(--ink-soft);
}
.mail-info.pending { background: #fde7d6; color: #7a3a0d; }
.orders .pa { display: inline-block; margin-top: 2px; color: var(--copper); font-size: 11.5px; font-weight: 700; }
.breakdown td, .breakdown th { padding: 11px 12px; }
.breakdown .total-col { background: var(--bg); font-weight: 700; }
.breakdown b { color: var(--forest); }

/* ---------- Admin: consegna e pagamento ---------- */
.orders .flags { white-space: nowrap; }
.flag-form { display: inline-block; margin: 0 4px 4px 0; }
.flag {
    border: 1.5px solid var(--line);
    background: #fff;
    border-radius: 999px;
    padding: 5px 11px;
    font-size: 12px;
    font-weight: 700;
    color: var(--muted);
    cursor: pointer;
    white-space: nowrap;
    transition: border-color .15s, background .15s, color .15s;
}
.flag:hover { border-color: var(--moss); color: var(--forest); }
.flag.on { background: var(--moss-soft); border-color: var(--moss); color: #24543a; }
.flag.off { border-style: dashed; }
tr.is-done td { background: #f6faf6; }
tr.is-done:hover td { background: #eff7f1; }

.done-box {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
    padding: 11px 13px;
    margin-bottom: 10px;
    border-radius: 10px;
    background: var(--moss-soft);
}
.done-check { flex-direction: row; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; color: #24543a; cursor: pointer; }
.done-check input { width: 17px; height: 17px; accent-color: var(--forest); cursor: pointer; }
.done-check small { font-weight: 500; }
/* spunte impilate: la colonna resta stretta */
.orders .flags { white-space: normal; min-width: 118px; }
.flag-form { display: block; margin: 0 0 4px; }
.flag { width: 100%; text-align: center; }

/* Correzioni: spunte in riga e tabella richieste più compatta */
.manage-side .done-check, .done-box .done-check { flex-direction: row; align-items: center; }
.orders th, .orders td { padding: 10px 8px; }
.orders td small { font-size: 11.5px; }
.orders .flags { min-width: 104px; }
.flag { padding: 5px 8px; font-size: 11.5px; }
.orders th { font-size: 10.5px; letter-spacing: .04em; }
.orders .num { padding-left: 6px; padding-right: 6px; }
/* la scelta animale è sempre visibile; attenuata finché il taglio non è selezionato */
.product-animal.is-idle { opacity: .55; }
.product-animal.is-idle legend { color: var(--muted); }
/* "Indifferente" è il valore di partenza: evidenziazione neutra, così spiccano le scelte vere */
.chips input[value="none"]:checked + span {
    background: var(--bg);
    border-color: #cdbfa6;
    color: var(--ink-soft);
}

/* ---------- Contatori per animale ---------- */
.product { padding: 14px 16px 12px; }
.product-head { margin-bottom: 10px; }
.product-head h3 { font-size: 19px; }
.animal-rows {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(178px, 1fr));
    gap: 6px 10px;
}
.animal-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 4px 4px 4px 12px;
    border-radius: 999px;
    border: 1.5px solid transparent;
    background: var(--bg);
    transition: background .15s, border-color .15s;
}
.animal-row .an { font-size: 14px; font-weight: 600; color: var(--ink-soft); }
.animal-row.has-qty { background: var(--moss-soft); border-color: var(--moss); }
.animal-row.has-qty .an { color: #24543a; }
.animal-rows .stepper { border: 0; background: transparent; padding: 0; }
.animal-rows .stepper button { width: 32px; height: 32px; font-size: 19px; }
.animal-rows .stepper input { width: 36px; font-size: 16px; }

/* Pannello admin: quantità confermate raggruppate per prodotto */
.manage-product { margin-bottom: 12px; }
.manage-product > strong { display: block; font-size: 14.5px; margin-bottom: 2px; }
.manage-product .manage-line { padding-left: 10px; }
.orders .pa { white-space: nowrap; }

/* ---------- Eliminazione richiesta ---------- */
.delete-form { margin-top: 10px; text-align: right; }
.button-danger {
    border: 1.5px solid #e6c4bd;
    background: #fff;
    color: var(--danger);
    border-radius: 999px;
    padding: 7px 14px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}
.button-danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }

/* ---------- Lista di consegna stampabile ---------- */
.print-page { background: var(--bg); }
.print-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    padding: 14px 20px;
    background: var(--forest);
    color: #f1ebe0;
}
.print-bar strong { margin-right: 8px; }
.print-bar .muted { color: rgba(241,235,224,.6); font-size: 13.5px; }
.print-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.print-actions .button { width: auto; margin: 0; }

.sheet {
    width: min(900px, calc(100% - 32px));
    margin: 24px auto 60px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 28px;
    box-shadow: var(--shadow);
}
.sheet-head { border-bottom: 2px solid var(--forest); padding-bottom: 14px; margin-bottom: 18px; }
.sheet-head h1 { font-size: 28px; margin-bottom: 6px; }
.sheet-head p { font-size: 14px; }
.sheet-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.sheet-table th {
    text-align: left;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--muted);
    padding: 8px 8px;
    border-bottom: 1.5px solid var(--line);
}
.sheet-table td { padding: 12px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.sheet-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sheet-table .tick { width: 42px; text-align: center; }
.sheet-table .box {
    display: inline-block;
    width: 20px; height: 20px;
    border: 1.5px solid var(--ink-soft);
    border-radius: 5px;
    line-height: 18px;
    text-align: center;
    font-weight: 700;
    color: var(--forest);
}
.sheet-table .box.checked { background: var(--moss-soft); border-color: var(--moss); }
.sheet-table .who strong { display: block; }
.sheet-table .who small { color: var(--muted); font-size: 11.5px; }
.sheet-table .what .line { display: block; line-height: 1.4; }
.sheet-table .what b { font-weight: 700; }
.sheet-table .what .note { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.sheet-table .is-paid { color: var(--moss); font-weight: 700; }
.sheet-foot { margin-top: 18px; text-align: right; font-size: 16px; }

@media print {
    .print-bar { display: none; }
    body { background: #fff; }
    .sheet { width: auto; margin: 0; border: 0; border-radius: 0; box-shadow: none; padding: 0; }
    .sheet-table tr { page-break-inside: avoid; }
    .sheet-table td, .sheet-table th { padding: 8px 6px; }
    .sheet-table .who small { display: none; }
}

/* ---------- "Avvisami alla prossima fornitura" ---------- */
.sr-only {
    position: absolute; width: 1px; height: 1px;
    padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.notify {
    width: min(760px, 100%);
    margin: 10px auto 0;
    background: var(--forest);
    color: #f1ebe0;
    border-radius: var(--radius);
    padding: 30px 32px;
    text-align: center;
    box-shadow: 0 20px 40px -22px rgba(27,47,35,.65);
}
.notify-text h2 { font-size: clamp(21px, 3vw, 26px); color: #fff; margin-bottom: 8px; }
.notify-text p { color: rgba(241,235,224,.75); font-size: 15px; }
.notify-text strong { color: #e6c98f; }
.notify-form {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
    margin: 20px 0 12px;
}
.notify-form input {
    flex: 1 1 200px;
    max-width: 260px;
    border: 1.5px solid rgba(255,255,255,.18);
    border-radius: 999px;
    padding: 13px 18px;
    background: rgba(255,255,255,.08);
    color: #fff;
    font-size: 15px;
}
.notify-form input::placeholder { color: rgba(241,235,224,.5); }
.notify-form input:focus {
    outline: none;
    border-color: #e6c98f;
    background: rgba(255,255,255,.14);
    box-shadow: 0 0 0 4px rgba(230,201,143,.18);
}
.notify-form button {
    border: 0;
    border-radius: 999px;
    padding: 13px 26px;
    background: var(--copper);
    color: #fff;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    transition: background .15s;
}
.notify-form button:hover { background: var(--copper-dark); }
.notify-fine { font-size: 12.5px; color: rgba(241,235,224,.5); }
.notify-flash {
    margin: 16px auto 0;
    padding: 11px 16px;
    border-radius: 12px;
    font-size: 14.5px;
    font-weight: 600;
    max-width: 520px;
}
.notify-flash.is-ok { background: rgba(95,138,107,.25); color: #d7ecdb; }
.notify-flash.is-err { background: rgba(180,87,44,.25); color: #f6d6c6; }

@media (max-width: 640px) {
    .notify { padding: 24px 18px; border-radius: 16px; }
    .notify-form { flex-direction: column; }
    .notify-form input { max-width: none; }
}

/* ---------- Admin: iscritti agli avvisi ---------- */
.subs-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.subs-hint { font-size: 13px; }
.subs { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 8px; }
.subs li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: #fff;
}
.subs li > div { min-width: 0; }
.subs strong { display: block; font-size: 14px; word-break: break-all; }
.subs span, .subs small { font-size: 12px; margin-right: 8px; }
.unsub-form button {
    border: 0;
    background: none;
    color: var(--muted);
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 8px;
}
.unsub-form button:hover { color: var(--danger); background: var(--danger-soft); }
.mail-alert p { margin-top: 6px; font-size: 14px; }
.mail-alert .muted { font-size: 12.5px; }
.inline-form { display: inline-block; margin: 0; }
.inline-form .button { width: auto; margin: 0; }
