/* Pierobon Webshop - palette + base */
:root {
  --pb-blue: #1a3a6e;
  --pb-blue-dark: #15305a;
  --pb-orange: #ff9800;
  --pb-green: #2e7d32;
  --pb-red: #c62828;
  --pb-bg: #f5f5f7;
  --pb-text: #1f2937;
  --pb-muted: #6b7280;
  --pb-border: #e5e7eb;
  --pb-card: #ffffff;
  --pb-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

* { box-sizing: border-box; }
body {
  margin: 0; padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--pb-bg);
  color: var(--pb-text);
  line-height: 1.5;
}

/* Layout */
.container { max-width: 1400px; margin: 0 auto; padding: 0 16px; }
.main-content { padding: 24px 16px 60px; }

/* Topbar */
.topbar { background: var(--pb-blue); color: #fff; box-shadow: var(--pb-shadow); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 600; }
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 6px;
  background: var(--pb-orange); color: #fff; font-weight: 700; font-size: 14px;
}
.brand-text { font-size: 18px; letter-spacing: 0.3px; }
.topnav { display: flex; align-items: center; gap: 16px; }
.navlink { color: rgba(255,255,255,0.92); text-decoration: none; font-weight: 500; }
.navlink:hover { color: #fff; }
.user { color: rgba(255,255,255,0.85); font-size: 14px; }
.badge {
  display: inline-block; min-width: 20px; padding: 1px 7px;
  background: var(--pb-orange); color: #fff; border-radius: 10px;
  font-size: 12px; font-weight: 700; text-align: center; margin-left: 4px;
}

/* Bottoni */
.btn-primary {
  background: var(--pb-blue); color: #fff; border: none;
  padding: 10px 20px; border-radius: 6px; font-size: 15px; font-weight: 600;
  cursor: pointer;
}
.btn-primary:hover { background: var(--pb-blue-dark); }
.btn-primary.big { padding: 14px 32px; font-size: 16px; }
.btn-secondary {
  background: var(--pb-card); color: var(--pb-blue); border: 1px solid var(--pb-blue);
  padding: 6px 12px; border-radius: 5px; font-size: 14px; font-weight: 600; cursor: pointer;
}
.btn-secondary:hover { background: var(--pb-blue); color: #fff; }
.btn-secondary.small { padding: 4px 8px; font-size: 13px; }
.btn-danger {
  background: var(--pb-card); color: var(--pb-red); border: 1px solid var(--pb-red);
  padding: 4px 10px; border-radius: 5px; cursor: pointer;
}
.btn-danger:hover { background: var(--pb-red); color: #fff; }
.btn-link {
  background: transparent; border: none; color: var(--pb-muted);
  text-decoration: underline; cursor: pointer; padding: 0; font: inherit;
}
.btn-link:hover { color: var(--pb-text); }
.btn-link-inline {
  display: inline-block; margin-left: 12px; color: var(--pb-blue); text-decoration: underline; font-weight: 600;
}

/* Hero / home */
.hero { padding: 32px 0 24px; text-align: center; }
.hero h1 { margin: 0 0 8px; font-size: 32px; color: var(--pb-blue); }
.subtitle { color: var(--pb-muted); margin: 0 0 24px; }
.search-form { display: flex; gap: 8px; justify-content: center; max-width: 720px; margin: 0 auto; }
.search-form input[type="text"] {
  flex: 1; padding: 12px 14px; font-size: 16px;
  border: 1px solid var(--pb-border); border-radius: 6px; outline: none;
}
.search-form input[type="text"]:focus { border-color: var(--pb-blue); box-shadow: 0 0 0 3px rgba(26,58,110,0.12); }
.search-form-inline {
  display: flex; gap: 8px; max-width: 600px; margin: 0 0 16px;
}
.search-form-inline input[type="text"] {
  flex: 1; padding: 8px 12px; font-size: 15px;
  border: 1px solid var(--pb-border); border-radius: 6px; outline: none;
}
.suggestions { margin-top: 16px; color: var(--pb-muted); font-size: 14px; }
.chip {
  display: inline-block; margin: 0 4px; padding: 4px 10px;
  background: #fff; border: 1px solid var(--pb-border);
  border-radius: 12px; color: var(--pb-blue); text-decoration: none; font-size: 13px;
}
.chip:hover { background: var(--pb-blue); color: #fff; border-color: var(--pb-blue); }

/* Info / alerts */
.info-box {
  margin-top: 20px; padding: 12px 16px;
  background: #fff8e1; border-left: 4px solid var(--pb-orange);
  border-radius: 4px; font-size: 14px;
}
.alert { padding: 12px 16px; border-radius: 6px; margin-bottom: 16px; font-size: 14px; }
.alert-error { background: #ffebee; color: var(--pb-red); border-left: 4px solid var(--pb-red); }
.alert-success { background: #e8f5e9; color: var(--pb-green); border-left: 4px solid var(--pb-green); }

/* Sezioni risultati */
.search-section { margin-bottom: 16px; }
.search-meta { color: var(--pb-muted); font-size: 14px; }
.tag {
  display: inline-block; margin-left: 8px; padding: 2px 8px;
  background: var(--pb-border); border-radius: 4px; font-size: 12px; font-weight: 600;
}
.tag-cache { background: #fff3e0; color: var(--pb-orange); }
.tag-time { background: #e3f2fd; color: var(--pb-blue); }
.tag-status { background: #f0f4f8; color: var(--pb-muted); font-style: italic; }
.tag-status-done { background: #e8f5e9; color: var(--pb-green); font-style: normal; }

/* Skeleton (placeholder shimmer) */
.skel {
  display: inline-block; height: 12px; border-radius: 4px;
  background: linear-gradient(90deg, #ececec 0%, #f6f6f6 50%, #ececec 100%);
  background-size: 200% 100%;
  animation: pb-shimmer 1.4s ease-in-out infinite;
  vertical-align: middle;
}
.skel-sm { width: 70px; }
.skel-md { width: 140px; }
.skel-lg { width: 220px; }
.skeleton-row td { padding: 12px; }

/* Cella prezzo "in caricamento" — shimmer breve */
.cell-loading {
  display: inline-block; width: 48px; height: 12px; border-radius: 4px;
  background: linear-gradient(90deg, #ececec 0%, #f6f6f6 50%, #ececec 100%);
  background-size: 200% 100%;
  animation: pb-shimmer 1.4s ease-in-out infinite;
  vertical-align: middle;
}

@keyframes pb-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.section { background: var(--pb-card); border-radius: 8px; box-shadow: var(--pb-shadow); margin-bottom: 20px; overflow: hidden; }
.section-head { padding: 12px 16px; border-bottom: 1px solid var(--pb-border); display: flex; align-items: center; gap: 12px; }
.section-head h2 { margin: 0; font-size: 16px; color: var(--pb-blue); }
.badge-warehouse { background: var(--pb-green); }
.badge-cross { background: var(--pb-blue); }
.badge-warehouse, .badge-cross { color: #fff; padding: 2px 10px; border-radius: 12px; font-size: 12px; font-weight: 700; }

.empty-msg { padding: 24px 16px; color: var(--pb-muted); text-align: center; font-style: italic; }
.empty-msg.error { color: var(--pb-red); }

/* Tabelle */
table.results { width: 100%; border-collapse: collapse; table-layout: fixed; }
table.results th {
  background: #f0f1f3; text-align: left; padding: 10px 12px;
  font-size: 13px; font-weight: 600; color: var(--pb-text);
  white-space: nowrap;
}
table.results td { padding: 10px 12px; border-top: 1px solid var(--pb-border); font-size: 14px; vertical-align: middle; }
table.results tr:hover { background: #fafbfc; }
table.results th.num, table.results td.num { text-align: right; }

/* Larghezze colonne per la tabella risultati ricerca:
   Codice | Marca | Descrizione | Listino | P.netto | Disp. | + */
table.results col.col-codice  { width: 280px; }
table.results col.col-marca   { width: 120px; }
table.results col.col-descr   { width: auto; }
table.results col.col-listino { width: 78px; }
table.results col.col-prezzo  { width: 90px; }
table.results col.col-avail   { width: 200px; }
table.results col.col-action  { width: 125px; }
table.results th.th-cart { text-align: center; padding: 8px 4px; }
table.results th.th-cart svg { vertical-align: middle; color: var(--pb-blue); }
/* overflow-wrap (non word-break): spezza solo se la riga e' troppo lunga,
   mai dentro i numeri decimali come '130,9 mm'. */
table.results td { overflow-wrap: break-word; word-break: normal; }

.mono { font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace; }
.small { font-size: 12px; }
.num { text-align: right; }
.strong { font-weight: 700; color: var(--pb-blue); }
.muted { color: var(--pb-muted); }

/* Stato disponibilita' */
.stock { font-size: 18px; }
.stock-1 { color: var(--pb-green); }
.stock-2 { color: var(--pb-orange); }
.stock-3 { color: var(--pb-red); }

/* Semaforo Carparts (cross-reference availability) */
.semaforo {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 500;
  padding: 3px 10px; border-radius: 12px;
  border: 1px solid var(--pb-border);
  background: #fff;
}
.semaforo-dot {
  display: inline-block; width: 10px; height: 10px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.1);
}
.semaforo-green { color: #1e6f2c; border-color: #b9deb9; background: #ecf8ec; }
.semaforo-green .semaforo-dot { background: #2e7d32; box-shadow: 0 0 4px rgba(46,125,50,0.5); }
.semaforo-yellow { color: #8a6300; border-color: #ffe0a0; background: #fff7e0; }
.semaforo-yellow .semaforo-dot { background: #f59f00; box-shadow: 0 0 4px rgba(245,159,0,0.5); }
.semaforo-red { color: #a32020; border-color: #f4c0c0; background: #fdebeb; }
.semaforo-red .semaforo-dot { background: #c62828; box-shadow: 0 0 4px rgba(198,40,40,0.5); }
.semaforo-grey { color: #555; border-color: #ddd; background: #f4f4f4; }
.semaforo-grey .semaforo-dot { background: #888; }
.semaforo-unknown { color: #888; border-color: #eee; background: #fafafa; }
.semaforo-unknown .semaforo-dot { background: #ccc; }

/* Stato "in caricamento" del semaforo: cerchio pulsante */
.semaforo-loading { color: #999; border-color: #eaeaea; background: #fafafa; }
.semaforo-dot-loading {
  display: inline-block; width: 10px; height: 10px; border-radius: 50%;
  border: 1.5px solid #c9d6e5; border-top-color: #6b89ad;
  animation: pb-spin 0.9s linear infinite;
}
@keyframes pb-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Pierobon (magazzino interno): cerchio colorato con la "P" bianca dentro */
.semaforo-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 50%;
  color: #fff; font-size: 11px; font-weight: 800;
  border: 1px solid rgba(0,0,0,0.15);
  letter-spacing: 0;
}
.semaforo-mark strong { font-weight: 800; line-height: 1; }
.semaforo-green-p {
  color: #1e6f2c; border-color: #9bd29b; background: #d8f0d8;
  font-weight: 600;
}
.semaforo-green-p .semaforo-mark {
  background: #2e7d32; box-shadow: 0 0 4px rgba(46,125,50,0.5);
}
.semaforo-yellow-p {
  color: #8a6300; border-color: #ffd070; background: #fff2c8;
  font-weight: 600;
}
.semaforo-yellow-p .semaforo-mark {
  background: #f59f00; box-shadow: 0 0 4px rgba(245,159,0,0.5);
}
/* Pierobon state 5 — disponibile su ordinazione 24/48h: meta' giallo, meta' verde */
.semaforo-half-p {
  color: #4a5400;
  border-color: #b9d094;
  background: linear-gradient(90deg, #d8f0d8 0%, #d8f0d8 50%, #fff2c8 50%, #fff2c8 100%);
  font-weight: 600;
}
.semaforo-half-p .semaforo-mark {
  background: linear-gradient(90deg, #2e7d32 0%, #2e7d32 50%, #f59f00 50%, #f59f00 100%);
  box-shadow: 0 0 4px rgba(0,0,0,0.18);
}

/* Nota di consegna sotto al semaforo (es. "48h se ordinato entro le 11:30") */
.avail-note {
  margin-top: 4px; font-size: 11px; color: var(--pb-muted);
  font-style: italic; line-height: 1.2; max-width: 180px;
}

/* Info riga (cella artHit di Carparts) sotto alla descrizione */
.hit-info {
  margin-top: 4px; font-size: 11px; color: var(--pb-muted);
  font-style: italic; line-height: 1.3;
}
/* Tag tecnologia (es. "COTEC") */
.art-tech {
  display: inline-block; margin-top: 4px;
  padding: 1px 6px; font-size: 10px; font-weight: 700;
  letter-spacing: 0.4px; text-transform: uppercase;
  color: #5d4037; background: #f3e8db;
  border: 1px solid #d4b8a0; border-radius: 3px;
}
/* Specifiche tecniche concatenate */
.art-specs {
  margin-top: 4px; font-size: 11.5px; line-height: 1.35;
  color: #495362;
}
/* Span helper per non-wrap (es. per singolo criterio "Largh.: 130,9 mm") */
.nw { white-space: nowrap; }
/* Numeri utili (alternativi) */
.art-util {
  margin-top: 3px; font-size: 11px; color: var(--pb-muted);
}

/* Cella codice: foto + codici a sinistra, bottone Cross a destra */
.cell-codice {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
}
.codice-left {
  display: flex; align-items: center; gap: 8px;
  flex: 1 1 auto; min-width: 0;
}
.codice-thumb {
  flex-shrink: 0; width: 40px; height: 40px;
  object-fit: contain; background: #fff;
  border: 1px solid var(--pb-border); border-radius: 4px;
  padding: 2px; cursor: zoom-in;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.codice-thumb:hover {
  border-color: var(--pb-blue);
  box-shadow: 0 0 0 2px rgba(26,58,110,0.15);
  transform: scale(1.06);
}

/* Modal zoom immagine articolo */
.img-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.78);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999; cursor: zoom-out;
  animation: pb-fade-in 0.15s ease;
}
.img-modal {
  background: #fff; border-radius: 10px;
  padding: 16px; box-shadow: 0 12px 48px rgba(0,0,0,0.5);
  max-width: 92vw; max-height: 92vh;
  display: flex; align-items: center; justify-content: center;
}
.img-modal img {
  display: block;
  max-width: 90vw; max-height: 86vh;
  width: auto; height: auto;
  object-fit: contain;
  image-rendering: auto;
}
@keyframes pb-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
.codice-stack {
  display: flex; flex-direction: column; align-items: flex-start;
  flex: 0 1 auto; min-width: 0; line-height: 1.25;
}
/* Mai troncare il codice: a capo se necessario */
.codice-text { white-space: normal; word-break: break-all; line-height: 1.2; }
.codice-link {
  color: var(--pb-blue); text-decoration: none;
  border-bottom: 1px dashed transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.codice-link:hover {
  color: var(--pb-blue-dark); border-bottom-color: var(--pb-blue);
  cursor: pointer;
}
.oecode-text { font-size: 11px; opacity: 0.85; margin-top: 2px; }

/* Bottone Cross — celeste, pill-shape, gradient con hover lift */
.btn-cross {
  flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 1px 7px; font-size: 9px; font-weight: 700;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  letter-spacing: 0.4px; text-transform: uppercase;
  color: #014a73;
  background: linear-gradient(180deg, #b3e5fc 0%, #81d4fa 100%);
  border: 1px solid #4fc3f7;
  border-radius: 999px;
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(2,136,209,0.18), inset 0 1px 0 rgba(255,255,255,0.55);
  transition: all 0.15s ease;
  line-height: 1.4;
}
.btn-cross:hover {
  background: linear-gradient(180deg, #4fc3f7 0%, #29b6f6 100%);
  border-color: #0288d1; color: #fff;
  box-shadow: 0 2px 6px rgba(2,136,209,0.32);
  transform: translateY(-1px);
}
.btn-cross:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(2,136,209,0.18);
}

/* Container che impila Cross + Scheda verticalmente a destra del codice */
.codice-actions {
  display: flex; flex-direction: column; align-items: stretch;
  gap: 4px; flex-shrink: 0;
}

/* Bottone Scheda articolo — 2 righe ("Scheda" sopra, "articolo" sotto), arancione Pierobon */
.btn-scheda {
  flex-shrink: 0;
  display: inline-flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 3px 8px; font-size: 9px; font-weight: 700;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  letter-spacing: 0.4px; text-transform: uppercase;
  color: #6b3d00;
  background: linear-gradient(180deg, #ffe0b2 0%, #ffcc80 100%);
  border: 1px solid #ffb74d;
  border-radius: 12px;
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(255,152,0,0.18), inset 0 1px 0 rgba(255,255,255,0.55);
  transition: all 0.15s ease;
  line-height: 1.15;
}
.btn-scheda span { display: block; }
.btn-scheda:hover {
  background: linear-gradient(180deg, #ffb74d 0%, #ff9800 100%);
  border-color: #f57c00; color: #fff;
  box-shadow: 0 2px 6px rgba(255,152,0,0.32);
  transform: translateY(-1px);
}
.btn-scheda:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(255,152,0,0.18);
}

/* Form inline (qty + bottone +). Centrato nella cella per allinearsi con l'icona carrello in header */
.inline-form { display: inline-flex; align-items: center; gap: 4px; }
table.results td.cell-action { text-align: center; }
.qty { width: 56px; padding: 4px 6px; border: 1px solid var(--pb-border); border-radius: 4px; font-size: 14px; text-align: center; }

/* Login page */
.login-page { max-width: 420px; margin: 40px auto; background: var(--pb-card); padding: 28px; border-radius: 10px; box-shadow: var(--pb-shadow); }
.login-page h1 { margin-top: 0; color: var(--pb-blue); }
.login-form { display: flex; flex-direction: column; gap: 14px; margin-top: 16px; }
.login-form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--pb-muted); }
.login-form input {
  padding: 10px 12px; font-size: 15px;
  border: 1px solid var(--pb-border); border-radius: 6px; outline: none;
}
.login-form input:focus { border-color: var(--pb-blue); }
.muted-small { color: var(--pb-muted); font-size: 13px; margin-top: 16px; }

/* Cart */
.cart-page { background: var(--pb-card); border-radius: 8px; box-shadow: var(--pb-shadow); padding: 24px; }
.cart-page h1 { margin-top: 0; color: var(--pb-blue); }
.cart-actions { display: flex; justify-content: space-between; align-items: center; padding: 16px 0; border-top: 1px solid var(--pb-border); margin-top: 16px; }

/* Note / Comunicazioni nel carrello */
.cart-note-block { margin-top: 20px; padding: 16px; background: #fafafa; border: 1px solid var(--pb-border); border-radius: 6px; }
.cart-note-label { display: block; font-weight: 600; color: var(--pb-blue); margin-bottom: 8px; }
.cart-note-block textarea { width: 100%; padding: 10px; border: 1px solid var(--pb-border); border-radius: 4px; font-family: inherit; font-size: 14px; resize: vertical; min-height: 60px; box-sizing: border-box; }
.cart-note-block textarea:focus { outline: none; border-color: var(--pb-blue); box-shadow: 0 0 0 2px rgba(30, 79, 142, 0.15); }
.hidden-form { display: none; }

/* Error page */
.error-page { text-align: center; padding: 60px 16px; }
.error-page h1 { color: var(--pb-red); }
.error-msg { color: var(--pb-muted); margin-bottom: 24px; }

/* Order confirmed (success page) */
.order-confirmed { padding: 40px 16px; }
.success-card {
  max-width: 560px; margin: 0 auto;
  background: var(--pb-card); padding: 40px 32px;
  border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  text-align: center;
}
.success-icon {
  width: 80px; height: 80px; margin: 0 auto 20px;
  border-radius: 50%; background: var(--pb-green); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 44px; font-weight: bold;
}
.success-card h1 { color: var(--pb-green); margin: 0 0 16px; font-size: 26px; }
.order-number-line { font-size: 18px; margin: 12px 0; }
.order-num { color: var(--pb-blue); font-size: 22px; }
.items-line { color: var(--pb-muted); font-size: 15px; margin: 8px 0 20px; }
.info-msg { color: var(--pb-text); margin: 20px 0 28px; line-height: 1.6; }
.actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* Orders page */
.orders-page { background: var(--pb-card); border-radius: 8px; box-shadow: var(--pb-shadow); padding: 24px; }
.orders-page h1 { color: var(--pb-blue); margin-top: 0; }
.empty-state-card { text-align: center; padding: 40px 16px; }
.empty-state-card p { color: var(--pb-muted); margin-bottom: 20px; }

/* Order detail */
.order-detail-page {
  background: var(--pb-card); border-radius: 8px; box-shadow: var(--pb-shadow);
  padding: 24px;
}
.order-detail-page h1 { color: var(--pb-blue); margin: 8px 0 16px; }
.back-link { margin-bottom: 8px; }
.order-meta {
  display: flex; flex-wrap: wrap; gap: 24px;
  padding: 14px 16px; background: #fafbfc;
  border-radius: 6px; margin-bottom: 24px; font-size: 14px;
}
.order-meta .meta-item { color: var(--pb-text); }
.order-meta strong { color: var(--pb-muted); margin-right: 6px; font-weight: 500; }
.section-title { color: var(--pb-blue); font-size: 18px; margin: 16px 0 12px; }
.order-detail-page tfoot td { background: #f0f1f3; font-size: 15px; padding: 12px; }

.order-status {
  display: inline-block; padding: 3px 10px; border-radius: 12px;
  font-size: 12px; font-weight: 600;
}
.order-status-complete { background: #e8f5e9; color: var(--pb-green); }
.order-status-pending { background: #fff3e0; color: var(--pb-orange); }
.order-status-processing { background: #e3f2fd; color: var(--pb-blue); }
.order-status-cancelled { background: #ffebee; color: var(--pb-red); }

/* Article detail page (scheda articolo) */
.article-detail { background: var(--pb-card); border-radius: 8px; box-shadow: var(--pb-shadow); padding: 24px; }
.ad-header { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 20px; padding-bottom: 14px; border-bottom: 1px solid var(--pb-border); }
.ad-header > div:first-child { display: flex; flex-direction: column; gap: 8px; }
.ad-header h1 { color: var(--pb-blue); margin: 0; font-size: 22px; line-height: 1.3; }
.ad-tech-badge { align-self: flex-start; }
.ad-grid { display: grid; grid-template-columns: minmax(220px, 320px) 1fr; gap: 24px; margin-bottom: 20px; }
.ad-gallery { display: flex; flex-direction: column; gap: 8px; }
.ad-photo {
  display: block; background: #fff; padding: 6px;
  border: 1px solid var(--pb-border); border-radius: 6px;
  cursor: zoom-in; transition: border-color 0.15s ease, box-shadow 0.15s ease;
  width: 100%;
}
.ad-photo:hover { border-color: var(--pb-blue); box-shadow: 0 0 0 2px rgba(26,58,110,0.15); }
.ad-photo img { display: block; width: 100%; height: auto; max-height: 320px; object-fit: contain; }
.img-modal { position: relative; }
.img-modal-close {
  position: absolute; top: -10px; right: -10px;
  width: 32px; height: 32px; border-radius: 50%;
  background: #fff; color: var(--pb-blue);
  border: 1px solid var(--pb-border);
  font-size: 20px; line-height: 1; font-weight: 700;
  cursor: pointer; box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  display: flex; align-items: center; justify-content: center;
}
.img-modal-close:hover { background: var(--pb-blue); color: #fff; }
.ad-gallery-empty { color: var(--pb-muted); padding: 16px; font-style: italic; }

.ad-main { display: flex; flex-direction: column; gap: 16px; }
.ad-card { background: #fafbfc; border: 1px solid var(--pb-border); border-radius: 8px; padding: 16px 18px; margin-bottom: 16px; }
.ad-card h2 { margin: 0 0 12px; font-size: 16px; color: var(--pb-blue); border-bottom: 1px solid var(--pb-border); padding-bottom: 6px; }

.ad-info-tbl { width: 100%; border-collapse: collapse; }
.ad-info-tbl td { padding: 6px 8px; vertical-align: top; font-size: 14px; border-bottom: 1px solid #eef0f3; }
.ad-info-tbl tr:last-child td { border-bottom: none; }
.ad-info-key { color: var(--pb-muted); width: 200px; }
.ad-info-val { font-weight: 500; }

.ad-criteria { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.ad-criteria li { font-size: 13.5px; color: #2c3849; padding: 4px 0; }

/* Tabella criteri tecnici scheda articolo (look "alla Carparts": righe alternate) */
.ad-criteria-tbl { width: 100%; border-collapse: collapse; }
.ad-criteria-tbl td {
  padding: 8px 12px; font-size: 13.5px; vertical-align: top;
  line-height: 1.35; color: var(--pb-text);
}
.ad-criteria-tbl tr.ad-row-even td { background: #ffffff; }
.ad-criteria-tbl tr.ad-row-odd td { background: #f3f5f8; }
.ad-criteria-tbl .ad-crit-key {
  width: 45%; font-weight: 600; color: #495362;
  border-right: 1px solid var(--pb-border);
}
/* Valori sempre su una sola riga: niente rotture in "130,9 mm" o "47,5 mm" */
.ad-criteria-tbl .ad-crit-val {
  font-weight: 500;
  white-space: nowrap;
  word-break: keep-all;
  overflow-wrap: normal;
}

.ad-oe-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.ad-oe-group { padding: 10px 12px; background: #fff; border: 1px solid var(--pb-border); border-radius: 6px; }
.ad-oe-marca { font-weight: 700; color: var(--pb-blue); margin-bottom: 6px; font-size: 13px; }
.ad-oe-codes { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 3px; }
.ad-oe-codes li a {
  display: inline-block; font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 12.5px; color: var(--pb-text); text-decoration: none;
  padding: 1px 4px; border-radius: 3px;
}
.ad-oe-codes li a:hover { background: #e3f2fd; color: var(--pb-blue); }

.ad-vehicles { list-style: none; padding: 0; margin: 0; column-count: 2; column-gap: 24px; }
.ad-vehicles li { font-size: 13px; padding: 4px 0; break-inside: avoid; color: #2c3849; }
@media (max-width: 800px) {
  .ad-grid { grid-template-columns: 1fr; }
  .ad-vehicles { column-count: 1; }
}

/* Footer */
.footer { padding: 24px 0; color: var(--pb-muted); font-size: 13px; text-align: center; }
.footer .container { display: flex; flex-direction: column; gap: 4px; align-items: center; }
.attribution { font-size: 11px; opacity: 0.85; }

/* Attribuzione nella scheda articolo */
.ad-attribution {
  margin-top: 20px; padding-top: 14px;
  border-top: 1px solid var(--pb-border);
  color: var(--pb-muted); font-size: 12px;
  text-align: center; font-style: italic;
}
.ad-attribution strong { font-style: normal; color: var(--pb-text); font-weight: 600; }

/* Responsive */
@media (max-width: 700px) {
  .topbar-inner { height: auto; padding: 12px 0; flex-direction: column; gap: 12px; }
  .hero h1 { font-size: 24px; }
  .search-form { flex-direction: column; }
  table.results { font-size: 13px; }
  table.results th, table.results td { padding: 8px 6px; }
}
