:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --ink: #1f2430;
  --muted: #6b7280;
  --line: #e5e7eb;
  --primary: #1f3a93;
  --radius: 16px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
}
.ribbon {
  height: 6px;
  background: linear-gradient(90deg,
    #F4A6A6, #C0392B, #1E8449, #82C99A, #1F3A93, #5DADE2, #F7DC6F, #D4AC0D);
}
.wrap { max-width: 760px; margin: 32px auto; padding: 0 18px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 32px 34px;
  box-shadow: 0 6px 24px rgba(20,30,60,.06);
}
h1 { font-size: 1.9rem; line-height: 1.2; margin: .2em 0 .5em; }
h2 { font-size: 1.2rem; margin: 1.6em 0 .5em; }
.lead { color: var(--ink); margin-bottom: 1.5em; }
.lead a { color: var(--primary); }
.hint { color: var(--muted); }

/* intro swatches */
.swatches { display: flex; gap: 8px; margin-bottom: 10px; }
.dot { width: 22px; height: 22px; border-radius: 50%; display: inline-block;
       box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }

/* buttons */
.btn {
  display: inline-block; text-decoration: none; cursor: pointer;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: 12px 22px; border-radius: 999px; font-size: 1rem; font-weight: 600;
  transition: transform .05s ease, box-shadow .2s ease; margin-top: 8px;
}
.btn:hover { box-shadow: 0 4px 14px rgba(20,30,60,.12); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-small { padding: 6px 14px; font-size: .85rem; margin-left: 10px; }

/* form */
fieldset { border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; margin: 0 0 22px; }
legend { font-weight: 700; padding: 0 8px; color: var(--muted); font-size: .82rem;
         text-transform: uppercase; letter-spacing: .04em; }
.userbox .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
label { display: block; font-size: .95rem; }
.userbox input[type=text], .userbox input[type=email], .userbox input[type=tel] {
  width: 100%; padding: 10px 12px; margin-top: 5px; border: 1px solid var(--line);
  border-radius: 9px; font-size: 1rem;
}
.field-invalid { border-color: #e79a97 !important; background: #fdf4f3; }
.field-error { display: block; margin-top: 5px; color: #b91c1c; font-size: .85rem; }
.consent { margin-top: 14px; font-size: .9rem; color: var(--muted); display: flex; gap: 10px; align-items: flex-start; }
.consent input { margin-top: 4px; }
.qtext { font-weight: 600; margin: .2em 0 1em; }
.qimg { max-width: 240px; width: 100%; border-radius: 10px; margin: 0 0 14px; display: block; }
.result-img { float: right; width: 120px; border-radius: 12px; margin: 0 0 12px 18px;
              box-shadow: 0 4px 14px rgba(20,30,60,.12); }
@media (max-width: 480px){ .result-img { float: none; width: 100%; max-width: 220px; margin: 0 0 14px; } }
.answers { display: flex; flex-direction: column; gap: 6px; }
.answer {
  display: flex; gap: 12px; align-items: flex-start; padding: 11px 14px;
  border: 1px solid var(--line); border-radius: 10px; cursor: pointer;
  transition: background .12s ease, border-color .12s ease;
}
.answer:hover { background: #f9fafb; }
.answer input { margin-top: 3px; }
.answer input:checked ~ span { font-weight: 600; }
.answer:has(input:checked) { border-color: var(--primary); background: #eef1fb; }
.alert { background: #fdecea; border: 1px solid #f5c6cb; color: #a3312a;
         padding: 12px 16px; border-radius: 10px; margin-bottom: 18px; }

/* result */
.result { border-top: 6px solid var(--accent); }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .8rem;
           color: var(--muted); margin: 0; }
.result-color { display: flex; align-items: center; gap: 18px; margin: 6px 0 18px; }
.big-dot { width: 64px; height: 64px; border-radius: 50%; flex: none;
           box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.result h1 { margin: 0; }
.color-name { margin: 2px 0 0; color: var(--muted); font-weight: 600; }
.desc { font-size: 1.05rem; margin-bottom: 20px; }
.who { color: var(--muted); }

/* grid2 responsive */
@media (max-width: 560px) { .userbox .grid2 { grid-template-columns: 1fr; } }

/* admin tables */
.dist td { padding: 5px 10px; border-bottom: 1px solid var(--line); }
.dist .num, .num { text-align: right; font-variant-numeric: tabular-nums; }
.tablewrap { overflow-x: auto; }
.reports { width: 100%; border-collapse: collapse; font-size: .9rem; }
.reports th, .reports td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.reports th { color: var(--muted); font-size: .78rem; text-transform: uppercase; }

/* home quiz grid */
.quizgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 20px; }
.quizcard { display: flex; flex-direction: column; text-decoration: none; color: var(--ink);
            border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
            border-top: 5px solid var(--accent); transition: box-shadow .2s ease, transform .05s ease; }
.quizcard:hover { box-shadow: 0 8px 26px rgba(20,30,60,.12); }
.quizcard img { width: 100%; height: 130px; object-fit: cover; background: #eee; }
.quizcard-body { padding: 16px 18px; }
.quizcard-body h2 { font-size: 1.1rem; margin: 0 0 6px; }
.quizcard-body p { color: var(--muted); font-size: .88rem; margin: 0 0 10px; }
.quizcard .go { color: var(--accent); font-weight: 700; }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
@media (max-width: 560px){ .quizgrid { grid-template-columns: 1fr; } }

/* login */
.login { max-width: 420px; margin: 0 auto; }
.login form { margin-top: 14px; }
.login label { margin-bottom: 12px; }
.login input { width: 100%; padding: 10px 12px; margin-top: 5px; border: 1px solid var(--line);
               border-radius: 9px; font-size: 1rem; }

/* admin header */
.admin-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.admin-top h1 { margin: 0; }

/* bar charts */
.barchart { margin: 8px 0 10px; }
.bar-row { display: grid; grid-template-columns: minmax(120px, 260px) 1fr auto; gap: 12px;
           align-items: center; padding: 5px 0; }
.bar-row.small { grid-template-columns: minmax(120px, 320px) 1fr auto; font-size: .88rem; }
.bar-label { color: var(--ink); overflow: hidden; text-overflow: ellipsis; }
.bar-row.small .bar-label { color: var(--muted); }
.bar-track { background: #eef0f4; border-radius: 6px; height: 16px; overflow: hidden; }
.bar-row.small .bar-track { height: 12px; }
.bar-fill { height: 100%; border-radius: 6px 0 0 6px; min-width: 2px;
            box-shadow: inset 0 0 0 1px rgba(0,0,0,.06); transition: width .3s ease; }
.bar-val { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; }
.bar-val .pct { color: var(--muted); font-weight: 400; }

.freq-block { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 14px; }
.freq-q { font-weight: 600; margin: 0 0 8px; display: flex; gap: 8px; align-items: baseline; }
.freq-n { display: inline-flex; align-items: center; justify-content: center; flex: none;
          width: 22px; height: 22px; border-radius: 50%; background: var(--primary); color: #fff;
          font-size: .78rem; }
@media (max-width: 560px){
  .bar-row, .bar-row.small { grid-template-columns: 1fr auto; }
  .bar-track { grid-column: 1 / -1; order: 3; }
}

/* ricerca + righe cliccabili */
.search-box { width: 100%; padding: 10px 14px; border: 1px solid var(--line);
              border-radius: 10px; font-size: 1rem; margin: 4px 0 6px; }
.reports tbody tr { cursor: pointer; }
.reports tbody tr:hover { background: #eef1fb; }
.reports td a { color: var(--primary); font-weight: 600; text-decoration: none; }

/* dettaglio singola persona */
.kv { border-collapse: collapse; margin-top: 6px; }
.kv th { text-align: left; color: var(--muted); font-weight: 600; font-size: .82rem;
         text-transform: uppercase; letter-spacing: .03em; padding: 6px 18px 6px 0; vertical-align: top;
         white-space: nowrap; }
.kv td { padding: 6px 0; }
.dot.small { width: 14px; height: 14px; flex: none; }
.answers-given { margin-top: 6px; }
.ans-row { display: flex; align-items: flex-start; gap: 10px; padding: 9px 0;
           border-bottom: 1px solid var(--line); }
.ans-row .qn { display: inline-flex; align-items: center; justify-content: center; flex: none;
               width: 22px; height: 22px; border-radius: 50%; background: #eef0f4; color: var(--muted);
               font-size: .78rem; font-weight: 700; margin-top: 1px; }
.ans-row .dot.small { margin-top: 4px; }
.ans-txt { flex: 1; }
.ans-a { font-weight: 500; }
.ans-p { color: var(--muted); font-size: .85rem; }

/* azioni di eliminazione */
.detail-actions { display: flex; gap: 8px; align-items: center; }
.detail-actions form { margin: 0; }
.btn-danger { color: #b91c1c; border-color: #f0c4c4; background: #fff; display: inline-flex;
              align-items: center; gap: 6px; }
.btn-danger:hover { background: #fdecea; border-color: #e79a97; }
.btn-danger .ico { display: block; }
.row-actions { width: 40px; text-align: center; }
.row-actions form { margin: 0; }
.icon-btn { border: none; background: none; cursor: pointer; color: var(--muted);
            padding: 6px; border-radius: 8px; line-height: 0; display: inline-flex; }
.icon-btn:hover { background: #fdecea; color: #b91c1c; }

/* selezione multipla */
.table-toolbar { display: flex; align-items: center; justify-content: space-between;
                 gap: 12px; min-height: 34px; margin: 2px 0 6px; flex-wrap: wrap; }
.bulkbar { display: inline-flex; align-items: center; gap: 10px; }
.bulkbar #selCount { color: var(--muted); font-size: .9rem; }
.chk-col { width: 34px; text-align: center; }
.chk-col input { width: 16px; height: 16px; cursor: pointer; }

/* ===================== TOPBAR + LANG SWITCHER ===================== */
.topbar { display: flex; align-items: center; justify-content: space-between;
          max-width: 1080px; margin: 0 auto; padding: 14px 20px; }
.brand { font-weight: 800; letter-spacing: -.01em; color: var(--ink); text-decoration: none; font-size: 1.02rem; }
.langsw { display: flex; gap: 4px; }
.langsw a { text-decoration: none; color: var(--muted); font-weight: 700; font-size: .82rem;
            padding: 5px 9px; border-radius: 8px; }
.langsw a.on, .langsw a:hover { background: #eef1fb; color: var(--primary); }

/* ===================== LANDING ===================== */
.wrap:has(.hero) { max-width: 1080px; }
.grad { background: linear-gradient(90deg,#C0392B,#D4AC0D,#1E8449,#1F3A93);
        -webkit-background-clip: text; background-clip: text; color: transparent; }
.btn-lg { padding: 15px 30px; font-size: 1.06rem; }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--ink); }
.btn-dark { background: #14181f; color: #fff; border-color: #14181f; }
.btn-dark:hover { background: #000; }

.hero { display: grid; grid-template-columns: 1.15fr .85fr; gap: 40px; align-items: center;
        padding: 30px 0 46px; }
.kicker { text-transform: uppercase; letter-spacing: .08em; font-size: .8rem; font-weight: 700;
          color: var(--primary); margin: 0 0 10px; }
.hero h1 { font-size: 3.1rem; line-height: 1.05; letter-spacing: -.02em; margin: 0 0 16px; }
.hero-sub { font-size: 1.18rem; color: #47505f; margin: 0 0 24px; max-width: 34ch; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; }
.trust { color: var(--muted); font-size: .9rem; margin: 18px 0 0; }
.swatches.big { margin-top: 18px; }
.swatches.big .dot { width: 26px; height: 26px; }
.hero-book { justify-self: center; }
.hero-book img { width: 300px; max-width: 78vw; border-radius: 10px; transform: rotate(2deg);
                 box-shadow: 0 30px 60px rgba(20,20,40,.35), 0 8px 20px rgba(20,20,40,.25); }

.sec { padding: 30px 0; border-top: 1px solid var(--line); }
.sec h2 { font-size: 1.7rem; letter-spacing: -.01em; }
.sec .lead { font-size: 1.1rem; color: #47505f; max-width: 68ch; }

.colorgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 14px; }
.colorcard { display: flex; gap: 12px; align-items: center; padding: 14px; border: 1px solid var(--line);
             border-radius: 12px; border-left: 5px solid var(--c); }
.colorcard .cdot { width: 24px; height: 24px; border-radius: 50%; flex: none;
                   box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.colorcard strong { display: block; font-size: .95rem; }
.colorcard .clabel { color: var(--muted); font-size: .82rem; text-transform: capitalize; }

.cardgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
.offer { border: 1px solid var(--line); border-radius: 16px; padding: 24px; position: relative; }
.offer h3 { margin: 0 0 8px; font-size: 1.2rem; }
.offer p { color: #47505f; }
.offer.premium { border-color: #d9c56a; background: linear-gradient(180deg,#fffdf5,#fff); }
.badge { position: absolute; top: 16px; right: 16px; background: #14181f; color: #fff;
         font-size: .72rem; font-weight: 700; padding: 4px 10px; border-radius: 999px; }
.voiceform { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.voiceform input { flex: 1; min-width: 180px; padding: 12px 14px; border: 1px solid var(--line);
                   border-radius: 10px; font-size: 1rem; }
.notice { background: #eaf7ee; border: 1px solid #bfe6cb; color: #1e6b3a; padding: 12px 16px;
          border-radius: 10px; margin-bottom: 14px; }

.book { display: grid; grid-template-columns: 240px 1fr; gap: 30px; align-items: center; }
.book-cover img { width: 100%; border-radius: 10px; box-shadow: 0 18px 40px rgba(20,20,40,.28); }

.faq details { border: 1px solid var(--line); border-radius: 12px; padding: 4px 16px; margin-bottom: 10px; }
.faq summary { cursor: pointer; font-weight: 600; padding: 12px 0; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; float: right; color: var(--muted); font-weight: 700; }
.faq details[open] summary::after { content: '–'; }
.faq details p { color: #47505f; margin: 0 0 12px; }
.finalcta { text-align: center; margin-top: 24px; }

/* CTA libro nel risultato */
.book-cta { display: flex; gap: 16px; align-items: center; margin: 20px 0; padding: 16px;
            border: 1px solid var(--line); border-radius: 12px; background: #fafbfc; }
.book-cta img { width: 66px; border-radius: 6px; box-shadow: 0 6px 16px rgba(20,20,40,.2); flex: none; }
.bookteaser { margin: 0 0 8px; font-weight: 600; }
.result-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

@media (max-width: 780px) {
  .hero { grid-template-columns: 1fr; text-align: center; }
  .hero-sub { margin-left: auto; margin-right: auto; }
  .hero-cta, .swatches.big { justify-content: center; }
  .hero-book { order: -1; }
  .hero h1 { font-size: 2.4rem; }
  .colorgrid { grid-template-columns: 1fr 1fr; }
  .cardgrid, .book { grid-template-columns: 1fr; }
  .book-cover { max-width: 220px; margin: 0 auto; }
}

.site-footer { text-align: center; color: var(--muted); font-size: .82rem; padding: 24px; }
