*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root { --color: #0047AB; --color-light: #eff6ff; --color-ring: rgba(0,71,171,.12); }
::selection { background: #FFD700; color: #0047AB; }
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 99px; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: #F0F2F8;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 16px 96px;
  color: #1e293b;
  font-size: 16px;
}

.blobs { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.blob { position: absolute; border-radius: 50%; filter: blur(120px); opacity: .5; }
.blob-1 { width: 55vw; height: 55vw; top: -15%; left: -10%; background: #dbeafe; }
.blob-2 { width: 40vw; height: 40vw; bottom: -10%; right: -8%; background: #fef9c3; }
.blob-3 { width: 30vw; height: 30vw; top: 40%; left: 60%; background: #e0e7ff; }

@media (max-width: 768px) {
  .blobs { display: none; }
  html {
    background: linear-gradient(170deg, #dbeafe 0%, #F0F2F8 28%, #F0F2F8 72%, #fef9c3 100%) fixed;
    min-height: 100%;
  }
  body { background: transparent; }
}

.page-content {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 580px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.page-header {
  padding: 48px 0 24px;
  display: flex;
  align-items: center;
  animation: fadeUp .5s cubic-bezier(.22,1,.36,1) both;
}
.page-logo { height: 56px; width: auto; }

/* Garanzia */
.wrap { width: 100%; }
.garanzia-block {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: var(--color-light);
  border: 1.5px solid #bfdbfe;
  border-radius: 20px;
  padding: 16px 20px;
  margin-bottom: 12px;
  animation: fadeUp .5s cubic-bezier(.22,1,.36,1) .04s both;
}
.garanzia-icon {
  width: 40px; height: 40px; border-radius: 12px;
  background: rgba(0,71,171,.12); color: var(--color);
  flex-shrink: 0; display: flex; align-items: center; justify-content: center;
}
.garanzia-title { font-size: .875rem; font-weight: 800; color: var(--color); margin-bottom: 4px; }
.garanzia-text  { font-size: .8125rem; color: #1e40af; line-height: 1.55; }

/* Card */
.card {
  background: #fff;
  border: 1px solid #e8edf5;
  border-radius: 36px;
  box-shadow: 0 4px 24px rgba(0,47,171,.07), 0 1px 4px rgba(0,0,0,.04);
  overflow: hidden;
  animation: fadeUp .5s cubic-bezier(.22,1,.36,1) .08s both;
}

.card-accent {
  display: inline-flex; align-items: center; gap: 7px;
  margin-bottom: 14px; padding: 5px 12px 5px 8px;
  background: var(--color-light); border-radius: 99px;
}
.card-accent-dot   { width: 8px; height: 8px; border-radius: 50%; background: var(--color); flex-shrink: 0; }
.card-accent-label { font-size: .6875rem; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; color: var(--color); }

.card-header { padding: 32px 36px 24px; border-bottom: 1px solid #f1f5f9; }
.card-title  { font-size: 1.35rem; font-weight: 900; color: #0f172a; line-height: 1.25; letter-spacing: -.03em; margin-bottom: 8px; }
.card-desc   { font-size: .875rem; color: #4e5e6e; line-height: 1.7; }

.card-body   { padding: 28px 36px; display: flex; flex-direction: column; gap: 20px; }
.card-footer { padding: 20px 36px 32px; border-top: 1px solid #f1f5f9; display: flex; flex-direction: column; gap: 12px; }

/* 2-col row */
.row-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* Fields */
.campo-wrap  { display: flex; flex-direction: column; }
.field-label { display: block; font-size: .8125rem; font-weight: 700; color: #1e293b; margin-bottom: 8px; letter-spacing: .01em; }
.req         { color: #ef4444; margin-left: 2px; }
.field-hint  { font-size: .75rem; color: #5d6e80; margin-top: 4px; }
.field-row-hint { display: flex; justify-content: space-between; align-items: flex-start; }

.field-input {
  width: 100%;
  border: 1.5px solid #e2e8f0;
  border-radius: 14px;
  font-size: 16px;
  font-family: inherit;
  color: #0f172a;
  background: #f8fafc;
  transition: border-color .15s, box-shadow .15s, background .15s;
  outline: none;
  padding: 12px 16px;
  -webkit-appearance: none;
}
.field-input:focus {
  border-color: var(--color);
  background: #fff;
  box-shadow: 0 0 0 4px var(--color-ring);
}
.field-textarea { resize: vertical; min-height: 140px; line-height: 1.65; }

/* Native select */
.native-select-wrap { position: relative; }
.field-select { appearance: none; -webkit-appearance: none; cursor: pointer; padding-right: 42px; }
.select-arrow {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; pointer-events: none; color: #5d6e80;
}

/* Tags */
.tags-block {
  background: var(--color-light);
  border: 1.5px solid #bfdbfe;
  border-radius: 16px;
  padding: 14px 16px;
}
.tags-title { font-size: .6875rem; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; color: #1e40af; margin-bottom: 10px; }
.tags-list  { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  display: inline-flex; align-items: center;
  font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
  padding: 4px 10px; border-radius: 99px;
  background: rgba(0,71,171,.1); color: var(--color);
}

/* Privacy */
.privacy-block {
  background: var(--color-light);
  border: 1.5px solid #bfdbfe;
  border-radius: 16px;
  padding: 14px 16px;
}
.privacy-wrap { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.privacy-cb   { width: 18px; height: 18px; accent-color: var(--color); cursor: pointer; flex-shrink: 0; margin-top: 2px; }
.privacy-text { font-size: .8375rem; color: #1e40af; line-height: 1.55; font-weight: 500; cursor: pointer; }
.privacy-text a { color: #0047AB; font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
.privacy-text strong { color: #0047AB; }

.info-toggle-btn {
  background: none; border: none; cursor: pointer; padding: 0;
  font-size: .75rem; font-weight: 700; color: var(--color);
  text-decoration: underline; text-underline-offset: 2px;
  font-family: inherit; min-height: 2rem;
  display: inline-flex; align-items: center;
}
.info-toggle-btn:hover { opacity: .8; }

.info-panel { display: none; margin-top: 12px; border-radius: 12px; padding: 14px 16px; font-size: .8125rem; line-height: 1.6; color: #1e40af; background: rgba(0,71,171,.05); border: 1px solid #bfdbfe; }
.info-panel.open { display: block; }
.info-panel .space-y-4 > * + * { margin-top: 1rem; }
.info-panel .space-y-1 > * + * { margin-top: .25rem; }
.info-panel ul { padding-left: 1.25rem; }
.info-panel ul li { margin-bottom: .25rem; }
.info-panel .border-t { border-top: 1px solid rgba(0,71,171,.15); padding-top: .5rem; margin-top: 1rem; }

/* Messages */
.msg     { padding: 12px 16px; font-size: .875rem; border-radius: 14px; font-weight: 600; }
.msg-err { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.hidden  { display: none !important; }

/* Submit */
.btn-submit {
  width: 100%;
  padding: 15px;
  font-size: 1rem;
  font-weight: 700;
  font-family: inherit;
  color: #fff;
  background: linear-gradient(135deg, var(--color) 0%, #1a5dcc 100%);
  border: none;
  border-radius: 50px;
  cursor: pointer;
  transition: opacity .15s, transform .1s, box-shadow .15s;
  letter-spacing: .015em;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  -webkit-appearance: none;
}
.btn-submit:hover:not(:disabled) { opacity: .92; box-shadow: 0 8px 28px rgba(0,71,171,.32); transform: translateY(-1px); }
.btn-submit:active:not(:disabled) { transform: translateY(0) scale(.99); }
.btn-submit:disabled { opacity: .45; cursor: not-allowed; }

.spinner {
  width: 15px; height: 15px;
  border: 2px solid rgba(255,255,255,.35); border-top-color: #fff;
  border-radius: 50%; animation: spin .6s linear infinite;
}

/* Success */
.success-inner { padding: 56px 36px; text-align: center; }
.success-icon  {
  width: 60px; height: 60px; border-radius: 50%;
  background: rgba(34,197,94,.12); color: #16a34a;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px;
}
.success-title { font-size: 1.3rem; font-weight: 900; color: #0f172a; margin-bottom: 10px; letter-spacing: -.02em; }
.success-text  { color: #4e5e6e; font-size: .9375rem; line-height: 1.65; max-width: 320px; margin: 0 auto; }

/* Footer */
.page-footer {
  margin-top: 24px;
  font-size: 11px;
  font-weight: 700;
  color: #475569;
  letter-spacing: .05em;
  text-align: center;
  animation: fadeUp .5s cubic-bezier(.22,1,.36,1) .14s both;
}
.page-footer a { color: var(--color); text-decoration: none; }
.page-footer a:hover { text-decoration: underline; }

/* Captcha note */
.captcha-note { font-size: .8125rem; font-weight: 700; color: #1e40af; margin-top: 8px; }

/* Honeypot */
.hp-wrap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* Skip link */
.a11y-skip {
  position: absolute; top: -100%; left: 8px; z-index: 999999;
  background: #0047ab; color: #fff; padding: 8px 18px;
  border-radius: 0 0 8px 8px; font-weight: 700; font-size: 14px;
  text-decoration: none; white-space: nowrap;
}
.a11y-skip:focus { top: 0; }

/* A11y bar */
#a11y-bar { position: fixed; bottom: 16px; right: 16px; z-index: 99990; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
#a11y-bar button { border: none; background: transparent; cursor: pointer; padding: 0 10px; border-radius: 10px; font-size: 11px; font-weight: 700; color: #475569; font-family: inherit; line-height: 1; transition: background .15s, color .15s; min-width: 44px; height: 44px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; touch-action: manipulation; }
.a11y-btn-label { font-size: 9px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; opacity: .85; }
#a11y-bar button:hover { background: #f1f5f9; color: #0f172a; }
#a11y-bar button[aria-pressed=true] { background: #0047ab; color: #fff; }
.a11y-div { width: 1px; height: 24px; background: #e2e8f0; margin: 0 2px; flex-shrink: 0; }
#a11y-toggle-wrap { display: flex; align-items: center; background: rgba(255,255,255,.97); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1.5px solid #e2e8f0; border-radius: 16px; padding: 4px; box-shadow: 0 4px 24px rgba(0,0,0,.12); }
#a11y-panel { display: none; align-items: center; gap: 2px; background: rgba(255,255,255,.97); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1.5px solid #e2e8f0; border-radius: 16px; padding: 4px; box-shadow: 0 4px 24px rgba(0,0,0,.12); }

/* Font scaling */
html.a11y-f1 { font-size: 112%; }
html.a11y-f2 { font-size: 125%; }
html.a11y-f3 { font-size: 140%; }

/* High contrast */
body.a11y-hc { background: #fff !important; color: #000 !important; }
body.a11y-hc .card { border: 1px solid #ccc !important; }
body.a11y-hc .garanzia-block, body.a11y-hc .tags-block, body.a11y-hc .privacy-block { background: #f0f0f0 !important; border-color: #999 !important; }
body.a11y-hc .garanzia-title, body.a11y-hc .garanzia-text { color: #000 !important; }
body.a11y-hc .tag { background: #ddd !important; color: #000 !important; }
body.a11y-hc .field-input { background: #fff !important; border-color: #666 !important; color: #000 !important; }
body.a11y-hc .info-panel { background: #f5f5f5 !important; }
body.a11y-hc #a11y-toggle-wrap, body.a11y-hc #a11y-panel { background: #fff; border: 2px solid #000; }

/* Warm */
body.a11y-warm { background: #fff8e7 !important; color: #2d1b00 !important; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(22px); }
  to   { opacity: 1; transform: none; }
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 480px) {
  .card-header, .card-body, .card-footer { padding-left: 20px; padding-right: 20px; }
  .card { border-radius: 24px; }
  .page-header { padding: 36px 0 20px; }
  .success-inner { padding: 40px 20px; }
  .row-2col { grid-template-columns: 1fr; }
}
