/* Prenájom alebo kúpa – "rovnoramenné váhy": formulár rozdelený na dve strany (nájom = fialovo-modrá, kúpa = zelená),
   vo výsledku váhy, ktorých drahšia miska klesne podľa rozdielu oproti nájmu */
:root{--rb-rent:#5b55d6;--rb-buy:#17744c;--rb-steel:#5d6676;--rb-steel2:#8b93a3;--rb-rentbg:#efeefe;--rb-buybg:#e8f6ee}
@media(prefers-color-scheme:dark){:root{--rb-rent:#a7a3ff;--rb-buy:#5fd49a;--rb-steel:#aab2c2;--rb-steel2:#cfd5e0;--rb-rentbg:#2e2f55;--rb-buybg:#203d33}}

/* formulár: nájom vľavo ako vysoká karta, kúpa vpravo v mriežke 2 × 2 */
.cform[data-tool="rent-vs-buy"] .fields{grid-template-columns:minmax(0,1fr) minmax(0,1fr) minmax(0,1fr);gap:.8rem;position:relative}
.cform[data-tool="rent-vs-buy"] .field{--c:var(--rb-buy);border-radius:16px;padding:.2rem .9rem .9rem;background:var(--rb-buybg);border:1px solid color-mix(in srgb,var(--c) 30%,transparent)}
.cform[data-tool="rent-vs-buy"] .field:first-child{--c:var(--rb-rent);grid-area:1/1/3/2;background:var(--rb-rentbg);display:flex;flex-direction:column;justify-content:center;
  background-image:radial-gradient(circle at 100% 0,color-mix(in srgb,var(--rb-rent) 18%,transparent) 0 60px,transparent 61px);position:relative;margin-right:1.2rem}
.cform[data-tool="rent-vs-buy"] .field:first-child::after{content:"";position:absolute;right:-1.45rem;top:12%;bottom:12%;width:4px;border-radius:4px;background:repeating-linear-gradient(180deg,var(--line) 0 8px,transparent 8px 14px)}
.cform[data-tool="rent-vs-buy"] .field:nth-child(2){grid-area:1/2}
.cform[data-tool="rent-vs-buy"] .field:nth-child(3){grid-area:1/3}
.cform[data-tool="rent-vs-buy"] .field:nth-child(4){grid-area:2/2}
.cform[data-tool="rent-vs-buy"] .field:nth-child(5){grid-area:2/3}
.cform[data-tool="rent-vs-buy"] .field label{color:var(--c);font-weight:800;font-size:.8rem;letter-spacing:.04em}
.cform[data-tool="rent-vs-buy"] .field:first-child label{font-size:.95rem}
.cform[data-tool="rent-vs-buy"] .field:first-child input{font-size:1.6rem;font-weight:800;padding:.7rem .9rem}
.cform[data-tool="rent-vs-buy"] input{background:var(--card);border-color:color-mix(in srgb,var(--c) 30%,var(--line));font-weight:600}
.cform[data-tool="rent-vs-buy"] input:focus{border-color:var(--c);box-shadow:0 0 0 3px color-mix(in srgb,var(--c) 22%,transparent)}
.cform[data-tool="rent-vs-buy"] .field-range{accent-color:var(--c)}
.cform[data-tool="rent-vs-buy"] .iu{flex-wrap:wrap}
.cform[data-tool="rent-vs-buy"] .iu input{flex:1 1 0}
.cform[data-tool="rent-vs-buy"] .iu .unit{background:color-mix(in srgb,var(--c) 12%,var(--card));color:var(--c);font-weight:800}
.cform[data-tool="rent-vs-buy"] .iu .field-range{order:3;flex:1 0 100%}
.cform[data-tool="rent-vs-buy"] .iu.ok::after{order:2;align-self:center;margin-left:.3rem}
@media(max-width:760px){
  .cform[data-tool="rent-vs-buy"] .fields{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}
  .cform[data-tool="rent-vs-buy"] .field:first-child{grid-area:1/1/2/-1;margin:0 0 .5rem}
  .cform[data-tool="rent-vs-buy"] .field:first-child::after{right:15%;left:15%;top:auto;bottom:-.9rem;width:auto;height:4px;background:repeating-linear-gradient(90deg,var(--line) 0 8px,transparent 8px 14px)}
  .cform[data-tool="rent-vs-buy"] .field:nth-child(2){grid-area:2/1}.cform[data-tool="rent-vs-buy"] .field:nth-child(3){grid-area:2/2}
  .cform[data-tool="rent-vs-buy"] .field:nth-child(4){grid-area:3/1}.cform[data-tool="rent-vs-buy"] .field:nth-child(5){grid-area:3/2}
}
/* na mobile má cena nehnuteľnosti (6 číslic + jednotka EUR) celý riadok, inak sa suma v poli nezmestí */
@media(max-width:480px){
  .cform[data-tool="rent-vs-buy"] .field:nth-child(2){grid-area:2/1/3/-1}
  .cform[data-tool="rent-vs-buy"] .field:nth-child(3){grid-area:3/1}.cform[data-tool="rent-vs-buy"] .field:nth-child(4){grid-area:3/2}
  .cform[data-tool="rent-vs-buy"] .field:nth-child(5){grid-area:4/1/5/-1}
}
@media(max-width:400px){.cform[data-tool="rent-vs-buy"] .field{padding:.2rem .65rem .75rem}}

/* výsledok: váhy */
.cform[data-tool="rent-vs-buy"]~.cres{border-top:4px solid var(--rb-steel)}
.cform[data-tool="rent-vs-buy"]~.cres.is-empty{border-top-color:var(--line)}
.rb-scale{display:block;width:100%;height:auto;max-height:340px;margin:.6rem 0 0;padding:.4rem 0 0;border-radius:18px 18px 0 0;overflow:visible;
  background:linear-gradient(100deg,var(--rb-rentbg) 0 50%,var(--rb-buybg) 50% 100%);border-bottom:3px solid var(--rb-steel);transition:opacity .2s}
.rb-scale[hidden]{display:none}
.rb-scale.is-example{opacity:.82}
.rb-ex-badge{font:700 11px system-ui,sans-serif;fill:var(--mut);stroke:var(--card);stroke-width:3px;paint-order:stroke fill;opacity:0;transition:opacity .2s}
.rb-scale.is-example .rb-ex-badge{opacity:1}
.rb-scale .beam,.rb-scale .pan{transition:transform 1.1s cubic-bezier(.34,1.45,.5,1)}
.rb-scale .beam{transform-origin:200px 52px}
.rb-scale .metal{fill:var(--rb-steel)}
.rb-scale .metal2{fill:var(--rb-steel2)}
.rb-scale .str{stroke:var(--rb-steel);stroke-width:1.6;fill:none}
.rb-scale .bowl{stroke-width:0}
.rb-scale .l .bowl{fill:var(--rb-rent)}
.rb-scale .r .bowl{fill:var(--rb-buy)}
.rb-scale .coin{stroke:rgba(0,0,0,.25);stroke-width:1}
.rb-scale .l .coin{fill:color-mix(in srgb,var(--rb-rent) 55%,#fff)}
.rb-scale .r .coin{fill:color-mix(in srgb,var(--rb-buy) 55%,#fff)}
.rb-scale .ico{fill:none;stroke:#fff;stroke-width:2.2;stroke-linecap:round;stroke-linejoin:round}
.rb-scale .amt{font:700 15px/1 system-ui,sans-serif;fill:var(--fg);text-anchor:middle;font-variant-numeric:tabular-nums}
.rb-scale .l .amt{fill:var(--rb-rent)}
.rb-scale .r .amt{fill:var(--rb-buy)}
.rb-scale .needle{transition:transform 1.1s cubic-bezier(.34,1.45,.5,1);transform-origin:200px 52px}
@media(prefers-reduced-motion:reduce){.rb-scale .beam,.rb-scale .pan,.rb-scale .needle{transition:none}}

.cform[data-tool="rent-vs-buy"]~.cres dl#out{grid-template-columns:1fr;justify-items:center;gap:.6rem;margin-top:-1px;padding-top:0}
.cform[data-tool="rent-vs-buy"]~.cres #out .tile{width:min(100%,380px);text-align:center}
.cform[data-tool="rent-vs-buy"]~.cres #out .tile:first-child{position:relative;border-radius:6px 6px 22px 22px;background:var(--card);border:2px solid var(--rb-steel);box-shadow:0 6px 0 -2px var(--rb-steel2)}
.cform[data-tool="rent-vs-buy"]~.cres.rb-buy-heavy #out .tile:first-child{border-color:var(--rb-buy);box-shadow:0 6px 0 -2px var(--rb-buy)}
.cform[data-tool="rent-vs-buy"]~.cres.rb-rent-heavy #out .tile:first-child{border-color:var(--rb-rent);box-shadow:0 6px 0 -2px var(--rb-rent)}
.cform[data-tool="rent-vs-buy"]~.cres #out .tile:first-child dt{text-transform:uppercase;letter-spacing:.12em;font-size:.74rem;color:var(--mut)}
.cform[data-tool="rent-vs-buy"]~.cres #out .tile:first-child dd{text-align:center;font-size:clamp(1.9rem,6vw,2.6rem);color:var(--fg);-webkit-text-fill-color:currentColor}
.cform[data-tool="rent-vs-buy"]~.cres.rb-buy-heavy #out .tile:first-child dd{color:var(--rb-buy)}
.cform[data-tool="rent-vs-buy"]~.cres.rb-rent-heavy #out .tile:first-child dd{color:var(--rb-rent)}
.cform[data-tool="rent-vs-buy"]~.cres #out .tile:nth-child(2){display:flex;align-items:baseline;justify-content:space-between;gap:.8rem;border-radius:99px;padding:.55rem 1.1rem;background:var(--rb-buybg);border:1px dashed color-mix(in srgb,var(--rb-buy) 50%,transparent)}
.cform[data-tool="rent-vs-buy"]~.cres #out .tile:nth-child(2) dt{color:var(--rb-buy);font-weight:700}
.cform[data-tool="rent-vs-buy"]~.cres #out .tile:nth-child(2) dd{margin:0;color:var(--fg)}
