/* Animula · console delle famiglie. Direzione «A + C»: la pianta della casa e i cartellini con gli adesivi.
   Il marchio è Nimbo (nebula.js): la nuvola di particelle viva sul cielo notturno. Fondo lavanda fredda, inchiostro notte,
   l'accento è il viola della nuvola (la variabile si chiama ancora --saffron); gli adesivi dicono come trattare un apparecchio, e la pianta li ripete in piccolo. */
:root {
  --stone: #ECEDF4; --paper: #F7F7FB; --white: #fff; --ink: #17153B; --mute: #5E6283; --line: #D0D2E2;
  --night: #120F33; --night2: #1E1A4D;
  --saffron: #6E5BFF; --sage: #14A08F; --grey: #D3D5E0; --red: #D2405A;
  --display: 'Bricolage Grotesque', system-ui, sans-serif; --text: 'Atkinson Hyperlegible', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--stone); color: var(--ink); font: 16px/1.5 var(--text); }
.hidden { display: none !important; }
a { color: var(--ink); }
.mute { color: var(--mute); }
.word { font-family: var(--display); font-weight: 700; font-size: 20px; letter-spacing: -.01em; }

/* buttons and fields */
.btn { font: 600 15px var(--text); border: 1.5px solid var(--ink); background: var(--white); color: var(--ink); border-radius: 8px; padding: 9px 16px; cursor: pointer; }
.btn:hover { background: var(--paper); }
.btn.pri { background: var(--ink); color: var(--white); }
.btn.pri:hover { background: #2A2660; }
.btn:disabled { opacity: .5; cursor: default; }
.btn:focus-visible, .link:focus-visible, select:focus-visible, input:focus-visible { outline: 2px solid var(--saffron); outline-offset: 2px; }
.link { background: none; border: 0; color: var(--mute); font: inherit; text-decoration: underline; cursor: pointer; padding: 0; }
label { display: block; font-size: 15px; color: var(--mute); }
input, select, textarea { font: 16px var(--text); color: var(--ink); background: var(--white); border: 1.5px solid var(--line); border-radius: 8px; padding: 9px 11px; width: 100%; margin-top: 4px; }
form > * + * { margin-top: 14px; }

/* gate: login and welcome */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.gate-box { width: 100%; max-width: 440px; background: var(--white); border: 1.5px solid var(--ink); border-radius: 8px 28px 28px 8px; padding: 30px 30px 26px; }
.gate-box h1 { font-family: var(--display); font-weight: 700; font-size: 30px; line-height: 1.15; margin: 14px 0 6px; }

/* shell */
.shell { display: grid; grid-template-columns: 220px 1fr; grid-template-rows: auto 1fr; min-height: 100vh; }
.top { grid-column: 1 / -1; display: flex; align-items: center; gap: 24px; padding: 14px 24px; border-bottom: 1.5px solid var(--line); background: var(--paper); }
.homepick { display: flex; align-items: center; gap: 8px; color: var(--mute); }
.homepick select { width: auto; margin: 0; border: 0; border-bottom: 2px solid var(--ink); border-radius: 0; background: none; font-weight: 700; padding: 2px 4px; }
.who { margin-left: auto; font-size: 14px; color: var(--mute); }
.side { padding: 20px 14px; border-right: 1.5px solid var(--line); }
.side .grp { font-family: var(--display); font-weight: 500; font-size: 14px; color: var(--mute); margin: 18px 10px 6px; }
.side .grp:first-child { margin-top: 0; }
.side a { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 7px; text-decoration: none; color: var(--ink); }
.side a:hover { background: rgba(23, 21, 59, .06); }
.side a.on { background: var(--white); box-shadow: inset 3px 0 0 var(--saffron); font-weight: 700; }
.badge { margin-left: auto; background: var(--saffron); color: var(--ink); border-radius: 10px; font-size: 12px; font-weight: 700; padding: 0 7px; }
main { padding: 28px 28px 70px; max-width: 1180px; width: 100%; }
main h1 { font-family: var(--display); font-weight: 700; font-size: 42px; letter-spacing: -.015em; line-height: 1.05; margin: 0; }
main .lead { color: var(--mute); margin: 6px 0 24px; max-width: 64ch; }

/* Apparecchi: the plan and the tags */
.plan-page { display: grid; grid-template-columns: 300px 1fr; gap: 36px; }
.plan { position: sticky; top: 20px; align-self: start; }
.plan svg { width: 100%; height: auto; display: block; }
.plan .room { fill: var(--paper); stroke: var(--ink); stroke-width: 2; cursor: pointer; transition: fill .15s; }
.plan .room.out { stroke-dasharray: 5 4; }
.plan .room:hover { fill: var(--white); }
.plan .room.on { fill: var(--white); stroke-width: 3.5; }
.plan .room:focus-visible { outline: none; stroke: var(--saffron); }
.plan text { font: 11px var(--text); fill: var(--ink); pointer-events: none; }
.plan text.z { fill: var(--mute); font-size: 10px; }
.plan .note { font-size: 14px; color: var(--mute); margin-top: 10px; }
.rh { font-family: var(--display); font-weight: 500; font-size: 22px; margin: 28px 0 12px; display: flex; align-items: baseline; gap: 10px; }
.rh:first-child { margin-top: 2px; }
.rh small { font-family: var(--text); font-size: 14px; color: var(--mute); }
.tags { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.tag { position: relative; background: var(--white); border: 1.5px solid var(--ink); border-radius: 6px 22px 22px 6px; padding: 14px 16px 14px 32px; }
.tag::before { content: ''; position: absolute; left: 11px; top: 50%; width: 10px; height: 10px; margin-top: -5px; border-radius: 50%; border: 1.5px solid var(--ink); background: var(--stone); }
.tag.off { border-style: dashed; }
.tag a.n { display: block; text-decoration: none; color: var(--ink); }
.tag a.n:hover { text-decoration: underline; }
.why-t { display: block; margin-top: 10px; font-size: 13.5px; color: var(--ink); text-decoration: none; border-left: 3px solid var(--saffron); padding: 2px 8px; background: #F1EFFF; border-radius: 0 6px 6px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.why-t:hover { text-decoration: underline; }
.tag .n { font-family: var(--display); font-weight: 700; font-size: 19px; line-height: 1.15; }
.tag .k { color: var(--mute); font-size: 14px; margin-top: 2px; }
.tag .bat { font-size: 13px; color: var(--mute); }
.tag .bat.low { color: var(--red); font-weight: 700; }
.stickers { display: flex; gap: 6px; margin-top: 12px; flex-wrap: wrap; }
.stk { border: 1.5px dashed #B9BCD2; color: var(--mute); border-radius: 4px; padding: 4px 8px; font: 13px var(--text); cursor: pointer; background: none; transition: transform .12s; }
.stk[aria-pressed="true"] { border-style: solid; transform: rotate(-2deg); box-shadow: 1px 2px 0 rgba(23, 21, 59, .2); }
.stk[aria-pressed="true"].p { background: var(--saffron); border-color: var(--saffron); color: var(--white); }
.stk[aria-pressed="true"].al { background: var(--sage); border-color: var(--sage); color: var(--white); }
.stk[aria-pressed="true"].ro { background: var(--grey); border-color: var(--grey); color: var(--ink); }
.stk:disabled { cursor: default; }
.stk:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.why { margin-top: 10px; }
.why input { font-size: 13.5px; padding: 5px 8px; border-color: transparent; border-left: 3px solid var(--saffron); border-radius: 0 6px 6px 0; background: #F1EFFF; margin: 0; }
.why input:focus { border-color: var(--saffron); }

/* cards for the other pages */
.panel { background: var(--white); border: 1.5px solid var(--ink); border-radius: 6px 22px 22px 6px; padding: 22px 24px; max-width: 560px; }
.req { background: var(--white); border: 1.5px solid var(--ink); border-radius: 6px 22px 22px 6px; padding: 18px 22px; margin-bottom: 14px; max-width: 620px; }
.req .code { font-family: var(--display); font-weight: 700; font-size: 34px; letter-spacing: .12em; margin: 6px 0; }
.req .row { display: flex; gap: 10px; margin-top: 12px; }
.empty { color: var(--mute); }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--white); padding: 10px 18px; border-radius: 8px; opacity: 0; pointer-events: none; transition: opacity .2s; }
.toast.on { opacity: 1; }
.toast.err { background: var(--red); }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { border-right: 0; border-bottom: 1.5px solid var(--line); display: flex; flex-wrap: wrap; gap: 4px; padding: 10px 12px; }
  .side .grp { display: none; }
  main { padding: 20px 16px 60px; }
  main h1 { font-size: 34px; }
  .plan-page { grid-template-columns: 1fr; }
  .plan { position: static; max-width: 360px; }
  .top { flex-wrap: wrap; gap: 10px 16px; padding: 12px 16px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Pianta: the real floor plan and the room boxes */
.fp { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 28px; align-items: start; }
.fp-stage { position: relative; background: var(--white); border: 1.5px solid var(--ink); border-radius: 6px; overflow: hidden; touch-action: none; user-select: none; cursor: crosshair; }
.fp-stage img { display: block; width: 100%; height: auto; opacity: .55; pointer-events: none; }
#boxes svg, .realplan svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.poly { fill: rgba(110, 91, 255, .16); stroke: var(--ink); stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round; cursor: move; }
.poly.on { stroke: var(--saffron); stroke-width: 3; fill: rgba(110, 91, 255, .3); }
.poly.prop { stroke-dasharray: 6 4; fill: rgba(20, 160, 143, .14); }
.poly.out { fill: rgba(20, 160, 143, .1); }
.plab { position: absolute; margin: 3px 0 0 4px; font-size: 12px; font-weight: 700; background: rgba(255, 255, 255, .85); padding: 0 4px; border-radius: 3px; white-space: nowrap; pointer-events: none; }
.vx, .mid { position: absolute; transform: translate(-50%, -50%); border-radius: 50%; }
.vx { width: 14px; height: 14px; background: var(--ink); border: 2px solid var(--white); cursor: grab; }
.mid { width: 10px; height: 10px; background: var(--white); border: 2px solid var(--saffron); cursor: copy; opacity: .85; }
.mid:hover, .vx:hover { transform: translate(-50%, -50%) scale(1.3); }
.rpick { display: block; width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--line); padding: 8px 4px; font: 15px var(--text); color: var(--ink); cursor: pointer; }
.rpick small { color: var(--mute); }
.rpick small u { color: var(--sage); cursor: pointer; font-weight: 700; }
.rpick.on { background: var(--white); box-shadow: inset 3px 0 0 var(--saffron); }
@media (max-width: 860px) { .fp { grid-template-columns: 1fr; } }
.row { display: flex; gap: 10px; align-items: center; }
/* Apparecchi on the real plan */
.realplan { position: relative; background: var(--white); border: 1.5px solid var(--ink); border-radius: 6px; overflow: hidden; }
.realplan img { display: block; width: 100%; height: auto; opacity: .45; }
.realplan { background: var(--paper); padding: 10px; }
.realplan svg { position: static; display: block; width: 100%; height: auto; }
.rpoly { fill: var(--white); stroke: var(--ink); stroke-linejoin: miter; cursor: pointer; outline: none; transition: fill .15s; }
.rg.idle .rpoly { fill: var(--paper); cursor: default; }
.rpoly:hover { fill: #F1EFFF; }
.rpoly.on { stroke: var(--saffron); fill: #F1EFFF; }
.rpoly:focus-visible { stroke: var(--saffron); }
.realplan text { font-family: var(--text); font-weight: 700; fill: var(--ink); pointer-events: none; }
.rg.idle text { fill: var(--mute); font-weight: 400; }
.z-day { fill: #FBEBD0 !important; background: #FBEBD0; } .z-night { fill: #D9E2F0 !important; background: #D9E2F0; }
.z-outdoor { fill: #DDEBDF !important; background: #DDEBDF; } .z-service { fill: #E4E4E4 !important; background: #E4E4E4; }
.z-other, .z-none { fill: var(--white); background: var(--white); }
.annex { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.abox { position: relative; min-width: 88px; height: 52px; border: 1.5px dashed var(--ink); background: var(--white); border-radius: 3px; cursor: pointer; font: 700 12px var(--text); color: var(--ink); text-align: left; padding: 4px 6px; }
.abox span { position: absolute; left: 6px; top: 4px; }
.abox.on { border: 3px solid var(--saffron); }
.abox em { position: absolute; right: 4px; bottom: 4px; display: flex; gap: 3px; }
.abox em i { width: 8px; height: 6px; border-radius: 1.5px; transform: rotate(-8deg); }
.zt { display: inline; font-size: 14px; } .zt input { width: auto; margin: 0 4px 0 0; }
.zleg { display: block; margin-top: 6px; font-size: 13px; } .zleg i { display: inline-block; width: 12px; height: 12px; border: 1px solid var(--ink); border-radius: 2px; margin: 0 4px -2px 8px; }
.zleg i:first-child { margin-left: 0; }

/* the mark: Nimbo, alive */
.brand { display: flex; align-items: center; gap: 2px; }
.brand canvas { flex: none; width: 44px; height: 44px; margin: -8px -2px -8px -10px; }
.top { background: var(--night); border-bottom: 0; color: #fff; }
.top .word { color: #fff; }
.top .homepick { color: #A9A6D6; }
.top .homepick select { color: #fff; border-bottom-color: var(--saffron); }
.top .homepick select option { color: var(--ink); }
.top .who, .top .who .link { color: #C9C6EE; }
.gate { position: relative; background: radial-gradient(120% 90% at 30% 40%, var(--night2), var(--night)); overflow: hidden; }
.gate-sky { position: absolute; inset: 0; width: 100%; height: 100%; }
.gate-box { position: relative; border: 0; border-radius: 18px; box-shadow: 0 30px 80px rgba(0, 0, 0, .35); }
@media (min-width: 900px) { .gate { place-items: center end; padding-right: 9vw; } .gate-sky { width: 60%; } }
.panel { border-radius: 14px; }
.btn.pri { background: var(--saffron); border-color: var(--saffron); }
.btn.pri:hover { background: #5A47E8; }
.mail .sw { display: flex; gap: 14px; align-items: flex-start; color: var(--ink); padding: 12px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.mail .sw:last-child { border-bottom: 0; }
.mail .sw input { flex: none; width: 20px; height: 20px; margin: 3px 0 0; accent-color: var(--saffron); }
.mail .sw .mute { font-size: 14px; }
.ic { width: 1.15em; height: 1.15em; vertical-align: -.2em; flex: none; }
.ic.big { width: 28px; height: 28px; }
/* Persone */
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; max-width: 900px; }
.person { display: flex; gap: 12px; align-items: flex-start; background: var(--white); border-radius: 14px; padding: 14px 16px; text-decoration: none; color: var(--ink); border: 1.5px solid transparent; }
.person:hover { border-color: var(--saffron); }
.person.gone { opacity: .6; }
.person small { margin: 3px 0 0 auto; color: var(--mute); font-size: 12.5px; white-space: nowrap; }
.person .ic.big { color: var(--saffron); margin-top: -1px; }
.sw-line { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; color: var(--ink); }
.sw-line input { width: auto; margin: 0; }
.side a .ic { color: var(--mute); }
.side a.on .ic { color: var(--saffron); }
a.btn { display: inline-flex; gap: 6px; align-items: center; text-decoration: none; }
