/* HUP · vista cliente
   Colori: blu #0046FF · blu notte #242038 · bianco · corallo #FE5F55
   Font: Rethink Sans */

:root {
  --blue: #0046FF;
  --navy: #242038;
  --coral: #FE5F55;
  --white: #FFFFFF;
  --bg: #F3F4F8;
  --grey: #6B6885;
  --grey-2: #8A87A0;
  --line: #EBEBF2;
  --soft: #E8EEFF;
  --soft-2: #EEF3FF;
  --field: #F3F4F8;
  --shadow: 0 2px 10px rgba(36, 32, 56, .06);
  --radius: 24px;
  --top: 108px;
  --dock: 96px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Rethink Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--navy);
  font-size: 16px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
[hidden] { display: none !important; }

.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- Barra superiore ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--white);
  box-shadow: 0 1px 6px rgba(0, 0, 0, .06);
  padding: calc(12px + env(safe-area-inset-top, 0px)) 20px 14px;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 22px; letter-spacing: .01em; color: var(--navy); }
.brand img { border-radius: 8px; }
.stepper { display: flex; gap: 6px; margin-top: 14px; overflow-x: auto; scrollbar-width: none; }
.stepper::-webkit-scrollbar { display: none; }
.pill {
  flex: none; height: 31px; min-width: 40px; padding: 0 12px; border-radius: 16px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; background: var(--soft); color: var(--blue);
  transition: background .2s, color .2s;
}
.pill.done { background: var(--soft); color: var(--blue); }
.pill.todo { background: var(--field); color: var(--grey-2); }
.pill.active { background: var(--blue); color: var(--white); }

.demo-banner {
  margin: 12px 20px 0; padding: 10px 14px; border-radius: 14px;
  background: #FFF1EF; color: #B23A31; font-size: 13px; font-weight: 600;
}

/* ---------- Contenuto ---------- */
main { max-width: 520px; margin: 0 auto; padding: 18px 20px calc(var(--dock) + 40px + var(--safe-b)); }
.step { display: flex; flex-direction: column; gap: 14px; animation: in .25s ease; }
@keyframes in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.intro h1 { font-size: 28px; line-height: 1.15; font-weight: 800; margin: 0 0 6px; letter-spacing: -.01em; }
.intro p { margin: 0; color: var(--grey); font-size: 16px; }

.card { background: var(--white); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 14px; }
.card.tight { gap: 12px; }
.label { color: var(--coral); font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.mini-label { color: var(--grey); font-size: 13px; font-weight: 600; margin-top: 2px; }
.sub { margin: -6px 0 0; color: var(--grey); font-size: 15px; }
.hint { margin: 0; color: var(--grey); font-size: 13px; }
.hint.error { color: #D2372C; font-weight: 600; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.row-between.small { font-size: 13px; color: var(--grey-2); margin-top: -6px; }
.divider { height: 1px; background: var(--line); }
.grow { flex: 1; min-width: 0; }

/* Campi */
.field {
  display: flex; align-items: center; gap: 10px;
  background: var(--field); border: 1.5px solid transparent; border-radius: 16px;
  min-height: 54px; padding: 0 16px;
  transition: border-color .15s, background .15s;
}
.field:focus-within { border-color: var(--blue); background: var(--white); }
.field input, .field textarea { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 16px; padding: 14px 0; }
.field.area { align-items: flex-start; }
.field.area textarea { resize: none; min-height: 84px; }
.field .ic { color: var(--blue); }
::placeholder { color: var(--grey-2); }
.phone-row { display: flex; gap: 10px; }
.prefix { width: 84px; flex: none; }
.prefix input { text-align: center; }

/* Suggerimenti indirizzo */
.suggestions { list-style: none; margin: -4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.suggestions:empty { display: none; }
.suggestions button {
  width: 100%; text-align: left; display: flex; align-items: center; gap: 12px;
  padding: 10px; border-radius: 16px;
}
.suggestions button:hover, .suggestions button:focus-visible { background: var(--soft-2); outline: 0; }
.sug-ic { width: 36px; height: 36px; border-radius: 18px; background: var(--soft); color: var(--blue); display: grid; place-items: center; flex: none; }
.sug-ic .ic { width: 18px; height: 18px; }
.sug-t { display: block; font-weight: 700; font-size: 15px; }
.sug-s { display: block; color: var(--grey); font-size: 13px; }

/* Mappa */
.map { height: 220px; border-radius: 18px; overflow: hidden; background: #E9ECF3; z-index: 0; }
.map-pin { width: 36px; height: 47px; }
.map-pin svg { width: 36px; height: 47px; filter: drop-shadow(0 4px 6px rgba(36, 32, 56, .3)); }
.chip-coord { display: inline-flex; align-items: center; gap: 6px; background: var(--field); color: var(--grey); border-radius: 15px; padding: 5px 12px 5px 10px; font-size: 13px; font-weight: 600; }
.chip-coord .ic { width: 14px; height: 14px; }
.link-btn { color: var(--blue); font-weight: 700; font-size: 15px; padding: 6px 0; }

/* Foto */
.photo-main { position: relative; border-radius: 18px; overflow: hidden; aspect-ratio: 33 / 20; background: var(--field); }
.photo-main:empty { display: none; }
.photo-main img { width: 100%; height: 100%; object-fit: cover; display: block; }
.badge { position: absolute; top: 12px; left: 12px; background: var(--blue); color: var(--white); font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 12px; }
.thumbs { display: flex; flex-wrap: wrap; gap: 10px; }
.thumb { position: relative; width: 100px; height: 100px; border-radius: 18px; overflow: hidden; background: var(--field); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.remove {
  position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border-radius: 14px;
  background: rgba(255, 255, 255, .92); color: var(--navy); display: grid; place-items: center;
}
.remove .ic { width: 14px; height: 14px; stroke-width: 2.5; }
.photo-main .remove { width: 32px; height: 32px; border-radius: 16px; top: 12px; right: 12px; }
.add-tile {
  width: 100px; height: 100px; border-radius: 18px; border: 1.5px dashed var(--blue); background: var(--soft-2);
  color: var(--blue); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  font-size: 13px; font-weight: 700;
}
.add-tile .ic { width: 24px; height: 24px; }
.add-tile.big { width: 100%; height: 170px; font-size: 15px; }

.tip, .info { display: flex; gap: 12px; padding: 16px; border-radius: 20px; }
.tip { background: var(--white); box-shadow: var(--shadow); }
.tip .ic { color: var(--coral); width: 24px; height: 24px; }
.tip strong { font-size: 15px; }
.tip p { margin: 2px 0 0; color: var(--grey); font-size: 14px; }
.info { background: var(--soft-2); color: #27408B; }
.info .ic { color: var(--blue); width: 22px; height: 22px; }
.info p { margin: 0; font-size: 15px; font-weight: 500; line-height: 1.4; }

/* Citofono */
.upload-slot {
  border: 1.5px dashed var(--blue); background: var(--soft-2); border-radius: 18px; min-height: 170px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 20px; text-align: center;
}
.upload-slot strong { font-size: 16px; }
.upload-slot span:last-child { color: var(--grey); font-size: 13px; }
.upload-ic { width: 52px; height: 52px; border-radius: 26px; background: var(--blue); color: var(--white); display: grid; place-items: center; margin-bottom: 4px; }
.upload-ic .ic { width: 24px; height: 24px; }
.intercom-preview { position: relative; border-radius: 18px; overflow: hidden; background: #111; aspect-ratio: 33 / 20; }
.intercom-preview canvas { width: 100%; height: 100%; display: block; object-fit: cover; }
.actions-2 { display: flex; gap: 10px; }
.actions-2 > * { flex: 1; }
.btn-soft, .btn-grey {
  height: 46px; border-radius: 23px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 700; font-size: 15px;
}
.btn-soft { background: var(--soft); color: var(--blue); }
.btn-grey { background: var(--field); color: var(--navy); }

/* Piano */
.floor { display: flex; align-items: center; justify-content: space-between; }
.floor span { font-size: 34px; font-weight: 800; min-width: 80px; text-align: center; }
.round { width: 48px; height: 48px; border-radius: 24px; background: var(--blue); color: var(--white); display: grid; place-items: center; }
.round.soft { background: var(--soft); color: var(--blue); }
.round .ic { width: 22px; height: 22px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1.5px solid var(--line); background: var(--white); border-radius: 18px; padding: 7px 14px; font-size: 14px; font-weight: 600; color: var(--navy); }
.chip.on { border-color: var(--blue); background: var(--soft); color: var(--blue); }

/* Riepilogo */
.summary { margin: 0; display: grid; grid-template-columns: auto 1fr auto; gap: 12px 12px; align-items: start; font-size: 15px; }
.summary dt { color: var(--grey); font-weight: 500; }
.summary dd { margin: 0; font-weight: 700; text-align: right; overflow-wrap: anywhere; }
.summary .ok { width: 18px; height: 18px; color: #1E9E5A; }
.summary .no { color: var(--grey-2); font-weight: 500; }

/* Codice */
.code-box {
  border: 1.5px dashed var(--blue); background: var(--soft-2); border-radius: 18px; padding: 20px 12px;
  display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center;
}
.code { font-size: 44px; font-weight: 800; color: var(--blue); letter-spacing: .08em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.code-box span { color: var(--grey); font-size: 13px; font-weight: 500; }
.howto { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 16px; }
.howto li { display: flex; gap: 12px; align-items: center; }
.howto strong { font-size: 15px; }
.howto p { margin: 2px 0 0; color: var(--grey); font-size: 13px; }
.howto-ic { width: 40px; height: 40px; border-radius: 20px; background: var(--soft); color: var(--blue); display: grid; place-items: center; flex: none; }

/* ---------- Pulsanti in basso ---------- */
.dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 15;
  display: flex; gap: 12px; justify-content: center;
  padding: 34px 20px calc(16px + var(--safe-b));
  background: linear-gradient(to bottom, rgba(243, 244, 248, 0), rgba(243, 244, 248, .96) 45%, var(--bg));
  pointer-events: none;
}
.dock > * { pointer-events: auto; }
.btn-primary {
  height: 56px; border-radius: 28px; background: var(--blue); color: var(--white);
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  font-weight: 700; font-size: 17px; padding: 0 22px; transition: transform .1s, opacity .2s;
}
.btn-primary:active, .btn-back:active, .btn-soft:active { transform: scale(.98); }
.btn-primary[disabled] { opacity: .45; }
.btn-primary.sm { height: 46px; font-size: 15px; border-radius: 23px; }
.btn-primary.wide { width: 100%; }
.dock .btn-primary { flex: 1; max-width: 360px; }
.btn-back { height: 56px; border-radius: 28px; background: var(--soft); color: var(--blue); font-weight: 700; font-size: 17px; padding: 0 24px; }

/* ---------- Editor forma ---------- */
.editor { position: fixed; inset: 0; z-index: 50; background: var(--bg); display: flex; flex-direction: column; }
.editor-bar {
  background: var(--white); display: flex; align-items: center; justify-content: space-between;
  padding: calc(12px + env(safe-area-inset-top, 0px)) 20px 12px; box-shadow: 0 1px 6px rgba(0, 0, 0, .06);
}
.editor-bar strong { font-size: 17px; font-weight: 800; }
.editor-bar .spacer { width: 64px; }
.editor-stage { position: relative; flex: 1; min-height: 44vh; background: #111; overflow: hidden; display: flex; align-items: center; justify-content: center; touch-action: none; }
.stage-inner { position: relative; }
.stage-inner img { display: block; max-width: 100%; user-select: none; -webkit-user-select: none; pointer-events: none; }
#stageSharp { position: absolute; inset: 0; width: 100%; height: 100%; }
.stage-inner.privacy #stageImg { filter: blur(3px) brightness(.88); }
.shape { position: absolute; border: 3px solid var(--white); box-shadow: 0 0 0 3px var(--coral), 0 0 0 9px rgba(254, 95, 85, .25); cursor: grab; touch-action: none; }
.shape.cerchio { border-radius: 50%; }
.shape.rettangolo { border-radius: 12px; }
.shape-tag {
  position: absolute; left: 50%; bottom: calc(100% + 12px); transform: translateX(-50%); white-space: nowrap;
  background: var(--coral); color: var(--white); font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 12px; pointer-events: none;
}
.stage-hint {
  position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); white-space: nowrap;
  background: rgba(36, 32, 56, .75); color: var(--white); font-size: 12px; font-weight: 600; padding: 5px 12px; border-radius: 12px; pointer-events: none;
}
.editor-panel { flex: none; max-height: 56vh; overflow-y: auto; padding: 10px 16px calc(12px + var(--safe-b)); display: flex; flex-direction: column; gap: 10px; max-width: 520px; width: 100%; margin: 0 auto; }
.editor-panel .card { padding: 12px 14px; gap: 10px; }
.editor-panel .slider-head .label { font-size: 11px; }
.editor-panel input[type=range] { height: 26px; }
.editor-panel .btn-primary { height: 52px; }

.segmented { display: flex; gap: 4px; padding: 4px; background: var(--field); border-radius: 22px; }
.segmented button { flex: 1; height: 36px; border-radius: 18px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 700; font-size: 14px; color: var(--navy); }
.segmented button .ic { width: 18px; height: 18px; }
.segmented button.on { background: var(--blue); color: var(--white); }

.slider-block { display: flex; flex-direction: column; gap: 0; }
.slider-block + .slider-block { margin-top: 2px; }
.slider-head { display: flex; justify-content: space-between; align-items: center; }
.slider-head b { font-size: 14px; }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 30px; background: transparent; --p: 50%; }
input[type=range]::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: linear-gradient(to right, var(--blue) var(--p), #DCDDE8 var(--p)); }
input[type=range]::-moz-range-track { height: 6px; border-radius: 3px; background: linear-gradient(to right, var(--blue) var(--p), #DCDDE8 var(--p)); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 28px; height: 28px; margin-top: -11px; border-radius: 50%; background: var(--white); border: 3px solid var(--blue); box-shadow: 0 2px 6px rgba(0, 0, 0, .15); }
input[type=range]::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: var(--white); border: 3px solid var(--blue); }

.privacy-row { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.privacy-row strong { display: block; font-size: 15px; }
.privacy-row small { display: block; color: var(--grey); font-size: 13px; }
.toggle { -webkit-appearance: none; appearance: none; width: 48px; height: 28px; border-radius: 14px; background: #D6D6E3; position: relative; flex: none; cursor: pointer; transition: background .2s; margin: 0; }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--white); box-shadow: 0 1px 3px rgba(0, 0, 0, .15); transition: transform .2s; }
.toggle:checked { background: var(--blue); }
.toggle:checked::after { transform: translateX(20px); }

/* ---------- Salvataggio e avvisi ---------- */
.overlay { position: fixed; inset: 0; z-index: 60; background: rgba(36, 32, 56, .45); display: grid; place-items: center; padding: 20px; }
.saving-box { background: var(--white); border-radius: 24px; padding: 28px 24px; width: min(320px, 100%); display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.saving-box strong { font-size: 18px; }
.saving-box span { color: var(--grey); font-size: 14px; }
/* caricamento: il pallino corallo di HUP che si ingrandisce e si rimpicciolisce */
.dot { width: 26px; height: 26px; border-radius: 50%; background: var(--coral); display: block; animation: dot-pulse 1.1s ease-in-out infinite; }
.saving-box .dot { margin: 8px 0 14px; }
@keyframes dot-pulse { 0%, 100% { transform: scale(.8); } 50% { transform: scale(1.15); } }
@keyframes spin { to { transform: rotate(360deg); } }
.toast {
  position: fixed; left: 50%; bottom: calc(var(--dock) + 28px + var(--safe-b)); transform: translateX(-50%); z-index: 70;
  background: var(--navy); color: var(--white); padding: 10px 16px; border-radius: 14px; font-size: 14px; font-weight: 600;
  max-width: calc(100% - 40px); text-align: center; box-shadow: 0 6px 20px rgba(0, 0, 0, .2);
}

/* Leaflet: attribution più discreta */
.leaflet-control-attribution { font-size: 10px; }
.leaflet-control-layers { border-radius: 12px !important; border: 0 !important; box-shadow: 0 2px 8px rgba(0,0,0,.2) !important; font-family: inherit; font-size: 13px; font-weight: 600; }
.leaflet-control-layers-expanded { padding: 6px 10px 6px 6px; }
.leaflet-control-layers label { margin: 2px 0; }

/* ---------- Account ---------- */
.brand-row { display: flex; align-items: center; justify-content: space-between; }
.avatar { width: 36px; height: 36px; border-radius: 18px; background: var(--soft); color: var(--blue); font-weight: 800; font-size: 15px; text-transform: uppercase; }

body.auth-mode main, body.auth-mode .dock, body.auth-mode .stepper, body.auth-mode .demo-banner { display: none !important; }
.auth { max-width: 440px; margin: 0 auto; padding: 28px 20px calc(32px + var(--safe-b)); }
.auth-view { display: flex; flex-direction: column; gap: 18px; animation: in .25s ease; }
.auth-head h1 { font-size: 28px; line-height: 1.15; font-weight: 800; margin: 0 0 6px; }
.auth-head p { margin: 0; color: var(--grey); }
.social { display: flex; flex-direction: column; gap: 10px; }
.btn-social {
  height: 54px; border-radius: 27px; background: var(--white); box-shadow: var(--shadow); border: 1.5px solid var(--line);
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; font-weight: 700; font-size: 16px;
}
.btn-social.apple { background: #000; color: #fff; border-color: #000; }
.or { display: flex; align-items: center; gap: 12px; color: var(--grey-2); font-size: 13px; font-weight: 600; margin-top: 6px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: #DCDDE8; }
.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-form .field { background: var(--white); box-shadow: var(--shadow); }
.link-btn.small { font-size: 13px; }
.link-btn.center { align-self: center; }
.auth-switch { margin: 0; text-align: center; color: var(--grey); font-size: 15px; }
.mail-ic { width: 56px; height: 56px; border-radius: 28px; background: var(--blue); color: var(--white); display: grid; place-items: center; margin-bottom: 14px; }
.mail-ic .ic { width: 26px; height: 26px; }
.field.otp input { text-align: center; font-size: 28px; font-weight: 800; letter-spacing: .35em; padding-left: .35em; color: var(--blue); }
.btn-primary .spin { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid rgba(255,255,255,.4); border-top-color: #fff; animation: spin .8s linear infinite; }
#redoBtn { width: 100%; }
.auth-legal { margin: 0; text-align: center; color: var(--grey-2); font-size: 13px; }
.auth-legal a { color: var(--blue); font-weight: 600; }

/* ---------- Home ---------- */
body.no-dock main { padding-bottom: calc(40px + var(--safe-b)); }
body.no-dock .dock { display: none; }
.screen { display: flex; flex-direction: column; gap: 14px; animation: in .25s ease; }
.code-hero {
  background: var(--blue); color: var(--white); border-radius: var(--radius); padding: 20px 18px 18px;
  display: flex; flex-direction: column; gap: 6px; box-shadow: 0 10px 30px rgba(0, 70, 255, .28); position: relative; overflow: hidden;
}
.code-hero::after { content: ""; position: absolute; right: -40px; top: -40px; width: 140px; height: 140px; border-radius: 50%; background: var(--coral); opacity: .9; }
.code-hero > * { position: relative; z-index: 1; }
.code-hero .label { color: rgba(255, 255, 255, .8); }
.code-hero .code { color: var(--white); font-size: 48px; margin: 2px 0; }
.code-hero p { margin: 0 0 10px; color: rgba(255, 255, 255, .85); font-size: 15px; }
.btn-white, .btn-ghost { height: 46px; border-radius: 23px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 700; font-size: 15px; }
.btn-white { background: var(--white); color: var(--blue); }
.btn-ghost { background: rgba(255, 255, 255, .16); color: var(--white); }

.house-card { padding: 0; overflow: hidden; text-align: left; width: 100%; gap: 0; }
.house-cover { aspect-ratio: 16 / 8; background: var(--field) center / cover no-repeat; }
.house-info { padding: 14px 16px 4px; display: flex; flex-direction: column; gap: 4px; }
.house-info strong { font-size: 18px; font-weight: 800; }
.house-meta { color: var(--grey); font-size: 14px; }
.house-go { display: flex; align-items: center; gap: 4px; padding: 6px 16px 16px; color: var(--blue); font-weight: 700; font-size: 15px; }
.house-go .ic { width: 18px; height: 18px; }

.create-card { align-items: flex-start; }
.create-card h2 { margin: 0; font-size: 22px; font-weight: 800; }
.create-card p { margin: -6px 0 4px; color: var(--grey); }
.create-ic { width: 48px; height: 48px; border-radius: 24px; background: var(--soft); color: var(--blue); display: grid; place-items: center; }
.create-ic .ic { width: 24px; height: 24px; }

/* ---------- La mia casa ---------- */
.back-link { display: inline-flex; align-items: center; gap: 4px; color: var(--blue); font-weight: 700; font-size: 16px; align-self: flex-start; padding: 4px 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: -4px; }
.card-head .link-btn { padding: 0; }
.big-text { margin: 0; font-size: 18px; font-weight: 700; }
.mini-map { height: 150px; border-radius: 16px; overflow: hidden; background: #E9ECF3; z-index: 0; }
.strip { display: flex; gap: 10px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; }
.strip::-webkit-scrollbar { display: none; }
.strip:empty { display: none; }
.strip img { width: 240px; height: 150px; object-fit: cover; border-radius: 16px; flex: none; background: var(--field); }
.strip.small img { width: 120px; height: 90px; }
.rows { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 10px 14px; font-size: 15px; }
.rows dt { color: var(--grey); }
.rows dd { margin: 0; font-weight: 700; text-align: right; overflow-wrap: anywhere; }
.loading { background: linear-gradient(90deg, var(--field), #E7E8F0, var(--field)); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Account ---------- */
.avatar { width: 36px; height: 36px; border-radius: 18px; background: var(--soft); color: var(--blue); font-weight: 800; font-size: 15px; text-transform: uppercase; display: grid; place-items: center; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.big { width: 72px; height: 72px; border-radius: 36px; font-size: 28px; }
.account-card { align-items: center; text-align: center; gap: 4px; padding: 24px 16px; }
.account-card strong { font-size: 20px; font-weight: 800; margin-top: 8px; }
.account-card span:not(.avatar) { color: var(--grey); font-size: 15px; overflow-wrap: anywhere; }
.acc-provider { font-size: 13px !important; background: var(--field); border-radius: 12px; padding: 3px 10px; margin-top: 6px; }
.btn-grey.wide { width: 100%; height: 52px; border-radius: 26px; }
.danger-card .label { color: #D2372C; }
.btn-danger { height: 46px; border-radius: 23px; border: 1.5px solid #F2C2BE; color: #D2372C; font-weight: 700; font-size: 15px; background: #FFF6F5; }
.btn-danger.armed { background: #D2372C; color: var(--white); border-color: #D2372C; }
.thumb .ph, .photo-main .ph { display: block; width: 100%; height: 100%; }
.strip .ph { display: block; width: 240px; height: 150px; border-radius: 16px; flex: none; }
.strip.small .ph { width: 120px; height: 90px; }
.intercom-preview.loading { min-height: 0; }

/* ---------- Schermi grandi (computer, tablet orizzontale) ----------
   Da telefono non cambia niente: queste regole valgono solo da 900px in su. */
@media (min-width: 900px) {
  :root { --wide: 1120px; }

  /* barra in alto allineata al contenuto largo */
  .topbar { padding-left: max(32px, calc((100% - var(--wide)) / 2)); padding-right: max(32px, calc((100% - var(--wide)) / 2)); }
  .brand-row .avatar { width: 40px; height: 40px; border-radius: 20px; }

  /* la home usa tutta la larghezza */
  main:has(> [data-screen="home"]:not([hidden])) { max-width: calc(var(--wide) + 64px); padding: 40px 32px 64px; }

  [data-screen="home"]:not([hidden]) {
    display: grid; grid-template-columns: 1.15fr 1fr; gap: 24px; align-items: stretch;
  }
  [data-screen="home"] > .intro { grid-column: 1 / -1; margin-bottom: 4px; }
  [data-screen="home"] .intro h1 { font-size: 40px; }
  [data-screen="home"] .intro p { font-size: 18px; }

  /* codice: riquadro grande a sinistra */
  [data-screen="home"] .code-hero { padding: 36px 36px 32px; gap: 10px; justify-content: center; border-radius: 32px; }
  [data-screen="home"] .code-hero::after { width: 260px; height: 260px; right: -120px; top: -120px; }
  [data-screen="home"] .code-hero .code { font-size: 76px; letter-spacing: .1em; margin: 6px 0 4px; }
  [data-screen="home"] .code-hero p { font-size: 17px; margin-bottom: 18px; }
  [data-screen="home"] .code-hero .actions-2 { max-width: 420px; }
  [data-screen="home"] .code-hero .btn-white,
  [data-screen="home"] .code-hero .btn-ghost { height: 52px; border-radius: 26px; font-size: 16px; }

  /* la mia casa: a destra, la foto riempie l'altezza */
  [data-screen="home"] .house-card { border-radius: 32px; transition: transform .15s, box-shadow .15s; }
  [data-screen="home"] .house-card:hover { transform: translateY(-3px); box-shadow: 0 14px 34px rgba(36, 32, 56, .12); }
  [data-screen="home"] .house-cover { aspect-ratio: auto; flex: 1; min-height: 220px; }
  [data-screen="home"] .house-info { padding: 20px 24px 4px; }
  [data-screen="home"] .house-info strong { font-size: 22px; }
  [data-screen="home"] .house-meta { font-size: 15px; }
  [data-screen="home"] .house-go { padding: 8px 24px 22px; font-size: 16px; }

  /* come dare il codice: tutta la larghezza, tre colonne affiancate */
  [data-screen="home"] #homeHowto { grid-column: 1 / -1; padding: 28px 32px; gap: 20px; border-radius: 32px; }
  [data-screen="home"] .howto { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; }
  [data-screen="home"] .howto li { flex-direction: column; align-items: flex-start; gap: 14px; }
  [data-screen="home"] .howto-ic { width: 52px; height: 52px; border-radius: 26px; }
  [data-screen="home"] .howto-ic .ic { width: 24px; height: 24px; }
  [data-screen="home"] .howto strong { font-size: 17px; }
  [data-screen="home"] .howto p { font-size: 15px; margin-top: 4px; }

  /* chi non ha ancora la scheda: invito grande su tutta la larghezza */
  [data-screen="home"] .create-card {
    grid-column: 1 / -1; display: grid; grid-template-columns: auto 1fr auto; grid-template-rows: auto auto;
    column-gap: 24px; row-gap: 6px; align-items: center; padding: 32px 36px; border-radius: 32px;
  }
  [data-screen="home"] .create-ic { grid-row: 1 / 3; width: 72px; height: 72px; border-radius: 36px; }
  [data-screen="home"] .create-ic .ic { width: 32px; height: 32px; }
  [data-screen="home"] .create-card h2 { font-size: 28px; align-self: end; }
  [data-screen="home"] .create-card p { margin: 0; font-size: 17px; align-self: start; max-width: 560px; }
  [data-screen="home"] .create-card .btn-primary { grid-column: 3; grid-row: 1 / 3; width: auto; padding: 0 32px; }

  body.no-dock .toast { bottom: 32px; }
}

/* ---------- Avvio ---------- */
.splash {
  position: fixed; inset: 0; z-index: 100; background: var(--bg);
  display: grid; place-items: center; transition: opacity .25s ease;
}
.splash.out { opacity: 0; pointer-events: none; }

/* ---------- Presentazione (chi arriva senza account) ----------
   Un solo elemento forte: il blocco blu con il citofono e il cerchio corallo
   che trova il nome. Il resto della pagina è sobrio, allineato a sinistra. */
body.welcome-mode main, body.welcome-mode .dock, body.welcome-mode .stepper, body.welcome-mode .demo-banner { display: none !important; }
body.welcome-mode .topbar { box-shadow: none; }
.top-login { height: 40px; padding: 0 18px; border-radius: 20px; background: var(--soft); color: var(--blue); font-weight: 700; font-size: 15px; }
.auth .back-link { margin: -8px 0 -6px; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }

.welcome { animation: in .25s ease; padding-bottom: calc(24px + var(--safe-b)); }
.w-wrap { max-width: 1120px; margin: 0 auto; padding-left: 20px; padding-right: 20px; }
.welcome h2 { font-size: 30px; line-height: 1.1; font-weight: 800; letter-spacing: -.02em; margin: 0; }

/* apertura */
.w-hero { background: var(--blue); color: var(--white); padding: 36px 0 44px; overflow: hidden; }
.w-hero-grid { display: flex; flex-direction: column; gap: 40px; }
.w-hero h1 { font-size: 44px; line-height: 1; font-weight: 800; letter-spacing: -.035em; margin: 0 0 18px; max-width: 12ch; }
.w-hero-text > p { margin: 0; font-size: 18px; line-height: 1.5; color: rgba(255, 255, 255, .9); max-width: 34em; }
.w-cta { display: flex; flex-direction: column; gap: 10px; margin-top: 28px; }
.w-btn-white, .w-btn-line { height: 56px; border-radius: 28px; padding: 0 28px; font-weight: 700; font-size: 17px; display: inline-flex; align-items: center; justify-content: center; transition: transform .1s, background .2s; }
.w-btn-white { background: var(--white); color: var(--blue); }
.w-btn-line { color: var(--white); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .55); }
.w-btn-line:hover { background: rgba(255, 255, 255, .1); }
.w-btn-white:active, .w-btn-line:active { transform: scale(.98); }
.w-hero :focus-visible { outline-color: var(--white); }
.w-note { margin: 14px 0 0 !important; font-size: 15px !important; color: rgba(255, 255, 255, .85) !important; }

.w-intercom { margin: 0; align-self: center; width: min(280px, 82%); }
.w-intercom svg { width: 100%; height: auto; display: block; filter: drop-shadow(0 24px 40px rgba(16, 12, 48, .35)); }
.w-intercom figcaption { margin-top: 18px; font-size: 15px; font-weight: 600; color: rgba(255, 255, 255, .9); text-align: center; }
/* il cerchio corallo cerca tra i nomi e si ferma sul tuo (una volta sola) */
.w-ring { animation: ring-find 1.9s cubic-bezier(.5, 0, .2, 1) .5s both; }
@keyframes ring-find {
  0%   { transform: translateY(120px); opacity: 0; }
  20%  { transform: translateY(120px); opacity: 1; }
  45%  { transform: translateY(-80px); }
  70%  { transform: translateY(40px); }
  100% { transform: translateY(0); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) { .w-ring, .welcome { animation: none; } }

/* il problema */
.w-problem { padding-top: 48px; padding-bottom: 8px; }
.w-problem ul { list-style: none; margin: 0 0 18px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.w-problem li { font-size: 24px; line-height: 1.2; font-weight: 800; letter-spacing: -.01em; color: var(--navy); padding-left: 22px; position: relative; }
.w-problem li::before { content: ""; position: absolute; left: 0; top: .42em; width: 10px; height: 10px; border-radius: 50%; background: var(--coral); }
.w-problem p { margin: 0; font-size: 17px; line-height: 1.5; color: var(--grey); max-width: 36em; }

/* sezioni */
.w-section { padding-top: 56px; }
.w-lead { margin: 10px 0 0; font-size: 17px; color: var(--grey); }

.w-steps { list-style: none; margin: 26px 0 0; padding: 0; display: flex; flex-direction: column; gap: 26px; position: relative; }
.w-steps::before { content: ""; position: absolute; left: 21px; top: 24px; bottom: 24px; width: 2px; background: #C9D3F5; }
.w-steps li { position: relative; padding-left: 62px; }
.w-num { position: absolute; left: 0; top: -6px; width: 44px; height: 44px; border-radius: 22px; background: var(--blue); color: var(--white); display: grid; place-items: center; font-weight: 800; font-size: 18px; box-shadow: 0 0 0 6px var(--bg); }
.w-steps strong { font-size: 19px; font-weight: 800; }
.w-steps p { margin: 4px 0 0; color: var(--grey); font-size: 16px; line-height: 1.45; max-width: 30em; }

.w-rider { display: flex; flex-direction: column; gap: 40px; }
.w-list { list-style: none; margin: 24px 0 0; padding: 0; display: flex; flex-direction: column; gap: 18px; }
.w-list li { display: flex; gap: 14px; align-items: flex-start; }
.w-list strong { font-size: 17px; }
.w-list p { margin: 2px 0 0; color: var(--grey); font-size: 15px; }

.w-phone { position: relative; align-self: center; width: min(300px, 86%); }
.w-screen { background: var(--white); border-radius: 34px; padding: 14px; box-shadow: 0 24px 50px rgba(36, 32, 56, .16), 0 0 0 8px var(--navy); display: flex; flex-direction: column; gap: 10px; }
.w-screen-top { display: flex; flex-direction: column; padding: 6px 6px 0; }
.w-screen-top span { color: var(--coral); font-size: 12px; font-weight: 700; }
.w-screen-top b { font-size: 18px; font-weight: 800; }
.w-house { width: 100%; height: auto; border-radius: 18px; display: block; }
.w-mini-intercom { display: flex; gap: 12px; align-items: center; background: var(--field); border-radius: 18px; padding: 10px; }
.w-mini-intercom svg { width: 96px; height: auto; flex: none; border-radius: 10px; }
.w-mini-intercom div { display: flex; flex-direction: column; min-width: 0; }
.w-mini-intercom span { color: var(--grey); font-size: 12px; font-weight: 600; }
.w-mini-intercom b { font-size: 17px; font-weight: 800; }
.w-mini-intercom small { color: var(--grey); font-size: 12px; }
.w-call { height: 46px; border-radius: 23px; background: var(--blue); color: var(--white); display: flex; align-items: center; justify-content: center; gap: 8px; font-weight: 700; }
.w-code-chip { position: absolute; left: -18px; top: 128px; background: var(--white); border-radius: 16px; padding: 8px 14px; box-shadow: 0 10px 26px rgba(36, 32, 56, .18); display: flex; flex-direction: column; transform: rotate(-4deg); }
.w-code-chip span { font-size: 11px; font-weight: 700; color: var(--coral); }
.w-code-chip b { font-size: 20px; font-weight: 800; color: var(--blue); letter-spacing: .08em; }

/* privacy: blocco blu notte */
.w-privacy { background: var(--navy); color: var(--white); margin-top: 64px; padding: 48px 0; }
.w-privacy ul { list-style: none; margin: 24px 0 0; padding: 0; display: flex; flex-direction: column; gap: 20px; }
.w-privacy li { font-size: 16px; line-height: 1.5; color: rgba(255, 255, 255, .78); padding-left: 34px; position: relative; max-width: 34em; }
.w-privacy li::before { content: ""; position: absolute; left: 0; top: 2px; width: 22px; height: 22px; border-radius: 11px; background: var(--coral) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.5l4 4L18 8'/%3E%3C/svg%3E") center / 14px no-repeat; }
.w-privacy strong { color: var(--white); display: block; font-size: 18px; margin-bottom: 2px; }

/* domande */
.w-faq > div { margin-top: 14px; border-top: 2px solid var(--navy); }
.w-faq details { border-bottom: 1px solid #DCDDE8; }
.w-faq summary { list-style: none; cursor: pointer; padding: 18px 36px 18px 0; font-weight: 700; font-size: 17px; position: relative; }
.w-faq summary::-webkit-details-marker { display: none; }
.w-faq summary::after { content: ""; position: absolute; right: 6px; top: 50%; width: 10px; height: 10px; margin-top: -7px; border-right: 2.5px solid var(--blue); border-bottom: 2.5px solid var(--blue); transform: rotate(45deg); transition: transform .2s; }
.w-faq details[open] summary::after { transform: rotate(-135deg); margin-top: -2px; }
.w-faq details p { margin: -6px 0 18px; color: var(--grey); font-size: 16px; line-height: 1.5; max-width: 40em; }

/* ristoranti */
.w-restaurant { background: var(--soft); margin-top: 56px; padding: 40px 0; }
.w-restaurant p { margin: 12px 0 0; font-size: 17px; line-height: 1.5; color: #33305A; max-width: 36em; }

/* chiusura */
.w-final { padding-top: 56px; padding-bottom: 40px; }
.w-final .w-cta { margin-top: 22px; }
.w-final .btn-primary, .w-final .btn-back { width: 100%; }
.w-foot { display: flex; align-items: center; justify-content: space-between; padding-top: 20px; font-size: 14px; }
.w-foot a { color: var(--grey); font-weight: 600; }
.brand.small { font-size: 16px; gap: 6px; }
.brand.small img { border-radius: 6px; }

@media (min-width: 900px) {
  .w-wrap { padding-left: 32px; padding-right: 32px; }
  .welcome h2 { font-size: 44px; }
  .w-hero { padding: 72px 0 80px; }
  .w-hero-grid { display: grid; grid-template-columns: 1.2fr 1fr; align-items: center; gap: 64px; }
  .w-hero h1 { font-size: 80px; letter-spacing: -.04em; margin-bottom: 26px; }
  .w-hero-text > p { font-size: 20px; }
  .w-cta { flex-direction: row; }
  .w-intercom { width: 320px; justify-self: center; }
  .w-problem { padding-top: 88px; display: grid; grid-template-columns: 1.3fr 1fr; gap: 64px; align-items: end; }
  .w-problem ul { margin: 0; gap: 14px; }
  .w-problem li { font-size: 34px; padding-left: 30px; }
  .w-problem li::before { width: 14px; height: 14px; }
  .w-problem p { font-size: 19px; }
  .w-section { padding-top: 104px; }
  .w-steps { flex-direction: row; gap: 40px; margin-top: 40px; }
  .w-steps::before { left: 22px; right: calc((100% - 80px) / 3 - 22px); top: 21px; bottom: auto; width: auto; height: 2px; }
  .w-steps li { flex: 1; padding-left: 0; padding-top: 70px; }
  .w-steps strong { font-size: 21px; }
  .w-steps p { font-size: 17px; }
  .w-num { top: 0; }
  .w-rider { flex-direction: row; align-items: center; justify-content: space-between; gap: 64px; }
  .w-rider-text { flex: 1; max-width: 560px; }
  .w-list { gap: 22px; margin-top: 32px; }
  .w-list strong { font-size: 19px; }
  .w-list p { font-size: 16px; }
  .w-phone { width: 330px; margin-right: 60px; }
  .w-code-chip { left: -64px; top: 150px; }
  .w-privacy { margin-top: 104px; padding: 88px 0; }
  .w-privacy ul { display: grid; grid-template-columns: repeat(3, 1fr); gap: 40px; margin-top: 40px; }
  .w-faq { display: grid; grid-template-columns: 1fr 1.6fr; gap: 64px; align-items: start; }
  .w-faq > div { margin-top: 6px; }
  .w-faq summary { font-size: 19px; padding: 22px 36px 22px 0; }
  .w-restaurant { margin-top: 104px; padding: 64px 0; }
  .w-restaurant p { font-size: 19px; }
  .w-final { padding-top: 96px; padding-bottom: 64px; }
  .w-final .w-cta { margin-top: 30px; }
  .w-final .btn-primary, .w-final .btn-back { width: auto; padding: 0 32px; }
}

/* ---------- Account: profilo, suggerimenti, elimina ---------- */
.avatar-edit { position: relative; border-radius: 50%; }
.avatar-cam { position: absolute; right: -2px; bottom: -2px; width: 30px; height: 30px; border-radius: 15px; background: var(--blue); color: var(--white); display: grid; place-items: center; box-shadow: 0 0 0 3px var(--white); }
.avatar-cam .ic { width: 16px; height: 16px; }
.acc-row { display: flex; align-items: center; gap: 14px; }
.acc-row strong { display: block; font-size: 16px; overflow-wrap: anywhere; }
.acc-k { display: block; color: var(--grey); font-size: 13px; font-weight: 500; margin-bottom: 2px; }
.link-btn.danger { color: #D2372C; }
.name-form { display: flex; flex-direction: column; gap: 10px; }
.name-form .actions-2 { margin-top: 4px; }
.suggest-card { flex-direction: row; align-items: center; gap: 14px; text-align: left; width: 100%; }
.suggest-card strong { display: block; font-size: 16px; }
.suggest-card small { display: block; color: var(--grey); font-size: 14px; margin-top: 2px; }
.suggest-card .chev { color: var(--grey-2); }
.suggest-card:active { transform: scale(.99); }
.btn-logout { width: 100%; height: 54px; border-radius: 27px; background: var(--white); box-shadow: var(--shadow); border: 1.5px solid var(--line); color: var(--navy); font-weight: 700; font-size: 16px; display: inline-flex; align-items: center; justify-content: center; gap: 10px; }
.acc-foot { display: flex; flex-direction: column; align-items: center; gap: 18px; margin-top: 18px; padding-top: 18px; border-top: 1px solid #DCDDE8; font-size: 14px; }
.acc-foot a { color: var(--blue); font-weight: 600; }
.link-quiet { color: var(--grey); font-size: 14px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; padding: 6px; }
.thanks-card { align-items: center; text-align: center; padding: 28px 18px; }
.thanks-card h2 { margin: 0; font-size: 22px; font-weight: 800; }
.thanks-card p { margin: -6px 0 6px; color: var(--grey); }
.thanks-card .actions-2 { width: 100%; }
.thanks-ic { width: 56px; height: 56px; border-radius: 28px; background: #E3F5EA; color: #1E9E5A; display: grid; place-items: center; }
.thanks-ic .ic { width: 28px; height: 28px; stroke-width: 2.5; }
.label.danger { color: #D2372C; }
.gone-list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; font-size: 15px; }
.btn-danger.wide { width: 100%; height: 52px; border-radius: 26px; }
.btn-danger[disabled] { opacity: .35; cursor: not-allowed; }
[data-screen="elimina"] .btn-grey.wide { margin-top: 4px; }
#suggestFormWrap { display: flex; flex-direction: column; gap: 14px; }
.avatar-cam .ic { stroke: var(--white); stroke-width: 2.2; }

/* ---------- Sito in pausa / account sospeso ---------- */
.halt { position: fixed; inset: 0; z-index: 90; background: var(--bg); display: grid; place-items: center; padding: 24px; }
.halt-box { max-width: 400px; width: 100%; display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.halt-box img { border-radius: 16px; margin-bottom: 6px; }
.halt-box h1 { margin: 0; font-size: 30px; font-weight: 800; letter-spacing: -.01em; }
.halt-box p { margin: 0 0 10px; color: var(--grey); font-size: 17px; line-height: 1.5; }
.halt-box .btn-primary, .halt-box .btn-grey { width: 100%; max-width: 280px; height: 52px; border-radius: 26px; }
.admin-banner { background: #FFF6E5; color: #8A5A00; }
.closed-note { background: #FFF1EF; color: #B23A31; font-weight: 600; padding: 10px 14px; border-radius: 14px; font-size: 14px; }
#loginSubmit[disabled] { opacity: .45; cursor: not-allowed; }
#linkActions { display: flex; flex-direction: column; gap: 14px; }
#linkActions[hidden] { display: none; }
#linkActions .auth-switch { margin: 0; }
.rist-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: #242038; color: #fff; border-radius: 20px; padding: 14px 18px; text-decoration: none; margin-bottom: 14px; }
.rist-banner > span { display: flex; flex-direction: column; gap: 2px; font-size: 13px; opacity: .95; }
.rist-banner b { font-size: 16px; }
.rist-banner[hidden] { display: none; }
