/* =====================================================================
   Quadrados de medidas (PainelQuadros): grelha, aspeto dos quadrados, modo de edição, gaveta «+ Medida»,
   quadrados da página inicial e lista de produções. Carregado depois de app.css.
   Motor: wwwroot/js/layout-quadros.js (order, --c e --r em cada .pq-card).
   ===================================================================== */

/* ---------- cores (claro / escuro). As cores dos estados seguem as escolhidas em Definições (--gq-*) ---------- */
:root {
    --t-bg1: #ffffff; --t-bg2: #f4f6fa; --t-bd: #dde2ea; --t-tx: #1a2230; --t-mut: #667385;
    --t-az: #2f6fe0; --t-ok: #1a9d55; --t-am: #c98408; --t-er: #d64545;
    --t-fraco: #0000000a; --t-soft: #00000010; --t-forte: #0000001c; --t-sombra: 0 6px 18px #1a22301f;
    --e-pend: var(--gq-laranja, #e0a52a); --e-cli: var(--gq-azul, #2f6fed); --e-dia: var(--gq-rosa, #e0568e);
    --e-prod: var(--gq-verde, #1f9d55); --e-gt: var(--gq-roxo, #8b5cf6); --e-cast: var(--gq-castanho, #a97142);
}
html[data-tema="escuro"] {
    --t-bg1: #3a3d43; --t-bg2: #32353a; --t-bd: #4b4f56; --t-tx: #eceef1; --t-mut: #a9b0ba;
    --t-az: #6c97f2; --t-ok: #3fbf79; --t-am: #f2b24a; --t-er: #f0776a;
    --t-fraco: #ffffff0d; --t-soft: #ffffff14; --t-forte: #ffffff24; --t-sombra: 0 6px 20px #0007;
    --e-pend: var(--gq-laranja, #f2b24a); --e-cli: var(--gq-azul, #6c97f2); --e-dia: var(--gq-rosa, #ea7aa8);
    --e-prod: var(--gq-verde, #3fbf79); --e-gt: var(--gq-roxo, #a587f7); --e-cast: var(--gq-castanho, #c99265);
}

/* ---------- grelha ---------- */
.pq { position: relative; }
.pq:not(.pq-pronto) { visibility: hidden; }
.pq-ajustar, .pq-fluido { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); grid-auto-flow: dense; }
/* ajustar: 12 × N linhas que ocupam exatamente a altura disponível; os quadrados escondem pormenores em vez de crescer */
.pq-ajustar { height: 100%; min-height: 0; gap: 10px; grid-template-rows: repeat(var(--linhas, 8), minmax(0, 1fr)); grid-auto-rows: minmax(0, 1fr); }
/* fluido: linhas de 20 px; a altura de cada quadrado vem do conteúdo */
.pq-fluido { grid-auto-rows: 20px; column-gap: 12px; row-gap: 0; }
.pq-medir .pq-card { align-self: start !important; grid-row: auto !important; }

.pq-card {
    grid-column: span var(--c, 6); grid-row: span var(--r, 1);
    min-width: 0; min-height: 0; position: relative; display: flex; flex-direction: column;
    background: linear-gradient(180deg, var(--t-bg1), var(--t-bg2)); border: 1px solid var(--t-bd); border-radius: 14px;
    padding: 8px 12px; color: var(--t-tx); box-shadow: inset 0 1px 0 #ffffff0c;
    transition: border-color 0.2s, box-shadow 0.2s;
    animation: pq-entrar 0.55s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.pq-card:hover { border-color: color-mix(in srgb, var(--t-az) 45%, var(--t-bd)); box-shadow: var(--t-sombra); }
.pq-ajustar > .pq-card { overflow: hidden; container-type: size; }
.pq-fluido > .pq-card { margin-bottom: 12px; container-type: inline-size; }
.pq-fluido > .pq-card:not([data-fixo="1"]) { padding: 10px 14px; }
.pq-corpo { flex: 1; min-height: 0; min-width: 0; display: flex; }
.pq-in { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.pq-fluido > .pq-card[data-rolar="1"] .pq-corpo { overflow: auto; }
.pq-fluido > .pq-card[data-rolar="1"] .pq-in { min-height: min-content; }
.pq-fora { display: none !important; }
.pq-sai { animation: pq-sair 0.26s forwards; }
.pq-pop { animation: pq-pop 0.6s; }
.pq-arrastando { opacity: 0.4; }
@keyframes pq-entrar { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes pq-sair { to { opacity: 0; transform: scale(0.92); } }
@keyframes pq-pop { 0% { box-shadow: 0 0 0 0 var(--t-az); } 100% { box-shadow: 0 0 0 14px transparent; } }

/* o conteúdo antigo dos quadrados (caixas e pastilhas das páginas) passa a ser só conteúdo do quadrado */
.pq-card .rel-caixa, .pq-card .qp-caixa { background: none; border: 0; border-radius: 0; padding: 0; margin: 0; box-shadow: none; flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pq-card .rel-caixa h3, .pq-card .qp-cab h3 { margin: 0 0 6px; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--t-mut); font-weight: 700; }
.pq-card .nc-pill, .pq-card .prod-kpi {
    background: none; border: 0; border-radius: 0; padding: 0; margin: 0; flex: 1; min-width: 0;
    display: flex; flex-direction: column-reverse; justify-content: center; gap: 2px;
    font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--t-mut); font-weight: 700;
}
.pq-card .prod-kpi { flex-direction: column; }
.pq-card .nc-pill b, .pq-card .prod-kpi b { display: block; font-size: 27px; line-height: 1.1; color: var(--t-tx); font-weight: 600; text-transform: none; letter-spacing: 0; font-variant-numeric: tabular-nums; }
.pq-card .nc-pill-euro b { color: var(--t-ok); }

/* ---------- modo de edição ---------- */
.pq-ed { display: none; }
.pq-edit > .pq-card:not([data-fixo="1"]) { outline: 1.5px dashed var(--t-az); outline-offset: -4px; cursor: grab; }
.pq-edit > .pq-card:not([data-fixo="1"]) .pq-ed {
    display: flex; position: absolute; inset: 0; z-index: 5; flex-wrap: wrap; align-content: center; align-items: center; justify-content: center; gap: 5px 6px; padding: 6px;
    background: color-mix(in srgb, var(--t-bg1) 70%, transparent); backdrop-filter: blur(2.5px); border-radius: 14px;
}
.pq-ed::before { content: attr(data-titulo); flex-basis: 100%; text-align: center; font-size: 11px; font-weight: 700; color: var(--t-tx); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pq-ed .grp { display: inline-flex; gap: 3px; background: var(--t-bg1); border: 1px solid var(--t-bd); border-radius: 8px; padding: 2px; }
.pq-ed button { background: transparent; border: 0; border-radius: 6px; font: inherit; font-size: 11px; padding: 3px 8px; min-width: 26px; color: var(--t-tx); cursor: pointer; }
.pq-ed button:hover { background: var(--t-az); color: #fff; }
.pq-ed button.x { color: var(--t-er); }
.pq-ed button.x:hover { background: var(--t-er); color: #fff; }
.pq-ed button.on { background: var(--t-az); color: #fff; }
.pq-edit > .pq-card[data-fixo="1"] { outline: 1.5px solid var(--t-forte); outline-offset: -4px; }
.pq-edit > .pq-card.pq-arrastando { outline-color: var(--t-am); }

/* ---------- barra de botões (páginas que a usam) e aviso ---------- */
.pq-barra { display: flex; align-items: center; gap: 0.5rem; margin: 0 0 0.6rem; flex-wrap: wrap; }
.pq-btn { background: var(--t-bg1); border: 1px solid var(--t-bd); color: var(--t-tx); padding: 0.3rem 0.75rem; border-radius: 9px; font: inherit; font-size: 0.75rem; cursor: pointer; white-space: nowrap; }
.pq-btn:hover { border-color: var(--t-az); }
.pq-btn.on, .pq-btn.pq-novo { background: var(--t-az); border-color: var(--t-az); color: #fff; }
.pq-dica { font-size: 0.7rem; color: var(--t-mut); }
.pq-aviso { flex: none; background: color-mix(in srgb, var(--t-az) 16%, var(--t-bg1)); border: 1px solid var(--t-az); border-radius: 10px; padding: 6px 12px; margin-bottom: 8px; font-size: 12.5px; animation: pq-entrar 0.3s both; }

/* ---------- gaveta «+ Medida» ---------- */
.pq-gaveta {
    position: fixed; top: 0; right: 0; bottom: 0; width: min(390px, 94vw); z-index: 60; display: flex; flex-direction: column;
    background: var(--t-bg1); color: var(--t-tx); border-left: 1px solid var(--t-bd); box-shadow: var(--t-sombra);
    transform: translateX(105%); transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1); visibility: hidden;
}
.pq-gaveta.on { transform: none; visibility: visible; }
.pq-gaveta header { padding: 12px 14px; border-bottom: 1px solid var(--t-bd); display: flex; justify-content: space-between; align-items: center; }
.pq-gaveta h2 { margin: 0; font-size: 15px; }
.gv-corpo { overflow: auto; padding: 8px 14px 24px; flex: 1; }
.gv-adv { margin-top: 8px; }
.gv-ajuda { font-size: 11.5px; color: var(--t-mut); margin: 8px 0 4px; }
.gv-q { width: 100%; box-sizing: border-box; background: var(--t-bg2); border: 1px solid var(--t-bd); border-radius: 8px; padding: 7px 10px; color: var(--t-tx); margin: 6px 0 8px; font: inherit; }
.gv-g { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--t-mut); margin: 12px 0 4px; font-weight: 700; }
.gv-erro { color: var(--t-er); font-size: 12px; }
.gv-ok { color: var(--t-ok); font-size: 12px; font-weight: 600; }
.pq-gaveta .med { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; border: 1px solid transparent; }
.pq-gaveta .med:hover { background: var(--t-fraco); border-color: var(--t-bd); }
.pq-gaveta .med > div { flex: 1; min-width: 0; }
.pq-gaveta .med b { display: block; font-size: 12.5px; }
.pq-gaveta .med small { font-size: 10.5px; color: var(--t-mut); }
.pq-gaveta .fmt { display: flex; gap: 3px; flex-wrap: wrap; justify-content: flex-end; max-width: 55%; }
.pq-gaveta .fmt button { background: var(--t-bg2); color: var(--t-tx); border: 1px solid var(--t-bd); border-radius: 6px; padding: 2px 7px; font: inherit; font-size: 10.5px; cursor: pointer; }
.pq-gaveta .fmt button:hover:not(:disabled) { background: var(--t-az); border-color: var(--t-az); color: #fff; }

/* ---------- peças comuns dos quadrados ---------- */
.pq-t { font-variant-numeric: tabular-nums; }
.pq-t header, .pq-card .qp-cab { display: flex; align-items: center; gap: 8px; justify-content: space-between; min-height: 20px; flex: none; }
.pq-t h3, .pq-t .t-tit { margin: 0; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--t-mut); font-weight: 700; display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pq-t h3 .pulso, .pq-t .t-tit .pulso { margin-right: 6px; vertical-align: 0; }
.pq-t header > :not(h3), .t-cab > :not(.t-tit) { flex: none; }
.pq-t small, .pq-card .qp-selo { color: var(--t-mut); }
.pq-card .qp-selo { font-size: 10px; font-weight: 500; background: var(--t-soft); border-radius: 99px; padding: 0 8px; white-space: nowrap; }
.pq-card .qp-cab h3 { margin: 0; display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.num { font-variant-numeric: tabular-nums; }
.linha-num { display: flex; align-items: center; gap: 7px; min-height: 0; min-width: 0; flex: none; }
.linha-num .num { font-size: 27px; line-height: 1.1; font-weight: 600; }
.linha-num small { font-size: 11px; line-height: 1.15; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.linha-num .spark { flex: 1 1 0; min-width: 0; height: 30px; margin: 0 0 0 auto; }
.delta { font-size: 10.5px; font-weight: 700; border-radius: 99px; padding: 1px 8px; background: var(--t-soft); color: var(--t-mut); white-space: nowrap; }
.delta.bom { background: color-mix(in srgb, var(--t-ok) 18%, transparent); color: var(--t-ok); }
.delta.mau { background: color-mix(in srgb, var(--t-er) 18%, transparent); color: var(--t-er); }
.nota { font-size: 11px; color: var(--t-mut); margin-top: auto; padding-top: 3px; flex: none; }
.nota b { color: var(--t-tx); }
.gargalo { color: var(--t-am); }
.t-vazio, .qp-vazio { font-size: 12px; color: var(--t-mut); margin: 6px 0 0; }
.pulso { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--t-er); animation: pq-pulsar 1.6s infinite; --pc: var(--t-er); }
.pip { display: inline-block; width: 8px; height: 8px; border-radius: 3px; background: var(--t-az); flex: none; }
.pip.conet { background: var(--e-dia); }
.pip.fibra { background: var(--t-az); }
.leg-mini { font-size: 10.5px; color: var(--t-mut); display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.t-btn { display: flex; flex-direction: column; gap: 3px; flex: 1; min-height: 0; min-width: 0; width: 100%; text-align: left; font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: default; }
button.t-btn { cursor: pointer; }
.t-cab { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 18px; flex: none; }
.peq .linha-num { flex: 1; }
.peq .t-btn { justify-content: space-between; }
.pq-card:has([data-alerta="1"]) { border-color: color-mix(in srgb, var(--t-er) 40%, var(--t-bd)); background: linear-gradient(180deg, color-mix(in srgb, var(--t-er) 11%, var(--t-bg1)), var(--t-bg2)); }
[data-alerta="1"] .num { color: var(--t-er); }
.chip-er, .chip-ok { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 11px; border-radius: 99px; padding: 2px 10px; white-space: nowrap; border: 0; font-family: inherit; }
.chip-er { background: color-mix(in srgb, var(--t-er) 16%, transparent); color: var(--t-er); cursor: pointer; }
.chip-ok { background: color-mix(in srgb, var(--t-ok) 16%, transparent); color: var(--t-ok); }
.seg { display: inline-flex; border: 1px solid var(--t-bd); border-radius: 8px; overflow: hidden; }
.seg button { background: transparent; border: 0; padding: 3px 9px; font: inherit; font-size: 11px; color: var(--t-mut); cursor: pointer; }
.seg button.on { background: var(--t-az); color: #fff; }

/* gráficos com movimento */
.spark { display: block; width: 100%; height: 24px; }
.spark .linha, .grafico .linha { stroke-dasharray: 1; stroke-dashoffset: 1; animation: pq-desenhar 1.4s 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards; }
.grafico .linha.tracejada { stroke-dasharray: 3 3; stroke-dashoffset: 0; animation: pq-aparecer 1s 0.9s both; }
.spark .area, .grafico .area { animation: pq-aparecer 1s 1.1s both; }
.grafico { display: block; width: 100%; height: 100%; }
.graf-w { position: relative; flex: 1; min-height: 20px; padding: 0 5px; box-sizing: border-box; }
.pontos-sem { position: absolute; top: 0; bottom: 0; left: 5px; right: 5px; pointer-events: none; }
.pontos-sem .ps { position: absolute; width: 8px; height: 8px; margin: 0 0 -4px -4px; border-radius: 50%; background: var(--e-cast); pointer-events: auto; cursor: pointer; animation: pq-aparecer 0.3s calc(0.5s + var(--k) * 0.15s) both; }
.pontos-sem .ps:hover { transform: scale(1.5); }
.eixo { display: flex; justify-content: space-between; font-size: 9.5px; color: var(--t-mut); margin-top: 1px; flex: none; }
.medidor-w { position: relative; height: 100%; max-height: 44px; width: 92px; margin-left: auto; flex: none; }
.medidor { width: 100%; height: 100%; display: block; }
.arco { animation: pq-arco 1.3s 0.4s cubic-bezier(0.4, 0, 0.2, 1) both; }
.anel-n { font-size: 10.5px; font-weight: 700; fill: var(--t-tx); font-variant-numeric: tabular-nums; }
.anel-t { font-size: 3.7px; fill: var(--t-mut); }
.an-seg { animation: pq-anel 1.1s calc(0.3s + var(--k) * 0.15s) cubic-bezier(0.4, 0, 0.2, 1) both; }
.empil { display: flex; height: 12px; border-radius: 99px; overflow: hidden; gap: 2px; margin: 4px 0; background: var(--t-bd); flex: none; }
.empil > i, .empil > button { flex: var(--w) 1 0; min-width: 3px; border: 0; padding: 0; transform-origin: left; animation: pq-crescer-x 0.9s calc(0.3s + var(--k) * 0.12s) cubic-bezier(0.2, 0.8, 0.2, 1) both; transition: flex 0.6s; cursor: pointer; }
.empil > i { cursor: default; }
.empil.fino { height: 8px; margin: 3px 0 0; }
.colunas { display: flex; align-items: flex-end; gap: 7px; margin-top: 4px; flex: 1; min-height: 0; }
.col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; position: relative; min-width: 0; background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: default; }
button.col { cursor: pointer; }
.col i { display: block; width: 100%; border-radius: 6px 6px 2px 2px; height: calc((100% - 32px) * var(--hn)); min-height: 2px; transform-origin: bottom; animation: pq-crescer 0.9s calc(0.35s + var(--k) * 0.08s) cubic-bezier(0.2, 0.8, 0.2, 1) both; transition: filter 0.2s, height 0.6s; }
.sinrot .col i { height: calc((100% - 16px) * var(--hn)); }
.col:hover i { filter: brightness(1.2); }
.col em { font-style: normal; font-size: 10.5px; font-weight: 700; margin-bottom: 2px; animation: pq-aparecer 0.4s calc(0.9s + var(--k, 0) * 0.08s) both; height: 14px; line-height: 14px; }
.col span { font-size: 10px; color: var(--t-mut); margin-top: 3px; height: 13px; white-space: nowrap; }
.col.dest i { box-shadow: 0 0 0 2px #ffffff55, 0 0 14px color-mix(in srgb, var(--t-az) 45%, transparent); }
.col.dest span { color: var(--t-tx); font-weight: 700; }
.mini-colunas { flex: 1; align-self: stretch; min-width: 60px; display: flex; }
.mini-colunas .colunas { margin: 0; gap: 4px; width: 100%; }
.mini-colunas .col em { font-size: 9px; height: 11px; line-height: 11px; }
.mini-colunas .sinrot .col i { height: calc((100% - 13px) * var(--hn)); }
@keyframes pq-crescer { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes pq-crescer-x { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes pq-desenhar { to { stroke-dashoffset: 0; } }
@keyframes pq-aparecer { from { opacity: 0; } to { opacity: 1; } }
@keyframes pq-anel { from { stroke-dasharray: 0 100; } to { stroke-dasharray: var(--d) 100; } }
@keyframes pq-arco { from { stroke-dasharray: 0 100; } to { stroke-dasharray: var(--v) 100; } }
@keyframes pq-pulsar { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--pc, var(--t-er)) 70%, transparent); } 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
@keyframes pq-respirar { 0%, 100% { opacity: 0.5; } 50% { opacity: 1; } }
@keyframes pq-flash { 0% { background: var(--t-forte); } 100% { background: transparent; } }

/* ---------- página inicial: Em curso agora ---------- */
.hero { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex: 1; min-height: 0; }
.grande { display: flex; align-items: baseline; gap: 7px; }
.grande .num { font-size: 46px; line-height: 1; letter-spacing: -0.02em; font-weight: 600; }
.mini3 { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 4px; color: var(--t-mut); font-size: 11.5px; }
.mini3 b { color: var(--t-tx); font-size: 13px; }
.hero-r { position: relative; width: 84px; height: 84px; flex: none; }
.hero-r .anel { width: 100%; height: 100%; display: block; }
.leg5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; flex: none; }
.leg-i { display: flex; gap: 6px; cursor: pointer; border-radius: 6px; padding: 1px 3px; min-width: 0; text-align: left; font: inherit; color: inherit; background: none; border: 0; }
.leg-i:hover { background: var(--t-soft); }
.leg-i > i { width: 4px; border-radius: 3px; background: var(--c); flex: none; }
.leg-i .ln { display: block; font-size: 10px; color: var(--t-mut); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.leg-i .lv { display: flex; align-items: baseline; gap: 4px; }
.leg-i { flex-wrap: wrap; align-content: flex-start; }
.leg-i .ln, .leg-i .lv { flex-basis: calc(100% - 10px); }
.leg-i b { font-size: 16px; line-height: 1.15; }
.leg-i small { font-size: 9.5px; }

/* paradas */
.pbs { display: flex; flex-direction: column; justify-content: space-around; gap: 3px; margin-top: 4px; flex: 1; min-height: 0; }
.pb { display: grid; grid-template-columns: minmax(80px, 112px) 1fr 24px; align-items: center; gap: 8px; font: inherit; font-size: 12px; color: inherit; border: 0; background: none; text-align: left; border-radius: 7px; padding: 0 4px; cursor: pointer; transition: background 0.15s; flex: 1; max-height: 26px; min-height: 14px; }
.pb:hover { background: var(--t-soft); }
.pn { display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; }
.trilho { height: min(11px, 60%); background: var(--t-soft); border-radius: 99px; overflow: hidden; }
.trilho i { display: block; height: 100%; width: var(--w); border-radius: 99px; transform-origin: left; background: linear-gradient(90deg, #3f6fe0, #6aa2ff); animation: pq-crescer-x 0.9s calc(0.35s + var(--k) * 0.07s) cubic-bezier(0.2, 0.8, 0.2, 1) both; transition: width 0.6s; }
.pb b { text-align: right; font-size: 13px; }
.pb.quente .trilho i { background: linear-gradient(90deg, #e0752b, #ff5d5d); }
.pb.quente b { color: var(--t-er); }

/* notícias */
.nw { display: flex; flex-direction: column; flex: 1; min-height: 0; position: relative; padding-bottom: 6px; }
.nw header h3 { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.nw .pontos { display: flex; gap: 4px; flex: 1; justify-content: center; min-width: 0; overflow: hidden; }
.nw .pontos i { flex: none; }
.pontos i { width: 6px; height: 6px; border-radius: 50%; background: var(--t-bd); transition: 0.3s; cursor: pointer; }
.pontos i.on { background: var(--t-az); width: 16px; border-radius: 99px; }
.nw-ctl-w { display: inline-flex; gap: 2px; }
.nw-ctl { background: none; border: 0; color: var(--t-mut); font-size: 14px; line-height: 1; padding: 0 5px; cursor: pointer; border-radius: 5px; }
.nw-ctl:hover { background: var(--t-soft); color: var(--t-tx); }
.noticias { position: relative; flex: 1; min-height: 0; margin-top: 6px; display: flex; }
.nt { display: flex; gap: 12px; align-items: center; min-width: 0; flex: 1; animation: pq-nt 0.5s both; }
@keyframes pq-nt { from { opacity: 0; transform: translateX(18px); } to { opacity: 1; transform: none; } }
.nt-img { width: min(120px, 36%); height: 100%; max-height: 130px; object-fit: cover; border-radius: 10px; flex: none; box-shadow: 0 4px 14px #0004; background: var(--t-soft); }
.nt-arte { display: grid; place-items: center; font-size: 34px; }
.nt-arte.g0 { background: linear-gradient(135deg, #2b5876, #4e4376); } .nt-arte.g1 { background: linear-gradient(135deg, #134e5e, #71b280); }
.nt-arte.g2 { background: linear-gradient(135deg, #614385, #516395); } .nt-arte.g3 { background: linear-gradient(135deg, #7b4397, #dc2430); }
.nt-arte.g4 { background: linear-gradient(135deg, #1f4037, #99f2c8); } .nt-arte.g5 { background: linear-gradient(135deg, #373b44, #4286f4); }
.nt-txt { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.nt-txt b { font-size: 14px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.nt-txt small { font-size: 11px; }
.nt-r { display: none; margin: 0; font-size: 12px; color: var(--t-mut); line-height: 1.35; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.fonte { font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--t-az); font-weight: 700; }
.nw-lista { flex: 1; min-height: 0; overflow: hidden; display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.nt.compacto { gap: 8px; animation: none; flex: none; }
.nt.compacto .nt-img { width: 44px; height: 44px; max-height: none; border-radius: 8px; font-size: 20px; }
.nt.compacto .nt-txt b { font-size: 12px; -webkit-line-clamp: 2; }
.nw-rodape { display: flex; justify-content: space-between; font-size: 10px; color: var(--t-mut); flex: none; padding-top: 2px; }
.prog { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; border-radius: 3px; overflow: hidden; }
.prog i { display: block; height: 100%; width: 0; background: var(--t-az); animation: pq-prog linear forwards; }
.prog i.pausa { animation-play-state: paused; }
@keyframes pq-prog { from { width: 0; } to { width: 100%; } }

/* ---------- tiles baixos / estreitos: escondem pormenores em vez de crescer (a página nunca tem scroll) ---------- */
@container (max-height: 112px) { .nota { display: none; } .linha-num .num { font-size: 24px; } .pq-t header { min-height: 16px; } .nw-rodape { display: none; } }
@container (max-height: 92px) { .linha-num .num { font-size: 21px; } .pq-t h3, .pq-t .t-tit { font-size: 9.5px; } .empil.fino { display: none; } .leg-i small { display: none; } }
@container (max-height: 210px) { .leg-i small { display: none; } .hero-r { width: 70px; height: 70px; } .grande .num { font-size: 38px; } .mini3 { margin-top: 2px; } .nw-rodape { display: none; } }
@container (max-height: 160px) { .eixo { display: none; } }
@container (max-height: 150px) { .hero-r { display: none; } .leg-i b { font-size: 14px; } .grande .num { font-size: 34px; } .nt-img { display: none; } }
@container (min-height: 240px) { .nt-r { display: -webkit-box; } }
@container (max-width: 300px) { .mx, .linha-num small { display: none; } .delta { padding: 0 6px; } .medidor-w { width: 64px; } .chip-er .ct { display: none; } }
@container (max-width: 215px) { .dt { display: none; } .t-cab .delta { display: none; } }
@container (max-width: 150px) { .linha-num .delta, .medidor-w { display: none; } }
@container (max-height: 140px) { .mini3 { display: none; } }
@container (max-height: 132px) { .empil:not(.fino) { display: none; } }
@container (max-width: 380px) { .leg-mini { display: none; } .leg5 { grid-template-columns: repeat(3, 1fr); } .nw .pontos { display: none; } }

/* ---------- medidas criadas pelo admin (formatos) ---------- */
.qp-caixa { --qp-cor: #5b8def; min-height: 0; }
.pq-card .qp-caixa > * { min-height: 0; }
.qp-num { font: 600 2rem "IBM Plex Mono", monospace; line-height: 1.1; flex: 1; display: flex; align-items: center; }
.qp-num small { font-size: 0.75rem; color: var(--t-mut); font-weight: 400; margin-left: 6px; }
.qp-medidor { display: flex; align-items: center; gap: 8px; flex: 1; min-height: 0; }
.qp-medidor .num { font: 600 1.9rem "IBM Plex Mono", monospace; }
.qp-medidor svg { flex: 1; min-width: 0; max-height: 52px; margin-left: auto; }
.qp-barras { display: flex; flex-direction: column; justify-content: space-around; gap: 4px; flex: 1; min-height: 0; overflow: hidden; }
.qp-barra { display: grid; grid-template-columns: minmax(70px, 38%) 1fr 3.4rem; gap: 6px; align-items: center; font-size: 0.72rem; }
.qp-barra .qp-rot { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qp-trilho { height: 10px; background: var(--t-soft); border-radius: 99px; overflow: hidden; }
.qp-trilho i { display: block; height: 100%; width: var(--w); border-radius: 99px; transform-origin: left; animation: pq-crescer-x 0.9s calc(0.2s + var(--k) * 0.07s) cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.qp-barra b { text-align: right; font-size: 0.75rem; }
.qp-colunas { display: flex; align-items: flex-end; gap: 6px; flex: 1; min-height: 60px; }
.qp-colunas .col span { overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.qp-linha { width: 100%; height: 100%; flex: 1; min-height: 60px; }
.qp-linha .linha { stroke-dasharray: 1; stroke-dashoffset: 1; animation: pq-desenhar 1.4s 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards; }
.qp-linha .area { animation: pq-aparecer 1s 1s both; }
.qp-linha .pt { animation: pq-aparecer 0.3s calc(0.4s + var(--k) * 0.08s) both; }
.qp-eixo { fill: var(--t-mut); font-size: 9px; }
.qp-donut-caixa { display: flex; gap: 12px; align-items: center; flex: 1; min-height: 0; }
.qp-anel { height: 100%; max-height: 120px; aspect-ratio: 1; flex: none; }
.qp-anel .anel-n { font-size: 9px; }
.qp-legenda { font-size: 0.72rem; min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; overflow: hidden; }
.qp-legenda > div { display: flex; align-items: center; gap: 6px; min-width: 0; }
.qp-legenda i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.qp-legenda span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.qp-tabela { font-size: 0.74rem; }
.pq-ajustar .qp-tabela { font-size: 0.7rem; }


/* caixas interiores antigas: o quadrado é que é a caixa */
.pq-card .nc-filtros, .pq-card .nc-legenda { background: none; border: 0; padding: 0; margin: 0; border-radius: 0; }
.pq-card .nc-tabela { background: none; border: 0; border-radius: 0; }

/* ---------- gráficos que já existiam nas páginas: mesmo aspeto e movimento ---------- */
.pq-card .rel-barras { border-bottom-color: var(--t-bd); height: auto; min-height: 140px; flex: 1; }
.pq-card .rel-barras > div { background: linear-gradient(180deg, #6aa2ff, #3f6fe0); border-radius: 6px 6px 2px 2px; transform-origin: bottom; animation: pq-crescer 0.9s 0.2s cubic-bezier(0.2, 0.8, 0.2, 1) both; transition: height 0.6s, filter 0.2s; }
.pq-card .rel-barras > div:hover { filter: brightness(1.2); }
.pq-card .prod-barras > div { background: linear-gradient(180deg, #7bb2ff, #3b82d6); }
.pq-card .rel-barras div span, .pq-card .rel-eixo { color: var(--t-mut); }
.pq-card .rel-barras > div:nth-child(1) { animation-delay: 0.24s; }
.pq-card .rel-barras > div:nth-child(2) { animation-delay: 0.28s; }
.pq-card .rel-barras > div:nth-child(3) { animation-delay: 0.32s; }
.pq-card .rel-barras > div:nth-child(4) { animation-delay: 0.36s; }
.pq-card .rel-barras > div:nth-child(5) { animation-delay: 0.40s; }
.pq-card .rel-barras > div:nth-child(6) { animation-delay: 0.44s; }
.pq-card .rel-barras > div:nth-child(7) { animation-delay: 0.48s; }
.pq-card .rel-barras > div:nth-child(8) { animation-delay: 0.52s; }
.pq-card .rel-barras > div:nth-child(9) { animation-delay: 0.56s; }
.pq-card .rel-barras > div:nth-child(10) { animation-delay: 0.60s; }
.pq-card .rel-barras > div:nth-child(11) { animation-delay: 0.64s; }
.pq-card .rel-barras > div:nth-child(12) { animation-delay: 0.68s; }
.pq-card .rel-barras > div:nth-child(13) { animation-delay: 0.72s; }
.pq-card .rel-barras > div:nth-child(14) { animation-delay: 0.76s; }
.pq-card .rel-barras > div:nth-child(15) { animation-delay: 0.80s; }
.pq-card .rel-barras > div:nth-child(16) { animation-delay: 0.84s; }
.pq-card .rel-barras > div:nth-child(17) { animation-delay: 0.88s; }
.pq-card .rel-barras > div:nth-child(18) { animation-delay: 0.92s; }
.pq-card .rel-barras > div:nth-child(19) { animation-delay: 0.96s; }
.pq-card .rel-barras > div:nth-child(20) { animation-delay: 1.00s; }
.pq-card .rel-barras > div:nth-child(21) { animation-delay: 1.04s; }
.pq-card .rel-barras > div:nth-child(22) { animation-delay: 1.08s; }
.pq-card .rel-barras > div:nth-child(23) { animation-delay: 1.12s; }
.pq-card .rel-barras > div:nth-child(24) { animation-delay: 1.16s; }
.pq-card .rel-barras > div:nth-child(25) { animation-delay: 1.20s; }
.pq-card .rel-barras > div:nth-child(26) { animation-delay: 1.24s; }
.pq-card .rel-barras > div:nth-child(27) { animation-delay: 1.28s; }
.pq-card .rel-barras > div:nth-child(28) { animation-delay: 1.32s; }
.pq-card .rel-barras > div:nth-child(29) { animation-delay: 1.36s; }
.pq-card .rel-barras > div:nth-child(30) { animation-delay: 1.40s; }
.pq-card .nc-graf-trilho { background: var(--t-soft); border-radius: 99px; height: 14px; }
.pq-card .nc-graf-barra { border-radius: 99px; overflow: hidden; transform-origin: left; animation: pq-crescer-x 0.9s 0.2s cubic-bezier(0.2, 0.8, 0.2, 1) both; transition: width 0.6s; }
.pq-card .rel-tabela th { color: var(--t-mut); }
.pq-card .rel-tabela td { border-bottom-color: var(--t-bd); }
.pq-card .rel-tabela tbody tr { transition: background 0.15s; }
.pq-card .rel-tabela tbody tr:hover { background: var(--t-fraco); }
.pq-card .rel-nota { color: var(--t-mut); }

/* ---------- cabeçalho da página inicial ---------- */
.dash-cab-linha { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: clamp(4px, 1vh, 10px); }
.dash-cab-linha h1 { margin: 0; flex: 1; min-width: 200px; }
.dash-cab-linha h1 small { font-weight: 400; font-size: 12px; margin-left: 6px; color: var(--t-mut); }
.vivo { display: inline-flex; align-items: center; gap: 6px; color: var(--t-mut); font-size: 12px; }
.vivo i { width: 8px; height: 8px; border-radius: 50%; background: var(--t-ok); animation: pq-pulsar 1.8s infinite; --pc: var(--t-ok); }
.vivo.off i { background: var(--t-mut); animation: none; }
.dash-cab-linha .dash-acoes { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.dash-corpo { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.dash-corpo > .pq { flex: 1; min-height: 0; }

/* ---------- lista de produções (quadrado fixo da página inicial) ---------- */
.pq-lista { padding: 8px 12px 6px; }
.pq-lista .dash-lista { background: none; box-shadow: none; border-radius: 0; padding: 0; height: 100%; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.ls-cab { display: flex; align-items: center; gap: 8px; justify-content: space-between; flex-wrap: wrap; flex: none; margin-bottom: 4px; }
.ls-cab h2 { margin: 0; font-size: 12px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--t-mut); font-weight: 700; }
.filtros { display: flex; gap: 5px; flex-wrap: wrap; }
.filtros button { background: transparent; border: 1px solid var(--t-bd); border-radius: 99px; padding: 2px 10px; font: inherit; font-size: 11px; color: var(--t-mut); cursor: pointer; }
.filtros button.on { background: var(--t-az); border-color: var(--t-az); color: #fff; }
.filtros button:not(.on):hover { border-color: var(--c, var(--t-az)); color: var(--t-tx); }
.pq-lista .dash-lista-scroll { overflow: auto; flex: 1; min-height: 0; padding-right: 2px; gap: 0; scrollbar-width: thin; scrollbar-color: var(--t-forte) transparent; }
.grupo { display: flex; align-items: center; gap: 8px; margin: 7px 0 4px; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--t-mut); font-weight: 700; }
.grupo:first-child { margin-top: 2px; }
.grupo > span { display: inline-flex; align-items: center; gap: 6px; }
.grupo b { background: var(--t-soft); border-radius: 99px; padding: 0 8px; color: var(--t-tx); }
.grupo em { text-transform: none; letter-spacing: 0; font-weight: 400; font-style: normal; }
.gr-atrasadas { color: var(--t-er); }
.gr-atrasadas b { background: color-mix(in srgb, var(--t-er) 18%, transparent); color: var(--t-er); }
.gr-hoje b { background: color-mix(in srgb, var(--t-am) 20%, transparent); color: var(--t-am); }
.mais { width: 100%; background: transparent; border: 1px dashed var(--t-bd); border-radius: 9px; color: var(--t-mut); padding: 4px; margin: 2px 0 4px; font: inherit; font-size: 11.5px; cursor: pointer; }
.mais:hover { color: var(--t-tx); border-color: var(--t-az); }

.lr { --c: var(--e-prod); display: grid; grid-template-columns: minmax(0, 1fr) minmax(84px, 0.42fr) 40px 112px 24px; grid-template-areas: "a rail pct d m" "b rail pct p m"; align-items: center; gap: 1px 10px; padding: 5px 4px 5px 12px; margin-bottom: 4px; background: var(--t-fraco); border-radius: 10px; border-left: 3px solid var(--c); position: relative; transition: background 0.2s, transform 0.2s; animation: pq-entrar 0.5s both; }
.lr.lr-sm { grid-template-columns: minmax(0, 1fr) minmax(84px, 0.42fr) 40px 112px; grid-template-areas: "a rail pct d" "b rail pct p"; padding-right: 10px; }
.lr.cor-verde { --c: var(--e-prod); } .lr.cor-rosa { --c: var(--e-dia); } .lr.cor-azul { --c: var(--e-cli); }
.lr.cor-laranja { --c: var(--e-pend); } .lr.cor-roxo { --c: var(--e-gt); } .lr.cor-castanho { --c: var(--e-cast); }
.lr.clicavel { cursor: pointer; }
.lr:hover, .lr:focus { background: var(--t-soft); outline: none; }
.lr[draggable="true"] { cursor: grab; }
.lr-1 { grid-area: a; display: flex; align-items: center; gap: 7px; min-width: 0; }
.lr .cli { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.cch { font-size: 9px; text-transform: uppercase; font-weight: 700; letter-spacing: 0.04em; color: var(--c); background: color-mix(in srgb, var(--c) 16%, transparent); border-radius: 99px; padding: 0 7px; white-space: nowrap; }
.lr-2 { grid-area: b; font-size: 11px; color: var(--t-mut); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lr .enc { margin-left: 4px; }
.lr-rail { grid-area: rail; display: flex; gap: 2px; }
.lr-rail i { flex: 1; height: 7px; border-radius: 3px; background: var(--t-forte); }
.lr-rail i.f { background: var(--c); transform-origin: left; animation: pq-crescer-x 0.6s calc(0.4s + var(--k) * 0.06s) both; }
.lr-rail i.a { background: color-mix(in srgb, var(--c) 40%, transparent); animation: pq-respirar 1.8s infinite; }
.lr-f { display: contents; }
.lr-pct { grid-area: pct; text-align: right; font-weight: 700; font-size: 13px; }
.lr-d { grid-area: d; display: flex; justify-content: flex-end; }
.lr-d small { display: none; }
.lr .prox { grid-area: p; text-align: right; font-size: 11px; color: var(--t-mut); white-space: nowrap; display: flex; justify-content: flex-end; align-items: center; gap: 6px; }
.lr .prox b { color: var(--t-tx); }
.lr .prox.gt { color: var(--e-gt); }
.lr .prox-i.clicavel { cursor: pointer; }
.lr .prox-i.clicavel:hover b { color: var(--t-az); }
.lr-conf { font: inherit; font-size: 10.5px; font-weight: 700; padding: 1px 10px; border-radius: 99px; border: 0; background: var(--e-gt); color: #fff; cursor: pointer; white-space: nowrap; }
.lr-conf:hover { filter: brightness(1.12); }
.lr .lr-m { grid-area: m; align-self: center; justify-self: end; }
.pill { font-size: 10.5px; font-weight: 700; border-radius: 99px; padding: 1px 9px; background: var(--t-soft); color: var(--t-mut); white-space: nowrap; }
.pill.am { background: color-mix(in srgb, var(--t-am) 22%, transparent); color: var(--t-am); }
.pill.er { background: color-mix(in srgb, var(--t-er) 20%, transparent); color: var(--t-er); }

/* barra lateral: «Todas em curso» */
.dot.cinza { background: #9aa0a9; }

/* modo fluido: os gráficos precisam de altura própria (no modo «ajustar» ela vem da grelha) */
.pq-fluido .pq-t .colunas { min-height: 130px; }
.pq-fluido .pq-t .mini-colunas .colunas { min-height: 34px; }
.pq-fluido .pq-t .graf-w { min-height: 110px; }
.pq-fluido .pq-t .hero-r { width: 84px; height: 84px; }
.pq-fluido .pq-t .pbs .pb { min-height: 24px; max-height: none; }
.pq-fluido .pq-t .noticias { min-height: 120px; }
.pq-fluido .pq-t .nt-img { height: 110px; max-height: 110px; }
.pq-fluido .pq-t .linha-num .spark { min-width: 40px; }

/* ---------- janela estreita / telemóvel: os quadrados empilham-se e a página pode deslizar ---------- */
.pq.pq-pilha { height: auto; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: none; grid-auto-rows: auto; gap: 0.6rem; }
.pq.pq-pilha > .pq-card { grid-column: 1 / -1; grid-row: auto; margin-bottom: 0; container-type: inline-size; overflow: visible; min-height: 120px; }
.pq.pq-pilha > .pq-card.peq, .pq.pq-pilha > .pq-card[data-id^="k-"] { grid-column: auto; min-height: 84px; }
.pq.pq-pilha .colunas { min-height: 120px; }
.pq.pq-pilha .graf-w { min-height: 90px; }
.pq.pq-pilha .pbs .pb { min-height: 24px; max-height: none; }
.pq.pq-pilha .noticias { min-height: 120px; }
.pq.pq-pilha .nt-img { height: 100px; max-height: 100px; }
.pq.pq-pilha .qp-colunas, .pq.pq-pilha .qp-linha, .pq.pq-pilha .qp-anel { min-height: 100px; }
.pq.pq-pilha > .pq-card[data-rolar="1"] .pq-corpo { overflow: auto; max-height: 420px; }
.pq.pq-pilha > .pq-lista { overflow: visible; }
.pq.pq-pilha > .pq-lista .pq-corpo { overflow: visible; max-height: none; }
.pq.pq-pilha .pq-ed { display: none !important; }

@media (max-width: 760px) {
    .dash-corpo .pq-card:not(.pq-lista) { display: none !important; }   /* os gráficos e as notícias estão no separador Resumo */
    .dash-cab-linha { display: none; }
    .lr, .lr.lr-sm { grid-template-columns: minmax(0, 1fr) 40px 26px; grid-template-areas: "a pct m" "b pct m" "rail rail rail" "f f f"; }
    .lr.lr-sm { grid-template-columns: minmax(0, 1fr) 40px; grid-template-areas: "a pct" "b pct" "rail rail" "f f"; }
    .lr-f { display: flex; grid-area: f; justify-content: space-between; align-items: center; gap: 8px; margin-top: 2px; }
    .lr-d small { display: block; margin-left: 8px; font-size: 11px; }
    .pq-barra { display: none; }
    .lr-d { justify-content: flex-start; align-items: center; }
    .lr .prox { grid-area: auto; }
    .ls-cab .filtros { display: none; }
    .pq-lista { padding: 8px; }
    .pq-lista .dash-lista-scroll { overflow: visible; }
    .pq-gaveta { width: 100vw; }
}

/* ---------- impressão / PDF ---------- */
@media print {
    .pq { display: block !important; height: auto !important; visibility: visible !important; }
    .pq-card { position: static !important; margin-bottom: 0.8rem; break-inside: avoid; box-shadow: none; animation: none; background: #fff; border-color: #ccc; color: #111; overflow: visible !important; }
    .pq-card .nc-pill b, .pq-card .prod-kpi b { color: #111; }
    .pq-corpo { overflow: visible !important; }
    .pq-ed, .pq-gaveta, .pq-aviso { display: none !important; }
}

/* ---------- movimento reduzido ---------- */
@media (prefers-reduced-motion: reduce) {
    .pq-card, .pq-card *, .lr, .nt { animation: none !important; transition: none !important; }
    .spark .linha, .grafico .linha, .qp-linha .linha { stroke-dashoffset: 0; }
    .prog i { animation: none; width: 100%; }
}
