/* Animula · console delle famiglie. Direzione «A + C»: la pianta della casa e i cartellini con gli adesivi.
   Pietra, inchiostro blu notte; gli adesivi dicono come trattare un apparecchio, e la pianta li ripete in piccolo. */
:root {
  --stone: #E6EAEE; --paper: #F5F7F9; --white: #fff; --ink: #1D2A3A; --mute: #5B6878; --line: #C9D1DA;
  --saffron: #E8A33D; --sage: #5E8C6A; --grey: #CDD3DA; --red: #C8463C;
  --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: #2b3d53; }
.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(29, 42, 58, .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: #fff8ea; 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 #b9c1ca; 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(29, 42, 58, .2); }
.stk[aria-pressed="true"].p { background: var(--saffron); border-color: var(--saffron); color: var(--ink); }
.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: #fff8ea; 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(232, 163, 61, .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(232, 163, 61, .3); }
.poly.prop { stroke-dasharray: 6 4; fill: rgba(94, 140, 106, .14); }
.poly.out { fill: rgba(94, 140, 106, .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: #fff8ea; }
.rpoly.on { stroke: var(--saffron); fill: #fff8ea; }
.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; }
