/* Napoli Affissioni — area affiliati.
   Stesso linguaggio del sito (site.css): bianco, blu scuro #1E2B4E, tratti sottili, spigoli netti, etichette piccole in maiuscolo,
   verde #64B989 per ciò che va bene. Le pagine pubbliche (accedi, registrati, diventa affiliato) usano i componenti del sito;
   qui ci sono solo i pezzi del pannello. Tutte le classi iniziano con af-. */

.af-body { background: #fff; color: var(--ink); padding-bottom: calc(40px + env(safe-area-inset-bottom)); }
.af-wrap { max-width: 1180px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 48px); }

/* ---------- Testata e schede ---------- */
.af-top { position: sticky; top: 0; z-index: 40; background: rgba(255,255,255,.96); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--gray-200); padding-top: env(safe-area-inset-top); }
.af-top .af-wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 64px; }
.af-brand { display: inline-flex; align-items: center; gap: 10px; line-height: 1; }
.af-brand .brand-mark { height: 30px; width: auto; display: block; }
.af-brand .brand-name { font-size: 17px; font-weight: 700; letter-spacing: -.02em; color: var(--ink); white-space: nowrap; }
.af-brand .brand-name b { color: var(--blue); font-weight: 700; }
.af-brand em { font-style: normal; font-size: 10.5px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--gray-500); padding-left: 12px; margin-left: 2px; border-left: 1px solid var(--gray-200); white-space: nowrap; }
.af-user { display: flex; align-items: center; gap: 18px; min-width: 0; }
.af-user-id { display: flex; flex-direction: column; align-items: flex-end; min-width: 0; line-height: 1.25; }
.af-user-id strong { font-size: 13px; font-weight: 600; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.af-user-id span { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--gray-500); font-weight: 500; }
.af-exit { background: none; border: 0; padding: 0 0 3px; cursor: pointer; font: 600 11.5px/1 var(--f); letter-spacing: .1em; text-transform: uppercase; color: var(--ink); border-bottom: 1px solid var(--ink); }
.af-exit:hover { color: var(--blue); border-color: var(--blue); }
.af-tabs { background: #fff; border-bottom: 1px solid var(--gray-200); }
.af-tabs .af-wrap { display: flex; gap: clamp(20px, 3.2vw, 40px); overflow-x: auto; scrollbar-width: none; }
.af-tabs .af-wrap::-webkit-scrollbar { display: none; }
.af-tabs a { position: relative; flex: none; display: inline-flex; align-items: center; gap: 8px; padding: 15px 0; font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--gray-500); transition: color .25s ease; }
.af-tabs a:hover { color: var(--ink); }
.af-tabs a.is-on { color: var(--ink); }
.af-tabs a.is-on::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--ink); }
.af-tabs a b { font-size: 10.5px; font-weight: 700; min-width: 19px; height: 19px; padding: 0 6px; display: inline-flex; align-items: center; justify-content: center; background: var(--status-ok); color: var(--ink); letter-spacing: 0; }
@media (max-width: 640px) {
  .af-brand em, .af-user-id { display: none; }
  .af-top .af-wrap { height: 58px; }
}

.af-imp { background: var(--ink); color: #fff; font-size: 13px; }
.af-imp .af-wrap { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding-top: 10px; padding-bottom: 10px; flex-wrap: wrap; }
.af-imp strong { font-weight: 600; }
.af-imp button { background: #fff; color: var(--ink); border: 0; padding: 7px 14px; border-radius: 10px; font: 700 11.5px/1 var(--f); letter-spacing: .08em; text-transform: uppercase; cursor: pointer; }

/* ---------- Pagina ---------- */
.af-main { padding: clamp(24px, 4vw, 44px) 0 24px; }
.af-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; flex-wrap: wrap; margin-bottom: 26px; }
.af-h1 { font-size: clamp(26px, 3.2vw, 38px); font-weight: 600; letter-spacing: -.03em; line-height: 1.08; }
.af-sub { margin-top: 8px; font-size: 14.5px; line-height: 1.55; color: var(--gray-700); max-width: 62ch; }
.af-back { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 14px; font-size: 11.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--gray-500); }
.af-back:hover { color: var(--ink); }
.af-back .icon { width: 13px; height: 13px; transform: rotate(180deg); }
.af-h2 { font-size: 13px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--ink); margin: 0 0 14px; }
.af-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.af-section { margin-top: clamp(28px, 4vw, 44px); }
.af-sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; margin-bottom: 10px; }
.af-sec-head .af-h2 { margin: 0; }
.af-sec-head a { font-size: 11.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; border-bottom: 1px solid var(--ink); padding-bottom: 2px; }

/* ---------- Bottoni e link ---------- */
.af-btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; height: 46px; padding: 0 20px; border: 1px solid var(--ink); background: var(--ink); color: #fff; border-radius: 12px; font: 600 12px/1 var(--f); letter-spacing: .1em; text-transform: uppercase; cursor: pointer; white-space: nowrap; transition: background .25s ease, color .25s ease, border-color .25s ease; }
.af-btn:hover { background: var(--blue); border-color: var(--blue); color: #fff; }
.af-btn .icon { width: 15px; height: 15px; }
.af-btn--ghost { background: #fff; color: var(--ink); }
.af-btn--ghost:hover { background: var(--ink); border-color: var(--ink); color: #fff; }
.af-btn--green { background: var(--status-ok); border-color: var(--status-ok); color: var(--ink); }
.af-btn--green:hover { background: var(--ink); border-color: var(--ink); color: #fff; }
.af-btn--danger { background: #fff; border-color: #f1b8b2; color: #C22B1C; }
.af-btn--danger:hover { background: #C22B1C; border-color: #C22B1C; color: #fff; }
.af-btn--sm { height: 36px; padding: 0 14px; font-size: 11px; border-radius: 10px; }
.af-btn--block { width: 100%; }
.af-btn[disabled], .af-btn.is-off { opacity: .4; pointer-events: none; }
.af-link { background: none; border: 0; padding: 0 0 3px; border-bottom: 1px solid currentColor; cursor: pointer; font: 600 11.5px/1.2 var(--f); letter-spacing: .1em; text-transform: uppercase; color: var(--ink); }
.af-link:hover { color: var(--blue); }
.af-link--danger { color: #C22B1C; }
form.af-inline { display: inline; }

/* ---------- Messaggi ---------- */
.af-alert { display: flex; gap: 12px; align-items: flex-start; padding: 14px 18px; margin-bottom: 20px; font-size: 14px; line-height: 1.5; border-left: 3px solid var(--ink); background: var(--gray-100); }
.af-alert .icon { width: 18px; height: 18px; margin-top: 2px; }
.af-alert strong { font-weight: 600; }
.af-alert--ok { border-color: var(--status-ok); background: rgba(100,185,137,.14); }
.af-alert--err { border-color: var(--status-hot); background: #FFE9E6; color: #8E1F13; }
.af-alert--warn { border-color: var(--status-warn); background: #FFF3DC; color: #6A4300; }
.af-alert--info { border-color: var(--blue); background: var(--blue-tint); }
.af-alert ul { margin: 6px 0 0 18px; }
.af-alert a { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Badge di stato ---------- */
.af-badge { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 2px; font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; white-space: nowrap; background: var(--gray-100); color: var(--gray-700); }
.af-badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.af-badge--ok { background: rgba(100,185,137,.18); color: #2F7D55; }
.af-badge--warn { background: #FFF0D2; color: #8A5200; }
.af-badge--err { background: #FFE3E0; color: #B3261E; }
.af-badge--blue { background: var(--blue-tint); color: var(--blue); }
.af-badge--plain::before { display: none; }

/* ---------- Riquadri e numeri ---------- */
.af-card { border: 1px solid var(--gray-200); background: #fff; }
.af-card-pad { padding: clamp(18px, 2.4vw, 28px); }
.af-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--gray-200); }
.af-kpi { display: block; padding: 22px 22px 20px; border-right: 1px solid var(--gray-200); background: #fff; transition: background .25s ease; }
.af-kpi:last-child { border-right: 0; }
a.af-kpi:hover { background: var(--gray-100); }
.af-kpi-n { display: block; font-size: clamp(30px, 3.4vw, 42px); font-weight: 600; letter-spacing: -.04em; line-height: 1; }
.af-kpi-l { display: block; margin-top: 10px; font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--gray-500); }
.af-kpi.is-hot .af-kpi-n { color: var(--blue); }
@media (max-width: 860px) { .af-kpis { grid-template-columns: 1fr 1fr; } .af-kpi:nth-child(2) { border-right: 0; } .af-kpi:nth-child(-n+2) { border-bottom: 1px solid var(--gray-200); } }

.af-grid2 { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: clamp(20px, 3vw, 40px); align-items: start; }
.af-grid2--eq { grid-template-columns: 1fr 1fr; }
.af-grid2 > *, .af-row2 > *, .af-row3 > *, .af-row4 > * { min-width: 0; }
@media (max-width: 900px) { .af-grid2, .af-grid2--eq { grid-template-columns: minmax(0, 1fr); } }

.af-quick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.af-quick a { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 22px; background: var(--ink); color: #fff; font-size: 12.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; border-radius: 12px; transition: background .25s ease; }
.af-quick a:nth-child(2) { background: #263a6b; }
.af-quick a:nth-child(3) { background: var(--status-ok); color: var(--ink); }
.af-quick a:hover { background: var(--blue); color: #fff; }
.af-quick .icon { width: 20px; height: 20px; }
@media (max-width: 760px) { .af-quick { grid-template-columns: 1fr; } }

/* ---------- Elenchi a righe ---------- */
.af-list { list-style: none; border-top: 1px solid var(--gray-200); }
.af-li { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--gray-200); }
.af-li--plain { grid-template-columns: minmax(0, 1fr) auto; }
.af-li-img { width: 56px; height: 42px; background: var(--gray-100); overflow: hidden; }
.af-li-img img, .af-li-img .ph { width: 100%; height: 100%; object-fit: cover; }
.af-li-t strong { display: block; font-size: 14.5px; font-weight: 600; line-height: 1.3; }
.af-li-t small { display: block; margin-top: 2px; font-size: 12.5px; color: var(--gray-500); }
.af-li-r { text-align: right; font-size: 12px; color: var(--gray-500); display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.af-code { font: 600 11.5px/1 ui-monospace, 'SF Mono', Menlo, monospace; letter-spacing: .04em; color: var(--blue); }
.af-empty { padding: 34px 20px; border: 1px dashed var(--gray-200); text-align: center; color: var(--gray-500); font-size: 14px; line-height: 1.6; }
.af-empty strong { display: block; color: var(--ink); font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.af-avvisi { list-style: none; }
.af-avvisi li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--gray-200); font-size: 14px; line-height: 1.45; }
.af-avvisi li:first-child { border-top: 1px solid var(--gray-200); }
.af-avvisi .icon { width: 17px; height: 17px; margin-top: 2px; color: var(--status-warn); }
.af-avvisi li.is-err .icon { color: var(--status-hot); }
.af-avvisi a { text-decoration: underline; text-underline-offset: 3px; }

/* I miei impianti: riga larga con foto, dati e azioni */
.af-imps { list-style: none; border-top: 1px solid var(--gray-200); }
.af-imp-row { display: grid; grid-template-columns: 124px minmax(0, 1fr) auto; gap: 18px; align-items: center; padding: 16px 0; border-bottom: 1px solid var(--gray-200); }
.af-imp-img { position: relative; width: 124px; height: 92px; background: var(--gray-100); overflow: hidden; }
.af-imp-img img, .af-imp-img .ph { width: 100%; height: 100%; object-fit: cover; }
.af-imp-info h3 { font-size: 16px; font-weight: 600; letter-spacing: -.01em; line-height: 1.25; margin: 6px 0 4px; }
.af-imp-info h3 a:hover { color: var(--blue); }
.af-imp-info p { font-size: 13px; color: var(--gray-700); line-height: 1.45; }
.af-imp-meta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.af-imp-motivo { margin-top: 8px; padding: 9px 12px; font-size: 13px; line-height: 1.45; background: #FFF3DC; border-left: 3px solid var(--status-warn); color: #6A4300; }
.af-imp-act { display: flex; flex-direction: column; gap: 8px; align-items: stretch; min-width: 150px; }
@media (max-width: 760px) {
  .af-imp-row { grid-template-columns: 96px minmax(0, 1fr); gap: 14px; align-items: start; }
  .af-imp-img { width: 96px; height: 76px; }
  .af-imp-act { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; }
  .af-imp-act > * { flex: 1 1 auto; }
}

/* ---------- Filtri a scheda ---------- */
.af-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.af-chip { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border: 1px solid var(--gray-200); background: #fff; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink); border-radius: 10px; transition: background .2s ease, border-color .2s ease; }
.af-chip:hover { border-color: var(--ink); }
.af-chip.is-on { background: var(--ink); border-color: var(--ink); color: #fff; }
.af-chip small { font-size: 11px; font-weight: 600; opacity: .6; letter-spacing: 0; }
.af-filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.af-filters .af-in { flex: 1 1 200px; max-width: 320px; }
@media (max-width: 640px) { .af-filters .af-in { max-width: none; flex-basis: 100%; } }

/* ---------- Moduli ---------- */
.af-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; min-width: 0; }
.af-field > span, .af-lbl { font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--gray-500); }
.af-field > span i { font-style: normal; color: var(--status-hot); }
.af-in { width: 100%; height: 48px; padding: 0 14px; font-size: 15px; font-weight: 500; color: var(--ink); background: #fff; border: 1px solid #cfd6e2; border-radius: 0; font-family: var(--f); transition: border-color .2s ease, box-shadow .2s ease; -webkit-appearance: none; appearance: none; }
textarea.af-in { height: auto; min-height: 110px; padding: 12px 14px; resize: vertical; line-height: 1.5; }
select.af-in { padding-right: 38px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='7'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%231E2B4E' fill='none' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat right 14px center; }
.af-in:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(30,43,78,.08); }
.af-in:disabled, .af-in[readonly] { background: var(--gray-100); color: var(--gray-700); }
input[type=file].af-in { height: auto; padding: 11px 12px; }
.af-hint { font-size: 12.5px; line-height: 1.5; color: var(--gray-500); }
.af-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.af-row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.af-row4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
@media (max-width: 760px) { .af-row2, .af-row3, .af-row4 { grid-template-columns: 1fr; gap: 0; } .af-row3.keep, .af-row2.keep { grid-template-columns: 1fr 1fr; gap: 12px; } }
.af-check { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; line-height: 1.45; color: var(--ink); text-transform: none; letter-spacing: 0; font-weight: 500; cursor: pointer; }
.af-check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--ink); flex: none; }
.af-form-actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.af-fieldset { border: 1px solid var(--gray-200); padding: clamp(18px, 2.4vw, 28px); margin-bottom: 22px; min-width: 0; }
.af-fieldset > legend { padding: 0 8px; margin-left: -8px; font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; }

/* Posizione sulla mappa */
.af-map-wrap { position: relative; margin-bottom: 10px; }
.af-map { position: relative; width: 100%; aspect-ratio: 16 / 9; min-height: 260px; background: #F4F6FA; overflow: hidden; border: 1px solid var(--gray-200); }
.af-map-pin { position: absolute; left: 50%; top: 50%; width: 38px; height: 38px; margin: -38px 0 0 -19px; color: var(--blue); pointer-events: none; z-index: 4; filter: drop-shadow(0 6px 6px rgba(30,43,78,.3)); }
.af-map-pin svg { width: 100%; height: 100%; display: block; }
.af-map-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.af-map-status { font-size: 13px; font-weight: 600; color: var(--gray-700); }
.af-map-status.is-ok { color: #2F7D55; }

/* Foto */
.af-foto-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-top: 14px; }
.af-foto { position: relative; border: 1px solid var(--gray-200); background: var(--gray-100); }
.af-foto img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.af-foto-bar { display: flex; justify-content: space-between; align-items: center; gap: 6px; padding: 8px 10px; background: #fff; border-top: 1px solid var(--gray-200); }
.af-foto-first { position: absolute; left: 8px; top: 8px; }
.af-drop { display: grid; justify-items: center; gap: 6px; text-align: center; padding: 28px 18px; border: 1.5px dashed #b9c3d6; background: var(--gray-100); cursor: pointer; transition: border-color .2s ease, background .2s ease; }
.af-drop:hover, .af-drop.is-over, .af-drop:focus-within { border-color: var(--ink); background: var(--blue-tint); }
.af-drop .icon { width: 28px; height: 28px; color: var(--blue); }
.af-drop strong { font-size: 14px; font-weight: 600; }
.af-drop span { font-size: 12.5px; color: var(--gray-500); }
.af-drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.af-prog { margin-top: 14px; }
.af-prog-bar { height: 6px; background: var(--gray-100); overflow: hidden; }
.af-prog-bar span { display: block; height: 100%; width: 0; background: var(--status-ok); transition: width .25s var(--ease-out); }
.af-prog p { margin-top: 8px; font-size: 13px; font-weight: 600; }
.af-log { margin-top: 12px; max-height: 220px; overflow: auto; font-size: 13px; line-height: 1.6; }
.af-log .is-err { color: #B3261E; } .af-log .is-ok { color: #2F7D55; }

/* ---------- Pannello stato di un impianto ---------- */
.af-status { display: flex; flex-direction: column; gap: 14px; padding: clamp(18px, 2.4vw, 26px); border: 1px solid var(--gray-200); background: var(--gray-100); }
.af-status h2 { font-size: 13px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; }
.af-status p { font-size: 14px; line-height: 1.55; color: var(--gray-700); }
.af-steps { list-style: none; counter-reset: s; display: grid; gap: 10px; }
.af-steps li { counter-increment: s; display: flex; gap: 12px; align-items: flex-start; font-size: 14px; line-height: 1.45; }
.af-steps li::before { content: counter(s); flex: none; width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--ink); border-radius: 50%; font-size: 11.5px; font-weight: 600; }
.af-steps li.is-done::before { content: '✓'; background: var(--status-ok); border-color: var(--status-ok); color: var(--ink); }
.af-steps li.is-done { color: var(--gray-500); }

/* ---------- Disponibilità ---------- */
.af-cal-month { margin-top: 22px; }
.af-cal-month h3 { font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--gray-500); margin-bottom: 10px; }
.af-cal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 8px; }
.af-per { position: relative; display: block; cursor: pointer; }
.af-per input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; cursor: pointer; margin: 0; }
.af-per span { display: flex; flex-direction: column; gap: 3px; padding: 11px 12px; border: 1px solid var(--gray-200); background: #fff; font-size: 13px; font-weight: 600; line-height: 1.25; transition: border-color .2s ease, background .2s ease, box-shadow .2s ease; }
.af-per span small { font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: #2F7D55; }
.af-per.is-occ span { background: #FFE9E6; border-color: #f4c4be; }
.af-per.is-occ span small { color: #B3261E; }
.af-per.is-trat span { background: #FFF3DC; border-color: #f2d9a3; cursor: not-allowed; }
.af-per.is-trat span small { color: #8A5200; }
.af-per.is-trat input { cursor: not-allowed; }
.af-per input:checked + span { box-shadow: inset 0 0 0 2px var(--ink); border-color: var(--ink); }
.af-per input:focus-visible + span { outline: 2.5px solid var(--blue); outline-offset: 2px; }
.af-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--gray-700); }
.af-legend i { display: inline-block; width: 12px; height: 12px; margin-right: 6px; vertical-align: -1px; border: 1px solid var(--gray-200); background: #fff; }
.af-legend i.occ { background: #FFE9E6; border-color: #f4c4be; } .af-legend i.trat { background: #FFF3DC; border-color: #f2d9a3; }
.af-cal-tools { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin: 18px 0 4px; }
.af-cal-tools .af-in { flex: 1 1 280px; height: 38px; max-width: 460px; }
.af-selbar { position: sticky; bottom: 12px; z-index: 20; display: flex; gap: 12px; align-items: center; justify-content: space-between; margin-top: 24px; padding: 12px 14px 12px 18px; background: var(--ink); color: #fff; }
.af-selbar-b { display: flex; gap: 8px; }
.af-selbar .af-btn { height: 40px; }
.af-selbar .af-btn--ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.5); }
.af-selbar .af-btn--ghost:hover { background: #fff; color: var(--ink); }
.af-selbar-n { font-size: 13px; font-weight: 600; }
@media (max-width: 560px) { .af-selbar { flex-direction: column; align-items: stretch; gap: 8px; } .af-selbar-b > * { flex: 1; padding: 0 10px; } .af-selbar-n { text-align: center; } }

/* ---------- Statistiche ---------- */
.af-chart { display: flex; align-items: flex-end; gap: 2px; height: 140px; padding: 6px 0 0; border-bottom: 1px solid var(--gray-200); }
.af-chart i { flex: 1 1 0; min-width: 2px; background: var(--blue); opacity: .85; transition: opacity .2s ease; position: relative; }
.af-chart i:hover { opacity: 1; background: var(--ink); }
.af-chart i.z { background: var(--gray-200); height: 2px !important; }
.af-chart-ax { display: flex; justify-content: space-between; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--gray-500); margin-top: 8px; }
.af-tbl-wrap { overflow-x: auto; }
.af-tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.af-tbl th { text-align: left; padding: 10px 14px 10px 0; font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--gray-500); border-bottom: 1px solid var(--ink); white-space: nowrap; }
.af-tbl td { padding: 13px 14px 13px 0; border-bottom: 1px solid var(--gray-200); vertical-align: top; }
.af-tbl .n { text-align: right; font-variant-numeric: tabular-nums; padding-right: 0; padding-left: 14px; }
.af-tbl tfoot td { font-weight: 700; border-bottom: 0; border-top: 1px solid var(--ink); }
.af-tbl small { display: block; color: var(--gray-500); font-size: 12px; }
.af-tbl tr.is-off td { opacity: .45; }
.af-tbl tr.is-err td { background: #FFF6F5; }
.af-tbl tr.is-skip td { opacity: .55; }
.af-tbl .col-sel { width: 34px; }
.af-tbl select.af-in { height: 40px; min-width: 190px; }
.af-periodi { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 22px; }
.af-periodi form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.af-periodi .af-in { height: 38px; width: auto; }

/* ---------- Import ---------- */
.af-steps-h { display: flex; gap: 0; margin-bottom: 26px; border: 1px solid var(--gray-200); }
.af-steps-h a, .af-steps-h span { flex: 1; padding: 13px 16px; font-size: 11.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--gray-500); border-right: 1px solid var(--gray-200); display: flex; gap: 8px; align-items: center; }
.af-steps-h > :last-child { border-right: 0; }
.af-steps-h .is-on { background: var(--ink); color: #fff; }
.af-steps-h .is-done { color: #2F7D55; }
@media (max-width: 640px) { .af-steps-h { flex-direction: column; } .af-steps-h a, .af-steps-h span { border-right: 0; border-bottom: 1px solid var(--gray-200); } }

/* ---------- Accesso bloccato / in verifica ---------- */
.af-gate { max-width: 620px; margin: clamp(24px, 6vw, 70px) auto; padding: clamp(24px, 4vw, 40px); border: 1px solid var(--gray-200); }
.af-gate h1 { font-size: clamp(22px, 3vw, 30px); font-weight: 600; letter-spacing: -.02em; margin: 14px 0 10px; }
.af-gate p { font-size: 15px; line-height: 1.6; color: var(--gray-700); margin-bottom: 10px; }
.af-gate .af-actions { margin-top: 18px; }

.af-toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); opacity: 0; z-index: 90; padding: 12px 18px; background: var(--ink); color: #fff; font-size: 13.5px; font-weight: 600; transition: opacity .25s ease, transform .25s ease; pointer-events: none; }
.af-toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Pagine pubbliche (Diventa affiliato, Termini) ---------- */
.afp-hero { background: var(--ink); color: #fff; position: relative; overflow: hidden; }
.afp-hero .nm-wm { position: absolute; right: -6%; top: -20%; width: min(520px, 60%); height: auto; fill: #fff; opacity: .06; transform: rotate(-6deg); pointer-events: none; }
.afp-hero-in { position: relative; display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: clamp(28px, 5vw, 80px); align-items: end; padding-top: clamp(44px, 7vw, 96px); padding-bottom: clamp(44px, 7vw, 96px); }
.afp-k { font-size: 11px; font-weight: 500; letter-spacing: .16em; text-transform: uppercase; color: var(--status-ok); margin-bottom: 18px; }
.afp-hero h1 { font-size: clamp(32px, 5vw, 62px); font-weight: 600; letter-spacing: -.04em; line-height: 1.02; max-width: 14em; }
.afp-hero p { margin-top: 22px; max-width: 46ch; font-size: clamp(15px, 1.5vw, 18px); line-height: 1.6; color: rgba(255,255,255,.82); }
.afp-cta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 30px; }
.afp-cta .af-btn { background: #fff; color: var(--ink); border-color: #fff; }
.afp-cta .af-btn:hover { background: var(--status-ok); border-color: var(--status-ok); color: var(--ink); }
.afp-cta .af-btn--ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.55); }
.afp-cta .af-btn--ghost:hover { background: #fff; color: var(--ink); border-color: #fff; }
.afp-facts { list-style: none; border-top: 1px solid rgba(255,255,255,.2); }
.afp-facts li { padding: 15px 0; border-bottom: 1px solid rgba(255,255,255,.2); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: rgba(255,255,255,.88); display: flex; gap: 12px; align-items: center; }
.afp-facts .icon { width: 16px; height: 16px; color: var(--status-ok); }
.afp-sec { padding: clamp(40px, 6vw, 80px) 0; }
.afp-sec + .afp-sec { border-top: 1px solid var(--gray-200); }
.afp-sec h2 { font-size: clamp(24px, 3vw, 38px); font-weight: 600; letter-spacing: -.03em; line-height: 1.1; margin-bottom: 14px; max-width: 18em; }
.afp-lead { font-size: 16px; line-height: 1.6; color: var(--gray-700); max-width: 56ch; margin-bottom: 30px; }
.afp-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; border: 1px solid var(--gray-200); }
.afp-grid > div { padding: 26px 24px 28px; border-right: 1px solid var(--gray-200); }
.afp-grid > div:last-child { border-right: 0; }
.afp-grid .icon { width: 26px; height: 26px; color: var(--blue); margin-bottom: 16px; }
.afp-grid h3 { font-size: 16px; font-weight: 600; letter-spacing: -.01em; margin-bottom: 8px; line-height: 1.25; }
.afp-grid p { font-size: 14px; line-height: 1.6; color: var(--gray-700); }
.afp-steps { list-style: none; counter-reset: p; border-top: 1px solid var(--gray-200); max-width: 780px; }
.afp-steps li { counter-increment: p; display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 16px; padding: 20px 0; border-bottom: 1px solid var(--gray-200); }
.afp-steps li::before { content: counter(p); width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--ink); border-radius: 50%; font-size: 13px; font-weight: 600; }
.afp-steps h3 { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.afp-steps p { font-size: 14.5px; line-height: 1.6; color: var(--gray-700); }
.afp-cond { list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: 0 clamp(24px, 4vw, 56px); max-width: 980px; }
.afp-cond li { display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--gray-200); font-size: 14.5px; line-height: 1.55; }
.afp-cond .icon { width: 18px; height: 18px; color: var(--status-ok); margin-top: 3px; }
.afp-final { background: var(--blue); color: #fff; padding: clamp(36px, 5vw, 64px) 0; }
.afp-final .af-wrap { display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.afp-final h2 { font-size: clamp(22px, 3vw, 34px); font-weight: 600; letter-spacing: -.03em; max-width: 20em; }
.afp-final .af-btn { background: #fff; color: var(--ink); border-color: #fff; }
.afp-final .af-btn:hover { background: var(--ink); color: #fff; border-color: var(--ink); }
.afp-doc { max-width: 760px; margin: 0 auto; padding: clamp(32px, 5vw, 64px) 0; }
.afp-doc h1 { font-size: clamp(28px, 4vw, 42px); font-weight: 600; letter-spacing: -.03em; margin-bottom: 8px; }
.afp-doc .ver { font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--gray-500); margin-bottom: 28px; }
.afp-doc h2 { font-size: 15px; font-weight: 600; letter-spacing: .02em; margin: 28px 0 8px; }
.afp-doc p, .afp-doc li { font-size: 15px; line-height: 1.7; color: var(--gray-700); }
.afp-doc ul { margin: 6px 0 0 20px; }
@media (max-width: 900px) { .afp-hero-in { grid-template-columns: 1fr; } .afp-grid { grid-template-columns: 1fr; } .afp-grid > div { border-right: 0; border-bottom: 1px solid var(--gray-200); } .afp-grid > div:last-child { border-bottom: 0; } .afp-cond { grid-template-columns: 1fr; } }

/* Pagine di accesso: casella "accetto i termini" e note */
.au-main .af-check { margin: 4px 0 2px; font-size: 13px; }
.au-main .af-check a { color: var(--blue); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.au-main .f-group textarea { width: 100%; min-height: 84px; padding: 12px 14px; font-size: 15px; color: var(--ink); background: #fff; border: 1px solid #cfd6e2; border-radius: 0; resize: vertical; font-family: inherit; line-height: 1.5; }
.au-main .f-group textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(30,43,78,.08); }
.au-main .f-group > span i { font-style: normal; color: var(--status-hot); }
.au-main .f-group .af-hint { display: block; margin-top: 2px; text-transform: none; letter-spacing: 0; }

@media print { .af-top, .af-tabs, .af-actions, .af-selbar { display: none !important; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Scheda impianto pubblica: segnalazione di un problema (solo impianti di affiliati) */
.pd-segnala { margin-top: 18px; border-top: 1px solid var(--gray-200); padding-top: 14px; }
.pd-segnala summary { cursor: pointer; list-style: none; font-size: 11.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--gray-500); }
.pd-segnala summary::-webkit-details-marker { display: none; }
.pd-segnala summary:hover, .pd-segnala[open] summary { color: var(--ink); }
.pd-segnala form { margin-top: 14px; }
.pd-segnala .hp { position: absolute; left: -5000px; }

.af-legal { padding: 0 0 28px; font-size: 11.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--gray-500); }
.af-legal a:hover { color: var(--ink); text-decoration: underline; }
.sf-legal a { text-decoration: underline; text-underline-offset: 3px; }
.afp-doc mark { background: #FFF3DC; color: #6A4300; padding: 0 4px; }
.afp-doc table { font-size: 13.5px; } .afp-doc code { background: var(--gray-100); padding: 1px 6px; font-size: 12.5px; }
