/* Neocard — stile base. Cambia i colori da qui. */
:root {
  --ink: #101828;
  --muted: #667085;
  --line: #e4e7ec;
  --bg: #f2f4f7;
  --paper: #ffffff;
  --accent: #0e7490;
  --accent-ink: #ffffff;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 8px 24px rgba(16,24,40,.06);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; max-width: 100%; overflow-x: clip; }
body {
  max-width: 100%; overflow-x: clip;
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: inherit; }
img { max-width: 100%; display: block; }
.ico { width: 20px; height: 20px; flex: none; }

/* ---- pulsanti ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px; border-radius: 999px; border: 1.5px solid transparent;
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; text-align: center;
}
.btn:focus-visible, .rows a:focus-visible, .up:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { background: var(--paper); border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--accent); }
.btn-outline { background: transparent; border-color: var(--ink); color: var(--ink); }
.btn-outline:hover { background: var(--ink); color: #fff; }
.btn-block { display: flex; width: 100%; }

/* ---- pagina profilo ---- */
.card { width: 100%; min-width: 0; overflow-wrap: break-word; overflow-x: clip; max-width: 480px; margin: 0 auto; min-height: 100vh; background: var(--paper); padding-bottom: 28px; box-shadow: var(--shadow); container-type: inline-size; }
/* l'header ha sempre le proporzioni 3:1 del ritaglio (1500x500): quello che ritagli e' quello che vedi */
.hero { --hh: max(calc(100cqw / 3), 110px); height: var(--hh); background: linear-gradient(135deg, #0b3b4a, var(--accent) 60%, #22b8cf); background-size: cover; background-position: center; position: relative; }
.hero-shade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(16,24,40,0) 40%, rgba(16,24,40,.35)); }
.identity { text-align: center; padding: 72px 20px 0; position: relative; }
.avatar { width: 120px; height: 120px; border-radius: 50%; object-fit: cover; margin: 0 auto 12px; border: 4px solid var(--paper); background: var(--bg); box-shadow: var(--shadow); }
.avatar-initials { display: grid; place-items: center; font-size: 40px; font-weight: 700; color: var(--accent); }

/* header fisso: scorrendo si riduce a 64px, l'avatar rimpicciolisce e va a sinistra, compare il nome (--p = 0..1 via card.js) */
.card { --p: 0; --sz: calc(120px - 72px * var(--p)); }
.hero { position: sticky; top: calc(64px - var(--hh)); z-index: 20; }
.hero .avatar { position: absolute; z-index: 2; margin: 0; width: var(--sz); height: var(--sz);
  left: calc((50% - var(--sz) / 2) * (1 - var(--p)) + 12px * var(--p));
  top: calc(var(--hh) - 60px + 4px * var(--p)); border-width: calc(4px - 2px * var(--p)); }
.hero .avatar-initials { font-size: calc(var(--sz) * .33); }
.hero-name { position: absolute; z-index: 1; left: 72px; right: 14px; top: calc(var(--hh) - 64px); height: 64px; display: flex; align-items: center;
  color: #fff; font-weight: 700; font-size: 1.05rem; text-shadow: 0 1px 4px rgba(0,0,0,.55); pointer-events: none;
  opacity: calc((var(--p) - .6) * 2.5); }
.hero-name span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-frame .hero { position: relative; top: 0; }
@media (max-width: 979px) { .phone .hero { position: relative; top: 0; } }
h1 { margin: 0 0 4px; font-size: 1.65rem; line-height: 1.2; letter-spacing: -.01em; overflow-wrap: anywhere; }
.role { margin: 0; font-weight: 700; }
.company { margin: 2px 0 0; color: var(--muted); }
.actions { display: flex; gap: 10px; padding: 20px 20px 4px; }
.actions .btn { flex: 1 1 0; min-width: 0; padding: 8px 12px; line-height: 1.25; }
.actions .btn-primary { flex: 1.45; }
.actions.stack { flex-direction: column; padding: 8px 0; }
.about { margin: 16px 20px 0; color: #344054; text-align: center; overflow-wrap: anywhere; }
.panel { margin: 22px 20px 0; }
.panel h2 { margin: 0 0 8px; font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.rows { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.rows li + li { border-top: 1px solid var(--line); }
.rows a { display: flex; align-items: center; gap: 14px; padding: 12px 14px; text-decoration: none; min-height: 56px; }
.rows a:hover { background: var(--bg); }
.row-ico { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: color-mix(in srgb, var(--accent) 12%, white); color: var(--accent); flex: none; }
.row-txt { display: flex; flex-direction: column; min-width: 0; }
.row-txt small { color: var(--muted); font-size: .75rem; line-height: 1.2; }
.row-txt span { overflow-wrap: anywhere; font-weight: 500; }
.socials { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin: 20px 20px 0; }
.soc { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; color: #fff; background: #333; transition: transform .15s; }
.soc:hover { transform: translateY(-2px); }
.soc:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px; }
.bico { width: 22px; height: 22px; }
.soc-facebook { background: #1877f2; }
.soc-instagram { background: radial-gradient(circle at 30% 107%, #fdf497 0, #fdf497 5%, #fd5949 45%, #d6249f 60%, #285aeb 90%); }
.soc-linkedin { background: #0a66c2; }
.soc-x, .soc-tiktok { background: #000; }
.soc-whatsapp { background: #25d366; }
.links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 22px 20px 0; }
.links .btn { min-height: 44px; min-width: 0; padding: 8px 14px; overflow-wrap: anywhere; line-height: 1.25; }
.company-logo { margin: 28px auto 0; max-width: 150px; }
.company-logo img { border-radius: 12px; margin: 0 auto; }
.foot { text-align: center; margin-top: 28px; color: var(--muted); font-size: .85rem; }
.foot p { margin: 8px 0 0; }
.up { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; font-weight: 600; color: var(--ink); min-height: 44px; }

/* ---- QR ---- */
.qr-dialog { border: 0; border-radius: 20px; padding: 24px; width: min(92vw, 360px); box-shadow: 0 24px 60px rgba(16,24,40,.35); text-align: center; }
.qr-dialog::backdrop { background: rgba(16,24,40,.55); }
.qr-box svg { width: 100%; height: auto; display: block; border-radius: 12px; }
.qr-box.inline { max-width: 240px; margin: 16px auto; }
.qr-name { margin: 12px 0 0; font-weight: 700; }
.qr-url { margin: 2px 0 14px; color: var(--muted); font-size: .8rem; overflow-wrap: anywhere; }
.qr-actions { display: flex; gap: 10px; }
.qr-actions .btn { flex: 1; }

/* ---- login / account / installazione ---- */
.auth-page { display: grid; place-items: start center; padding: 32px 16px; }
.auth { width: 100%; max-width: 400px; background: var(--paper); padding: 28px 24px; border-radius: 20px; box-shadow: var(--shadow); }
.auth h1 { font-size: 1.4rem; }
.muted { color: var(--muted); margin-top: 0; }
.auth form { display: grid; gap: 14px; margin-top: 18px; }
.auth label { display: grid; gap: 6px; font-weight: 600; font-size: .9rem; }
.auth input[type=text], .auth input[type=password] {
  min-height: 48px; padding: 0 14px; border: 1.5px solid var(--line); border-radius: 12px; font: inherit; width: 100%; background: #fff;
}
.auth input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.alert { background: #fef3f2; color: #b42318; border: 1px solid #fecdca; padding: 10px 12px; border-radius: 12px; }
.urlbox { background: var(--bg); border-radius: 12px; padding: 10px 12px; font-size: .85rem; overflow-wrap: anywhere; }
.notice { background: #f0f9ff; border: 1px solid #b9e6fe; color: #065986; border-radius: 12px; padding: 10px 12px; font-size: .9rem; }
.check { display: flex !important; grid-template-columns: none; align-items: center; gap: 8px !important; font-weight: 500 !important; }
.status { list-style: none; padding: 0; margin: 16px 0; display: grid; gap: 6px; }
.status li { padding: 8px 12px; border-radius: 10px; font-size: .9rem; overflow-wrap: anywhere; }
.status .ok { background: #ecfdf3; } .status .ko { background: #fffaeb; }
.log { background: #101828; color: #d0d5dd; padding: 12px; border-radius: 12px; font-size: .8rem; white-space: pre-wrap; }

@media (min-width: 520px) {
  body.card-page { padding: 24px 0; }
  .card { min-height: 0; border-radius: 24px; overflow: hidden; overflow: clip; }
}

/* ================= editor e pannello admin ================= */
.muted a { color: var(--accent); }
.editor-page { background: var(--bg); }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 16px; background: var(--ink); color: #fff; position: sticky; top: 0; z-index: 20; }
.topbar .brand { font-weight: 800; letter-spacing: -.01em; text-decoration: none; }
.topbar nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.topbar nav a, .topbar .link { color: #d0d5dd; text-decoration: none; padding: 8px 10px; border-radius: 8px; background: none; border: 0; font: inherit; cursor: pointer; }
.topbar nav a:hover, .topbar .link:hover { background: rgba(255,255,255,.1); color: #fff; }
form.inline { display: inline; margin: 0; }

.editor-wrap { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; padding: 20px 16px 96px; max-width: 1080px; margin: 0 auto; }
@media (min-width: 980px) {
  .editor-wrap { grid-template-columns: minmax(0, 1fr) 400px; align-items: start; }
  .preview { position: sticky; top: 72px; }
}
.editor-wrap > *, .form { min-width: 0; }
.img-row { min-width: 0; }
.img-ctl input[type=file] { min-width: 0; width: 100%; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.page-head h1 { font-size: 1.5rem; margin: 0; }
.page-head p { margin: 2px 0 0; overflow-wrap: anywhere; font-size: .9rem; }

.form fieldset { border: 1px solid var(--line); background: var(--paper); border-radius: var(--radius); padding: 16px; margin: 0 0 16px; min-width: 0; }
.form legend { padding: 0 8px; font-weight: 700; font-size: .95rem; }

/* sezioni a pastello alternato (pagina modifica) */
.form fieldset:nth-of-type(4n+1) { --sec: #eaf2f8; --sec-line: #cfe0ee; }  /* azzurro polvere */
.form fieldset:nth-of-type(4n+2) { --sec: #faf6ef; --sec-line: #eadfca; }  /* crema */
.form fieldset:nth-of-type(4n+3) { --sec: #eef4ec; --sec-line: #d3e3cf; }  /* verde salvia */
.form fieldset:nth-of-type(4n+4) { --sec: #f2eef7; --sec-line: #ddd2ea; }  /* lilla tenue */
.form fieldset { background: var(--sec, var(--paper)); border-color: var(--sec-line, var(--line)); }
.form fieldset .check input, .form fieldset .f input[type=file] { background: transparent; }

/* ritaglio immagini */
.crop-ov { position: fixed; inset: 0; z-index: 100; background: rgba(16,24,40,.72); display: grid; place-items: center; padding: 16px; }
.crop-box { background: #fff; border-radius: var(--radius); padding: 16px; width: min(560px, 100%); display: grid; gap: 12px; box-shadow: var(--shadow); }
.crop-box h3 { margin: 0; font-size: 1.05rem; }
.crop-stage { position: relative; overflow: hidden; margin: 0 auto; background: #101828; border-radius: 10px; touch-action: none; cursor: grab; user-select: none; }
.crop-stage:active { cursor: grabbing; }
.crop-stage img { position: absolute; max-width: none; pointer-events: none; -webkit-user-drag: none; }
.crop-circle { position: absolute; inset: 0; pointer-events: none; border-radius: 50%; box-shadow: 0 0 0 999px rgba(16,24,40,.55); outline: 2px solid #fff; outline-offset: -2px; }
.crop-safe { position: absolute; left: 37.5%; width: 25%; bottom: 0; height: 37.5%; pointer-events: none; border: 2px dashed rgba(255,255,255,.9); border-bottom: 0; border-radius: 999px 999px 0 0; background: rgba(255,255,255,.12); }
.crop-safe::after { content: "foto profilo"; position: absolute; left: 50%; top: 4px; transform: translateX(-50%); font-size: .65rem; color: #fff; background: rgba(16,24,40,.6); padding: 0 6px; border-radius: 99px; white-space: nowrap; }
.crop-zoom { display: flex; align-items: center; gap: 10px; font-size: .85rem; }
.crop-zoom input { flex: 1; }
.crop-act { display: flex; gap: 10px; justify-content: flex-end; }
.grid2 { display: grid; gap: 12px; }
@media (min-width: 560px) { .grid2 { grid-template-columns: 1fr 1fr; } }
.f { display: grid; gap: 4px; margin-bottom: 12px; font-size: .9rem; min-width: 0; }
.f .lbl, .img-head .lbl { font-weight: 600; }
.f input, .f textarea, .f select, .filters input, .filters select {
  width: 100%; min-height: 44px; padding: 8px 12px; border: 1.5px solid var(--line); border-radius: 10px; font: inherit; background: #fff; color: var(--ink);
}
.f textarea { resize: vertical; min-height: 96px; }
.f input:focus, .f textarea:focus, .f select:focus, .filters input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.has-err input, .has-err textarea, .has-err select { border-color: #d92d20; }
.hint { color: var(--muted); font-size: .8rem; }
.err { color: #b42318; font-size: .82rem; font-weight: 600; }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: .9rem; margin: 8px 0; font-weight: 500; }
.check input { margin-top: 3px; width: 18px; height: 18px; flex: none; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---- guida ---- */
.guide { max-width: 760px; margin: 0 auto; padding: 20px 16px 64px; }
.g-tocwrap { --tb: 56px; position: sticky; top: var(--tb); z-index: 10; margin: 4px -16px 16px; background: var(--bg); border-bottom: 1px solid var(--line); }
.g-toc { display: flex; flex-wrap: nowrap; gap: 8px; padding: 10px 16px; overflow-x: auto; scrollbar-width: none; scroll-behavior: smooth; }
.g-arrow { position: absolute; top: 0; bottom: 0; z-index: 2; width: 44px; border: 0; padding: 0; font: inherit; font-size: 1.7rem; font-weight: 700; line-height: 1; color: var(--accent); cursor: pointer; display: flex; align-items: center; }
.g-arrow[hidden] { display: none; }
.g-prev { left: 0; justify-content: flex-start; padding-left: 8px; background: linear-gradient(90deg, var(--bg) 55%, rgba(242,244,247,0)); }
.g-next { right: 0; justify-content: flex-end; padding-right: 8px; background: linear-gradient(270deg, var(--bg) 55%, rgba(242,244,247,0)); }
.g-arrow:hover { filter: brightness(.85); }
.g-toc::-webkit-scrollbar { display: none; }
.g-toc a { flex: none; padding: 6px 12px; border-radius: 999px; background: var(--paper); border: 1px solid var(--line); text-decoration: none; font-size: .85rem; font-weight: 600; }
.g-toc a:hover { border-color: var(--accent); }
.g-toc a.is-on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.g-sec { border: 1px solid var(--sec-line); background: var(--sec); border-radius: var(--radius); padding: 16px 18px; margin: 0 0 16px; scroll-margin-top: 130px; }
.g-sec:nth-of-type(4n+1) { --sec: #eaf2f8; --sec-line: #cfe0ee; }
.g-sec:nth-of-type(4n+2) { --sec: #faf6ef; --sec-line: #eadfca; }
.g-sec:nth-of-type(4n+3) { --sec: #eef4ec; --sec-line: #d3e3cf; }
.g-sec:nth-of-type(4n+4) { --sec: #f2eef7; --sec-line: #ddd2ea; }
.g-sec h2 { margin: 0 0 8px; font-size: 1.1rem; }
.g-sec p, .g-sec li { font-size: .95rem; }
.g-sec dl { margin: 8px 0 0; display: grid; gap: 10px; }
.g-row { background: rgba(255,255,255,.7); border-radius: 12px; padding: 10px 12px; }
.g-row dt { font-weight: 700; }
.g-row dd { margin: 2px 0 0; font-size: .92rem; color: #344054; }
.g-ex { display: block; margin-top: 4px; color: var(--muted); font-size: .82rem; }
.g-tag { font-style: normal; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 1px 8px; border-radius: 99px; background: var(--ink); color: #fff; vertical-align: middle; }
.g-sec code { background: rgba(255,255,255,.8); padding: 1px 6px; border-radius: 6px; font-size: .85em; }

.img-field { padding: 8px 0 12px; border-bottom: 1px dashed var(--line); margin-bottom: 8px; }
.img-field:last-of-type { border-bottom: 0; }
.img-head { display: flex; flex-direction: column; gap: 2px; margin-bottom: 8px; }
.img-row { display: flex; gap: 12px; align-items: center; }
.thumb { width: 64px; height: 64px; border-radius: 12px; object-fit: cover; background: var(--bg); flex: none; border: 1px solid var(--line); }
.thumb-empty { display: grid; place-items: center; font-size: .7rem; color: var(--muted); }
.img-ctl { display: grid; gap: 4px; min-width: 0; font-size: .85rem; }
.img-ctl input[type=file] { max-width: 100%; }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: .875rem; }
.notice-ok { background: #ecfdf3; border: 1px solid #abefc6; color: #067647; padding: 10px 12px; border-radius: 12px; }
.notice-err { background: #fef3f2; border: 1px solid #fecdca; color: #b42318; padding: 10px 12px; border-radius: 12px; }
.savebar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; display: flex; gap: 10px; justify-content: center; padding: 12px 16px; background: rgba(255,255,255,.92); backdrop-filter: blur(8px); border-top: 1px solid var(--line); }
.savebar .btn { min-width: 0; flex: 1 1 auto; max-width: 220px; padding: 0 14px; }

.preview-label { font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; text-align: center; }
.phone { max-width: 390px; margin: 0 auto; border-radius: 28px; overflow: hidden; background: var(--paper); box-shadow: var(--shadow), 0 0 0 8px #1d2939; }
.phone .card { min-height: 0; box-shadow: none; padding-bottom: 20px; }
.phone .rows a, .phone .btn { cursor: default; }
@media (min-width: 980px) { .phone { max-height: calc(100vh - 140px); overflow-y: auto; } }

/* ---- admin ---- */
.admin { max-width: 1080px; margin: 0 auto; padding: 20px 16px 48px; }
.admin.narrow { max-width: 560px; }
.filters { display: grid; grid-template-columns: 1fr; gap: 8px; margin: 12px 0 16px; }
@media (min-width: 640px) { .filters { grid-template-columns: 1fr 220px auto; } }
.table-wrap { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
table.users { width: 100%; border-collapse: collapse; font-size: .9rem; }
.users th { text-align: left; font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 10px 12px; background: #f9fafb; border-bottom: 1px solid var(--line); }
.users td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.users tr:last-child td { border-bottom: 0; }
.users tr.off { opacity: .6; }
.users .num { text-align: right; }
.users small { color: var(--muted); }
.tag { display: inline-block; font-size: .7rem; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 14%, white); color: var(--accent); vertical-align: middle; }
.tag-warn { background: #fffaeb; color: #b54708; }
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 16px; }
.pw-row { display: flex; gap: 8px; }
.pw-row input { flex: 1; }
@media (max-width: 760px) {
  .users thead { display: none; }
  .users, .users tbody, .users tr, .users td { display: block; width: 100%; }
  .users tr { padding: 10px 12px; border-bottom: 1px solid var(--line); }
  .users td { border: 0; padding: 2px 0; }
  .users td[data-l]::before { content: attr(data-l) ": "; color: var(--muted); font-size: .75rem; }
  .users td[data-l="Nome"]::before { content: ""; }
  .users .num { text-align: left; }
  .users .act { padding-top: 6px; }
}

/* sezione Azienda: logo in alto a sinistra, dati con sole icone */
.panel-biz { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 14px 6px; }
.biz-head { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.biz-logo { width: 56px; height: 56px; object-fit: contain; border-radius: 10px; flex: none; }
.biz-head h2 { min-width: 0; overflow-wrap: anywhere; }
.panel-biz .biz-head h2 { margin: 0; font-size: 1rem; letter-spacing: 0; text-transform: none; color: var(--text, inherit); font-weight: 650; }
.panel-biz .rows { border: 0; border-radius: 0; }
.panel-biz .rows a { padding: 8px 0; min-height: 50px; }
.panel-biz .rows li + li { border-top: 1px solid var(--line); }
.panel-biz .rows a:hover { background: transparent; }
.panel-biz .row-txt { overflow-wrap: anywhere; }
.biz-icons { display: flex; flex-wrap: wrap; gap: 12px; padding: 4px 0 12px; }
.bi { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: color-mix(in srgb, var(--accent) 12%, white); color: var(--accent); transition: background .15s, color .15s; }
.bi:hover { background: var(--accent); color: #fff; }
.bi .ico { width: 22px; height: 22px; }
.choice { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice label { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; cursor: pointer; }
.choice label:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, white); }
.choice small { display: block; color: var(--muted); font-size: .8rem; }
.f input[type=radio], .f input[type=checkbox] { width: 18px; height: 18px; min-height: 0; padding: 0; margin: 3px 0 0; flex: none; accent-color: var(--accent); }
.choice label { align-items: flex-start; min-width: 0; line-height: 1.3; }
.choice label > span { min-width: 0; flex: 1; overflow-wrap: anywhere; }
.choice small { margin-top: 2px; }
@media (max-width: 480px) { .choice { grid-template-columns: 1fr; } }

/* ---- galleria layout ---- */
.layouts { max-width: 1100px; margin: 0 auto; padding: 20px 16px 110px; }
.veilbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 8px; }
.seg { display: inline-flex; border: 1.5px solid var(--line); border-radius: 999px; overflow: hidden; }
.seg label { cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 8px 16px; font-weight: 600; font-size: .9rem; }
.seg input:checked + span { background: var(--accent); color: #fff; }
.seg input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: -3px; }
.lgroup h2 { margin: 26px 0 12px; font-size: .85rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 22px; }
.tile { display: flex; flex-direction: column; gap: 8px; }
.tile-pick { display: block; cursor: pointer; }
.tile-pick input { position: absolute; opacity: 0; pointer-events: none; }
.tile-frame { display: block; position: relative; aspect-ratio: 390 / 740; overflow: hidden; border-radius: 22px; box-shadow: var(--shadow), 0 0 0 5px #d0d5dd; transition: box-shadow .15s; background: var(--paper); }
.tile-pick:hover .tile-frame { box-shadow: var(--shadow), 0 0 0 5px #98a2b3; }
.tile-pick input:checked ~ .tile-frame { box-shadow: var(--shadow), 0 0 0 5px var(--accent); }
.tile-pick input:focus-visible ~ .tile-frame { outline: 3px solid var(--accent); outline-offset: 6px; }
.tile-frame::after { content: ""; position: absolute; inset: 0; z-index: 2; }  /* i link dentro l'anteprima non cliccabili */
.tile-scale { display: block; width: 390px; transform: scale(.8); transform-origin: top left; pointer-events: none; }
.tile-scale .card { min-height: 740px; box-shadow: none; }
.tile-name { display: block; margin-top: 10px; font-weight: 700; }
.tile.is-on .tile-name::after { content: " ✓ in uso"; color: var(--accent); font-weight: 600; font-size: .85rem; }
.tile-blurb { margin: 0; color: var(--muted); font-size: .9rem; }
.tile-open { font-size: .85rem; font-weight: 600; color: var(--accent); }
.savebar.sticky { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: center; gap: 10px; padding: 12px 16px; background: rgba(255,255,255,.94); border-top: 1px solid var(--line); backdrop-filter: blur(8px); }
.layout-pick p { margin: 0 0 10px; }

/* ---- organizzazioni: elenco a schede + pannello (barra a sinistra su desktop, fascia in alto su mobile) ---- */
.org-layout { margin-top: 16px; }
.org-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.org-card { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; text-align: left; font: inherit; color: inherit; cursor: pointer; text-decoration: none;
  background: var(--paper); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); min-width: 0; transition: border-color .15s, transform .15s, background .15s; }
.org-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.org-card:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px; }
.org-card-new { border-style: dashed; background: transparent; box-shadow: none; justify-content: center; }
.org-mark { width: 56px; height: 56px; border-radius: 14px; flex: none; display: grid; place-items: center; overflow: hidden; background: #fff; border: 1px solid var(--line); }
.org-mark img { width: 100%; height: 100%; object-fit: contain; padding: 6px; }
.org-mark-ini { background: color-mix(in srgb, var(--accent) 12%, white); color: var(--accent); font-weight: 800; font-size: 1.15rem; letter-spacing: .02em; border-color: transparent; }
.org-mark.lg { width: 64px; height: 64px; }
.org-name { font-weight: 700; font-size: 1.05rem; line-height: 1.25; overflow-wrap: anywhere; }
.org-meta { font-size: .85rem; color: var(--muted); }
.org-mgrs { font-size: .8rem; color: var(--muted); overflow-wrap: anywhere; }
.org-cta { margin-top: auto; padding-top: 6px; font-size: .85rem; font-weight: 700; color: var(--accent); }

/* con una organizzazione aperta: elenco compatto a sinistra, dettaglio a destra */
.org-layout.has-open { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 20px; align-items: start; }
.has-open .org-list { display: flex; flex-direction: column; gap: 8px; position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow-y: auto; padding: 2px; }
.has-open .org-card { flex-direction: row; align-items: center; gap: 12px; padding: 10px 12px; box-shadow: none; flex: none; }
.has-open .org-card:hover { transform: none; }
.has-open .org-card.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, white); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 25%, transparent); }
.has-open .org-mark { width: 40px; height: 40px; border-radius: 10px; font-size: .95rem; }
.has-open .org-meta, .has-open .org-mgrs, .has-open .org-cta { display: none; }
.has-open .org-name { font-size: .95rem; }
.has-open .org-card-new .org-name { font-weight: 600; }

.org-panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); min-width: 0; }
.org-panel[hidden] { display: none; }
.org-dhead { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.org-dhead h1, .org-dhead h2 { margin: 0; font-size: 1.3rem; overflow-wrap: anywhere; }
.org-dhead p { margin: 2px 0 0; font-size: .9rem; }
.org-back { display: none; margin: 0 0 10px; }
.org-panel section { border-top: 1px solid var(--line); padding: 14px 0 4px; }
.org-panel h3 { font-size: .95rem; margin: 0 0 8px; }
.org-panel .hint { font-size: .8rem; color: var(--muted); margin: 6px 0 0; }
.org-chips { list-style: none; padding: 0; margin: 0 0 10px; display: flex; flex-wrap: wrap; gap: 8px; }
.org-chips li { display: inline-flex; align-items: center; gap: 10px; background: var(--bg); border-radius: 999px; padding: 6px 12px; font-size: .9rem; }
.org-add, .org-logo-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; }
.org-add input[type=text], .org-logo-form input[type=file] { min-height: 40px; padding: 8px 12px; border: 1.5px solid var(--line); border-radius: 10px; font: inherit; background: #fff; color: var(--ink); }
.org-add input[type=text] { flex: 1 1 220px; min-width: 0; }
.org-add input[type=text]:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.org-logo-form input[type=file] { flex: 1 1 220px; min-width: 0; }
.org-members { max-height: 360px; overflow: auto; margin-bottom: 8px; }

/* mobile / tablet stretto: l'elenco diventa una fascia orizzontale scorrevole sopra il dettaglio */
@media (max-width: 820px) {
  .org-layout.has-open { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .has-open .org-list { position: static; flex-direction: row; max-height: none; overflow-x: auto; overflow-y: hidden; padding: 4px 2px 8px;
    scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; margin: 0 -16px; padding-left: 16px; padding-right: 16px; }
  .has-open .org-card { scroll-snap-align: start; min-height: 52px; max-width: 220px; }
  .has-open .org-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .org-panel { padding: 16px; }
  .org-back { display: inline-flex; }
  .org-list { grid-template-columns: 1fr 1fr; gap: 10px; }
  .org-card { padding: 14px; }
}
@media (max-width: 480px) { .org-list { grid-template-columns: 1fr; } .has-open .org-list { display: flex; } }
