/* Montador de Sala: tela da ferramenta, prévia da home. Usa as cores e peças de site.css. */

.container--larga { max-width: 84rem; }
.lede-curto { max-width: 60ch; font-size: 1.12rem; margin-bottom: 1.25rem; }
.pagina-ferramenta h1 { max-width: none; }
.so-leitor { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.mensagem { margin: 0 0 1rem; padding: .7rem .9rem; color: var(--tinta); background: var(--papel); border: 2px solid var(--tinta); border-left-width: .5rem; border-radius: var(--raio); }
.mensagem p { margin: 0 0 .5rem; }
.mensagem p:last-child { margin-bottom: 0; }
.mensagem--privacidade { background: var(--ceu); }
.avisos:empty { display: none; }
.avisos { margin-bottom: 1rem; }
.avisos .mensagem { margin-bottom: .5rem; }

/* ---------- layout: painel de controles + palco da planta ---------- */
.sala { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.5rem; margin-top: 1rem; }
.sala > * { min-width: 0; }
.sala input, .sala select, .sala textarea { min-width: 0; max-width: 100%; }
@media (min-width: 64rem) { .sala { grid-template-columns: minmax(0, 20rem) minmax(0, 1fr); gap: 2rem; align-items: start; } }
.sala-painel { display: grid; gap: 1rem; }
.sala-painel h2, .secao-sala h2, .painel-peca h2 { margin-top: 0; font-size: 1.3rem; }
.sala .linha { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .75rem; }
.sala .linha--3 { grid-template-columns: repeat(auto-fit, minmax(min(9rem, 100%), 1fr)); }
.sala .campo-largo { grid-column: 1 / -1; }
@media (min-width: 40rem) { .sala .campo-largo { grid-column: span 2; } }
.sala .campo { margin-bottom: .75rem; }
.sala .acoes { margin-top: .25rem; }
.sala .divisoria .ajuda { margin: .5rem 0 .75rem; }

.biblioteca { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.btn-peca { display: flex; align-items: center; gap: .55rem; min-height: 2.75rem; padding: .4rem .7rem; font: inherit; font-weight: 600; color: var(--tinta); background: var(--papel); border: 2px solid var(--tinta); border-radius: var(--raio); cursor: grab; text-align: left; touch-action: none; }
.btn-peca:hover { background: var(--ceu); }
.btn-peca:active { cursor: grabbing; }
.mini { flex: none; display: inline-block; width: 1.6rem; height: 1.1rem; border: 2px solid var(--tinta); border-radius: 3px; background: #FFFDF8; }
.mini--mesa { background: var(--ceu); }
.mini--quadro { height: .5rem; background: var(--tinta); }
.mini--armario { background: repeating-linear-gradient(45deg, var(--kraft) 0 3px, #D9C9AE 3px 6px); }
.mini--porta { height: .35rem; border-style: dashed; background: transparent; }

/* ---------- planta ---------- */
.barra-planta { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .5rem; }
.barra-planta .botao-mini[aria-pressed="true"] { background: var(--etiqueta); }
.dica-planta { margin: 0 0 .75rem; }
.planta-caixa { position: relative; background: var(--papel); border: 2px solid var(--cabine); border-radius: var(--raio); padding: .5rem; }
.planta { display: block; width: 100%; height: auto; max-height: 78vh; touch-action: none; user-select: none; -webkit-user-select: none; }
.planta-vazia { position: absolute; inset: .5rem; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 1rem; background: rgba(251, 246, 236, .86); }
.planta-vazia[hidden] { display: none !important; }

.peca { cursor: grab; outline: none; }
.peca:active { cursor: grabbing; }
.peca .corpo { stroke: #4A5560; stroke-width: 2; }
.peca--carteira .corpo { fill: #FFFDF8; }
.peca--mesa .corpo { fill: #A9D4F0; }
.peca--quadro .corpo { fill: #2E363E; stroke: #2E363E; }
.peca--armario .corpo { fill: url(#hachura); }
.peca--porta .corpo { fill: #F3E9DA; stroke-dasharray: 6 4; }
.peca--porta .giro { fill: none; stroke: #4A5560; stroke-width: 1.5; stroke-dasharray: 5 4; }
.peca .etiqueta-nome { fill: #FF8A3D; stroke: #2E363E; stroke-width: 1.2; }
.peca .texto-nome { font-family: "Alata", sans-serif; fill: #2E363E; text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.peca .numero { font-family: "Kanit", sans-serif; font-weight: 600; fill: #4A5560; text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.peca:focus-visible .corpo, .peca--escolhida .corpo { stroke: #2E363E; stroke-width: 4; }
.peca--escolhida .corpo { filter: drop-shadow(0 0 0 #FF8A3D); }
.peca--escolhida .aura { fill: none; stroke: #FF8A3D; stroke-width: 4; }
.peca--primeira-troca .aura { fill: none; stroke: #FF8A3D; stroke-width: 4; stroke-dasharray: 8 5; }
.peca--alerta .corpo { stroke: #2E363E; stroke-width: 3; stroke-dasharray: 7 4; }
.peca .selo { fill: #FF8A3D; stroke: #2E363E; stroke-width: 1.5; }
.peca .selo-texto { font-family: "Kanit", sans-serif; font-weight: 700; fill: #2E363E; text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.alca { fill: #FF8A3D; stroke: #2E363E; stroke-width: 1.5; cursor: nwse-resize; }
.alca--w { cursor: ew-resize; }
.alca--h { cursor: ns-resize; }
.fantasma { opacity: .55; pointer-events: none; }

/* ---------- painel da peça, alertas e lista ---------- */
.painel-peca { margin-top: 1rem; }
.secao-sala { margin-top: 1.75rem; }
.resumo { font-family: var(--fonte-titulo); font-weight: 600; font-size: 1.1rem; color: var(--tinta); margin-bottom: .75rem; }
.alertas { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; gap: .5rem; }
.alertas li { padding: .6rem .8rem .6rem 2.4rem; position: relative; background: var(--papel); border: 2px solid var(--tinta); border-radius: var(--raio); }
.alertas li::before { position: absolute; left: .75rem; top: .6rem; display: inline-grid; place-items: center; width: 1.3rem; height: 1.3rem; font-family: var(--fonte-titulo); font-weight: 700; font-size: .85rem; color: var(--tinta); border-radius: 50%; background: var(--etiqueta); border: 2px solid var(--tinta); }
.alertas li.alerta--erro::before { content: "!"; }
.alertas li.alerta--aviso { border-style: dashed; }
.alertas li.alerta--aviso::before { content: "i"; background: var(--ceu); }
.alertas li.alerta--ok { border-color: var(--cabine); }
.alertas li.alerta--ok::before { content: "✓"; background: var(--ceu); }
.aviso-estimativa { margin: 0 0 1rem; padding: .8rem 1rem; background: var(--papel); border: 2px dashed var(--costura); border-radius: var(--raio); font-size: .97rem; }
.aviso-estimativa .etiqueta { margin-right: .5rem; font-size: .85rem; }
#tabela-carteiras td .botao-mini { min-height: 2.5rem; min-width: 0; padding: .1rem .7rem; }
.botao-mini { min-width: 2.75rem; min-height: 2.75rem; padding: .2rem .8rem; font: inherit; font-weight: 600; color: var(--tinta); background: var(--papel); border: 2px solid var(--tinta); border-radius: var(--raio); cursor: pointer; }
.botao-mini:hover:not(:disabled) { background: var(--ceu); }
.botao-mini:disabled { opacity: .5; cursor: not-allowed; border-style: dashed; }
.acoes-lista { margin-top: 1.5rem; }

dialog { max-width: min(28rem, calc(100vw - 2rem)); padding: 1.5rem; color: var(--cabine); background: var(--papel); border: 2px solid var(--tinta); border-radius: var(--raio); }
dialog::backdrop { background: rgba(46, 54, 62, .65); }
dialog h2 { margin-top: 0; font-size: 1.35rem; }

/* ---------- prévia da home ---------- */
.previa { margin-bottom: 1.25rem; }
.previa-campos { display: grid; grid-template-columns: minmax(0, 12rem) minmax(0, 9rem); gap: .75rem; margin-bottom: .75rem; }
.previa-resumo { font-weight: 600; margin: 0 0 .5rem; }
.previa-planta { max-width: 26rem; background: var(--papel); border: 2px solid var(--cabine); border-radius: var(--raio); padding: .35rem; }
.previa-planta svg { display: block; width: 100%; height: auto; }
.previa .aviso { font-size: .95rem; }

@media print {
  .sala-painel, .barra-planta, .dica-planta, .acoes-lista, .texto-da-ferramenta, .lede-curto, #avisos { display: none !important; }
  .sala { display: block; }
}
