/* Componentes dos sistemas (BRAIN, BRAVES, EZ-AERMOD, Tools).
   Mesma paleta do site (cinza #444, azul #266DD3, azul claro #B8C5D6) e escopo .app,
   para não interferir no Bootstrap do layout original. */
.app {
  --ink: #333333; --ink-2: #444444; --muted: #6c757d; --line: #dee2e6;
  --surface: #ffffff; --surface-2: #f4f6f9;
  --primary: #266DD3; --primary-2: #266DD3; --primary-soft: #e8f0fb;
  --ok: #2e8540; --warn: #c05600; --err: #b50909; --focus: #2491ff; --radius: 3px;
  --font: inherit; --mono: SFMono-Regular, Consolas, "Courier New", monospace;
  color: var(--ink); line-height: 1.5;
}
.app h1, .app h2, .app h3 { color: #444444; }
.app h1 { font-size: 1.7rem; } .app h2 { font-size: 1.25rem; } .app h3 { font-size: 1.02rem; }
.app .page { padding: 1.5rem 0 3rem; }
.app .page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.app .page-head p { margin: 0; color: var(--ink-2); }
.app .wrap { max-width: 1140px; margin: 0 auto; padding: 0 15px; }
.app .btn:hover { background: #1d58ad; }
.app label { color: #444; }
.subnav { border-bottom: 1px solid #dee2e6; background: #fff; }
.subnav .wrap { display: flex; gap: 1.5rem; overflow-x: auto; max-width: 1140px; margin: 0 auto; padding: 0 15px; }
.subnav a { padding: .6rem 0; font-size: .92rem; text-decoration: none; color: #444; white-space: nowrap; border-bottom: 2px solid transparent; }
.subnav a:hover { color: #266DD3; text-decoration: none; }
.subnav a[aria-current="page"] { color: #266DD3; border-bottom-color: #266DD3; font-weight: 600; }
.app a {color: var(--primary-2); text-underline-offset: 2px;}
.app a:hover {color: var(--primary);}
.app :focus-visible {outline: 3px solid var(--focus); outline-offset: 2px;}
.app h1, .app h2, .app h3 {line-height: 1.2; margin: 0 0 .5em; font-weight: 700; letter-spacing: -.01em;}
.app h1 {font-size: 2rem;}
.app h2 {font-size: 1.35rem;}
.app h3 {font-size: 1.05rem;}
.app p {margin: 0 0 1em; max-width: 72ch;}
.app small, .app .muted {color: var(--muted);}
.app code, .app .mono {font-family: var(--mono); font-size: .9em;}
.app img {max-width: 100%;}
.app .page {padding: 2rem 0 3rem;}
.app .page-head {display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap;}
.app .page-head p {margin: 0; color: var(--ink-2);}
.app .btn {display: inline-flex; align-items: center; gap: .4rem; font: inherit; font-weight: 700; font-size: .92rem; padding: .55rem 1rem; border-radius: var(--radius); border: 1px solid var(--primary); background: var(--primary); color: #fff; cursor: pointer; text-decoration: none; line-height: 1.2;}
.app .btn:hover {background: #1d58ad; color: #fff;}
.app .btn.secondary {background: var(--surface); color: var(--primary);}
.app .btn.secondary:hover {background: var(--primary-soft);}
.app .btn.danger {background: var(--err); border-color: var(--err);}
.app .btn.small {padding: .3rem .6rem; font-size: .82rem;}
.app .btn.link {background: none; border: none; color: var(--primary-2); padding: 0; font-weight: 600;}
.app .btn:disabled {opacity: .45; cursor: not-allowed;}
.app label {display: block; font-weight: 600; font-size: .88rem; margin: .8rem 0 .25rem;}
.app input, .app select, .app textarea {font: inherit; font-size: .95rem; width: 100%; padding: .45rem .55rem; border: 1px solid #a9aeb1; border-radius: var(--radius); background: #fff; color: var(--ink);}
.app input[type=checkbox], .app input[type=radio] {width: auto; margin-right: .4rem; accent-color: var(--primary);}
.app .check {display: flex; align-items: center; font-weight: 400; margin: .3rem 0;}
.app .help {font-size: .82rem; color: var(--muted); margin-top: .2rem;}
.app .errorlist {color: var(--err); font-size: .85rem; margin: .2rem 0; padding-left: 1rem;}
.app .grid-2 {display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem;}
.app .grid-3 {display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 1rem;}
@media (max-width: 700px) {
  .app .grid-2, .app .grid-3 {grid-template-columns: 1fr;}
}
.app fieldset {border: 0; border-top: 1px solid var(--line); margin: 1.25rem 0 0; padding: .75rem 0 0;}
.app legend {font-weight: 700; padding: 0 .4rem 0 0;}
.app .alert {border-left: 6px solid var(--primary-2); background: var(--primary-soft); padding: .75rem 1rem; margin: 0 0 1rem; font-size: .92rem;}
.app .alert.success {border-color: var(--ok); background: #ecf3ec;}
.app .alert.warning {border-color: #ffbe2e; background: #faf3d1;}
.app .alert.error {border-color: var(--err); background: #f4e3db;}
.app .stats {display: grid; grid-template-columns: repeat(5, 1fr); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: 0 0 1.5rem;}
.app .stats div {padding: .9rem 1rem; border-left: 1px solid var(--line);}
.app .stats div:first-child {border-left: 0; padding-left: 0;}
.app .stats b {display: block; font-size: 1.6rem; font-weight: 700; color: var(--primary); line-height: 1.1;}
.app .stats span {font-size: .82rem; color: var(--ink-2);}
@media (max-width: 760px) {
  .app .stats {grid-template-columns: repeat(2, 1fr);}
  .app .stats div:nth-child(odd) {border-left: 0; padding-left: 0;}
}
.app .table-wrap {overflow-x: auto;}
.app table {border-collapse: collapse; width: 100%; font-size: .9rem;}
.app th {text-align: left; font-weight: 700; border-bottom: 2px solid var(--ink); padding: .45rem .6rem; white-space: nowrap;}
.app td {border-bottom: 1px solid var(--line); padding: .45rem .6rem; vertical-align: top;}
.app td.num, .app th.num {text-align: right;}
.app tr.off td {color: var(--muted);}
.app .tag {display: inline-block; font-size: .75rem; padding: .05rem .4rem; border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink-2); margin: 0 .2rem .2rem 0;}
.app .tag.ok {border-color: var(--ok); color: #00611a;}
.app .tag.warn {border-color: var(--warn); color: var(--warn);}
.app .tag.err {border-color: var(--err); color: var(--err);}
.app .map-app {display: grid; grid-template-columns: 360px 1fr; height: calc(100vh - 140px); min-height: 520px; border-top: 1px solid var(--line);}
.app .map-app.wide-panel {grid-template-columns: 420px 1fr;}
.app .panel {overflow-y: auto; border-right: 1px solid var(--line); padding: 1rem 1.1rem 2rem; background: var(--surface);}
.app .panel h2 {font-size: 1.1rem;}
.app .panel section {border-bottom: 1px solid var(--line); padding: .8rem 0;}
.app .panel section:last-child {border-bottom: 0;}
.app .map {width: 100%; height: 100%; background: #0e1a2b;}
@media (max-width: 900px) {
  .app .map-app, .app .map-app.wide-panel {grid-template-columns: 1fr; height: auto;}
  .app .map {height: 60vh;}
  .app .panel {border-right: 0;}
}
.app .legend {background: rgba(255, 255, 255, .95); padding: .45rem .6rem; font-size: .78rem; line-height: 1.5; border-radius: var(--radius);}
.app .legend i {display: inline-block; width: 10px; height: 10px; margin-right: .35rem; vertical-align: middle;}
.app .leaflet-container {font-family: var(--font);}
.app .leaflet-popup-content {font-size: .85rem; margin: .7rem .85rem;}
.app .leaflet-popup-content-wrapper {border-radius: var(--radius);}
.app .tabs {display: flex; border-bottom: 1px solid var(--line); margin: 0 -1.1rem 1rem; padding: 0 1.1rem; gap: 1rem;}
.app .tabs button {background: none; border: 0; font: inherit; font-size: .9rem; font-weight: 600; color: var(--ink-2); padding: .55rem 0; border-bottom: 3px solid transparent; cursor: pointer;}
.app .tabs button[aria-selected="true"] {color: var(--primary); border-bottom-color: var(--primary);}
.app [role=tabpanel][hidden] {display: none;}
.app .timeline {display: grid; grid-template-columns: 220px 1fr; gap: .35rem .75rem; align-items: center; font-size: .85rem;}
.app .timeline .track {position: relative; height: 12px; background: var(--surface-2);}
.app .timeline .bar {position: absolute; top: 0; bottom: 0; background: var(--primary);}
.app .timeline .axis {display: flex; justify-content: space-between; font-size: .72rem; color: var(--muted);}
.app .heat {display: grid; gap: 1px; font-size: .7rem;}
.app .heat .cell {height: 12px; background: var(--surface-2);}
.app .heat .cell.on {background: var(--primary-2);}
.app .heat .label {white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: .4rem; color: var(--ink-2);}
.app .steps {list-style: none; padding: 0; margin: 0;}
.app .steps li {display: grid; grid-template-columns: 18px 1fr auto; gap: .6rem; align-items: center; padding: .45rem 0; border-bottom: 1px solid var(--line); font-size: .92rem;}
.app .dot {width: 12px; height: 12px; border-radius: 50%; border: 2px solid #a9aeb1;}
.app .dot.running {border-color: var(--primary-2); border-top-color: transparent; animation: spin 1s linear infinite;}
.app .dot.done {background: var(--ok); border-color: var(--ok);}
.app .dot.failed {background: var(--err); border-color: var(--err);}
.app .dot.stopped {background: var(--warn); border-color: var(--warn);}
@keyframes spin { to { transform: rotate(360deg); } }
.app .log {background: #0f1720; color: #d6dde5; font-family: var(--mono); font-size: .78rem; height: 300px; overflow-y: auto; padding: .6rem .75rem; white-space: pre-wrap; border-radius: var(--radius);}
.app .log .error {color: #ff9b8a;}
.app .log .warn {color: #ffd479;}
.app .log .stdout {color: #9fb3c8;}
.app .progress {height: 6px; background: var(--surface-2);}
.app .progress > div {height: 100%; background: var(--primary-2); transition: width .4s;}
.app .emis input {width: 7.5rem; padding: .25rem .4rem; text-align: right;}
.app .posts article {padding: 1rem 0; border-bottom: 1px solid var(--line);}
.app .posts h3 a {color: var(--ink); text-decoration: none;}
.app .prose {max-width: 72ch;}
.app .prose img {margin: 1rem 0;}
@media print { header.site-header, .subnav, .site-footer, .no-print { display: none !important; } .app .page { padding: 0; } }

/* Páginas de apresentação dos sistemas (estilo das páginas originais do site) */
.sys-head { display: flex; gap: 2rem; align-items: center; padding: 2rem 0 1rem; flex-wrap: wrap; }
.sys-head img { width: 220px; max-width: 40%; }
.sys-head .txt { flex: 1; min-width: 260px; font-size: 15px; color: #444; }
.sys-row { display: grid; grid-template-columns: 110px 220px 1fr; gap: 1rem; align-items: center; margin: 0 0 1rem; }
.sys-row img { width: 110px; height: 80px; object-fit: cover; border-radius: 3px; }
.sys-row .go { display: block; text-align: center; background: #444; color: #fff; border-radius: 3px; padding: .45rem .5rem; font-size: 13px; text-decoration: none; }
.sys-row .go:hover { background: #266DD3; color: #fff; text-decoration: none; }
.sys-row .desc { background: #B8C5D6; border-radius: 3px; padding: .7rem 1rem; font-size: 13px; color: #333; }
@media (max-width: 760px) { .sys-row { grid-template-columns: 80px 1fr; } .sys-row .desc { grid-column: 1 / -1; } .sys-row img { width: 80px; height: 60px; } }
.sys-stats { display: flex; gap: 2rem; flex-wrap: wrap; margin: .5rem 0 1.5rem; font-size: 13px; color: #444; }
.sys-stats b { display: block; font-size: 1.5rem; color: #266DD3; }
/* BRAIN — painel de camadas */
.app .layer-sec {border-bottom: 1px solid var(--line); padding: .5rem 0;}
.app .layer-sec > summary {font-weight: 700; font-size: 1.02rem; cursor: pointer; padding: .3rem 0; list-style: none;}
.app .layer-sec > summary::before {content: "▸"; display: inline-block; width: 1.1rem; transition: transform .15s;}
.app .layer-sec[open] > summary::before {transform: rotate(90deg);}
.app .layer-sec h3 {font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: .8rem 0 .2rem;}
.app .indent {margin-left: 1.5rem;}
.app .sw {display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin: 0 .45rem 0 .25rem; flex: none;}
.app .sw.line {border-radius: 0; height: 4px; width: 14px;}
.app .sw.sq {border-radius: 1px;}
.app .sw.dot {border-radius: 50%;}
.app .sw.tri {border-radius: 0; width: 12px; height: 11px; clip-path: polygon(50% 0, 100% 100%, 0 100%);}
.app .muted {color: var(--muted); font-size: .85em; margin-left: .25rem;}
.app .phase-table td, .app .phase-table th {text-align: right;}
.app .phase-table td:first-child, .app .phase-table th:first-child {text-align: left;}
.app .heat-rep {display: grid; gap: 2px; font-size: .72rem;}
.app .heat-rep span {text-align: center; padding: 2px 0;}
.app pre.code {background: #f6f6f6; border: 1px solid var(--line); padding: .6rem; font-size: .78rem; overflow-x: auto; max-height: 320px;}
.app .tool {max-width: 1140px; margin: 0 auto; padding: 1.2rem 15px 3rem;}
.app .tool-grid {display: grid; grid-template-columns: 340px 1fr; gap: 1.5rem;}
@media (max-width: 900px) { .app .tool-grid {grid-template-columns: 1fr;} }
.app .tool .map-sm {height: 380px; border: 1px solid var(--line);}
.app .chart {min-height: 300px;}
.app .grid-2 > div, .app .grid-3 > div {min-width: 0;}
.app .grid-2 input, .app .grid-2 select, .app .grid-3 input, .app .grid-3 select {width: 100%; min-width: 0;}
.app .tool .tabs {margin: 0;}
.app .panel .tabs {flex-wrap: wrap; gap: .2rem .9rem;}
/* EZ-AERMOD — painel de entradas */
.app .dash-grid {display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 1rem;}
@media (max-width: 900px) { .app .dash-grid {grid-template-columns: 1fr;} .app .dash-map-wrap {grid-template-columns: 1fr !important;} }
.app .dash-card {border: 1px solid var(--line); padding: .9rem 1rem; background: var(--surface); min-width: 0;}
.app .dash-card h2 {font-size: 1.05rem; margin: 0 0 .6rem;}
.app .dash-h3 {font-size: .85rem; color: var(--muted); margin: .4rem 0;}
.app .dash-map-wrap {display: grid; grid-template-columns: 1fr 260px; gap: 1rem;}
.app .legend-row {display: flex; align-items: center; gap: .4rem; font-size: .8rem; margin: .15rem 0;}
.app .legend-row i {width: 14px; height: 14px; display: inline-block; border: 1px solid #0002;}
.app .dash-card .chart {min-height: 220px;}
.app .panel .tabs button {font-size: .84rem;}
.app .panel .tabs {gap: .1rem .7rem;}
.app .sc-season {border: 1px solid var(--line); margin: .4rem 0; padding: .2rem .5rem;}
.app .sc-season > summary {cursor: pointer; font-size: .85rem; padding: .25rem 0;}
.app .sc-season > summary::marker {color: var(--primary);}

/* Skew-T (sondagens IGRA2) */
.skewt-grid { display: grid; grid-template-columns: minmax(0, 620px) minmax(240px, 1fr); gap: 1rem; align-items: start; }
.skewt-grid svg { max-width: 100%; height: auto; }
@media (max-width: 760px) { .skewt-grid { grid-template-columns: 1fr; } }
.sector-label { font: 600 11px/14px system-ui, sans-serif; color: #d83933; text-align: center; text-shadow: 0 0 3px #fff, 0 0 3px #fff; }
/* revisão das fontes (aba Executar) */
.rv-form legend { font-size: .9rem; font-weight: 600; }
.rv-form fieldset { margin: .5rem 0; }
details.rv-src { border-bottom: 1px solid var(--line); padding: .3rem 0; }
details.rv-src > summary { cursor: pointer; }
details.review > summary { cursor: pointer; margin: .8rem 0 .4rem; }

.ex-dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; margin-right: .35rem; vertical-align: -1px; flex: none; }
details.rv-src > summary { list-style-position: outside; }
details.rv-src > summary input[type="checkbox"] { width: auto; display: inline-block; margin: 0 .4rem 0 0; vertical-align: -2px; }
.rc-icon { white-space: nowrap; font: 600 11px/22px system-ui, sans-serif; color: #fff; text-shadow: 0 0 3px #000, 0 0 2px #000; }
.rc-icon .rc-dot { font-size: 20px; color: #ff4f9a; margin-right: 2px; vertical-align: middle; }
.rc-icon .rc-dot.linked { color: #00e5ff; }

/* EZ-AERMOD — painel de resultados e cenários */
.rd-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; border-bottom: 3px solid var(--primary, #005ea2); padding-bottom: .8rem; }
.rd-head h1 { font-size: 1.6rem; margin: 0; }
.rd-kicker { text-transform: uppercase; letter-spacing: .08em; font-size: .72rem; color: var(--muted); margin: 0; }
.rd-desc { margin: .5rem 0 0; max-width: 70ch; font-size: .92rem; }
.rd-actions { display: flex; gap: .4rem; flex-wrap: wrap; }
.rd-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .6rem; margin-top: 1rem; }
.rd-kpi { border: 1px solid var(--line); border-left: 4px solid #005ea2; padding: .55rem .75rem; background: var(--surface); }
.rd-kpi b { display: block; font-size: 1.35rem; line-height: 1.2; }
.rd-kpi span { font-size: .78rem; color: var(--muted); }
.rd-kpi.bad { border-left-color: #d83933; } .rd-kpi.good { border-left-color: #00a91c; }
.rd-mapbar { display: flex; flex-wrap: wrap; gap: .4rem .8rem; align-items: center; margin-bottom: .5rem; }
.rd-mapbar label { margin: 0; font-size: .85rem; } .rd-mapbar select { width: auto; max-width: 100%; }
.rd-ramp { height: 12px; border: 1px solid #0002; }
.rd-ramp-l { display: flex; justify-content: space-between; font-size: .75rem; color: var(--muted); }
.rd-bar { position: relative; background: #f0f0f0; height: 16px; min-width: 100px; }
.rd-bar i { position: absolute; left: 0; top: 0; bottom: 0; }
.rd-bar span { position: relative; font-size: .72rem; padding-left: .3rem; }
.rd-stack { display: flex; height: 22px; border: 1px solid var(--line); margin-bottom: .4rem; }
.rd-stack i { display: block; height: 100%; }
.scn-box { border: 1px solid var(--line); border-left: 4px solid #00a91c; padding: .7rem .9rem; margin: 1rem 0; background: var(--surface); }
.scn-box h3 { margin: 0 0 .4rem; font-size: 1rem; }
.run-list li .scn-desc { display: block; font-size: .78rem; color: var(--muted); }
/* editor de fundo por setor */
.bg-ed { border-bottom: 1px solid var(--line); padding: .5rem 0; }
.bg-ed .bg-sect { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .3rem .6rem; margin-top: .3rem; }
.bg-ed .bg-sect label { font-size: .75rem; margin: 0; }
.bg-ed input[type=number] { max-width: 9rem; }
dialog.ez-dialog { border: 1px solid var(--line); padding: 1.2rem 1.4rem; max-width: 92vw; }
dialog.ez-dialog::backdrop { background: #0006; }
dialog.ez-dialog textarea, dialog.ez-dialog input:not([type=checkbox]) { width: 100%; }
.rd-mapbar input[type=range] { width: 140px; }
#emis { max-height: 560px; overflow: auto; padding-right: .3rem; }
/* aba Veicular */
.veh-steps { padding-left: 1.2rem; } .veh-steps > li { margin: .8rem 0 1.1rem; } .veh-steps > li > b { font-size: .98rem; }
.veh-table input { padding: .2rem .3rem; font-size: .82rem; }
.veh-table td, .veh-table th { padding: .25rem .35rem; font-size: .82rem; }
.veh-grid { font-size: .7rem; } .veh-grid th, .veh-grid td { padding: 1px; text-align: center; }
.veh-grid input { width: 3.1rem; padding: 1px 2px; font-size: .7rem; text-align: right; }
.app .map-app.veh-panel {grid-template-columns: minmax(420px, 760px) 1fr;}
@media (max-width: 900px) { .app .map-app.veh-panel {grid-template-columns: 1fr;} }
.res-card { border: 1px solid var(--line); border-left: 4px solid var(--line); padding: .55rem .7rem; margin: .5rem 0; background: var(--surface); }
.res-card.saved { border-left-color: #00a91c; }
dialog.report-dialog { width: min(1200px, 96vw); height: 92vh; padding: .7rem; }
dialog.report-dialog iframe { width: 100%; height: calc(100% - 2.6rem); border: 1px solid var(--line); margin-top: .5rem; background: #fff; }
/* variação temporal das emissões */
.tp-bar { display: flex; flex-wrap: wrap; gap: .4rem .7rem; align-items: center; margin: .3rem 0; }
.tp-bar label { margin: 0; font-size: .85rem; } .tp-bar select { width: auto; max-width: 100%; }
.tp-grid { display: grid; grid-template-columns: 1fr; gap: .4rem; }
#tp-dlg .tp-grid { grid-template-columns: 1.4fr 1fr 1fr; }
@media (max-width: 800px) { #tp-dlg .tp-grid { grid-template-columns: 1fr; } }
.tp-grid textarea { width: 100%; font-size: .75rem; }
.tp-modes { display: flex; flex-wrap: wrap; gap: .3rem 1rem; margin: .3rem 0 .6rem; }
.tp-modes label { margin: 0; font-weight: 400; }
.tp-svg { user-select: none; -webkit-user-select: none; }

/* links de ajuda contextual (guia e tutorial do EZ-AERMOD) */
.help-row{display:flex;flex-wrap:wrap;gap:.4rem;justify-content:flex-end;margin:.2rem 0 .4rem}
a.help-link{display:inline-flex;align-items:center;gap:.25rem;font-size:.78rem;font-weight:600;line-height:1;padding:.28rem .55rem;border-radius:999px;
  border:1px solid #b6c8e3;background:#eef4fc;color:#1a4480;text-decoration:none;vertical-align:middle;white-space:nowrap}
a.help-link:hover{background:#d9e8f6;text-decoration:none}
legend a.help-link,summary a.help-link,h1 a.help-link,label a.help-link{margin-left:.4rem}
/* seletor de idioma */
.lang-switch{display:inline-flex;border:1px solid #c9c9c9;border-radius:999px;overflow:hidden;margin-right:.8rem;font-size:.75rem}
.lang-switch button{border:0;background:#fff;padding:.2rem .55rem;cursor:pointer;color:#555;font-weight:600}
.lang-switch button[aria-pressed="true"]{background:#1a4480;color:#fff}
@media print{.help-row,a.help-link,.lang-switch{display:none!important}}
