/* XBAZAR - Area commercianti */
:root {
  --azzurro: #1F6FB2;
  --azzurro-scuro: #185C95;
  --verde: #2C8A47;
  --rosso: #C2361F;
  --ink: #1B2A3A;
  --ink-2: #51606F;
  --line: #DCE4EB;
  --wash: #F1F5F8;
  --surface: #FFFFFF;
  --r: 14px;
  --font: "Bricolage Grotesque", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.5; color: var(--ink); background: var(--wash); -webkit-font-smoothing: antialiased; }
a { color: var(--azzurro); }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #5DA9E9; outline-offset: 2px; }

.pagina { max-width: 640px; margin: 0 auto; padding: 20px 16px 48px; }
body.admin .pagina { max-width: 980px; }
.marchio { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 800; font-size: 18px; margin-bottom: 18px; }
.marchio img { width: 40px; height: 40px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(27,42,58,.18); object-fit: contain; }
.marchio small { display: block; font-weight: 500; font-size: 13px; color: var(--ink-2); line-height: 1.1; }

.foglio { background: var(--surface); border-radius: 22px; padding: 28px 24px; box-shadow: 0 1px 2px rgba(27,42,58,.08), 0 8px 30px rgba(27,42,58,.08); }
.foglio.stretto { max-width: 460px; margin: 0 auto; }
h1 { margin: 0 0 8px; font-size: 30px; line-height: 1.12; font-weight: 800; letter-spacing: -.02em; }
h2 { font-size: 18px; margin: 0 0 6px; }
.lead { color: var(--ink-2); font-size: 17px; margin: 0 0 20px; }
.occhiello { margin: 0 0 6px; color: var(--azzurro); font-weight: 700; font-size: 14px; text-transform: uppercase; letter-spacing: .06em; }
.ciao { margin: 0; color: var(--ink-2); font-weight: 600; }
.sotto { margin: 18px 0 0; color: var(--ink-2); font-size: 15px; }

/* moduli */
.modulo { display: block; }
fieldset { border: 0; padding: 0; margin: 0 0 26px; }
legend { display: flex; align-items: center; gap: 10px; font-weight: 750; font-size: 18px; margin-bottom: 10px; padding: 0; }
legend small { font-weight: 500; color: var(--ink-2); font-size: 14px; }
.num { width: 28px; height: 28px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--ink); color: #fff; font-size: 14px; }
.etichetta { display: block; font-weight: 650; margin: 14px 0 6px; }
.etichetta small { font-weight: 500; color: var(--ink-2); margin-left: 4px; }
input[type=text], input[type=email], input[type=tel], input[type=password], input[type=search], input:not([type]), textarea {
  width: 100%; font: inherit; color: var(--ink); background: #fff;
  border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 14px; min-height: 48px;
}
textarea { resize: vertical; }
input:focus, textarea:focus { border-color: var(--azzurro); outline: none; box-shadow: 0 0 0 3px rgba(93,169,233,.35); }
.campo-pw { position: relative; }
.campo-pw input { padding-right: 96px; }
.mostra { position: absolute; right: 6px; top: 6px; height: 36px; border: 0; background: var(--wash); border-radius: 9px; padding: 0 12px; font: inherit; font-size: 14px; font-weight: 650; color: var(--ink-2); cursor: pointer; }
.spunta { display: flex; gap: 10px; align-items: flex-start; margin-top: 16px; font-size: 15px; color: var(--ink-2); }
.spunta input { width: 20px; height: 20px; margin-top: 2px; flex: none; accent-color: var(--azzurro); }
.trappola { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.scelte { margin-top: 10px; max-height: 300px; overflow-y: auto; border: 1.5px solid var(--line); border-radius: 12px; padding: 4px; overscroll-behavior: contain; }
.scelta { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 9px; cursor: pointer; }
.scelta:hover { background: var(--wash); }
.scelta input { width: 20px; height: 20px; flex: none; accent-color: var(--azzurro); }
.scelta span { display: block; min-width: 0; }
.scelta strong { display: block; font-weight: 650; }
.scelta small { display: block; color: var(--ink-2); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scelta:has(input:checked) { background: #E6F0F9; box-shadow: inset 0 0 0 1.5px var(--azzurro); }
.nessuna { padding: 12px; margin: 0; color: var(--ink-2); }

/* bottoni */
.bottone { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 22px;
  border: 0; border-radius: 24px; background: var(--azzurro); color: #fff; font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; }
.bottone:hover { background: var(--azzurro-scuro); }
.bottone.grande { width: 100%; min-height: 54px; font-size: 17px; margin-top: 6px; }
.bottone.secondario { background: var(--wash); color: var(--ink); }
.bottone.secondario:hover { background: #E3ECF4; }
.bottone.verde { background: var(--verde); }
.bottone.verde:hover { background: #22703A; }
.bottone.piccolo { min-height: 40px; padding: 0 16px; font-size: 15px; }
.link { border: 0; background: none; padding: 6px 4px; font: inherit; color: var(--azzurro); text-decoration: underline; cursor: pointer; }
.link.pericolo { color: var(--rosso); font-size: 14px; }
.azioni { display: flex; flex-wrap: wrap; gap: 10px; margin: 22px 0 6px; }
.azioni form { flex: 1 1 260px; }
.azioni .bottone.grande { margin: 0; }
.azioni > .bottone { flex: 1 1 200px; min-height: 54px; }
.in-linea { display: inline; }

/* avvisi e riquadri */
.avviso { border-radius: 12px; padding: 12px 16px; margin: 0 0 18px; font-size: 15.5px; }
.avviso ul { margin: 6px 0 0; padding-left: 20px; }
.avviso-errore { background: #FCE9E6; color: #8A1F10; }
.avviso-info { background: #E6F0F9; color: #164D7A; }
.avviso-ok { background: #E3F2E7; color: #1D5E30; }
.riquadro { margin-top: 24px; padding: 18px; border-radius: var(--r); background: var(--wash); }
.riquadro p { margin: 0 0 12px; color: var(--ink-2); }
details.riquadro summary { cursor: pointer; font-weight: 700; }
details.riquadro[open] summary { margin-bottom: 4px; }
.passi { margin: 0 0 8px; padding: 0; list-style: none; counter-reset: p; }
.passi li { position: relative; padding: 0 0 14px 44px; counter-increment: p; }
.passi li::before { content: counter(p); position: absolute; left: 0; top: -2px; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: #E6F0F9; color: var(--azzurro); font-weight: 800; }

/* pannello */
.testata { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.schede { display: flex; gap: 6px; flex-wrap: wrap; margin: 16px 0 20px; border-bottom: 1.5px solid var(--line); }
.schede a { padding: 10px 14px; text-decoration: none; color: var(--ink-2); font-weight: 650; border-bottom: 3px solid transparent; margin-bottom: -1.5px; }
.schede a[aria-current] { color: var(--ink); border-color: var(--azzurro); }
.conta { display: inline-block; min-width: 24px; padding: 0 7px; border-radius: 12px; background: var(--wash); font-size: 13px; text-align: center; }
.schede a[aria-current] .conta { background: var(--azzurro); color: #fff; }
.vuoto { color: var(--ink-2); padding: 20px 0; }
.richieste { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.richiesta { border: 1.5px solid var(--line); border-radius: var(--r); padding: 16px 18px; border-left: 5px solid var(--azzurro); }
.richiesta.stato-attivo { border-left-color: var(--verde); }
.richiesta.stato-sospeso, .richiesta.stato-rifiutato { border-left-color: #9AA7B3; }
.r-testa { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.r-testa h2 { font-size: 20px; margin: 0; }
.pastiglia { font-size: 12.5px; font-weight: 700; padding: 2px 10px; border-radius: 10px; background: var(--wash); white-space: nowrap; }
.stato-in_attesa .pastiglia { background: #E6F0F9; color: #164D7A; }
.stato-attivo .pastiglia { background: #E3F2E7; color: #1D5E30; }
.r-ind { margin: 2px 0 10px; color: var(--ink-2); font-size: 14.5px; }
.r-dati { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px 16px; margin: 0; }
.r-dati dt { font-size: 12.5px; color: var(--ink-2); font-weight: 600; }
.r-dati dd { margin: 0; overflow-wrap: anywhere; }
.attenzione { color: var(--rosso); }
.r-msg { margin: 12px 0 0; padding: 10px 14px; background: var(--wash); border-radius: 10px; font-style: italic; }
.r-nota { margin: 8px 0 0; font-size: 14px; color: var(--ink-2); }
.r-azioni { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 14px; }
.tabella { width: 100%; border-collapse: collapse; margin-top: 14px; font-size: 15px; }
.tabella th, .tabella td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tabella th { font-size: 13px; color: var(--ink-2); }

@media (max-width: 520px) {
  .foglio { padding: 22px 16px; border-radius: 18px; }
  h1 { font-size: 26px; }
}
@media print {
  body { background: #fff; }
  .marchio, .schede, .testata form, .bottone, .lead { display: none !important; }
  .foglio { box-shadow: none; padding: 0; }
}

/* ---------- scheda dell'attività ---------- */
body.scheda .pagina { max-width: 820px; padding-bottom: 120px; }
.banda-admin { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; align-items: center;
  background: var(--ink); color: #fff; border-radius: 14px; padding: 12px 16px; margin-bottom: 14px; font-size: 15px; }
.banda-admin a { color: #9FCBF2; font-weight: 650; }
.scheda-form .foglio { margin-bottom: 14px; }
.testata-scheda { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.testata-scheda .lead { margin: 0; }
.blocco h2 { font-size: 20px; margin: 0 0 4px; display: flex; align-items: center; gap: 10px; }
.griglia { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.griglia .largo { grid-column: 1 / -1; }
select { width: 100%; font: inherit; color: var(--ink); background: #fff; border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 14px; min-height: 48px; }
input[type=date] { width: 100%; font: inherit; border: 1.5px solid var(--line); border-radius: 12px; padding: 11px 14px; min-height: 48px; }
.campo-azione { display: flex; gap: 8px; }
.campo-azione input { flex: 1; min-width: 0; }
.campo-azione .bottone { flex: none; min-height: 48px; }
.aiuto { color: var(--ink-2); font-size: 14.5px; margin: 10px 0 8px; }
.aiuto.piccolo { font-size: 13px; margin-top: 8px; }
.mappa-posizione { height: 320px; border-radius: 14px; overflow: hidden; border: 1.5px solid var(--line); z-index: 0; }

.editor { border: 1.5px solid var(--line); border-radius: 12px; background: #fff; overflow: hidden; }
.editor:focus-within { border-color: var(--azzurro); box-shadow: 0 0 0 3px rgba(93,169,233,.35); }
.editor-barra { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px; background: var(--wash); border-bottom: 1px solid var(--line); }
.editor-barra button { border: 0; background: #fff; border-radius: 8px; padding: 6px 11px; font: inherit; font-size: 14px; color: var(--ink); cursor: pointer; box-shadow: 0 1px 1px rgba(27,42,58,.08); }
.editor-barra button:hover { background: #E3ECF4; }
.editor-testo { min-height: 130px; max-height: 420px; overflow-y: auto; padding: 12px 14px; outline: none; line-height: 1.55; position: relative; overflow-wrap: anywhere; }
.editor-testo p { margin: 0 0 .6em; }
.editor-testo ul, .editor-testo ol { margin: 0 0 .6em; padding-left: 22px; }
.editor.is-vuoto .editor-testo::before { content: attr(data-vuoto); color: #8A97A4; position: absolute; pointer-events: none; }
.spento { opacity: .45; }

.foto-griglia { margin-top: 18px; align-items: start; }
.foto-anteprima { aspect-ratio: 16 / 10; border-radius: 12px; background: var(--wash) center / cover no-repeat; border: 1.5px dashed var(--line);
  display: grid; place-items: center; color: var(--ink-2); font-size: 14px; margin: 6px 0 10px; }
.scegli-foto { position: relative; overflow: hidden; }
.scegli-foto input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.spunta.piccola { margin-top: 10px; font-size: 14px; }

.testata-blocco { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.pallino { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.pallino.rosso { background: #D63A2A; }
.pallino.ocra { background: #D99A00; }
.interruttore { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 650; }
.interruttore input { appearance: none; -webkit-appearance: none; width: 50px; height: 30px; border-radius: 15px; background: #C5CFD8; position: relative; cursor: pointer; transition: background .2s; margin: 0; }
.interruttore input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.interruttore input:checked { background: var(--verde); }
.interruttore input:checked::after { transform: translateX(20px); }

.riservato { border: 2px dashed #C5CFD8; box-shadow: none; }
.barra-salva { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; display: flex; align-items: center; justify-content: center; gap: 16px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)); background: rgba(255,255,255,.96); backdrop-filter: blur(8px);
  box-shadow: 0 -4px 20px rgba(27,42,58,.12); }
.barra-salva .bottone.grande { width: auto; min-width: 240px; margin: 0; }
.stato-salva { color: var(--ink-2); font-size: 14px; font-weight: 600; }

@media (max-width: 620px) {
  .griglia { grid-template-columns: 1fr; }
  .barra-salva { justify-content: space-between; }
  .barra-salva .link { display: none; }
  .barra-salva .bottone.grande { min-width: 0; flex: 1; }
  .stato-salva { display: none; }
  .mappa-posizione { height: 260px; }
}

/* accesso */
.non-registrato { margin: 22px 0 0; text-align: center; font-size: 17px; font-weight: 600; }
.non-registrato a { font-weight: 800; }
.nota-vecchie { margin: 10px 0 0; text-align: center; color: var(--ink-2); font-size: 14px; }
#cercaScheda { margin: 4px 0 6px; }
.tabella td.destra { text-align: right; white-space: nowrap; }
.tabella .bottone.piccolo { min-height: 36px; padding: 0 14px; font-size: 14px; }
.muto { color: #9AA7B3; }
.p-in_attesa { background: #E6F0F9; color: #164D7A; }
.p-attivo { background: #E3F2E7; color: #1D5E30; }
.p-sospeso { background: #FCE9E6; color: #8A1F10; }
@media (max-width: 620px) { .tabella th:nth-child(2), .tabella td:nth-child(2) { display: none; } }
#password { scroll-margin-top: 16px; }
.form-password .bottone { margin-top: 16px; }

/* primo accesso: la sezione password in evidenza */
.foglio.in-evidenza { box-shadow: 0 0 0 3px #2F7FC1 inset; }

/* campo non modificabile (es. nome azienda già noto) */
.modulo input[readonly] { background: #eef2f6; color: #4a5a6a; cursor: default; }
