/* Paleta da casa (variáveis do site mcminsky.pt, css/styles.css): preto, branco, cinzentos e dourado. */
:root {
  --black: #0a0a0a;
  --black-light: #141414;
  --black-lighter: #1a1a1a;
  --white: #f5f5f5;
  --white-dim: #e0e0e0;
  --gold: #c9a962;
  --gold-light: #d4bc7a;
  --gold-dark: #a88a4a;
  --gray: #666666;
  --gray-dark: #333333;
  --gray-light: #999999;
  --linha: #262626;
  --font-display: 'Cormorant Garamond', 'Times New Roman', serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --g: 16px;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  background: var(--black);
  color: var(--white);
  line-height: 1.45;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  font-variant-numeric: tabular-nums;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
h2 { font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--gray-light); }

.aviso-mock { background: var(--gold); color: var(--black); text-align: center; font-size: 12px; font-weight: 600; padding: 6px var(--g); letter-spacing: .04em; }

/* ---------- topo ---------- */
.topo { border-bottom: 1px solid var(--linha); }
.topo-in { padding: 14px var(--g); max-width: 1600px; margin: 0 auto; }
.marca { display: flex; align-items: center; gap: 12px; min-width: 0; }
.marca-casa { font-family: var(--font-display); font-size: 20px; font-weight: 600; color: var(--gold); letter-spacing: .02em; flex: none; }
.marca-sep { width: 1px; height: 22px; background: var(--gray-dark); flex: none; }
.marca-tit { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
@media (max-width: 599px) { .marca-tit em { display: none; } }
.marca-tit em { font-style: normal; color: var(--gray-light); font-weight: 400; margin-left: 6px; }

/* ---------- grelha ---------- */
.layout { display: flex; flex-direction: column; max-width: 1600px; margin: 0 auto; }
.layout > * { min-width: 0; }

/* ---------- cenários ---------- */
.faixa-cenarios { padding: 14px 0 0; }
.cenarios { display: flex; gap: 8px; overflow-x: auto; padding: 0 var(--g) 4px; scrollbar-width: none; scroll-snap-type: x proximity; }
.cenarios::-webkit-scrollbar { display: none; }
.cenario {
  flex: none; scroll-snap-align: start;
  border: 1px solid var(--gray-dark); border-radius: 999px;
  padding: 8px 14px; font-size: 13px; color: var(--white-dim); white-space: nowrap;
  transition: background .2s, color .2s, border-color .2s;
}
.cenario:hover { border-color: var(--gray); }
.cenario.on { background: var(--white); color: var(--black); border-color: var(--white); font-weight: 500; }
.cenario.personalizado { border-style: dashed; color: var(--gray-light); }
.cenario.personalizado.on { background: transparent; color: var(--white); border-color: var(--gray-light); }
.cenario-resumo {
  display: block; width: 100%; text-align: left; padding: 8px var(--g) 0;
  font-size: 12.5px; color: var(--gray-light); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  min-height: 26px;
}

/* ---------- números grandes ---------- */
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--linha); margin: 14px var(--g) 0; border: 1px solid var(--linha); }
.kpi { background: var(--black); padding: 12px 12px 11px; text-align: left; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.kpi:hover { background: var(--black-light); }
.kpi .k-rot { font-size: 11px; color: var(--gray-light); letter-spacing: .02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .k-val { font-variant-numeric: lining-nums tabular-nums; font-feature-settings: 'lnum' 1, 'tnum' 1; font-family: var(--font-display); font-weight: 600; font-size: 28px; line-height: 1.1; color: var(--white); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .k-val small { font-family: var(--font-body); font-size: 12px; font-weight: 500; color: var(--gray-light); margin-left: 3px; }
.kpi .k-sub { font-size: 11px; color: var(--gray); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi.principal { grid-column: 1 / -1; }
.kpi.principal .k-val { font-size: 40px; color: var(--gold); }
.kpi.principal .k-rot { color: var(--white-dim); }
.kpi .k-val.zero { color: var(--gray); }

/* ---------- rede ---------- */
.painel-rede { margin: 18px 0 0; }
.rede-cabeca { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 var(--g) 8px; }
.rot { font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--gray-light); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.rot-min { font-size: 11px; color: var(--gray); }
.horizonte { display: flex; align-items: center; gap: 2px; flex: none; }
.horizonte button { font-size: 12px; min-width: 30px; height: 26px; border-radius: 4px; color: var(--gray-light); }
.horizonte button.on { background: var(--black-lighter); color: var(--white); box-shadow: inset 0 0 0 1px var(--gray-dark); }
.rede-wrap { position: relative; height: 68vh; min-height: 420px; max-height: 680px; border-top: 1px solid var(--linha); border-bottom: 1px solid var(--linha); background: var(--black); overflow: hidden; }
.rede { position: absolute; inset: 0; }
.rede-wrap .fluxo-overlay { position: absolute; inset: 0; pointer-events: none; }
.rede-vazia { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--gray); font-size: 13px; pointer-events: none; opacity: 0; transition: opacity .3s; text-align: center; padding: var(--g); }
.rede-vazia.on { opacity: 1; }
.legenda { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 10px var(--g) 0; }
.leg { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; color: var(--gray-light); }
.leg i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }

.ampliar { position: absolute; top: 8px; right: 8px; z-index: 3; font-size: 11.5px; letter-spacing: .04em; color: var(--white-dim); background: rgba(10,10,10,.82); border: 1px solid var(--gray-dark); border-radius: 4px; padding: 6px 10px; }
.ampliar:hover { border-color: var(--gray); color: var(--white); }
.ampliar .amp-f { display: none; }
.painel-rede.cheio { position: fixed; inset: 0; z-index: 40; margin: 0; background: var(--black); display: flex; flex-direction: column; padding-top: env(safe-area-inset-top); }
.painel-rede.cheio .rede-cabeca { padding-top: 12px; }
.painel-rede.cheio .rede-wrap { flex: 1; height: auto !important; max-height: none; min-height: 0; margin: 0; border-left: 0; border-right: 0; }
.painel-rede.cheio .legenda { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
.painel-rede.cheio .amp-a { display: none; }
.painel-rede.cheio .amp-f { display: inline; }
body.travado { overflow: hidden; }

/* ---------- controlos ---------- */
.controlos { padding: 6px 0 0; }
.bloco { padding: 22px var(--g) 0; }
.bloco-cabeca { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.ligeiro { font-size: 12px; color: var(--gray-light); padding: 4px 0; text-decoration: underline; text-decoration-color: var(--gray-dark); text-underline-offset: 3px; }
.ligeiro:hover { color: var(--white); }

.grupo { margin-bottom: 18px; }
.grupo-tit { font-size: 12px; color: var(--gold); font-weight: 500; margin-bottom: 4px; letter-spacing: .02em; }
.slider { padding: 9px 0 6px; border-bottom: 1px solid var(--linha); }
.slider-topo { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.slider-rot { font-size: 13.5px; color: var(--white-dim); text-align: left; min-width: 0; }
.slider-rot.com-nota::after { content: 'i'; display: inline-flex; align-items: center; justify-content: center; width: 14px; height: 14px; margin-left: 6px; border-radius: 50%; border: 1px solid var(--gray-dark); font-size: 9px; color: var(--gray-light); font-style: italic; font-family: Georgia, serif; vertical-align: 1px; }
.slider-val { font-size: 14px; font-weight: 600; color: var(--white); white-space: nowrap; }
.slider-val.zero { color: var(--gray); font-weight: 500; }

input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 30px; background: transparent; display: block; touch-action: pan-y; }
input[type=range]::-webkit-slider-runnable-track { height: 2px; background: linear-gradient(to right, var(--white-dim) 0, var(--white-dim) var(--p, 0%), var(--gray-dark) var(--p, 0%)); border-radius: 2px; }
input[type=range]::-moz-range-track { height: 2px; background: var(--gray-dark); }
input[type=range]::-moz-range-progress { height: 2px; background: var(--white-dim); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; margin-top: -9px; border-radius: 50%; background: var(--white); border: 0; box-shadow: 0 0 0 4px var(--black); }
input[type=range]::-moz-range-thumb { width: 20px; height: 20px; border-radius: 50%; background: var(--white); border: 0; }
input[type=range]:focus-visible { outline: none; }
input[type=range]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px var(--black), 0 0 0 5px var(--gold); }

/* ROI */
.alternar { display: inline-flex; border: 1px solid var(--gray-dark); border-radius: 6px; padding: 2px; margin-bottom: 14px; }
.alternar button { font-size: 12px; padding: 6px 12px; border-radius: 4px; color: var(--gray-light); }
.alternar button.on { background: var(--white); color: var(--black); font-weight: 500; }
.roi-linha { display: block; width: 100%; text-align: left; padding: 9px 0 10px; border-bottom: 1px solid var(--linha); }
.roi-linha:hover .roi-rot { color: var(--white); }
.roi-topo { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.roi-rot { font-size: 13.5px; color: var(--white-dim); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.roi-val { font-size: 14px; font-weight: 600; white-space: nowrap; color: var(--gold); }
.roi-barra { height: 6px; background: var(--black-lighter); margin: 7px 0 5px; position: relative; overflow: hidden; border-radius: 1px; }
.roi-barra i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--gold); transition: width .35s ease; }
.roi-barra i.neg { background: var(--gray); }
.roi-sub { display: flex; justify-content: space-between; gap: 10px; font-size: 11.5px; color: var(--gray-light); }
.roi-sub span:last-child { text-align: right; }
.roi-vazio { font-size: 13px; color: var(--gray); padding: 8px 0; }

/* Pressupostos */
.pressupostos summary { list-style: none; display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 4px 0 12px; }
.pressupostos summary::-webkit-details-marker { display: none; }
.pressupostos summary::after { content: ''; width: 8px; height: 8px; border-right: 1.5px solid var(--gray-light); border-bottom: 1.5px solid var(--gray-light); transform: rotate(45deg); margin-left: auto; transition: transform .2s; }
.pressupostos[open] summary::after { transform: rotate(-135deg); }
.contagem { font-size: 11px; color: var(--gray); }
.pp-barra { display: flex; justify-content: flex-end; margin-bottom: 6px; }
.param .slider-topo { align-items: center; }
.etq { display: inline-block; font-size: 9.5px; font-weight: 600; letter-spacing: .08em; padding: 2px 5px; border-radius: 2px; margin-left: 6px; vertical-align: 1px; border: 1px solid var(--gray-dark); color: var(--gray-light); white-space: nowrap; }
.etq.MEDIDO { border-color: var(--white-dim); color: var(--white-dim); }
.etq.LEI { border-color: var(--gold-dark); color: var(--gold); }
.etq.ESTIMATIVA { border-style: dashed; color: var(--gray-light); }
.param.mudado .slider-val { color: var(--gold); }

/* rodapé */
.rodape { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; padding: 28px var(--g) calc(28px + env(safe-area-inset-bottom)); margin-top: 28px; border-top: 1px solid var(--linha); font-size: 11px; color: var(--gray); max-width: 1600px; margin-left: auto; margin-right: auto; }

/* modal */
.modal { border: 0; padding: 0; background: transparent; color: var(--white); max-width: 560px; width: calc(100% - 24px); margin: auto; max-height: calc(100% - 24px); }
.modal::backdrop { background: rgba(0,0,0,.72); }
.modal-in { position: relative; background: var(--black-light); border: 1px solid var(--gray-dark); padding: 22px 20px 20px; border-radius: 6px; }
.fechar { position: absolute; top: 6px; right: 8px; width: 36px; height: 36px; font-size: 24px; line-height: 1; color: var(--gray-light); }
.fechar:hover { color: var(--white); }
.m-tipo { font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--gray-light); margin-bottom: 6px; padding-right: 36px; }
.m-tit { font-family: var(--font-display); font-size: 26px; font-weight: 600; line-height: 1.15; margin-bottom: 12px; padding-right: 30px; }
.m-val { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-bottom: 14px; }
.m-val b { font-size: 20px; font-weight: 600; color: var(--gold); }
.m-val span { font-size: 11px; color: var(--gray-light); display: block; }
.m-formula { font-size: 13.5px; background: var(--black); border-left: 2px solid var(--gold); padding: 10px 12px; margin-bottom: 12px; color: var(--white-dim); line-height: 1.5; overflow-wrap: anywhere; }
.m-texto { font-size: 14px; color: var(--white-dim); line-height: 1.55; margin-bottom: 10px; }
.m-fonte { font-size: 12.5px; color: var(--gray-light); line-height: 1.5; border-top: 1px solid var(--linha); padding-top: 10px; margin-top: 4px; overflow-wrap: anywhere; }
.m-lista { list-style: none; margin: 4px 0 6px; }
.m-lista li { display: flex; justify-content: space-between; gap: 12px; font-size: 13.5px; padding: 7px 0; border-bottom: 1px solid var(--linha); }
.m-lista li span:last-child { white-space: nowrap; font-weight: 600; }
.m-lista li.tot { border-bottom: 0; color: var(--gold); }

/* ---------- desktop ---------- */
@media (min-width: 760px) {
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .kpi.principal .k-val { font-size: 36px; }
}
@media (min-width: 1100px) {
  :root { --g: 28px; }
  .layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 400px;
    grid-template-areas: "cen cen" "kpi kpi" "rede ctl";
    column-gap: 0;
  }
  .faixa-cenarios { grid-area: cen; padding-top: 20px; }
  .kpis { grid-area: kpi; grid-template-columns: 1.4fr repeat(6, 1fr); margin-top: 16px; }
  .kpi { padding: 14px 16px; }
  .kpi.principal { grid-column: auto; }
  .kpi.principal .k-val { font-size: 38px; }
  .kpi .k-val { font-size: 27px; }
  .painel-rede { grid-area: rede; margin-top: 20px; position: sticky; top: 0; align-self: start; }
  .rede-wrap { height: calc(100vh - 110px); max-height: none; min-height: 520px; border: 1px solid var(--linha); margin-left: var(--g); }
  .rede-cabeca { padding-top: 0; }
  .legenda { padding-left: var(--g); }
  .controlos { grid-area: ctl; padding-top: 12px; border-left: 0; }
  .controlos .bloco { padding-left: 24px; padding-right: var(--g); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
.fechar:focus:not(:focus-visible) { outline: none; }
