/* GA-Soft QR: stile comune del sito. Blu oceano e grafite, chiaro e scuro. */
:root {
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-2: #eef2f7;
  --ink: #0f172a;
  --muted: #475569;
  --line: #d8dee8;
  --accent: #0369a1;
  --accent-ink: #ffffff;
  --accent-soft: #e0f2fe;
  --danger: #b91c1c;
  --danger-soft: #fee2e2;
  --ok: #166534;
  --ok-soft: #dcfce7;
  --warn-soft: #fef3c7;
  --warn-ink: #78350f;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 8px 24px rgba(15, 23, 42, .06);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1220;
    --surface: #131c2e;
    --surface-2: #1b2740;
    --ink: #e6ecf5;
    --muted: #9fb0c8;
    --line: #2a3854;
    --accent: #38bdf8;
    --accent-ink: #04263a;
    --accent-soft: #0c3350;
    --danger: #fca5a5;
    --danger-soft: #451a1a;
    --ok: #86efac;
    --ok-soft: #12351f;
    --warn-soft: #3d2f0a;
    --warn-ink: #fde68a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .3);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
img, svg { max-width: 100%; }
a { color: var(--accent); text-underline-offset: 2px; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.7rem, 4.5vw, 2.5rem); }
h2 { font-size: 1.3rem; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; border-radius: 8px; z-index: 10; }
.skip:focus { left: 8px; }

.wrap { width: 100%; max-width: 1040px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 460px; }
main { flex: 1; padding: 32px 0 56px; }

.top { background: var(--surface); border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; align-items: center; gap: 12px; min-height: 60px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; color: var(--ink); text-decoration: none; margin-right: auto; }
.brand svg { width: 28px; height: 28px; color: var(--accent); }
.nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.nav a, .nav button { padding: 8px 12px; border-radius: 8px; color: var(--ink); text-decoration: none; font: inherit; background: none; border: 0; cursor: pointer; }
.nav a:hover, .nav button:hover { background: var(--surface-2); }
.nav a[aria-current="page"] { color: var(--accent); font-weight: 600; }
.nav form { margin: 0; }
.nav .btn, .nav .btn:hover { background: var(--accent); color: var(--accent-ink); min-height: 40px; padding: 8px 14px; }
@media (max-width: 480px) { .top .wrap { padding-top: 8px; padding-bottom: 8px; } }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px; border-radius: 10px; border: 1px solid transparent;
  background: var(--accent); color: var(--accent-ink); font: inherit; font-weight: 600;
  text-decoration: none; cursor: pointer;
}
.btn:hover { filter: brightness(1.08); background: var(--accent); }
.btn.secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn.secondary:hover { background: var(--surface-2); }
.btn.danger { background: var(--danger); color: var(--surface); }
.btn.block { width: 100%; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.card + .card { margin-top: 20px; }
.grid > .card { margin-top: 0; }
.grid { display: grid; gap: 20px; }
@media (min-width: 760px) { .grid.two { grid-template-columns: 1fr 1fr; } .grid.three { grid-template-columns: repeat(3, 1fr); } }

.hero { padding: 24px 0 8px; margin-bottom: 32px; }
.hero p.lead { font-size: 1.15rem; color: var(--muted); max-width: 60ch; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }

.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; margin-bottom: 6px; }
.field .help { color: var(--muted); font-size: .88rem; margin-top: 6px; }
.field .help ul { margin: 0; padding-left: 18px; }
input[type="text"], input[type="email"], input[type="password"], input[type="url"], textarea, select {
  width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit;
}
input:focus-visible, textarea:focus-visible, select:focus-visible { outline-offset: 0; border-color: var(--accent); }
.errorlist { list-style: none; margin: 6px 0 0; padding: 0; color: var(--danger); font-size: .92rem; }

.notice { padding: 12px 16px; border-radius: 10px; margin-bottom: 20px; border: 1px solid transparent; }
.notice.ok { background: var(--ok-soft); color: var(--ok); }
.notice.error { background: var(--danger-soft); color: var(--danger); }
.notice.warn { background: var(--warn-soft); color: var(--warn-ink); }
.notice.info { background: var(--accent-soft); color: var(--ink); }
.notice form { display: inline; }
.linklike { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-decoration: underline; cursor: pointer; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.list li:first-child { border-top: 0; }
.list .grow { flex: 1; min-width: 180px; overflow-wrap: anywhere; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 600; background: var(--surface-2); color: var(--muted); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }
.empty { text-align: center; padding: 32px 16px; color: var(--muted); }

.foot { border-top: 1px solid var(--line); background: var(--surface); padding: 20px 0; color: var(--muted); font-size: .9rem; }
.foot .wrap { display: flex; gap: 16px; flex-wrap: wrap; justify-content: space-between; }
.foot a { color: var(--muted); }
.below { margin-top: 16px; }

/* Generatore */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
input[type="tel"], input[type="datetime-local"] {
  width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit;
}
input[type="color"] { width: 100%; height: 44px; padding: 4px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; }
input[type="file"] { width: 100%; font: inherit; color: var(--ink); }
textarea { resize: vertical; }
.field.check label { display: flex; align-items: center; gap: 10px; font-weight: 500; min-height: 32px; }
.field.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.field-error { color: var(--danger); font-size: .92rem; margin: 6px 0 0; }
.field-error:empty { display: none; }
[aria-invalid="true"] { border-color: var(--danger); }

.gen { margin-bottom: 32px; }
.gen-grid { display: grid; gap: 20px; align-items: start; }
.gen-grid > .card { margin-top: 0; min-width: 0; }
@media (min-width: 860px) {
  .gen-grid { grid-template-columns: minmax(0, 1fr) 380px; }
  .gen-preview { position: sticky; top: 16px; }
}
.chips { border: 0; margin: 0 0 16px; padding: 0; min-width: 0; }
.chips legend, .gen-style summary { font-weight: 700; font-size: 1.05rem; padding: 0; margin-bottom: 12px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.chip span { display: inline-flex; align-items: center; min-height: 40px; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; font-size: .95rem; }
.chip input:hover + span { background: var(--surface-2); }
.chip input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }
.gen-style { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 16px; }
.gen-style summary { cursor: pointer; margin-bottom: 0; }
.gen-style[open] summary { margin-bottom: 16px; }
.grid.tight { gap: 0 16px; }
@media (max-width: 759px) { .grid.tight { grid-template-columns: 1fr 1fr; } }
.gen-canvas-box { display: grid; place-items: center; min-height: 220px; border-radius: 10px; background: var(--surface-2); padding: 16px; margin-bottom: 16px; text-align: center; }
.gen-canvas-box canvas { width: 100%; max-width: 300px; height: auto; border-radius: 6px; box-shadow: var(--shadow); }
.gen-canvas-box.transparent canvas { background: repeating-conic-gradient(#d9dee6 0% 25%, #ffffff 0% 50%) 0 0 / 20px 20px; }
.gen-canvas-box p { margin: 0; }
.gen-advice { list-style: none; margin: 0; padding: 0; }
.gen-advice .notice { margin-bottom: 12px; font-size: .92rem; padding: 10px 12px; }
.gen-preview .actions { margin-top: 0; }
.gen-preview .actions .btn { flex: 1 0 auto; padding-left: 12px; padding-right: 12px; white-space: nowrap; }
.cta { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between; margin-bottom: 32px; }
.cta > div:first-child { flex: 1 1 320px; }
.cta p, .cta .actions { margin: 0; }

/* Area personale: QR salvati e statistiche */
.narrow.wide { max-width: 620px; }
.head-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.head-row h1, .head-row h2 { margin: 0; overflow-wrap: anywhere; }
.head-row .actions { margin: 0; }
a.strong { font-weight: 700; color: var(--ink); }
.badge.warn { background: var(--warn-soft); color: var(--warn-ink); }
.label { display: block; font-weight: 600; margin-bottom: 6px; }
.code-line { display: block; margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); font: .92rem/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; overflow-wrap: anywhere; white-space: pre-wrap; max-height: 180px; overflow: auto; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.danger-text { color: var(--danger); }
.gen-grid + .card, .stats + .card { margin-top: 20px; }
.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; margin: 0 0 20px; }
.figures div { background: var(--surface-2); border-radius: 10px; padding: 12px 14px; }
.figures dt { color: var(--muted); font-size: .88rem; }
.figures dd { margin: 0; font-size: 1.7rem; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.figures dd.small-figure { font-size: 1rem; padding-top: 8px; }
.chart { display: block; width: 100%; height: auto; }
.chart .bar { fill: var(--accent); }
.chart .grid-line { stroke: var(--line); stroke-width: 1; }
.chart .tick { fill: var(--muted); font-size: 11px; font-family: inherit; }
.table { width: 100%; border-collapse: collapse; margin-top: 12px; }
.table th, .table td { text-align: left; padding: 8px 4px; border-top: 1px solid var(--line); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
details > summary { cursor: pointer; }
.breakdowns { margin-top: 24px; }
.breakdowns h3 { font-size: 1rem; }
.bars { list-style: none; margin: 0; padding: 0; }
.bars li { display: grid; grid-template-columns: minmax(70px, 1fr) 2fr auto; gap: 10px; align-items: center; padding: 5px 0; font-size: .92rem; }
.bars-label { overflow-wrap: anywhere; }
.bars-value { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.bars progress { width: 100%; height: 10px; appearance: none; -webkit-appearance: none; border: 0; border-radius: 999px; background: var(--surface-2); overflow: hidden; accent-color: var(--accent); }
.bars progress::-webkit-progress-bar { background: var(--surface-2); border-radius: 999px; }
.bars progress::-webkit-progress-value { background: var(--accent); border-radius: 999px; }
.bars progress::-moz-progress-bar { background: var(--accent); border-radius: 999px; }
@media (max-width: 859px) {
  #qr-saved .gen-preview { order: -1; }
  .chart .tick { font-size: 19px; }
}

/* Demo */
.demo-banner { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.demo-banner .btn { min-height: 40px; padding: 6px 14px; }
.lead-small { font-size: 1.08rem; max-width: 70ch; }
.grid.below { margin-top: 20px; }
.menu dl { margin: 0; }
.menu dl > div { display: grid; grid-template-columns: 1fr auto; gap: 0 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.menu dl > div:first-child { border-top: 0; }
.menu dt { font-weight: 600; }
.menu dd { margin: 0; font-variant-numeric: tabular-nums; white-space: nowrap; }
.menu dl p { grid-column: 1 / -1; margin: 2px 0 0; }

/* Settori */
.sectors { margin: 8px 0 32px; }
.sector-card { display: flex; flex-direction: column; }
.sector-card h3 { font-size: 1.15rem; }
.sector-card h3 a { color: var(--ink); }
.sector-card p.muted { flex: 1; }
.sector-links { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; margin: 0; }
.sector-links .btn { min-height: 40px; padding: 6px 14px; }
.below-lg { margin-top: 20px; }
.foot-links { display: flex; flex-wrap: wrap; gap: 6px 16px; justify-content: flex-start; padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
