/* BM AERMOD selaimessa */
body.aermod header { gap: 16px; }
.projektipalkki { flex: 1; display: flex; gap: 12px; align-items: baseline; min-width: 0; }
.projektipalkki strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tallennus { font-size: 12px; opacity: .85; }
.tallennus.virhe { color: #ffcdd2; font-weight: 600; }
.tallennus.odottaa { color: #fff3c4; }
.keski { max-width: 860px; margin: 24px auto; padding: 0 16px; width: 100%; border: 0; }
body.aermod .palkki { height: auto; background: none; overflow: visible; display: flex; gap: 6px; flex-wrap: wrap;
  align-items: center; margin: 6px 0; border-radius: 0; }
body.aermod .palkki.pysty { flex-direction: column; align-items: stretch; margin-top: auto; }
body.aermod button { border: 1px solid var(--reuna); background: #fff; border-radius: 4px; padding: 4px 10px; cursor: pointer; }
body.aermod button:hover { background: #f1f5f0; }
body.aermod button:disabled { opacity: .5; cursor: not-allowed; }
body.aermod button.paa { background: var(--vihrea); border-color: var(--vihrea); color: #fff; font-weight: 600; }
body.aermod button.paa:hover { background: var(--vihrea-tumma); }
body.aermod header button { background: transparent; color: #fff; border-color: rgba(255,255,255,.6); }
.projektilista { list-style: none; padding: 0; display: grid; gap: 8px; }
.projektilista .projekti { background: #fff; border: 1px solid var(--reuna); border-radius: 6px; padding: 10px 12px;
  display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }

#editori { flex: 1; display: grid; grid-template-columns: 170px minmax(380px, 470px) 1fr; min-height: 0; }
.sivupalkki { background: #e9ede7; border-right: 1px solid var(--reuna); display: flex; flex-direction: column; padding: 8px; gap: 6px; overflow-y: auto; }
.navi { display: flex; flex-direction: column; gap: 2px; }
.navi button { text-align: left; border: 0 !important; background: transparent !important; padding: 7px 8px !important; border-radius: 4px; }
.navi button.valittu { background: #fff !important; font-weight: 600; box-shadow: inset 3px 0 0 var(--vihrea); }
.takaisin { margin-bottom: 6px; }
.sivu { overflow-y: auto; padding: 8px 14px 40px; background: var(--harmaa); border-right: 1px solid var(--reuna); font-size: 13px; }
.sivu-otsikko h2 { margin: 6px 0 0; font-size: 16px; }
.sivu-otsikko p { margin: 2px 0 8px; }
.ryhma { border: 1px solid var(--reuna); border-radius: 6px; background: #fff; margin: 10px 0; padding: 6px 10px 10px; }
.ryhma legend { font-weight: 600; padding: 0 4px; }
.rivi { display: grid; grid-template-columns: 44% 1fr; gap: 8px; align-items: center; padding: 3px 0; }
.rivi-koko { padding: 3px 0; }
.r-kentta { display: flex; gap: 4px; align-items: center; min-width: 0; }
.r-kentta input[type=text], .r-kentta select { flex: 1; min-width: 0; font: inherit; padding: 3px 6px; border: 1px solid var(--reuna); border-radius: 4px; }
.yksikko { color: #666; font-size: 12px; white-space: nowrap; }
input.luku { text-align: right; }
input.virhe { border-color: var(--punainen) !important; background: #ffebee; }
.aineisto { display: flex; gap: 4px; flex: 1; min-width: 0; }
.aineisto select { flex: 1; min-width: 0; }
.ruutu { display: block; padding: 3px 0; }
.huom { color: #555; font-size: 12px; margin: 6px 0; white-space: pre-wrap; }
.virhe-teksti { color: var(--punainen) !important; }
.ok-teksti { color: var(--vihrea-tumma); }
.taulu { width: 100%; border-collapse: collapse; font-size: 12px; background: #fff; margin: 4px 0; }
.taulu th { background: #eef1ec; text-align: left; font-weight: 600; padding: 4px; border-bottom: 1px solid var(--reuna); white-space: nowrap; }
.taulu td { padding: 2px 4px; border-bottom: 1px solid #eef0ec; }
.taulu td input[type=text], .taulu td select { width: 100%; min-width: 50px; font: inherit; padding: 2px 4px; border: 1px solid transparent; background: transparent; }
.taulu td input[type=text]:focus, .taulu td select:focus { border-color: var(--reuna); background: #fff; }
.taulu tbody tr { cursor: pointer; }
.taulu tbody tr:hover { background: #f6f9f5; }
.taulu tr.valittu { background: #fff3e0 !important; }
.taulu .oik { text-align: right; }
.pieni-taulu { max-width: 340px; }
.vierita { overflow-x: auto; }
pre.syote { max-height: 50vh; overflow: auto; background: #111; color: #e0e0e0; padding: 8px; font-size: 11px; }
.palkki-edistyminen { height: 6px; background: #e6e9e4; border-radius: 3px; overflow: hidden; margin-top: 5px; }
.palkki-edistyminen > div { height: 100%; background: var(--vihrea); transition: width .5s; }
.rivi-tyo { display: flex; justify-content: space-between; gap: 6px; }
.tuuliruusu { width: 100%; max-width: 300px; display: block; margin: 0 auto; }
.ruusu { text-align: center; }

.karttaosa { display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; }
.tyokalut { display: flex; flex-wrap: wrap; gap: 3px; padding: 5px; background: #fff; border-bottom: 1px solid var(--reuna); }
.tyokalut button { font-size: 12px !important; padding: 3px 8px !important; }
.tyokalut button.valittu { background: var(--vihrea) !important; color: #fff; border-color: var(--vihrea) !important; }
.tyokaluohje { position: absolute; top: 44px; left: 50%; transform: translateX(-50%); z-index: 1000; background: rgba(38,50,56,.9);
  color: #fff; font-size: 12px; padding: 4px 10px; border-radius: 4px; pointer-events: none; }
.tyokaluohje:empty { display: none; }
.karttaosa #kartta { flex: 1; min-height: 300px; }
#kartta.piirto { cursor: crosshair; }
.kahva { background: #fff; border: 2px solid #ff9800; border-radius: 50%; box-sizing: border-box; }
.kahva.siirto { border-radius: 2px; background: #ff9800; }

dialog.kysely { width: 460px; }
dialog.kysely h3 { margin-top: 0; }
.dialogi-napit { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }

@media (max-width: 1100px) {
  #editori { grid-template-columns: 140px 1fr; grid-template-rows: auto 60vh; }
  .karttaosa { grid-column: 1 / -1; }
}
@media (max-width: 700px) {
  #editori { display: flex; flex-direction: column; overflow-y: auto; }
  .sivupalkki { flex-direction: row; flex-wrap: wrap; }
  .navi { flex-direction: row; flex-wrap: wrap; }
  .karttaosa { min-height: 60vh; }
}

body.kesken .sivu, body.kesken #kartta { cursor: progress; }
body.kesken .sivu { opacity: .75; pointer-events: none; }
