/* ==========================================================================
   app.css — layout & design SerpTune (si appoggia ai token di a11y.css).
   Caricato DOPO a11y.css: non tocca focus/contrasto/reduced-motion.
   ========================================================================== */

:root {
  --bg-soft: #f4f7fb;        /* sfondo pagina */
  --panel: #ffffff;          /* card/pannelli */
  --accent-strong: #094a8c;
  --accent-soft: #e8f0fa;    /* riempimenti tenui accent */
  --border-soft: #d9e0ea;    /* bordi decorativi (non campi) */
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16,32,64,.06), 0 6px 20px rgba(16,32,64,.06);
  --maxw: 1120px;
  --warn: #9a6a00;           /* livello "medio" (ambra), leggibile su chiaro */
}

body {
  background: var(--bg-soft);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* --- Tipografia ----------------------------------------------------------- */
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.9rem, 1.3rem + 2.4vw, 2.9rem); font-weight: 800; }
h2 { font-size: clamp(1.4rem, 1.1rem + 1.2vw, 1.9rem); font-weight: 700; margin-top: 1.6rem; }
h3 { font-size: 1.2rem; font-weight: 700; }
p { margin: 0 0 1rem; }
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-strong); }
strong { font-weight: 700; }

/* --- Header / navigazione ------------------------------------------------- */
header {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; flex-wrap: wrap; gap: .6rem 1.4rem;
  padding: .85rem clamp(1rem, 4vw, 2rem);
  background: var(--panel);
  border-bottom: 1px solid var(--border-soft);
}
.brand {
  font-size: 1.35rem; font-weight: 800; letter-spacing: -.02em;
  color: var(--accent); text-decoration: none; margin-right: auto;
}
.brand::before { content: "◧ "; color: var(--accent); }
/* ordine desktop: brand … [nav principale] [selettore lingua] */
.brand { order: 0; }
.site-nav { order: 1; display: flex; align-items: center; flex-wrap: wrap; gap: .4rem 1.4rem; }
/* i tre controlli (tema, lingua, hamburger) restano SEMPRE sulla stessa riga */
.nav-controls { order: 2; display: flex; align-items: center; flex-wrap: nowrap; gap: .5rem; }
.nav-toggle { display: none; }   /* hamburger: solo sotto il breakpoint mobile */
header nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .9rem; }
header nav a, .linkish {
  color: var(--text); text-decoration: none; font-weight: 600; font-size: .96rem;
  padding: .4rem .55rem; border-radius: 6px; display: inline-block;
}
header nav a:hover { color: var(--accent); background: var(--accent-soft); }
.logout-form { margin: 0; display: inline; }

/* --- Selettore lingua (dropdown <details>, fuori dal menu) ---------------- */
.lang-select { position: relative; }
.lang-select summary {
  list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: .4rem;
  padding: .4rem .75rem; min-height: 40px;
  border: 1px solid var(--border-soft); border-radius: 999px; background: var(--panel);
  font-weight: 700; font-size: .88rem; color: var(--text);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.lang-select summary::-webkit-details-marker { display: none; }
.lang-select summary::marker { content: ""; }
.lang-select summary:hover { border-color: var(--accent); }
.lang-select[open] summary { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.lang-globe { color: var(--accent); flex: none; }
.lang-chevron { color: var(--muted); flex: none; transition: transform .2s ease; }
.lang-select[open] .lang-chevron { transform: rotate(180deg); }
.lang-select > ul {
  position: absolute; right: 0; top: calc(100% + .5rem); z-index: 60;
  list-style: none; margin: 0; padding: .4rem; min-width: 200px;
  background: var(--panel); border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm); box-shadow: var(--shadow);
  display: grid; gap: .1rem; animation: lang-in .16s ease;
}
@keyframes lang-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.lang-select > ul a {
  display: flex; align-items: center; gap: .6rem; padding: .5rem .55rem;
  border-radius: 6px; text-decoration: none; color: var(--text); font-weight: 600; font-size: .92rem;
}
.lang-select > ul a:hover { background: var(--accent-soft); color: var(--accent-strong); }
.lang-select > ul a[aria-current="true"] { background: var(--accent-soft); color: var(--accent-strong); }
.lang-code {
  font-size: .7rem; font-weight: 800; color: var(--muted); background: var(--bg-soft);
  border-radius: 5px; padding: .15rem .4rem; min-width: 2.2em; text-align: center; letter-spacing: .03em;
}
.lang-select > ul a[aria-current="true"] .lang-code { color: var(--accent-strong); background: #fff; }
.linkish { background: none; border: none; cursor: pointer; font: inherit; font-weight: 600; }
.linkish:hover { color: var(--accent); background: var(--accent-soft); }

/* --- Layout principale ---------------------------------------------------- */
main { max-width: var(--maxw); margin-inline: auto; padding: clamp(1.5rem, 4vw, 3rem) clamp(1rem, 4vw, 2rem); }
main > section, main > article { margin-bottom: 2.75rem; }
main > section:last-child { margin-bottom: 0; }

/* --- Hero ----------------------------------------------------------------- */
.hero {
  background: linear-gradient(135deg, #0b5cad 0%, #0a3f7a 100%);
  color: #fff; border-radius: var(--radius); padding: clamp(1.8rem, 4vw, 3.2rem);
  box-shadow: var(--shadow);
}
.hero-kicker { text-transform: uppercase; letter-spacing: .09em; font-size: .8rem; font-weight: 700;
  color: #bcd6f2; margin: 0 0 .55rem; }
.hero h1 { color: #fff; max-width: 20ch; }
.hero p:not(.hero-kicker) { color: #dce9f7; font-size: 1.15rem; margin: 0; max-width: 60ch; }

/* --- "Cosa fa" (what-it-does): spiega esplicitamente il prodotto ---------- */
.what-it-does { margin-top: 2.4rem; }
.wid-cards { list-style: none; padding: 0; margin: 1.4rem 0 1.2rem; display: grid; gap: 1.1rem;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.wid-cards li { background: var(--panel); border: 1px solid var(--border-soft); border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm); padding: 1.1rem 1.2rem; box-shadow: var(--shadow); }
.wid-cards h3 { color: var(--accent); font-size: 1.05rem; margin-bottom: .4rem; }
.wid-cards p { margin: 0; color: var(--muted); font-size: .95rem; }
.wid-outcome { font-size: 1.12rem; margin: .2rem 0 .3rem; }
.wid-who { color: var(--muted); margin: 0; }
.hero-cta { margin: 1.4rem 0 0; }
.btn-hero { display: inline-block; text-decoration: none; font-weight: 700; color: #fff;
  border: 2px solid rgba(255,255,255,.6); border-radius: 6px; padding: .55rem 1.2rem; }
.btn-hero:hover { background: rgba(255,255,255,.15); color: #fff; border-color: #fff; }

/* --- Form "analizza" e form generici ------------------------------------- */
#start-form, .auth form, .contact form {
  background: var(--panel); border: 1px solid var(--border-soft);
  border-radius: var(--radius); padding: clamp(1.2rem, 3vw, 2rem);
  box-shadow: var(--shadow); max-width: 46rem;
}
#start-form .btn-primary, .auth .btn-primary, .contact .btn-primary { margin-top: .5rem; }

/* --- Bottoni (estende a11y .btn-primary) --------------------------------- */
.btn-primary { padding: .7rem 1.5rem; font-size: 1rem; box-shadow: 0 1px 2px rgba(11,92,173,.35); }
.buy .btn-primary { width: 100%; }

/* --- Billing toggle (monthly / annual) ----------------------------------- */
.billing-toggle {
  display: inline-flex; gap: .25rem; margin: 1rem 0 .25rem;
  background: var(--panel); border: 1px solid var(--border-soft);
  border-radius: 999px; padding: .25rem;
}
.billing-toggle a {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .45rem 1rem; border-radius: 999px; text-decoration: none;
  color: var(--muted); font-weight: 600; line-height: 1;
}
.billing-toggle a.is-active { background: var(--accent); color: #fff; }
.billing-toggle .save-badge {
  font-size: .72rem; font-weight: 700; padding: .12rem .45rem; border-radius: 999px;
  background: rgba(11,92,173,.12); color: var(--accent);
}
.billing-toggle a.is-active .save-badge { background: rgba(255,255,255,.25); color: #fff; }

/* --- Pricing (ul.cards > li) --------------------------------------------- */
.cards {
  list-style: none; margin: 1rem 0 0; padding: 0;
  display: grid; gap: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}
.cards > li {
  background: var(--panel); border: 1px solid var(--border-soft);
  border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: .4rem;
}
.cards > li h3 { margin-bottom: .2rem; }
.price { font-size: 2rem; font-weight: 800; color: var(--text); margin: .1rem 0 .3rem; letter-spacing: -.02em; }
.price span { font-size: .95rem; font-weight: 600; color: var(--muted); margin-left: .3rem; }
.cards .buy, .cards form { margin-top: auto; padding-top: .8rem; }
.badge {
  display: inline-block; background: var(--accent-soft); color: var(--accent-strong);
  font-size: .78rem; font-weight: 700; padding: .2rem .55rem; border-radius: 999px;
  text-transform: uppercase; letter-spacing: .03em;
}

/* --- Report / pSEO -------------------------------------------------------- */
.report, .pseo { background: var(--panel); border: 1px solid var(--border-soft);
  border-radius: var(--radius); padding: clamp(1.3rem, 3vw, 2.4rem); box-shadow: var(--shadow); }
.report h2 { border-bottom: 2px solid var(--accent-soft); padding-bottom: .3rem; }
.report-q { color: var(--muted); font-style: italic; }
.report ul, .pseo ul { padding-left: 1.2rem; }
.report li, .pseo li { margin-bottom: .5rem; }
.actions { list-style: none; padding: 0; display: grid; gap: .9rem; }
.actions > li {
  border: 1px solid var(--border-soft); border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm); padding: .9rem 1.1rem; background: #fbfdff;
}
.actions > li h3, .actions > li h4 { margin: 0 0 .3rem; }

/* --- Progress (SSE) ------------------------------------------------------- */
.progress { list-style: none; padding: 0; margin: 1.2rem 0; display: grid; gap: .5rem; max-width: 40rem; }
.progress li {
  padding: .65rem 1rem; border: 1px solid var(--border-soft); border-radius: var(--radius-sm);
  background: var(--panel); display: flex; align-items: center; gap: .6rem; box-shadow: var(--shadow);
}
.progress li::before { content: "○"; color: var(--muted); }
.progress li.is-done::before { content: "✓"; color: var(--success); font-weight: 700; }
.progress li.is-active { border-color: var(--accent); }
.progress li.is-active::before { content: "◐"; color: var(--accent); }

/* --- Publish bar / note --------------------------------------------------- */
.publish-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .8rem;
  background: var(--accent-soft); border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm); padding: .8rem 1.1rem; margin-bottom: 1.3rem; }
.publish-bar form { margin: 0; }
.pub-note { color: var(--muted); font-size: .9rem; }

/* --- CTA / lede ----------------------------------------------------------- */
.lede { font-size: 1.15rem; color: var(--muted); max-width: 60ch; }
.cta { margin-top: 1.4rem; }
.cta .btn-primary { text-decoration: none; }

/* --- Documenti legali ----------------------------------------------------- */
.legal { background: var(--panel); border: 1px solid var(--border-soft);
  border-radius: var(--radius); padding: clamp(1.4rem, 3vw, 2.6rem); box-shadow: var(--shadow);
  max-width: 60rem; margin-inline: auto; }
.legal-back a { font-weight: 600; text-decoration: none; }
.legal h1 { margin-top: .4rem; }
.legal-meta { color: var(--muted); font-size: .9rem; margin-top: -.2rem; }
.legal-lead { font-size: 1.05rem; color: var(--muted); }
.legal-body h2 { font-size: 1.15rem; margin-top: 1.8rem; padding-bottom: .3rem;
  border-bottom: 1px solid var(--border-soft); }
.legal-body p, .legal-body li { color: #2b2b2b; }
.legal-body ul { padding-left: 1.2rem; }
.legal-body li { margin-bottom: .45rem; }
.legal-body code { background: var(--bg-soft); border-radius: 4px; padding: .1rem .35rem; font-size: .9em; }
.legal-table { width: 100%; border-collapse: collapse; margin: .8rem 0; font-size: .95rem; }
.legal-table th, .legal-table td { border: 1px solid var(--border-soft); padding: .5rem .7rem; text-align: left; vertical-align: top; }
.legal-table thead th { background: var(--bg-soft); }

/* --- 2FA ------------------------------------------------------------------ */
.twofa { max-width: 30rem; }
.twofa input[name="code"] { letter-spacing: .35em; font-size: 1.3rem; text-align: center; max-width: 12rem; }
.tfa-qr { width: 220px; max-width: 100%; margin: 1.2rem 0; }
.tfa-qr svg { width: 100%; height: auto; display: block; border: 1px solid var(--border-soft); border-radius: 10px; background: #fff; }
.tfa-manual { color: var(--muted); font-size: .92rem; }
.tfa-manual code { background: var(--bg-soft); padding: .35rem .55rem; border-radius: 6px; font-size: 1rem; letter-spacing: .08em; word-break: break-all; }
.tfa-recovery { margin-top: 1.4rem; }
.tfa-recovery summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.tfa-recovery summary::-webkit-details-marker { color: var(--accent); }
.recovery-codes { list-style: none; padding: 1.1rem; margin: 1.1rem 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: .55rem;
  background: var(--bg-soft); border: 1px solid var(--border-soft); border-radius: var(--radius-sm); }
.recovery-codes li { text-align: center; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 1.05rem; letter-spacing: .06em; }
.twofa a.btn-primary { display: inline-block; text-decoration: none; }
.auth-links { font-size: .9rem; color: var(--muted); }
.btn-danger { font: inherit; font-weight: 700; cursor: pointer; background: var(--error); color: #fff;
  border: 2px solid transparent; border-radius: 6px; padding: .6rem 1.3rem; }
.btn-danger:hover { background: #8f1e17; }

/* --- Admin dashboard ------------------------------------------------------ */
.admin-head { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1.4rem; margin-bottom: 1.5rem; }
.admin-head h1 { margin: 0; font-size: 1.6rem; }
.admin-tabs { display: flex; flex-wrap: wrap; gap: .4rem; }
.admin-tabs a { text-decoration: none; font-weight: 600; font-size: .92rem; color: var(--text);
  padding: .4rem .8rem; border-radius: 999px; border: 1px solid var(--border-soft); background: var(--panel); }
.admin-tabs a:hover { border-color: var(--accent); color: var(--accent); }
.admin-tabs a.is-active { background: var(--accent); color: #fff; border-color: var(--accent); }
.admin h2 { font-size: 1.15rem; margin: 2rem 0 .8rem; }
.admin h3 { font-size: 1.05rem; margin: 1.8rem 0 .6rem; }

.kpi-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.kpi { background: var(--panel); border: 1px solid var(--border-soft); border-radius: var(--radius-sm);
  padding: 1rem 1.1rem; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: .25rem; }
.kpi-label { color: var(--muted); font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.kpi-value { font-size: 1.7rem; font-weight: 800; letter-spacing: -.02em; }
.kpi-sub { color: var(--muted); font-size: .82rem; }

/* External service credits panel */
.svc-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); margin-bottom: 1.5rem; }
.svc-card { background: var(--panel); border: 1px solid var(--border-soft); border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm); padding: 1rem 1.1rem; box-shadow: var(--shadow); }
.svc-card.is-low { border-left-color: #c0392b; }
.svc-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .5rem; }
.svc-badge { font-size: .72rem; font-weight: 800; padding: .12rem .5rem; border-radius: 999px; }
.svc-badge.is-ok { background: var(--accent-soft); color: var(--accent-strong); }
.svc-badge.is-low { background: #fdecea; color: #c0392b; }
.svc-bar { height: 8px; border-radius: 999px; background: var(--accent-soft); overflow: hidden; }
.svc-fill { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.svc-fill.is-low { background: #c0392b; }
.svc-meta { font-size: .84rem; color: var(--muted); margin: .5rem 0 .6rem; }
.svc-form { display: flex; flex-wrap: wrap; align-items: end; gap: .5rem; }
.svc-form label { font-size: .78rem; color: var(--muted); font-weight: 600; display: flex; flex-direction: column; gap: .2rem; }
.svc-form input { width: 6.5rem; padding: .35rem .5rem; border: 1px solid var(--border-soft); border-radius: 6px;
  background: var(--panel); color: var(--text); font: inherit; }

.table-wrap { overflow-x: auto; border: 1px solid var(--border-soft); border-radius: var(--radius-sm); background: var(--panel); }
.admin-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.admin-table th, .admin-table td { padding: .55rem .7rem; text-align: left; border-bottom: 1px solid var(--border-soft); white-space: nowrap; }
.admin-table thead th { background: var(--bg-soft); font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.admin-table tbody tr:last-child td { border-bottom: none; }
.admin-table tbody tr:hover { background: var(--accent-soft); }
.admin-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.admin-table .mono, .mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: .82em; }
.admin-table a { color: var(--accent); text-decoration: none; }
.admin-table a:hover { text-decoration: underline; }

.badge-status { display: inline-block; font-size: .74rem; font-weight: 700; padding: .12rem .5rem; border-radius: 999px; text-transform: capitalize; }
.badge-status.ok { background: #e6f4ec; color: var(--success); }
.badge-status.bad { background: #fce8e6; color: var(--error); }
.badge-status.neutral { background: var(--bg-soft); color: var(--muted); }

.admin-facts { display: grid; gap: .8rem 1.4rem; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  background: var(--panel); border: 1px solid var(--border-soft); border-radius: var(--radius-sm); padding: 1.2rem; box-shadow: var(--shadow); }
.admin-facts > div { display: flex; flex-direction: column; gap: .1rem; }
.admin-facts span { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; }
.admin-back a, .admin-facts .mono { font-size: .85rem; }
.admin-note { color: var(--muted); font-size: .85rem; font-weight: 400; }
.admin-actions { margin: 1.2rem 0; padding: 1.1rem 1.3rem; background: var(--accent-soft); border: 1px solid var(--border-soft); border-radius: var(--radius-sm); display: flex; flex-wrap: wrap; align-items: center; gap: .8rem 1.2rem; }
.admin-actions h3 { margin: 0; width: 100%; font-size: 1rem; }
.impersonate-bar { background: #7a5c00; color: #fff; text-align: center; padding: .5rem 1rem; font-size: .9rem; font-weight: 600; }
.impersonate-bar a { color: #fff; text-decoration: underline; }

/* log colorati: warning=giallo, error=rosso */
.admin-table tr.log-warning td { background: #fff8e1; }
.admin-table tr.log-warning:hover td { background: #ffefc0; }
.admin-table tr.log-error td { background: #fdecea; }
.admin-table tr.log-error:hover td { background: #fbdbd6; }
.badge-status.warn { background: #fff3cd; color: #7a5c00; }

/* card "Prova" (1 credito) evidenziata nel pricing */
.cards > li.is-trial { border: 2px solid var(--accent); box-shadow: 0 6px 24px rgba(11,92,173,.14); }
.badge-trial { align-self: flex-start; background: var(--accent); color: #fff; }
.trial-hint { color: var(--muted); font-size: .88rem; margin-top: -.1rem; }

/* --- Barra azioni report + liste account ---------------------------------- */
.report-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem; margin-bottom: 1rem; }
.report-actions select { font: inherit; padding: .4rem .5rem; border: 1px solid var(--border-soft); border-radius: 6px; }
.acc-list { list-style: none; padding: 0; margin: .4rem 0 1.4rem; display: grid; gap: .5rem; }
.acc-list li { display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem 1rem;
  padding: .6rem .8rem; background: var(--panel); border: 1px solid var(--border-soft); border-radius: var(--radius-sm); }
.acc-list a { font-weight: 600; text-decoration: none; color: var(--accent); }
.muted-inline { color: var(--muted); font-size: .88rem; }

/* --- How it works + blog -------------------------------------------------- */
.hiw-steps { list-style: none; padding: 0; margin: 1.2rem 0; display: grid; gap: 1.2rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.hiw-steps li { background: var(--panel); border: 1px solid var(--border-soft); border-radius: var(--radius-sm);
  padding: 1.3rem; box-shadow: var(--shadow); }
.hiw-steps h3 { color: var(--accent); font-size: 1.05rem; margin-bottom: .4rem; }
.hiw-links { color: var(--muted); }
.blog-list { list-style: none; padding: 0; margin: 1.4rem 0; display: grid; gap: 1.3rem; }
.blog-list li { background: var(--panel); border: 1px solid var(--border-soft); border-radius: var(--radius);
  padding: 1.4rem 1.6rem; box-shadow: var(--shadow); }
.blog-list h2 { margin: 0 0 .2rem; font-size: 1.25rem; }
.blog-list a { text-decoration: none; }
.blog-post { max-width: 46rem; }
.blog-post .legal-body h2 { border-bottom: none; font-size: 1.3rem; }
.blog-cta { margin-top: 2rem; }
.legal-body pre { background: #0f1b2d; color: #e6edf3; padding: 1rem 1.1rem; border-radius: 8px;
  overflow-x: auto; font-size: .85rem; line-height: 1.5; }
.legal-body pre code { background: none; padding: 0; color: inherit; font-size: inherit; }
.api-key-show { background: var(--bg-soft); border: 1px solid var(--border-soft); border-radius: 6px;
  padding: .6rem .8rem; word-break: break-all; }

/* --- Stampa / salva PDF del report ---------------------------------------- */
@media print {
  header, .site-footer, .footer-bar, .publish-bar, .report-actions, .skip-link, .lang-select, .nav-toggle { display: none !important; }
  body { background: #fff; color: #000; }
  main { max-width: none; margin: 0; padding: 0; }
  .report { border: none; box-shadow: none; padding: 0; }
  a[href]::after { content: ""; }
}

/* --- Footer --------------------------------------------------------------- */
.site-footer { margin-top: 3rem; border-top: 1px solid var(--border-soft); background: var(--panel); }
.footer-inner {
  max-width: var(--maxw); margin-inline: auto; padding: clamp(2rem, 4vw, 3rem) clamp(1rem, 4vw, 2rem);
  display: grid; gap: 2rem; grid-template-columns: 1.6fr 1fr 1fr 1.4fr;
}
.footer-brand .brand { font-size: 1.3rem; }
.footer-tag { color: var(--muted); font-size: .92rem; margin-top: .6rem; max-width: 34ch; }
.footer-col h2 { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); margin-bottom: .8rem; }
.footer-col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.footer-col a { color: var(--text); text-decoration: none; font-size: .93rem; }
.footer-col a:hover { color: var(--accent); }
.footer-company address { font-style: normal; color: var(--muted); font-size: .9rem; line-height: 1.7; }
.footer-company a { color: var(--accent); }
.footer-bar { border-top: 1px solid var(--border-soft); }
.footer-bar p { max-width: var(--maxw); margin-inline: auto; padding: 1rem clamp(1rem, 4vw, 2rem);
  color: var(--muted); font-size: .85rem; }
@media (max-width: 820px) { .footer-inner { grid-template-columns: 1fr 1fr; } .footer-brand { grid-column: 1 / -1; } }
@media (max-width: 520px) { .footer-inner { grid-template-columns: 1fr; gap: 1.6rem; } }

/* --- Responsive / menu hamburger ----------------------------------------- */
@media (max-width: 820px) {
  .nav-toggle {
    display: inline-flex; flex-direction: column; justify-content: center; gap: 5px;
    width: 44px; height: 44px; padding: 0 9px; cursor: pointer;
    background: var(--panel); border: 1px solid var(--border-soft); border-radius: 8px;
  }
  .nav-toggle span { display: block; width: 100%; height: 2px; background: var(--text);
    border-radius: 2px; transition: transform .2s ease, opacity .2s ease; }
  .nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

  /* ordine mobile: brand … [tema][lingua][hamburger] su una riga, menu sotto.
     gap ridotto così brand + i tre controlli stanno su un'unica riga. */
  header { column-gap: .6rem; }
  .nav-controls { gap: .35rem; }
  .site-nav { order: 3; }

  /* il menu diventa un pannello a discesa a tutta larghezza, chiuso di default */
  .site-nav { display: none; flex-basis: 100%; width: 100%;
    flex-direction: column; align-items: stretch; gap: .3rem; margin-top: .7rem; }
  .site-nav.is-open { display: flex; }
  .site-nav .nav-main { flex-direction: column; align-items: stretch; gap: .1rem; }
  .site-nav .nav-main li, .logout-form { display: block; width: 100%; }
  .site-nav .nav-main a, .site-nav .linkish {
    display: block; width: 100%; padding: .7rem .6rem; border-radius: 6px; }
}

/* --- FAQ (home) + articoli correlati (blog) ------------------------------- */
.faq { margin-top: 2.2rem; }
.faq-item { background: var(--panel); border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm); margin: .6rem 0; }
.faq-item summary { cursor: pointer; padding: .85rem 1rem; font-weight: 600; }
.faq-item summary h3 { display: inline; font-size: 1.02rem; margin: 0; }
.faq-item summary::-webkit-details-marker { color: var(--accent); }
.faq-item[open] summary { border-bottom: 1px solid var(--border-soft); }
.faq-item p { padding: .85rem 1rem; margin: 0; color: var(--muted); }
.blog-related { margin: 2rem 0 0; padding: 1rem 1.2rem; background: var(--panel);
  border: 1px solid var(--border-soft); border-radius: var(--radius-sm); }
.blog-related h2 { font-size: 1.05rem; margin: 0 0 .5rem; }
.blog-related ul { margin: 0; padding-left: 1.2rem; }

/* ==========================================================================
   DARK MODE — attivato da data-theme="dark" sul <html> (theme.js).
   La preferenza di sistema è onorata al primo caricamento; il toggle in header
   la sovrascrive (persistita in localStorage). Contrasti verificati WCAG AA
   (testo ≥ 4.5:1, non-testo ≥ 3:1) su entrambe le modalità.
   Senza JS il sito resta in light (default), pienamente accessibile.
   ========================================================================== */
:root[data-theme="dark"] {
  /* token base (da a11y.css) */
  --text: #e9eef5;            /* su panel ≈ 13:1 */
  --muted: #a6b4c6;           /* su panel ≈ 6.6:1 */
  --bg: #0f1621;
  --accent: #63a8ef;          /* link su bg ≈ 6.0:1 */
  --accent-contrast: #08121e; /* testo su bottoni accent ≈ 8:1 */
  --error: #f28b82;
  --success: #67d99b;
  --border: #566579;          /* bordi campi, non-testo ≥ 3:1 */
  --focus: #93c5fb;
  /* token layout (da app.css) */
  --bg-soft: #0f1621;
  --panel: #1a2431;
  --accent-strong: #93c5fb;
  --accent-soft: rgba(99,168,239,.16);
  --border-soft: #2b3a4c;
  --shadow: 0 1px 2px rgba(0,0,0,.5), 0 8px 24px rgba(0,0,0,.45);
  --warn: #e0b055;           /* livello "medio" (ambra chiara) su scuro */
}
/* campi: a11y.css forza background:#fff → va scurito o il testo chiaro sparisce */
:root[data-theme="dark"] input[type="text"],
:root[data-theme="dark"] input[type="email"],
:root[data-theme="dark"] input[type="url"],
:root[data-theme="dark"] input[type="password"],
:root[data-theme="dark"] input[type="number"],
:root[data-theme="dark"] textarea,
:root[data-theme="dark"] .svc-form input {
  background: var(--panel); color: var(--text); border-color: var(--border);
}
/* override di colori hardcoded chiari */
:root[data-theme="dark"] .btn-primary:hover { background: var(--accent-strong); }
:root[data-theme="dark"] .billing-toggle a.is-active,
:root[data-theme="dark"] .badge-trial { color: var(--accent-contrast); }
:root[data-theme="dark"] .actions > li { background: rgba(255,255,255,.03); }
:root[data-theme="dark"] .legal-body p,
:root[data-theme="dark"] .legal-body li { color: var(--text); }
:root[data-theme="dark"] .form-status.is-error   { background: rgba(242,139,130,.14); border-color: rgba(242,139,130,.55); }
:root[data-theme="dark"] .form-status.is-success { background: rgba(103,217,155,.14); border-color: rgba(103,217,155,.55); }
:root[data-theme="dark"] .svc-badge.is-low { background: rgba(242,139,130,.16); color: #f28b82; }
:root[data-theme="dark"] .admin-table tr.log-warning td { background: rgba(255,193,7,.10); }
:root[data-theme="dark"] .admin-table tr.log-error td   { background: rgba(242,139,130,.10); }

/* ------- Theme toggle (header, in linea con menu e switch lingua) --------- */
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; min-height: 40px; padding: 0;
  border: 1px solid var(--border-soft); border-radius: 999px;
  background: var(--panel); color: var(--accent); cursor: pointer;
}
.theme-toggle:hover { border-color: var(--accent); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .ic-sun { display: none; }
.theme-toggle .ic-moon { display: block; }
:root[data-theme="dark"] .theme-toggle .ic-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .ic-moon { display: none; }

/* --- Pagine di errore personalizzate (404/403/500 in-layout) -------------- */
.error-page { text-align: center; max-width: 34rem; margin: 3rem auto; padding: 1rem; }
.error-page .error-code {
  font-size: clamp(4rem, 12vw, 7rem); font-weight: 800; line-height: 1;
  color: var(--accent); letter-spacing: -.04em; margin: 0 0 .3rem;
}
.error-page h1 { font-size: clamp(1.5rem, 1.2rem + 1.4vw, 2.1rem); margin: 0 0 .5rem; }
.error-page .error-msg { color: var(--muted); font-size: 1.05rem; margin: 0 0 1.6rem; }
.error-page .error-actions { display: flex; gap: .8rem; justify-content: center; flex-wrap: wrap; align-items: center; }
.error-page .btn-primary { text-decoration: none; }

/* --- Analisi di esempio (pSEO): vetrina ricca ---------------------------- */
.pseo-eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .78rem; font-weight: 800;
  color: var(--accent); margin: 0 0 .3rem; }
.pseo-summary { font-size: 1.05rem; }
.pseo-axis { margin: 1.6rem 0; padding: 1.1rem 1.3rem; background: var(--panel);
  border: 1px solid var(--border-soft); border-left: 4px solid var(--accent); border-radius: var(--radius-sm); }
.pseo-axis h2 { margin-top: 0; }
.pseo-score { font-size: 1.05rem; margin: 0 0 .5rem; }
.findings { list-style: none; padding: 0; margin: .8rem 0 0; display: grid; gap: .6rem; }
.findings li { display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem; line-height: 1.5; }
.lvl { display: inline-block; font-size: .68rem; font-weight: 800; padding: .1rem .55rem; border-radius: 999px;
  text-transform: uppercase; letter-spacing: .03em; border: 1px solid currentColor; white-space: nowrap; }
.lvl-high { color: var(--error); }
.lvl-medium { color: var(--warn); }
.lvl-low { color: var(--muted); }
.pseo-more { color: var(--muted); font-size: .9rem; font-style: italic; margin: .6rem 0 0; }
.pseo .actions { margin-top: .8rem; }

/* --- Report completo (a pagamento): sezioni per asse --------------------- */
.report-axis { margin: 1.8rem 0; }
.report-axis h3 { color: var(--accent); font-size: 1rem; margin: 1.1rem 0 .35rem; }
.findings li em { color: var(--muted); }
.entity-list { list-style: none; padding: 0; margin: .6rem 0 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.entity-list li { display: inline-flex; align-items: center; gap: .35rem; font-size: .9rem;
  background: var(--panel); border: 1px solid var(--border-soft); border-radius: 999px; padding: .25rem .7rem; }

/* --- Grafico accessibile: colori dal tema (leggibile chiaro/scuro) ------- */
.chart svg { color: var(--text); max-width: 520px; }
.chart svg .bar { fill: var(--accent); }

/* --- Free tool: AI Overview citability checker ---------------------------- */
.aio-check { max-width: 720px; }
.aio-card {
  margin-top: 1.2rem; padding: 1.4rem clamp(1rem, 3vw, 1.8rem);
  background: var(--panel); border: 1px solid var(--border-soft);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.aio-head { display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap; }
.aio-ring {
  --aio-pct: 0;
  width: 120px; height: 120px; border-radius: 50%; flex: 0 0 auto;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: conic-gradient(var(--aio-color, var(--accent)) calc(var(--aio-pct) * 1%), var(--accent-soft) 0);
  position: relative;
}
.aio-ring::before {
  content: ""; position: absolute; inset: 10px; border-radius: 50%;
  background: var(--panel);
}
.aio-ring strong { position: relative; font-size: 2rem; line-height: 1; }
.aio-ring span { position: relative; font-size: .85rem; color: var(--muted, #5a6a7d); }
.aio-high { --aio-color: #1d7a3f; }
.aio-mid  { --aio-color: var(--warn); }
.aio-low  { --aio-color: #b3392e; }
.aio-verdict { flex: 1 1 260px; }
.aio-verdict h3 { margin-bottom: .3rem; }
.aio-page { margin: .6rem 0 0; font-size: .92rem; overflow-wrap: anywhere; }
.aio-cached { font-size: .85rem; color: var(--muted, #5a6a7d); }
.aio-capped {
  margin-top: .8rem; padding: .7rem .9rem; border-radius: var(--radius-sm);
  background: #fdecea; border: 1px solid #f2b8b5; color: #8a1f16; font-weight: 600;
}
.aio-sec { margin-top: 1.4rem; }
.aio-signals { list-style: none; margin: 0; padding: 0; display: grid; gap: .7rem; }
.aio-sig-top { display: flex; justify-content: space-between; gap: .8rem; font-size: .95rem; }
.aio-sig-name { font-weight: 600; }
.aio-sig-status { color: var(--muted, #5a6a7d); white-space: nowrap; }
.aio-bar { height: 8px; border-radius: 4px; background: var(--accent-soft); overflow: hidden; }
.aio-bar-fill { height: 100%; border-radius: 4px; background: var(--accent); transition: width .5s ease; }
.st-absent  .aio-bar-fill { background: #b3392e; }
.st-partial .aio-bar-fill { background: var(--warn); }
.st-present .aio-bar-fill { background: #1d7a3f; }
.aio-fixes { padding-left: 1.2rem; display: grid; gap: .5rem; }
.aio-result-cta {
  margin-top: 1.5rem; padding: 1.1rem 1.2rem; border-radius: var(--radius-sm);
  background: var(--accent-soft); border: 1px solid var(--border-soft);
}
.aio-result-cta h3 { margin-top: 0; }
.aio-cta { margin-top: 2rem; }
.aio-cards li h3 { font-size: 1.05rem; }
/* checker: override dark (verdi/rossi hardcoded leggibili su scuro) */
:root[data-theme="dark"] .aio-high { --aio-color: #67d99b; }
:root[data-theme="dark"] .aio-low  { --aio-color: #f28b82; }
:root[data-theme="dark"] .st-present .aio-bar-fill { background: #67d99b; }
:root[data-theme="dark"] .st-absent  .aio-bar-fill { background: #f28b82; }
:root[data-theme="dark"] .aio-capped { background: rgba(242,139,130,.14); border-color: rgba(242,139,130,.55); color: #f28b82; }
