/* Officina PDF — luminosa, con un colore per ogni famiglia di attrezzi. */

@font-face {
  font-family: 'Bricolage Grotesque';
  src: url('fonts/BricolageGrotesque-Bold.woff') format('woff');
  font-weight: 700 800;
  font-display: swap;
}
@font-face {
  font-family: 'Instrument Sans';
  src: url('fonts/InstrumentSans-Regular.woff') format('woff');
  font-weight: 400 500;
  font-display: swap;
}
@font-face {
  font-family: 'Instrument Sans';
  src: url('fonts/InstrumentSans-Bold.woff') format('woff');
  font-weight: 600 800;
  font-display: swap;
}
@font-face {
  font-family: 'Instrument Sans';
  src: url('fonts/InstrumentSans-Italic.woff') format('woff');
  font-style: italic;
  font-display: swap;
}

:root {
  --bg: #f3f6f7;
  --surface: #ffffff;
  --surface-2: #edf1f3;
  --ink: #0f2b28;
  --muted: #5a6b6a;
  --line: #dfe5e8;
  --accent: #e8492a;
  --accent-ink: #ffffff;
  --accent-soft: #fde8e2;
  --gold: #2f6feb;
  --icon: #e8492a;
  --icon-soft: #fde8e2;
  --danger: #cf3a24;
  --c-modifica: #e8492a;
  --c-organizza: #0e9f6e;
  --c-converti: #2f6feb;
  --c-ottimizza: #e19400;
  --c-sicurezza: #7a4de0;
  --shadow: 0 1px 2px rgba(15, 43, 40, 0.05), 0 6px 20px -10px rgba(15, 43, 40, 0.18);
  --radius: 16px;
  --serif: 'Bricolage Grotesque', 'Instrument Sans', system-ui, sans-serif;
  --sans: 'Instrument Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1514;
    --surface: #15201f;
    --surface-2: #1c2a28;
    --ink: #e9f1ef;
    --muted: #9aabaa;
    --line: #273532;
    --accent: #ff6a4a;
    --accent-ink: #1d0b06;
    --accent-soft: #3a211b;
    --gold: #79a3ff;
    --icon: #ff7a5c;
    --icon-soft: #3a211b;
    --danger: #ff8a73;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 26px -14px rgba(0, 0, 0, 0.8);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 var(--sans);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  font-family: var(--serif);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.015em;
  margin: 0;
  text-wrap: balance;
}

p {
  margin: 0;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
  border-radius: 6px;
}

.skip {
  position: absolute;
  left: -999px;
  top: 8px;
  background: var(--surface);
  padding: 8px 12px;
  border-radius: 8px;
  z-index: 10;
}
.skip:focus {
  left: 8px;
}

.muted {
  color: var(--muted);
}

/* ---------- Intestazione e piè di pagina ---------- */

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: max(14px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) 14px max(20px, env(safe-area-inset-left));
  max-width: 1160px;
  width: 100%;
  margin: 0 auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}
.brand img {
  border-radius: 10px;
}
.brand span {
  color: var(--ink);
}
.brand b {
  color: var(--accent);
  font-weight: 700;
}

main {
  flex: 1;
  width: 100%;
  max-width: 1160px;
  margin: 0 auto;
  padding: 8px max(20px, env(safe-area-inset-right)) 56px max(20px, env(safe-area-inset-left));
  outline: none;
}

.boot {
  padding: 40px 0;
  text-align: center;
}

.credit {
  justify-self: center;
  display: grid;
  justify-items: center;
  gap: 8px;
  margin-top: 18px;
  text-decoration: none;
  color: var(--muted);
  font-size: 0.82rem;
}
.credit img {
  display: block;
  width: 120px;
  height: auto;
  border-radius: 8px;
  background: #f1f6f4;
  transition: transform 0.15s;
}
.credit:hover img {
  transform: translateY(-2px);
}
.credit:hover span {
  color: var(--ink);
}
.foot {
  max-width: 1160px;
  width: 100%;
  margin: 0 auto;
  padding: 22px max(20px, env(safe-area-inset-right)) max(28px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  color: var(--muted);
  font-size: 0.875rem;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 6px;
}

/* ---------- Bottoni ---------- */

.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background-color 0.15s, border-color 0.15s, transform 0.1s, box-shadow 0.15s;
}
.btn:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--ink) 35%, transparent);
}
.btn:active:not(:disabled) {
  transform: translateY(1px);
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 6px 16px -8px color-mix(in srgb, var(--accent) 80%, transparent);
}
.btn.primary:hover:not(:disabled) {
  filter: brightness(1.06);
  border-color: var(--accent);
}
.btn.big {
  min-height: 52px;
  padding: 0 28px;
  font-size: 1.05rem;
}
.btn.small {
  min-height: 38px;
  padding: 0 14px;
  font-size: 0.9rem;
  border-radius: 10px;
}

.icon-btn {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink);
  font: inherit;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  cursor: pointer;
  display: inline-grid;
  place-items: center;
}
.icon-btn:hover:not(:disabled) {
  background: var(--surface-2);
}
.icon-btn:disabled {
  opacity: 0.3;
  cursor: default;
}
.icon-btn.danger:hover:not(:disabled) {
  color: var(--danger);
}

/* ---------- Icone degli strumenti: illustrazioni a colori, niente piastrella ---------- */

.ico {
  display: inline-grid;
  place-items: center;
  width: 46px;
  height: 46px;
  flex: none;
}
.ico svg { width: 100%; height: 100%; display: block; }
.cat-modifica { --cat: var(--c-modifica); }
.cat-organizza { --cat: var(--c-organizza); }
.cat-converti { --cat: var(--c-converti); }
.cat-ottimizza { --cat: var(--c-ottimizza); }
.cat-sicurezza { --cat: var(--c-sicurezza); }

/* ---------- Pagina iniziale ---------- */

.hero {
  display: grid;
  gap: 28px;
  align-items: center;
  padding: 26px 0 30px;
}
@media (min-width: 900px) {
  .hero {
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
    padding: 40px 0 44px;
  }
}
.hero-text {
  display: grid;
  gap: 16px;
}
.hero h1 {
  font-size: clamp(2.3rem, 6.2vw, 4rem);
  letter-spacing: -0.035em;
  line-height: 1;
  max-width: 13ch;
}
.lead {
  color: var(--muted);
  font-size: 1.06rem;
  max-width: 60ch;
}
.hero .lead {
  font-size: 1.1rem;
  line-height: 1.55;
}

.scan-cta {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 2px 0 20px;
  padding: 16px 18px;
  border-radius: var(--radius);
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  text-decoration: none;
  color: inherit;
}
.scan-cta .ico {
  flex: 0 0 auto;
}
.scan-cta h2 {
  font-size: 1.05rem;
  margin: 0 0 2px;
  color: var(--ink);
}
.scan-cta p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}
.scan-cta-arrow {
  margin-left: auto;
  flex: 0 0 auto;
  font-size: 1.3rem;
  color: var(--accent);
}
@media (min-width: 761px) {
  .scan-cta {
    display: none;
  }
}

/* parete degli attrezzi */
.pegboard {
  display: none;
}
@media (min-width: 900px) {
  .pegboard {
    position: relative;
    display: grid;
    grid-template-columns: repeat(4, 74px);
    grid-auto-rows: 74px;
    gap: 22px;
    justify-content: center;
    padding: 30px;
    border-radius: 28px;
    background-color: var(--surface);
    border: 1px solid var(--line);
  }
  .pegboard .ico {
    width: 74px;
    height: 74px;
    border-radius: 20px;
    background: #fff;
    border: 1px solid var(--line);
    box-shadow: 0 3px 8px -4px rgba(16, 24, 20, 0.18);
  }
  .pegboard .ico svg {
    width: 54px;
    height: 54px;
  }
  .pegboard .ico:nth-child(3n + 1) {
    transform: rotate(-6deg);
  }
  .pegboard .ico:nth-child(4n + 2) {
    transform: rotate(5deg) translateY(6px);
  }
  .pegboard .ico:nth-child(5n) {
    transform: rotate(-3deg) translateY(-4px);
  }
}

/* punti di fiducia, in fondo alla pagina iniziale */
.trust {
  display: grid;
  gap: 32px;
  margin: 34px 0 10px;
  padding: 34px 0 6px;
  border-top: 1px solid var(--line);
}
@media (min-width: 720px) {
  .trust {
    grid-template-columns: repeat(3, 1fr);
    gap: 36px;
  }
}
.trust-item {
  text-align: center;
  display: grid;
  justify-items: center;
}
.trust-item .trust-ico {
  width: 56px;
  height: 56px;
  margin-bottom: 14px;
}
.trust-item h3 {
  font-size: 1.05rem;
  margin: 0 0 8px;
  color: var(--ink);
}
.trust-item p {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
  max-width: 34ch;
}

.search {
  font: inherit;
  width: 100%;
  max-width: 460px;
  min-height: 52px;
  padding: 0 18px 0 46px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235a6b6a' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='6.5'/%3E%3Cpath d='m20 20-4.2-4.2'/%3E%3C/svg%3E") no-repeat 16px center / 20px;
  color: var(--ink);
  margin-top: 4px;
  box-shadow: var(--shadow);
}
.search:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0 18px;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar {
  display: none;
}
.chips-select {
  display: none;
}
@media (max-width: 760px) {
  .chips {
    display: none;
  }
  .chips-select {
    display: block;
    width: 100%;
    appearance: none;
    font: inherit;
    font-weight: 600;
    font-size: 0.98rem;
    min-height: 46px;
    padding: 0 40px 0 16px;
    margin: 4px 0 18px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 14px center;
    background-size: 18px;
    color: var(--ink);
  }
  .chips-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-soft);
  }
}
.chip {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.93rem;
  font-weight: 600;
  min-height: 40px;
  padding: 0 16px 0 12px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.chip::before {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--cat, var(--ink));
}
.chip.on {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}
.chip.on::before {
  background: var(--cat, var(--bg));
}

.cat-section {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}
.cat-section h2 {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 1.45rem;
}
.cat-section h2::before {
  content: '';
  align-self: center;
  width: 12px;
  height: 12px;
  border-radius: 4px;
  background: var(--cat);
}
.cat-section h2 span {
  font-family: var(--sans);
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--muted);
  letter-spacing: 0;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}
.tool-card {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 14px;
  row-gap: 4px;
  align-items: start;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.tool-card .ico {
  grid-row: span 2;
}
.tool-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--cat) 55%, var(--line));
  box-shadow: 0 12px 26px -16px color-mix(in srgb, var(--cat) 70%, transparent);
}
.tool-card h3 {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  line-height: 1.25;
  margin-top: 2px;
}
.tool-card p {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}
.empty {
  padding: 24px 0;
}

/* ---------- Pagina strumento ---------- */

.tool-head {
  display: grid;
  gap: 14px;
  padding: 8px 0 18px;
}
.back {
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  justify-self: start;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
}
.back:hover {
  color: var(--accent);
}
.tool-title {
  display: flex;
  gap: 16px;
  align-items: center;
}
.tool-title .ico {
  width: 60px;
  height: 60px;
}
.tool-title h1 {
  font-size: clamp(1.7rem, 4.6vw, 2.5rem);
  letter-spacing: -0.03em;
}
.tool-title .lead {
  margin-top: 4px;
  font-size: 1rem;
}

.workspace {
  display: grid;
  gap: 18px;
  align-items: start;
}
@media (min-width: 860px) {
  .workspace:has(.side:not([hidden])) {
    grid-template-columns: minmax(0, 1fr) 340px;
  }
  .side {
    position: sticky;
    top: 16px;
  }
}

.left {
  display: grid;
  gap: 14px;
}

.dropzone {
  display: grid;
  justify-items: center;
  gap: 6px;
  text-align: center;
  padding: 44px 20px;
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}
.dropzone:hover,
.dropzone.over {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.dropzone.compact {
  padding: 16px;
  grid-auto-flow: column;
  justify-content: center;
  gap: 12px;
}
.dropzone.compact .dz-hint {
  display: none;
}
.dz-icon {
  color: var(--accent);
  display: inline-grid;
}
.dropzone strong {
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 600;
}
.dz-hint {
  color: var(--muted);
  font-size: 0.92rem;
}

.files {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.file {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 8px 8px 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.file[draggable='true'] {
  cursor: grab;
}
.file.dragging {
  opacity: 0.45;
}
.file-thumb {
  width: 44px;
  height: 56px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
  flex: none;
}
.file-info {
  display: grid;
  min-width: 0;
  flex: 1;
}
.file-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-meta {
  color: var(--muted);
  font-size: 0.85rem;
}
.file-actions {
  display: flex;
  gap: 2px;
  flex: none;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  display: grid;
  gap: 14px;
  box-shadow: var(--shadow);
}
.panel h3 {
  font-size: 1.15rem;
}

.options {
  display: grid;
  gap: 14px;
}
.opt {
  display: grid;
  gap: 6px;
}
.opt > label {
  font-size: 0.9rem;
  font-weight: 600;
}
.opt input[type='text'],
.opt input[type='number'],
.opt select,
.opt input[type='file'] {
  font: inherit;
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
}
.opt input[type='file'] {
  padding: 8px 10px;
}
.opt input[type='color'] {
  width: 64px;
  height: 44px;
  padding: 2px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg);
}
.opt input:focus,
.opt select:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.hint {
  color: var(--muted);
  font-size: 0.85rem;
}
.check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  cursor: pointer;
  font-size: 0.95rem;
}
.check input {
  width: 20px;
  height: 20px;
  margin: 2px 0 0;
  accent-color: var(--accent);
  flex: none;
}
.range {
  display: flex;
  align-items: center;
  gap: 12px;
}
.range input {
  flex: 1;
  accent-color: var(--accent);
}
.range output {
  min-width: 7.5em;
  text-align: right;
  font-size: 0.85rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
input[type='range'] {
  accent-color: var(--accent);
}

.segmented {
  display: inline-flex;
  flex-wrap: wrap;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px;
  background: var(--bg);
  gap: 2px;
}
.segmented label {
  position: relative;
}
.segmented input {
  position: absolute;
  opacity: 0;
  inset: 0;
  cursor: pointer;
}
.segmented span {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 600;
  white-space: nowrap;
}
.segmented input:checked + span {
  background: var(--accent);
  color: var(--accent-ink);
}
.segmented input:focus-visible + span {
  outline: 3px solid var(--gold);
  outline-offset: 1px;
}

.need {
  font-size: 0.9rem;
}

/* ---------- Avanzamento e risultati ---------- */

.progress {
  margin-top: 18px;
  display: grid;
  gap: 8px;
}
.track {
  height: 10px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}
.bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent), var(--gold));
  border-radius: 999px;
  transition: width 0.2s ease;
}
.plabel {
  color: var(--muted);
  font-size: 0.9rem;
}

.guide {
  margin-top: 28px;
  padding: 20px 22px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
}
.guide h2 {
  font-size: 1.15rem;
  margin: 0 0 12px;
}
.guide-steps {
  margin: 0;
  padding-left: 1.3em;
  display: grid;
  gap: 8px;
  line-height: 1.5;
}
.guide-steps li::marker {
  color: var(--accent);
  font-weight: 700;
}
.guide-note {
  margin: 14px 0 0;
  font-size: 0.88rem;
}
.results {
  margin-top: 22px;
  padding: 20px;
  border-radius: var(--radius);
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  display: grid;
  gap: 14px;
}
.results h2 {
  font-size: 1.4rem;
}
.result-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
  max-height: 60vh;
  overflow: auto;
}
.result {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
}
.result .file-info {
  min-width: min(100%, 220px);
}
.note {
  font-size: 0.88rem;
  color: var(--muted);
  margin-top: 2px;
}
.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chain select {
  font: inherit;
  min-height: 44px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  padding: 0 16px;
  max-width: 100%;
}

.is-busy .workspace {
  opacity: 0.7;
  pointer-events: none;
}

/* ---------- Organizza ---------- */

.org-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.org-bar .primary {
  margin-left: auto;
}
.org-info {
  font-size: 0.92rem;
}
.org-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 12px;
}
.pg {
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px;
  display: grid;
  gap: 6px;
  cursor: grab;
}
.pg.dragging {
  opacity: 0.4;
}
.pg-frame {
  aspect-ratio: 3 / 4;
  background: #fff;
  border-radius: 6px;
  border: 1px solid var(--line);
  overflow: hidden;
  display: grid;
  place-items: center;
}
.pg-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.2s;
}
.pg.is-del .pg-img {
  opacity: 0.2;
  filter: grayscale(1);
}
.pg.is-del {
  border-style: dashed;
}
.pg figcaption {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--muted);
}
.pg-num {
  font-weight: 700;
  color: var(--ink);
}
.pg-src {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pg-tools {
  display: flex;
  justify-content: space-between;
}
.pg-tools .icon-btn {
  width: 34px;
  height: 34px;
}

/* ---------- Firma ---------- */

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.file-bar .file-name {
  flex: 1;
}
.sig-pad {
  width: 100%;
  max-width: 520px;
  aspect-ratio: 1040 / 320;
  background: #fff;
  border: 1px dashed var(--line);
  border-radius: 12px;
  touch-action: none;
  cursor: crosshair;
  background-image: linear-gradient(transparent calc(100% - 38px), #cfd8d6 calc(100% - 38px), #cfd8d6 calc(100% - 37px), transparent calc(100% - 37px));
}
.swatch {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 1px var(--line);
  cursor: pointer;
  padding: 0;
}
.swatch.on {
  box-shadow: 0 0 0 3px var(--gold);
}
.sign-stage {
  position: relative;
  margin: 0 auto;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  background: #fff;
  max-width: 100%;
}
.sign-stage canvas {
  display: block;
}
.sig-overlay {
  position: absolute;
  touch-action: none;
  cursor: grab;
  outline: 2px dashed var(--accent);
  outline-offset: 3px;
  background: rgba(255, 255, 255, 0.0);
  user-select: none;
  -webkit-user-drag: none;
}
.sig-overlay.drag {
  cursor: grabbing;
}

/* ---------- Avvisi ---------- */

#toast {
  position: fixed;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  transform: translate(-50%, 24px);
  max-width: min(92vw, 520px);
  background: var(--ink);
  color: var(--bg);
  padding: 12px 18px;
  border-radius: 14px;
  font-size: 0.95rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 50;
  box-shadow: var(--shadow);
}
#toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
#toast[data-kind='error'] {
  background: var(--danger);
  color: #fff;
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

@media (max-width: 520px) {
  .tool-title .ico {
    width: 48px;
    height: 48px;
  }
  .result-actions .btn {
    flex: 1;
  }
}

/* ---------- Annota ---------- */

.ann-work {
  display: grid;
  gap: 14px;
}
.ann-bar {
  position: sticky;
  top: 8px;
  z-index: 5;
  gap: 10px;
  padding: 12px;
}
.ann-tools {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: thin;
}
.ann-tool {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  min-width: 68px;
  min-height: 56px;
  padding: 6px 8px;
  border-radius: 12px;
  cursor: pointer;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 3px;
  flex: none;
}
.ann-tool:hover {
  border-color: var(--icon);
}
.ann-tool[aria-pressed='true'] {
  background: var(--icon);
  border-color: var(--icon);
  color: #fff;
}
.ann-sub {
  gap: 8px 14px;
}
.ann-swatches {
  gap: 8px;
}
.ann-size {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  font-weight: 600;
}
.ann-size input {
  width: 120px;
}
.ann-size output {
  min-width: 2ch;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.ann-spacer {
  flex: 1;
}
.ann-hint {
  font-size: 0.88rem;
}
.ann-nav {
  justify-content: center;
}
.ann-count {
  margin-left: 8px;
}
.ann-scroll {
  overflow-x: auto;
  display: grid;
  justify-items: center;
}
.ann-stage {
  position: relative;
  background: #fff;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
}
.ann-canvas {
  display: block;
}
.ann-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: text;
}
.ann-overlay[data-tool='pen'],
.ann-overlay[data-tool='fix'] {
  cursor: crosshair;
}
.ann-overlay[data-tool='eraser'] {
  cursor: pointer;
}
.ann-overlay[data-tool='pan'] {
  touch-action: auto;
  cursor: default;
}
.ann-hl {
  mix-blend-mode: multiply;
}
.ann-drag {
  fill: rgba(232, 73, 42, 0.06);
  stroke: #e8492a;
  stroke-width: 0.8;
  stroke-dasharray: 3 2;
  vector-effect: non-scaling-stroke;
}
.ann-hit {
  fill: rgba(229, 56, 59, 0.08);
  stroke: #e5383b;
  stroke-dasharray: 3 2;
  vector-effect: non-scaling-stroke;
}
.ann-overlay[data-tool='eraser'] g[data-id]:hover .ann-hit {
  fill: rgba(229, 56, 59, 0.22);
}
.ann-editor {
  position: absolute;
  z-index: 3;
  border: 1.5px dashed #e8492a;
  border-radius: 4px;
  padding: 0 2px;
  margin: 0;
  font-family: Helvetica, Arial, sans-serif;
  line-height: 1.2;
  resize: none;
  overflow: hidden;
  outline: none;
  white-space: pre;
}
.ann-save {
  justify-content: center;
}
@media (max-width: 520px) {
  .ann-bar {
    padding: 8px;
    gap: 8px;
    top: 4px;
  }
  .ann-hint {
    display: none;
  }
  .ann-tool {
    min-width: 58px;
    min-height: 48px;
    font-size: 0.75rem;
  }
  .ann-swatches .swatch {
    width: 26px;
    height: 26px;
  }
  .ann-size input {
    width: 90px;
  }
}

/* ---------- Modifica testo ---------- */

.ann-overlay[data-tool='edit'] {
  cursor: default;
}
.te-run {
  fill: transparent;
  stroke: transparent;
  pointer-events: all;
  cursor: text;
}
.ann-overlay[data-tool='edit']:hover .te-run {
  stroke: rgba(232, 73, 42, 0.25);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}
.ann-overlay[data-tool='edit'] .te-run:hover {
  fill: rgba(232, 73, 42, 0.08);
  stroke: #e8492a;
}
.ann-overlay[data-tool='edit'] .te-run.is-edited {
  stroke: rgba(11, 138, 75, 0.7);
  stroke-dasharray: 3 2;
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}
.te-editor {
  border: 1.5px solid #e8492a;
  border-style: solid;
  border-radius: 2px;
  padding: 0 2px;
  box-shadow: 0 0 0 3px rgba(232, 73, 42, 0.18);
}
.te-note {
  position: absolute;
  z-index: 4;
  max-width: min(340px, 90%);
  padding: 5px 9px;
  border-radius: 7px;
  font: 600 12px/1.35 var(--sans);
  background: #0b3b35;
  color: #f1f6f4;
  pointer-events: none;
  box-shadow: var(--shadow);
}
.te-note[data-kind='warn'] {
  background: #b3402a;
  color: #fff;
}

/* ---------- Apri PDF ---------- */

.reader-work {
  display: grid;
  gap: 14px;
}
.reader-nav,
.reader-zoombar {
  justify-content: center;
  align-items: center;
  gap: 10px;
}
.reader-pagenum {
  width: 4.5em;
  text-align: center;
}
.reader-page,
.reader-zoom {
  min-width: 3.2em;
  text-align: center;
}
.reader-scroll {
  max-height: 70vh;
}

/* ---------- Ritaglia paragrafo ---------- */

.snip-work {
  display: grid;
  gap: 14px;
}
.snip-layout {
  display: grid;
  gap: 18px;
  align-items: start;
}
@media (min-width: 900px) {
  .snip-layout {
    grid-template-columns: minmax(0, 1fr) 320px;
  }
}
.snip-main {
  display: grid;
  gap: 12px;
  min-width: 0;
}
.snip-overlay {
  cursor: crosshair;
}
.snip-shade {
  fill: rgba(11, 59, 53, 0.42);
  pointer-events: none;
}
.snip-sel {
  fill: transparent;
  stroke: #e8492a;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
  cursor: move;
  pointer-events: all;
}
.snip-handle {
  fill: #fff;
  stroke: #e8492a;
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
}
.h-nw, .h-se { cursor: nwse-resize; }
.h-ne, .h-sw { cursor: nesw-resize; }
.h-n, .h-s { cursor: ns-resize; }
.h-e, .h-w { cursor: ew-resize; }
.snip-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.snip-actions .btn {
  padding: 0 10px;
  font-size: 0.92rem;
}
.snip-text {
  font: 0.88rem/1.45 var(--sans);
  width: 100%;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  resize: vertical;
}
.snip-size {
  font-size: 0.88rem;
}
@media (min-width: 900px) {
  .snip-panel {
    position: sticky;
    top: 16px;
  }
}
.snip-actions .btn.primary {
  grid-column: 1 / -1;
}

/* ---------- Sostituisci paragrafo ---------- */

.pp-panel {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 30;
  width: min(440px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  overflow: auto;
  display: grid;
  gap: 10px;
  padding: 16px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 18px 50px -12px rgba(11, 59, 53, 0.45);
}
.pp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--serif);
  font-size: 1.1rem;
}
.pp-sub {
  font-size: 0.85rem;
  margin-top: -6px;
}
.pp-text {
  font: 0.95rem/1.45 var(--sans);
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  resize: vertical;
}
.pp-text:focus {
  outline: none;
  border-color: var(--icon);
  box-shadow: 0 0 0 3px var(--icon-soft);
}
.pp-opts {
  gap: 8px 16px;
  font-size: 0.9rem;
}
.pp-align select {
  font: inherit;
  min-height: 36px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  padding: 0 8px;
  margin-left: 4px;
}
.pp-info {
  font-size: 0.85rem;
  color: var(--muted);
}
.pp-info[data-kind='warn'] {
  color: var(--danger);
  font-weight: 600;
}
.pp-warn {
  font-size: 0.85rem;
  color: var(--danger);
}
.pp-actions {
  gap: 8px;
}
.pp-outline {
  fill: none;
  stroke: #e8492a;
  stroke-width: 1.5;
  stroke-dasharray: 4 3;
  vector-effect: non-scaling-stroke;
}
.ann-overlay[data-tool='para'] {
  cursor: default;
}
.ann-overlay[data-tool='para']:hover .te-run {
  stroke: rgba(232, 73, 42, 0.25);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}
.ann-overlay[data-tool='para'] .te-run:hover {
  fill: rgba(232, 73, 42, 0.08);
  stroke: #e8492a;
}

/* ---------- Confronta ---------- */

.cmp-slots {
  display: grid;
  gap: 14px;
}
@media (min-width: 760px) {
  .cmp-slots {
    grid-template-columns: 1fr 1fr;
  }
}
.cmp-slot {
  display: grid;
  gap: 8px;
}
.cmp-file {
  font-size: 0.9rem;
}
.cmp-tag {
  justify-self: start;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 999px;
}
.cmp-tag-A {
  background: #fde2e1;
  color: #a5282a;
}
.cmp-tag-B {
  background: #d9f2e4;
  color: #0b6b3a;
}
.cmp-go {
  justify-content: center;
  margin-top: 14px;
}
.cmp-result {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}
.cmp-summary {
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
}
.cmp-layout {
  display: grid;
  gap: 18px;
  align-items: start;
}
@media (min-width: 1000px) {
  .cmp-layout {
    grid-template-columns: minmax(0, 1fr) 300px;
  }
  .cmp-side {
    position: sticky;
    top: 16px;
    max-height: calc(100dvh - 32px);
    overflow: auto;
  }
}
.cmp-pages {
  display: grid;
  gap: 10px;
  min-width: 0;
}
.cmp-toolbar {
  gap: 8px 14px;
}
.cmp-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 640px) {
  .cmp-cols {
    grid-template-columns: 1fr;
  }
}
.cmp-col {
  display: grid;
  gap: 6px;
  min-width: 0;
}
.cmp-colhead {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 0.85rem;
}
.cmp-page {
  min-width: 0;
}
.cmp-stage {
  position: relative;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  max-width: 100%;
}
.cmp-stage canvas {
  display: block;
  max-width: 100%;
}
.cmp-ov {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.cmp-hl-del {
  fill: rgba(229, 56, 59, 0.28);
  stroke: rgba(229, 56, 59, 0.85);
  stroke-width: 0.6;
}
.cmp-hl-add {
  fill: rgba(11, 166, 90, 0.26);
  stroke: rgba(11, 138, 75, 0.85);
  stroke-width: 0.6;
}
.cmp-hl-del.is-focus,
.cmp-hl-add.is-focus {
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}
.cmp-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
  max-height: 60vh;
  overflow: auto;
}
.cmp-item {
  appearance: none;
  width: 100%;
  text-align: left;
  font: inherit;
  font-size: 0.86rem;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  display: grid;
  gap: 3px;
  cursor: pointer;
}
.cmp-item:hover {
  border-color: var(--icon);
}
.cmp-where {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--muted);
}
.cmp-item del {
  color: #b42318;
  background: rgba(229, 56, 59, 0.1);
  text-decoration-thickness: 1px;
}
.cmp-item ins {
  color: #0b6b3a;
  background: rgba(11, 166, 90, 0.12);
  text-decoration: none;
}

/* ---------- Ritocchi della nuova grafica ---------- */

.bar {
  background: linear-gradient(90deg, var(--accent), #f2a20c);
}
.dropzone {
  border-radius: 18px;
  border-color: color-mix(in srgb, var(--ink) 18%, transparent);
}
.dropzone:hover,
.dropzone.over {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.dropzone strong {
  font-family: var(--serif);
  font-weight: 700;
  letter-spacing: -0.01em;
}
.panel h3,
.results h2 {
  letter-spacing: -0.01em;
}
.results {
  background: color-mix(in srgb, var(--c-organizza) 9%, var(--surface));
  border-color: color-mix(in srgb, var(--c-organizza) 35%, transparent);
}
.segmented,
.opt input[type='text'],
.opt input[type='password'],
.opt input[type='number'],
.opt select {
  border-radius: 10px;
}
.opt input[type='password'] {
  font: inherit;
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
}
.opt input[type='password']:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.segmented {
  border-radius: 12px;
}
.segmented span {
  border-radius: 9px;
}
.tool-head .lead {
  max-width: 62ch;
}

/* ---------- Scansiona ---------- */

.scan-start {
  display: grid;
  gap: 14px;
}
@media (min-width: 700px) {
  .scan-start {
    grid-template-columns: 1fr 1fr;
  }
}
.scan-big {
  appearance: none;
  display: grid;
  justify-items: start;
  gap: 6px;
  text-align: left;
  padding: 22px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: border-color 0.15s, transform 0.15s;
}
.scan-big:hover {
  border-color: var(--c-converti);
  transform: translateY(-2px);
}
.scan-big strong {
  font-family: var(--serif);
  font-size: 1.3rem;
  margin-top: 6px;
}
.scan-big > span:last-child {
  color: var(--muted);
  font-size: 0.93rem;
}
.scan-big-ico {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 16px;
  color: #fff;
  background: var(--c-converti);
}
.scan-cam {
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  background: #000;
  max-width: 720px;
  margin: 0 auto;
}
.scan-cam.flash::after {
  content: '';
  position: absolute;
  inset: 0;
  background: #fff;
  opacity: 0.7;
}
.scan-video {
  display: block;
  width: 100%;
  max-height: 70vh;
  object-fit: contain;
  background: #000;
}
.scan-cam-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.6));
}
.scan-cam-bar .btn {
  justify-self: start;
}
.scan-shutter {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  border: 5px solid #fff;
  background: rgba(255, 255, 255, 0.25);
  cursor: pointer;
}
.scan-shutter:active {
  background: #fff;
}
.scan-count {
  justify-self: end;
  color: #fff;
  font-weight: 700;
}
.scan-work {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}
.scan-pages-head {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  justify-content: space-between;
}
.scan-strip {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 6px;
}
.scan-page {
  margin: 0;
  flex: none;
  width: 120px;
  display: grid;
  gap: 4px;
}
.scan-thumb {
  appearance: none;
  padding: 0;
  border: 2px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  cursor: pointer;
  height: 150px;
  display: grid;
  place-items: center;
}
.scan-page.on .scan-thumb {
  border-color: var(--accent);
}
.scan-thumb img {
  max-width: 100%;
  max-height: 100%;
  display: block;
}
.scan-page figcaption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  font-size: 0.85rem;
}
.scan-page .icon-btn {
  width: 30px;
  height: 30px;
}
.scan-editor {
  display: grid;
  gap: 18px;
  padding: 16px;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
}
@media (min-width: 860px) {
  .scan-editor {
    grid-template-columns: 1fr 1fr;
  }
}
.scan-edit-col {
  display: grid;
  gap: 10px;
  justify-items: center;
  align-content: start;
  min-width: 0;
}
.scan-hint {
  justify-self: start;
  font-size: 0.9rem;
}
.scan-stage {
  position: relative;
  touch-action: none;
  max-width: 100%;
}
.scan-stage canvas {
  display: block;
  border-radius: 6px;
}
.scan-quad {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.scan-poly {
  fill: color-mix(in srgb, var(--c-converti) 18%, transparent);
  stroke: var(--c-converti);
  stroke-width: 3;
  vector-effect: non-scaling-stroke;
}
.scan-handle {
  fill: #fff;
  stroke: var(--c-converti);
  stroke-width: 3;
  vector-effect: non-scaling-stroke;
  cursor: grab;
}
.scan-preview {
  max-width: 100%;
  max-height: 520px;
  border-radius: 6px;
  box-shadow: var(--shadow);
  background: #fff;
}
.scan-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}
.scan-filter {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  cursor: pointer;
}
.scan-filter.on {
  background: var(--c-converti);
  border-color: var(--c-converti);
  color: #fff;
}
.scan-export {
  gap: 10px 14px;
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
}
.scan-export select {
  font: inherit;
  min-height: 40px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  padding: 0 8px;
  margin-left: 4px;
}

/* ---- Moduli PDF ---- */
.fm-panel .fm-hint { margin: 0 0 12px; }
.fm-toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.fm-tool.on { background: var(--cat, var(--accent)); color: #fff; border-color: transparent; }
.fm-nav { align-items: center; gap: 12px; margin-bottom: 10px; }
.fm-stage {
  position: relative;
  margin: 0 auto 14px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  background: #fff;
  max-width: 100%;
}
.fm-stage canvas { display: block; }
.fm-stage.placing { cursor: crosshair; }
.fm-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.fm-layer > * { pointer-events: auto; }

/* campi da compilare */
.fm-field { position: absolute; }
.fm-in {
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  border: 1px solid var(--accent);
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.92);
  padding: 1px 4px;
  font: inherit;
  font-size: 13px;
  color: #111;
  outline: none;
  resize: none;
}
.fm-in:focus { box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 45%, transparent); }
textarea.fm-in { padding: 3px 4px; line-height: 1.25; }
.fm-check {
  width: 100%;
  height: 100%;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

/* campi nuovi (modalità crea) */
.fm-new {
  position: absolute;
  box-sizing: border-box;
  border: 1.5px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border-radius: 3px;
  cursor: grab;
  touch-action: none;
  user-select: none;
}
.fm-new-check, .fm-new-radio { border-radius: 4px; }
.fm-new-radio { border-radius: 50%; }
.fm-new-label {
  position: absolute;
  left: 0;
  bottom: 100%;
  margin-bottom: 2px;
  font-size: 11px;
  line-height: 1.4;
  white-space: nowrap;
  background: var(--accent);
  color: #fff;
  padding: 0 5px;
  border-radius: 3px;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fm-del, .fm-cog {
  position: absolute;
  top: -9px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: none;
  color: #fff;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
  cursor: pointer;
  padding: 0;
}
.fm-del { right: -9px; background: #d4342a; }
.fm-cog { right: 13px; background: #555; }
.fm-grip {
  position: absolute;
  right: -4px;
  bottom: -4px;
  width: 12px;
  height: 12px;
  background: var(--accent);
  border: 2px solid #fff;
  border-radius: 3px;
  cursor: nwse-resize;
  touch-action: none;
}

/* ---- Piè di pagina legale, banner privacy, pagina privacy ---- */
.legal {
  justify-self: center;
  margin: 14px 0 0;
  font-size: 0.8rem;
  text-align: center;
}
.legal a {
  color: inherit;
  text-underline-offset: 3px;
}
.legal a:hover {
  color: var(--ink);
}

.privacy-banner {
  position: fixed;
  z-index: 60;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(720px, calc(100% - 32px));
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 18px 24px;
  padding: 16px 18px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 18px 50px -12px rgba(15, 43, 40, 0.35), var(--shadow);
}
.privacy-banner[hidden] {
  display: none;
}
.pb-body {
  flex: 1;
  min-width: 0;
}
.privacy-banner h2 {
  margin: 0 0 4px;
  font-family: var(--serif);
  font-size: 1.05rem;
}
.privacy-banner p {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--muted);
}
.pb-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex-shrink: 0;
}
.pb-actions .btn {
  text-decoration: none;
  white-space: nowrap;
}
@media (max-width: 620px) {
  .privacy-banner {
    flex-direction: column;
    align-items: stretch;
  }
  .pb-actions .btn {
    flex: 1;
    justify-content: center;
    text-align: center;
  }
}

.policy {
  max-width: 680px;
  margin: 18px auto 0;
}
.policy h1 {
  font-family: var(--serif);
  margin: 0 0 8px;
}
.policy h2 {
  font-family: var(--serif);
  font-size: 1.2rem;
  margin: 30px 0 8px;
}
.policy p {
  margin: 0 0 12px;
  line-height: 1.6;
}
.policy .lead {
  color: var(--muted);
}

.foot .seals {
  justify-self: center;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 16px 24px;
  margin-top: 18px;
}
.foot .seals .credit {
  margin-top: 0;
  display: block;
}
/* i due loghi hanno la stessa altezza */
.foot .seals img {
  display: block;
  height: 40px;
  width: auto;
  border-radius: 6px;
}
.foot .ssl {
  background: #fff;
}

/* ---------- Registrazione (attiva solo se config.js la accende) ---------- */

.linklike {
  font: inherit;
  background: none;
  border: 0;
  padding: 0;
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.linklike:hover {
  text-decoration-thickness: 2px;
}
.account {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
  font-size: 0.95rem;
}
.account[hidden] {
  display: none;
}
.acct-name {
  font-weight: 600;
  max-width: 14ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.free-note {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}
dialog.reg {
  width: min(440px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 24px 60px -20px rgba(15, 43, 40, 0.45);
  overflow: auto;
}
dialog.reg::backdrop {
  background: rgba(13, 21, 20, 0.55);
}
.reg-body {
  display: grid;
  gap: 14px;
  padding: 24px;
}
.reg-body h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.4rem;
  letter-spacing: -0.02em;
}
.reg-body p {
  margin: 0;
}
.reg-form {
  display: grid;
  gap: 8px;
}
.reg-form label {
  font-size: 0.9rem;
  font-weight: 600;
}
.reg-form input[type='text'],
.reg-form input[type='email'] {
  font: inherit;
  width: 100%;
  min-height: 46px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
}
.reg-form input:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.reg-form .btn {
  margin-top: 8px;
}
.reg-trap {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.reg-google {
  display: flex;
  justify-content: center;
  min-height: 44px;
}
.reg-google[hidden],
.reg-or[hidden],
.reg-err[hidden] {
  display: none;
}
.reg-or {
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}
.reg-err {
  color: var(--danger);
  font-weight: 600;
  font-size: 0.95rem;
}
.reg-close {
  justify-self: center;
  color: var(--muted);
  font-size: 0.9rem;
}
.reg-consent {
  font-size: 0.88rem;
  color: var(--muted);
}
@media (max-width: 520px) {
  .acct-name {
    display: none;
  }
}
.acct-box {
  display: grid;
  gap: 10px;
  justify-items: start;
  margin-top: 8px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.acct-box p {
  margin: 0;
}

/* Versione 45: accesso rapido, documento iniziale e risultati guidati. */
.eyebrow { margin: 0; font-size: .74rem; font-weight: 700; letter-spacing: .13em; color: var(--muted); }
.hero { gap: 40px; }
.hero h1 { max-width: 14ch; }
.hero .lead { max-width: 41ch; }
.hero-badges { display: flex; flex-wrap: wrap; gap: 10px 20px; font-size: .85rem; color: var(--muted); }
.home-opener { min-width: 0; padding: 22px; border: 1px solid var(--line); background: var(--surface); border-radius: 24px; box-shadow: var(--shadow); }
.home-opener > .eyebrow { margin-bottom: 16px; }
.home-opener .dropzone { min-height: 186px; padding: 28px 14px; border-radius: 16px; }
.home-opener .local-note { text-align: center; margin: 14px 0 0; font-size: .78rem; color: var(--muted); }
.opener-status { font-size: .85rem; margin: 12px 0 0; }
.opener-status:empty { display: none; }
.opener-file { display: flex; align-items: center; gap: 16px; margin: 14px 0 20px; }
.opener-file img { width: 65px; height: 85px; object-fit: contain; background: white; border-radius: 5px; }
.opener-file > div { min-width: 0; }
.opener-file p { margin: 5px 0 0; font-size: .85rem; }
.opener-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 16px; }
.opener-actions .btn { min-width: 0; padding: 10px 8px; font-size: .85rem; }
.opener-actions .ico { flex-shrink: 0; }
.section-heading { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px 20px; margin-bottom: 16px; }
.section-heading h2 { margin: 0; font-size: 1.35rem; letter-spacing: -.025em; }
.section-heading p { margin: 0; font-size: .9rem; }
.quick-section { margin: 10px 0 38px; }
.quick-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 12px; }
.quick-card { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 16px; padding: 20px 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--ink); text-decoration: none; font-weight: 700; font-size: .92rem; transition: border-color .18s, transform .18s; }
.quick-card:hover { border-color: var(--accent); transform: translateY(-3px); }
.quick-arrow { position: absolute; right: 13px; top: 15px; color: var(--muted); font-weight: 400; }
.catalog-head { padding-top: 24px; border-top: 1px solid var(--line); }
.catalog-head .search { width: 100%; max-width: 580px; margin-bottom: 22px; }
.catalog-head .chips { margin-top: 0; }
.workflow { list-style: none; display: flex; flex-wrap: wrap; gap: 12px 28px; padding: 0; margin: 22px 0; color: var(--muted); font-size: .87rem; }
.workflow li { display: flex; align-items: center; gap: 8px; }
.workflow li > span { display: inline-grid; place-items: center; width: 25px; height: 25px; border-radius: 50%; background: var(--surface-2); color: var(--ink); font-weight: 700; }
.guide summary, .compression-comparison summary { cursor: pointer; font-weight: 700; min-height: 28px; }
.guide[open] summary { margin-bottom: 18px; }
.guide:not([open]) { padding-top: 16px; padding-bottom: 12px; }
.compression-note { border-left: 3px solid var(--c-organizza); padding: 12px; border-radius: 0 8px 8px 0; background: var(--surface-2); font-size: .87rem; line-height: 1.6; }
.compression-note.is-lossy { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); }
.chain { border-top: 1px solid var(--line); padding-top: 18px; }
.chain h3 { margin: 0 0 4px; font-size: 1rem; }
.chain p { margin: 0 0 14px; font-size: .87rem; }
.chain-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.chain-actions .btn { gap: 7px; }
.compression-comparison { padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.comparison-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 20px 0 12px; }
.comparison-controls input { width: 80px; min-height: 44px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); color: var(--ink); font: inherit; }
.compression-comparison p { font-size: .85rem; }
.comparison-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.comparison-grid figure { margin: 0; min-width: 0; }
.comparison-grid figcaption { margin: 12px 0; font-weight: 700; font-size: .9rem; }
.comparison-grid img { display: block; width: 100%; border: 1px solid var(--line); border-radius: 5px; }
@media (prefers-color-scheme: dark) { :root { --muted: #b0bfbb; } }
@media (max-width: 1000px) { .quick-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 600px) {
  .hero { gap: 24px; padding-top: 24px; }
  .hero h1 { font-size: clamp(2.2rem, 9vw, 3rem); }
  .home-opener { padding: 16px; border-radius: 18px; }
  .home-opener .dropzone { min-height: 145px; }
  .quick-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .quick-card { padding: 16px; gap: 10px; }
  .workflow { gap: 8px 16px; font-size: .78rem; }
  .comparison-grid { grid-template-columns: 1fr; }
  .chain-actions { display: grid; grid-template-columns: 1fr; }
  .chain-actions .btn, .chain-actions select { width: 100%; }
  .privacy-banner { width: calc(100% - 24px); padding: 12px 14px; gap: 10px; }
}
@media (prefers-reduced-motion: reduce) { .quick-card { transition: none; } .quick-card:hover { transform: none; } }


/* Invito a condividere il servizio, senza trasmettere documenti o indirizzi. */
.referral-card { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 24px; margin: 0 0 24px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); text-align: left; color: var(--ink); width: 100%; }
.referral-copy { min-width: 0; }
.referral-card h2, .results .referral-card h2 { font-size: 1.2rem; margin: 0 0 6px; }
.referral-card p { margin: 0; font-size: .95rem; color: var(--muted); }
.referral-card .referral-note { margin-top: 8px; font-size: .8rem; }
.referral-card > .btn { flex-shrink: 0; text-decoration: none; gap: 8px; }
.referral-result { margin: 4px 0 0; padding: 18px; }
@media (max-width: 650px) { .referral-card { flex-direction: column; align-items: stretch; padding: 18px; } .referral-card > .btn { justify-content: center; } }

.referral-card { flex-wrap: wrap; }
.referral-panel { flex: 0 1 auto; min-width: 0; }
.referral-panel[open] { flex: 1 1 100%; }
.referral-panel > summary { cursor: pointer; width: fit-content; }
.referral-form { display: grid; gap: 14px; max-width: 620px; margin-top: 18px; }
.referral-form > label { display: grid; gap: 7px; font-weight: 700; font-size: .9rem; }
.referral-form input[type=email] { width: 100%; min-height: 46px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: var(--surface-2); font: inherit; }
.referral-form > .btn { justify-self: start; }
.referral-message { font-size: .87rem; padding: 12px; background: var(--surface-2); border-radius: 10px; overflow-wrap: anywhere; }
.referral-message summary { cursor: pointer; font-weight: 700; }
.referral-message p { margin-top: 10px; font-size: .87rem; }
.referral-status:empty { display: none; }
.referral-trap { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
@media (max-width: 650px) { .referral-panel { width: 100%; } .referral-panel > summary, .referral-form > .btn { width: 100%; justify-content: center; } }

.seo-content { max-width: 1120px; margin: 36px auto 0; padding: 28px 24px; border-top: 1px solid var(--line); font-size: .95rem; line-height: 1.7; }
.seo-content h2 { font-size: 1.4rem; margin: 0 0 16px; }
.seo-content h3 { font-size: 1rem; margin: 24px 0 8px; }
.seo-content p, .seo-content ol { color: var(--muted); max-width: 80ch; }
.seo-content ol { padding-left: 22px; }
.seo-content li { margin-bottom: 8px; }
.seo-links { display: flex; flex-wrap: wrap; gap: 10px 20px; }
.seo-links a { color: var(--ink); text-underline-offset: 4px; }
.seo-fallback { padding: 28px 0; }
.seo-fallback h1 { max-width: 25ch; font-size: clamp(2rem, 5vw, 3.3rem); }
