:root {
  color-scheme: light;
  --bg: #eef2f6;
  --panel: #ffffff;
  --ink: #152033;
  --muted: #64748b;
  --line: #d8e0ea;
  --brand: #0f766e;
  --brand-dark: #115e59;
  --brand-soft: #ccfbf1;
  --accent: #f59e0b;
  --good: #16a34a;
  --shadow: 0 18px 45px rgba(15, 23, 42, .08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: linear-gradient(135deg, #ecfeff 0%, var(--bg) 42%, #f8fafc 100%);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

.app {
  width: min(1200px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0;
}

.hero {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 24px;
  align-items: stretch;
  margin-bottom: 20px;
}

.hero > div:first-child,
.total-card,
.panel {
  background: rgba(255, 255, 255, .88);
  border: 1px solid rgba(216, 224, 234, .8);
  border-radius: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.hero > div:first-child {
  padding: 34px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--brand);
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 12px;
  font-size: clamp(2.1rem, 6vw, 4.4rem);
  letter-spacing: -.06em;
  line-height: .95;
}

h2 {
  margin-bottom: 0;
  font-size: 1.05rem;
}

.hero p:last-child {
  max-width: 700px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.total-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 24px;
  position: sticky;
  top: 12px;
}

.total-card span,
.total-card small,
.note,
#compareHint,
.section-sub {
  color: var(--muted);
}

.total-card strong {
  display: block;
  margin: 8px 0;
  font-size: 2.7rem;
  letter-spacing: -.05em;
}

.total-card button {
  margin-top: 12px;
  align-self: flex-start;
}

.panel {
  padding: 20px;
  margin-bottom: 20px;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: end;
}

.control {
  display: grid;
  gap: 8px;
}

.control.grow {
  flex: 1;
  min-width: 220px;
}

.control-label {
  color: var(--muted);
  font-weight: 700;
  font-size: .9rem;
}

.segmented {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
}

.segmented button {
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 11px 18px;
  font-weight: 800;
  color: var(--muted);
  cursor: pointer;
}

.segmented button + button {
  border-left: 1px solid var(--line);
}

.segmented button.active {
  background: var(--brand);
  color: #fff;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  background: #fff;
  color: var(--ink);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 16px;
  background: rgba(255, 255, 255, .9);
  color: #334155;
  cursor: pointer;
  font-weight: 800;
  font-size: .92rem;
}

.chip:hover {
  border-color: var(--brand);
}

.chip.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.section-icon {
  margin-right: 8px;
}

.section-sub {
  font-size: .9rem;
}

.badge {
  display: inline-block;
  margin-left: 6px;
  border-radius: 999px;
  padding: 3px 10px;
  background: #fef3c7;
  color: #92400e;
  font-size: .72rem;
  font-weight: 800;
  vertical-align: middle;
}

button {
  border: 0;
  border-radius: 999px;
  padding: 9px 14px;
  background: #e2e8f0;
  color: #334155;
  cursor: pointer;
  font-weight: 800;
}

button:hover {
  background: #cbd5e1;
}

/* ---------- Foto prodotto ---------- */

.thumb {
  width: 86px;
  height: 52px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 3px;
  cursor: zoom-in;
  flex-shrink: 0;
}

.thumb.big {
  width: 150px;
  height: 92px;
}

.mini-card .thumb {
  width: 100%;
  height: 84px;
  border: 0;
  padding: 0;
  margin-bottom: 2px;
}

.row-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.row-head small {
  display: block;
  color: var(--muted);
  font-weight: 500;
  white-space: normal;
  max-width: 210px;
  line-height: 1.25;
  margin-top: 2px;
}

.gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 14px;
}

.gallery figure {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 8px 14px 8px 8px;
  background: #fff;
}

.gallery figcaption {
  color: var(--muted);
  font-size: .84rem;
  max-width: 300px;
  line-height: 1.3;
}

#lightbox {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, .78);
  z-index: 50;
  cursor: zoom-out;
  padding: 24px;
}

#lightbox.open {
  display: flex;
}

#lightbox img {
  max-width: min(920px, 100%);
  max-height: 85vh;
  background: #fff;
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .4);
}

/* ---------- Tabelle prezzi ---------- */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}

thead th {
  text-align: left;
  padding: 12px 14px;
  background: #f8fafc;
  color: var(--muted);
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

tbody th {
  text-align: left;
  padding: 10px 14px;
  font-size: .95rem;
  white-space: nowrap;
  border-bottom: 1px solid #eef2f7;
}

tbody td {
  padding: 6px;
  border-bottom: 1px solid #eef2f7;
}

tr.group-row td {
  padding: 10px 14px 6px;
  background: #f0fdfa;
  color: var(--brand-dark);
  font-weight: 800;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.cell {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 8px 10px;
  background: transparent;
  color: var(--brand-dark);
  font-weight: 800;
  font-size: .98rem;
  letter-spacing: -.02em;
  text-align: center;
  cursor: pointer;
  white-space: nowrap;
}

.cell:hover {
  background: var(--brand-soft);
  border-color: #99f6e4;
}

.cell.selected {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, .18);
}

.cell small {
  display: block;
  font-weight: 600;
  color: inherit;
  opacity: .7;
}

.cell-empty {
  text-align: center;
  color: var(--muted);
}

/* ---------- Mini cards (Dragonfly, NEO, luci) ---------- */

.mini-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.mini-cards:last-child {
  margin-bottom: 0;
}

.mini-card {
  display: grid;
  gap: 4px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  background: #fff;
  cursor: pointer;
  transition: .16s ease;
}

.mini-card:hover {
  transform: translateY(-2px);
  border-color: #99f6e4;
  background: #fff;
}

.mini-card.selected {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, .14);
  background: #f0fdfa;
}

.mini-card b {
  font-size: .98rem;
}

.mini-card span {
  color: var(--muted);
  font-size: .8rem;
}

.mini-card strong {
  color: var(--brand-dark);
  font-size: 1.35rem;
  font-weight: 900;
  letter-spacing: -.04em;
}

.mini-card .tick {
  font-style: normal;
  font-size: .8rem;
  font-weight: 800;
  color: var(--brand);
}

.mini-card.light.selected .tick {
  color: var(--good);
}

/* ---------- Confronto & riepilogo ---------- */

.comparison {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.compare-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  background: #fff;
}

.compare-card.active {
  border-color: var(--brand);
  background: #f0fdfa;
}

.compare-card.saving {
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.compare-card.saving strong {
  color: var(--good);
}

.compare-card b {
  display: block;
  margin-bottom: 6px;
  font-size: .88rem;
}

.compare-card strong {
  display: block;
  color: var(--brand-dark);
  font-size: 1.35rem;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.summary-item {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  background: #fff;
}

.summary-item span {
  display: block;
  color: var(--muted);
  font-size: .86rem;
  margin-bottom: 4px;
}

.summary-item strong {
  display: block;
  margin-top: 4px;
  color: var(--brand-dark);
  font-size: 1.2rem;
}

.note {
  margin: 14px 0 0;
  font-size: .86rem;
}

.empty {
  color: var(--muted);
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 16px;
  background: #fff;
}

@media (max-width: 900px) {
  .hero,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .total-card {
    position: static;
  }

  .filters {
    flex-direction: column;
    align-items: stretch;
  }

  .segmented {
    display: flex;
  }

  .segmented button {
    flex: 1;
  }
}
