/* 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; }
