:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e5e7eb;
  --ink: #0b1220;           /* header e sezioni scure */
  --accent: #2f6bff;        /* blu elettrico */
  --accent-hover: #1f55e0;
  --accent-soft: #eaf0ff;
  --lime: #c6f432;          /* dettagli */
  --danger: #c0262d;
  --ok: #0f7a4d;
  --ok-bg: #e7f6ee;
  --err-bg: #fdecec;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 8px 24px rgba(15, 23, 42, .06);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.55; -webkit-font-smoothing: antialiased; }
img { max-width: 100%; display: block; }
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.2; letter-spacing: -.015em; }
h1 { font-size: 2rem; margin: 1.25rem 0 .5rem; }
h2 { font-size: 1.35rem; margin: 0 0 1rem; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.main { min-height: 50vh; padding-bottom: 3rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.empty { padding: 3rem 0; text-align: center; color: var(--muted); }

/* --- Top bar e header -------------------------------------------------- */
.topbar { background: var(--ink); color: #cbd5e1; font-size: .8rem; }
.topbar-inner { display: flex; justify-content: center; gap: 2rem; padding: .45rem 16px; }
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.header-inner { display: flex; align-items: center; gap: 1.25rem; min-height: 68px; }
.logo { display: inline-flex; align-items: center; gap: .55rem; text-decoration: none; color: var(--text); flex-shrink: 0; }
.logo-mark { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--ink); color: var(--lime); }
.logo-text { font-weight: 800; font-size: 1.2rem; letter-spacing: -.02em; }
.search { flex: 1; display: flex; max-width: 560px; margin: 0 auto; background: var(--bg); border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search input { flex: 1; border: 0; background: transparent; padding: .65rem 1rem; font: inherit; color: var(--text); outline: none; min-width: 0; }
.search button { border: 0; background: transparent; padding: 0 1rem; color: var(--muted); cursor: pointer; }
.cart-link { position: relative; display: inline-flex; align-items: center; gap: .45rem; text-decoration: none; color: var(--text); font-weight: 600; flex-shrink: 0; padding: .5rem .75rem; border-radius: 999px; }
.cart-link:hover { background: var(--bg); }
.badge { position: absolute; top: 0; left: 1.6rem; background: var(--accent); color: #fff; border-radius: 999px; min-width: 1.25rem; height: 1.25rem; padding: 0 .3rem; font-size: .72rem; font-weight: 700; display: grid; place-items: center; }
.catnav { border-top: 1px solid var(--border); }
.catnav-inner { display: flex; gap: .35rem; overflow-x: auto; padding-top: .5rem; padding-bottom: .5rem; scrollbar-width: none; }
.catnav-inner::-webkit-scrollbar { display: none; }
.catnav a { white-space: nowrap; text-decoration: none; color: var(--text); font-size: .9rem; font-weight: 500; padding: .4rem .85rem; border-radius: 999px; }
.catnav a:hover { background: var(--bg); }
.catnav a.active { background: var(--ink); color: #fff; }

/* --- Bottoni e form ---------------------------------------------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; border: 1px solid var(--border); background: var(--surface); color: var(--text); padding: .65rem 1.15rem;
  border-radius: 999px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; text-align: center; transition: background .15s, border-color .15s, transform .05s; }
.btn:hover { border-color: #cbd5e1; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.35); }
.btn-ghost:hover { border-color: #fff; }
.btn-danger { color: var(--danger); border-color: var(--danger); }
.btn-block { display: flex; width: 100%; }
.btn-lg { padding: .85rem 1.5rem; font-size: 1rem; }
.btn-small { padding: .35rem .8rem; font-size: .85rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.link-btn { background: none; border: 0; color: var(--accent); cursor: pointer; font: inherit; padding: 0; text-decoration: underline; }
.inline { display: inline; }
label { display: block; font-weight: 600; font-size: .9rem; }
.field { margin-bottom: 1rem; }
input[type=text], input[type=email], input[type=tel], input[type=url], input[type=password], input[type=number], input[type=search], select, textarea {
  display: block; width: 100%; margin-top: .35rem; padding: .65rem .8rem; font: inherit; font-weight: 400;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text);
}
.search input[type=search] { margin: 0; border: 0; display: block; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input.qty { width: 5rem; display: inline-block; }
.checkbox { font-weight: 400; display: flex; gap: .5rem; align-items: flex-start; flex-wrap: wrap; margin: 1rem 0; }
.checkbox input { margin-top: .3rem; }
.has-error input, .has-error.checkbox { border-color: var(--danger); }
.error { display: block; width: 100%; color: var(--danger); font-size: .85rem; font-weight: 400; margin-top: .25rem; }
.field-row { display: grid; grid-template-columns: 1fr 2fr 1fr; gap: 0 .75rem; }
.flash { padding: .85rem 1rem; border-radius: var(--radius-sm); margin: 1rem 0; }
.flash-ok { background: var(--ok-bg); color: var(--ok); }
.flash-error { background: var(--err-bg); color: var(--danger); }

/* --- Home -------------------------------------------------------------- */
.hero { display: grid; grid-template-columns: 1.1fr 1fr; gap: 2rem; align-items: center; margin: 1.5rem 0 2.5rem;
  padding: clamp(1.5rem, 4vw, 3rem); border-radius: 24px; color: #fff; overflow: hidden;
  background: radial-gradient(120% 140% at 100% 0%, #2a4cff 0%, transparent 55%), linear-gradient(135deg, #0b1220 0%, #121c38 100%); }
.eyebrow { display: inline-block; font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--lime); margin-bottom: .75rem; }
.hero h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); margin: 0 0 1rem; }
.hero p { color: #cbd5e1; font-size: 1.05rem; max-width: 34rem; margin: 0 0 1.5rem; }
.hero-actions { display: flex; gap: .75rem; flex-wrap: wrap; }
.hero-art { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem; }
.hero-tile { background: #fff; border-radius: 18px; aspect-ratio: 1; padding: .75rem; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.hero-tile img { width: 100%; height: 100%; object-fit: contain; }
.hero-tile-1, .hero-tile-3 { transform: translateY(1.5rem); }
.section { margin: 2.5rem 0; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.link-more { font-weight: 600; text-decoration: none; }
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 1rem; }
.cat-tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; text-decoration: none; color: var(--text); display: flex; flex-direction: column; gap: .2rem; transition: box-shadow .15s, transform .15s; }
.cat-tile:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.cat-img { aspect-ratio: 1; display: block; margin-bottom: .5rem; }
.cat-img img { width: 100%; height: 100%; object-fit: contain; }
.cat-name { font-weight: 700; }
.cat-count { color: var(--muted); font-size: .8rem; }

/* --- Schede prodotto --------------------------------------------------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1.25rem; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; text-decoration: none; color: var(--text);
  display: flex; flex-direction: column; transition: box-shadow .15s, transform .15s, border-color .15s; }
.card:hover { box-shadow: var(--shadow); transform: translateY(-3px); border-color: #d6dbe3; }
.card-img { position: relative; aspect-ratio: 1; background: #fff; padding: 1rem; border-bottom: 1px solid var(--border); }
.card-img img { width: 100%; height: 100%; object-fit: contain; transition: transform .25s; }
.card:hover .card-img img { transform: scale(1.04); }
.tag { position: absolute; top: .6rem; left: .6rem; font-size: .75rem; font-weight: 700; padding: .2rem .5rem; border-radius: 6px; }
.tag-sale { background: var(--danger); color: #fff; }
.card-body { padding: .85rem 1rem 1rem; display: flex; flex-direction: column; gap: .35rem; flex: 1; }
.card-cat { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); text-decoration: none; }
.card-title { font-size: .95rem; font-weight: 500; margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.9em; }
.card-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: .5rem; flex-wrap: wrap; }
.price { font-weight: 800; font-size: 1.1rem; margin: 0; }
.price s { font-weight: 400; font-size: .85rem; color: var(--muted); margin-left: .35rem; }
.price.big { font-size: 2rem; }
.chip { font-size: .72rem; font-weight: 600; color: var(--ok); background: var(--ok-bg); padding: .15rem .5rem; border-radius: 999px; }

/* --- Catalogo ---------------------------------------------------------- */
.breadcrumbs { font-size: .85rem; color: var(--muted); margin: 1.25rem 0 .25rem; display: flex; gap: .4rem; flex-wrap: wrap; }
.breadcrumbs a { color: var(--muted); text-decoration: none; }
.breadcrumbs a:hover { color: var(--text); }
.list-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.list-head h1 { margin-bottom: .1rem; }
.list-head p { margin: 0; }
.sort label { font-weight: 500; color: var(--muted); display: flex; align-items: center; gap: .5rem; }
.sort select { width: auto; margin: 0; }
.pager { display: flex; justify-content: center; gap: .35rem; margin: 2rem 0; flex-wrap: wrap; }
.pager a, .pager span { padding: .45rem .8rem; border-radius: 999px; text-decoration: none; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: .9rem; }
.pager .current { background: var(--ink); color: #fff; border-color: var(--ink); }

/* --- Pagina prodotto --------------------------------------------------- */
.product { display: grid; grid-template-columns: 1.05fr 1fr; gap: 2.5rem; margin-top: 1rem; align-items: start; }
.product > *, .checkout > *, .admin-cols > * { min-width: 0; }
select { max-width: 100%; text-overflow: ellipsis; }
.product-title { overflow-wrap: anywhere; }
.gallery { position: sticky; top: 140px; }
.gallery-main { aspect-ratio: 1; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; padding: 1.5rem; }
.gallery-main img { width: 100%; height: 100%; object-fit: contain; }
.thumbs { display: flex; gap: .5rem; margin-top: .75rem; overflow-x: auto; padding-bottom: .25rem; }
.thumb { flex: 0 0 68px; height: 68px; padding: 4px; border: 2px solid var(--border); border-radius: 10px; overflow: hidden; cursor: pointer; background: #fff; }
.thumb.active { border-color: var(--accent); }
.thumb img { width: 100%; height: 100%; object-fit: contain; }
.product-title { font-size: 1.45rem; font-weight: 700; margin: .4rem 0 1rem; }
.price-row { display: flex; align-items: baseline; gap: .75rem; flex-wrap: wrap; padding-bottom: 1rem; border-bottom: 1px solid var(--border); }
.buy-form { margin: 1.25rem 0; }
.buy-row { display: flex; gap: .75rem; align-items: stretch; }
.buy-btn { flex: 1; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); }
.stepper button { border: 0; background: none; width: 2.5rem; height: 100%; font-size: 1.2rem; cursor: pointer; color: var(--text); }
.stepper input { width: 2.75rem; margin: 0; border: 0; text-align: center; padding: .5rem 0; -moz-appearance: textfield; background: transparent; }
.stepper input::-webkit-inner-spin-button, .stepper input::-webkit-outer-spin-button { -webkit-appearance: none; }
.stepper input:focus { box-shadow: none; }
.perks { list-style: none; padding: 1rem 1.25rem; margin: 0 0 1.25rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); font-size: .9rem; display: grid; gap: .45rem; }
.perks li { padding-left: 1.6rem; position: relative; color: var(--muted); }
.perks li::before { content: "✓"; position: absolute; left: 0; color: var(--ok); font-weight: 800; }
.perks strong { color: var(--text); }
.description { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0 1.25rem; }
.description summary { cursor: pointer; font-weight: 700; padding: 1rem 0; }
.description-body { padding-bottom: 1.25rem; color: #334155; font-size: .95rem; }

/* --- Fiducia e footer -------------------------------------------------- */
.trust { background: var(--surface); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); margin-top: 2rem; }
.trust-inner { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.5rem; padding-top: 1.75rem; padding-bottom: 1.75rem; }
.trust-inner div { display: flex; flex-direction: column; gap: .15rem; }
.trust-inner strong { font-size: .95rem; }
.trust-inner span { color: var(--muted); font-size: .85rem; }
.site-footer { background: var(--ink); color: #cbd5e1; padding: 2.5rem 0 1.5rem; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 2rem; }
.site-footer h3 { color: #fff; font-size: .95rem; margin: 0 0 .75rem; }
.site-footer a { display: block; color: #cbd5e1; text-decoration: none; font-size: .9rem; padding: .2rem 0; }
.site-footer a:hover { color: #fff; }
.site-footer .muted { color: #94a3b8; }
.logo-footer .logo-text { color: #fff; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.1); margin-top: 2rem; padding-top: 1.25rem; }

/* --- Tabelle, carrello, checkout --------------------------------------- */
.table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.table th, .table td { padding: .75rem .9rem; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; background: #fafbfc; }
.cart-product { display: flex; gap: .75rem; align-items: center; }
.cart-product a { color: var(--text); text-decoration: none; font-weight: 500; }
.cart-product img, .thumb-cell img { width: 60px; height: 60px; object-fit: contain; border-radius: 8px; background: #fff; border: 1px solid var(--border); }
.cart-actions { margin: 1rem 0; text-align: right; }
.summary { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; margin: 1rem 0; max-width: 420px; margin-left: auto; }
.summary h2 { margin-top: 0; }
.summary .row { display: flex; justify-content: space-between; gap: 1rem; padding: .35rem 0; }
.summary .total { font-weight: 800; font-size: 1.15rem; border-top: 1px solid var(--border); margin-top: .5rem; padding-top: .75rem; }
.summary .btn { margin-top: 1rem; }
.checkout { display: grid; grid-template-columns: 3fr 2fr; gap: 2rem; align-items: start; }
.checkout-form { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; }
.checkout-form h2 { font-size: 1.1rem; margin-top: .5rem; }
.checkout .summary { margin: 0; max-width: none; position: sticky; top: 140px; }
.pay-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; max-width: 460px; margin: 1rem 0; }

.status-pill { display: inline-block; padding: .2rem .65rem; border-radius: 999px; font-size: .8rem; font-weight: 600; background: #eef0f3; }
.status-pending { background: #fff4d6; color: #7a5200; }
.status-paid { background: #fff1d6; color: #7a4b00; }
.status-ordered { background: var(--accent-soft); color: #1d4b8f; }
.status-shipped, .status-delivered, .status-active { background: var(--ok-bg); color: var(--ok); }
.status-cancelled, .status-refunded { background: var(--err-bg); color: var(--danger); }

/* --- Admin ------------------------------------------------------------- */
body.admin .site-header { position: static; }
.admin-header .header-inner { justify-content: space-between; }
.admin-nav { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.admin-nav a { text-decoration: none; font-weight: 500; }
.login-box { max-width: 380px; margin: 4rem auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.75rem; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.15rem; text-decoration: none; color: var(--text); }
.stat-alert { border-color: #f2b705; background: #fff9e6; }
.stat-value { display: block; font-size: 1.6rem; font-weight: 800; }
.stat-label { color: var(--muted); font-size: .85rem; }
.filters { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.filters a { padding: .35rem .8rem; border: 1px solid var(--border); border-radius: 999px; text-decoration: none; font-size: .85rem; background: var(--surface); }
.filters a.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.admin-cols { display: grid; grid-template-columns: 2fr 1fr; gap: 2rem; align-items: start; }
.address-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; margin-bottom: .5rem; }
.image-list { display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: 1rem; }
.image-item { width: 120px; }
.image-item img { width: 120px; height: 120px; object-fit: contain; background: #fff; border-radius: 8px; border: 1px solid var(--border); margin-bottom: .3rem; }
.ai-box { margin-top: 2rem; display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.danger-zone { margin-top: 3rem; padding-top: 1rem; border-top: 1px solid var(--border); }
code { background: #eef0f3; padding: .1em .35em; border-radius: 4px; font-size: .9em; }

/* --- Responsive -------------------------------------------------------- */
@media (max-width: 960px) {
  .product { grid-template-columns: 1fr; gap: 1.5rem; }
  .gallery { position: static; max-width: 560px; }
  .hero { grid-template-columns: 1fr; }
  .hero-art { display: none; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .trust-inner { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  h1 { font-size: 1.5rem; }
  .hide-sm { display: none; }
  .header-inner { flex-wrap: wrap; gap: .75rem; padding-top: .6rem; padding-bottom: .6rem; min-height: 0; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
  .cart-link { margin-left: auto; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: .75rem; }
  .card-body { padding: .7rem .75rem .85rem; }
  .card-title { font-size: .85rem; }
  .price { font-size: 1rem; }
  .product, .checkout, .admin-cols { grid-template-columns: 1fr; gap: 1.5rem; }
  .gallery, .checkout .summary { position: static; }
  .price.big { font-size: 1.6rem; }
  .field-row { grid-template-columns: 1fr 1fr; }
  .field-row .field:nth-child(2) { grid-column: span 2; grid-row: 1; }
  .summary { max-width: none; }
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { border-bottom: 1px solid var(--border); padding: .5rem 0; }
  .table td { border: 0; padding: .3rem .8rem; }
  .table td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); font-size: .85rem; }
  .footer-grid, .trust-inner { grid-template-columns: 1fr; gap: 1rem; }
  .topbar-inner { gap: 1rem; }
}
