/* Fast Pass — Loudness: medição real por entrada e programa */

/* Cabeçalho: preset global + especificação */
.ld-pagehead { align-items: flex-start; }
.ld-preset { display: grid; gap: 6px; justify-items: end; }
.ld-target { display: flex; align-items: center; gap: 8px; }
.ld-target span { font-size: 11px; color: var(--muted); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.ld-target select { min-width: 230px; }
.ld-spec { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.ld-spec span { font-size: 11px; color: var(--muted); border: 1px solid var(--line); background: var(--panel); border-radius: 99px; padding: 2px 9px; font-family: var(--mono); }
.ld-spec b { color: var(--text); font-weight: 600; }

/* KPIs */
.ld-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 22px; }
.ld-kpi { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: grid; gap: 2px; position: relative; overflow: hidden; }
.ld-kpi::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--line-2); }
.ld-kpi.ok::before { background: var(--green); }
.ld-kpi.bad::before { background: var(--red); }
.ld-kpi span { font-size: 11.5px; color: var(--muted); }
.ld-kpi b { font-size: 24px; font-family: var(--mono); font-variant-numeric: tabular-nums; line-height: 1.15; }
.ld-kpi b small { font-size: 12px; color: var(--muted); margin-left: 3px; font-weight: 500; }
.ld-kpi.bad b { color: #f87171; }
.ld-kpi em { font-style: normal; font-size: 11px; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.ld-sec { display: flex; align-items: center; gap: 7px; margin: 0 2px 10px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.ld-sec span { margin-left: auto; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--dim); }
.ld-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 440px), 1fr)); gap: 14px; margin-bottom: 24px; align-items: start; }

/* Cartão */
.ld-card { padding: 16px 18px; display: grid; gap: 14px; min-width: 0; transition: border-color .2s; }
.ld-card.sel { border-color: rgba(139, 92, 246, .55); box-shadow: 0 0 0 1px rgba(139, 92, 246, .18); }
.ld-head { display: flex; align-items: center; gap: 11px; }
.ld-head .grow { flex: 1; min-width: 0; }
.ld-head b { display: block; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ld-head small { font-size: 11.5px; color: var(--muted); }
.ld-ico { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex: none; color: var(--accent-2); background: var(--accent-bg); }
.ld-ico.input { color: var(--cyan); background: var(--cyan-bg); }

.ld-state { display: inline-flex; align-items: center; gap: 6px; font-size: 10px; font-weight: 700; letter-spacing: .06em; border-radius: 99px; padding: 4px 10px; border: 1px solid var(--line-2); color: var(--muted); white-space: nowrap; }
.ld-state i { width: 7px; height: 7px; border-radius: 50%; background: var(--dim); }
.ld-state.live { color: #4ade80; border-color: rgba(34, 197, 94, .4); background: var(--green-bg); }
.ld-state.live i { background: var(--green); animation: ldPulse 1.6s ease-in-out infinite; }
.ld-state.wait { color: var(--amber); border-color: rgba(245, 158, 11, .4); background: var(--amber-bg); }
.ld-state.wait i { background: var(--amber); }
.ld-state.err { color: #f87171; border-color: rgba(239, 68, 68, .4); background: var(--red-bg); }
.ld-state.err i { background: var(--red); }
@keyframes ldPulse { 50% { box-shadow: 0 0 0 4px rgba(34, 197, 94, .2); } }

/* Valores */
.ld-main { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 18px; align-items: end; }
.ld-big { display: grid; gap: 3px; padding-right: 18px; border-right: 1px solid var(--line); }
.ld-big > span { font-size: 11px; color: var(--muted); }
.ld-big b { font-family: var(--mono); font-size: 40px; line-height: 1; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.ld-big b small { font-size: 13px; color: var(--muted); font-weight: 500; margin-left: 5px; letter-spacing: 0; }
.ld-big em { font-style: normal; font-size: 11.5px; color: var(--muted); display: flex; gap: 4px; align-items: center; }
.ld-big.ok b, .ld-big.ok em { color: #4ade80; }
.ld-big.warn b, .ld-big.warn em { color: var(--amber); }
.ld-big.bad b, .ld-big.bad em { color: #f87171; }
.ld-vals { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; margin: 0; }
.ld-vals div { display: grid; gap: 1px; border-left: 2px solid var(--line-2); padding-left: 9px; min-width: 0; }
.ld-vals div.ok { border-left-color: var(--green); }
.ld-vals div.warn { border-left-color: var(--amber); }
.ld-vals div.bad { border-left-color: var(--red); }
.ld-vals dt { font-size: 10.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ld-vals dd { margin: 0; font-family: var(--mono); font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.ld-vals dd small { font-size: 10px; color: var(--dim); margin-left: 3px; font-weight: 500; }
.ld-vals div.bad dd { color: #f87171; }

/* Régua: faixa do alvo, short-term (preenchimento), momentâneo (agulha) e integrado (marcador) */
.ld-ruler { display: grid; gap: 4px; }
.ld-track { position: relative; height: 18px; border-radius: 6px; background: var(--bg); border: 1px solid var(--line); overflow: hidden; }
.ld-track i { position: absolute; top: 0; bottom: 0; }
.ld-band { background: var(--green-bg); box-shadow: inset 1px 0 rgba(34, 197, 94, .5), inset -1px 0 rgba(34, 197, 94, .5); }
/* Barra neutra até o short-term: a conformidade aparece nos números e no marcador do integrado */
.ld-fill { left: 0; background: linear-gradient(90deg, rgba(139, 92, 246, .06), rgba(139, 92, 246, .38)); transition: width .35s ease; }
.ld-band { z-index: 1; }
.ld-tgt { width: 2px; margin-left: -1px; background: var(--green); z-index: 2; }
.ld-needle { width: 2px; margin-left: -1px; background: var(--text); box-shadow: 0 0 4px rgba(0, 0, 0, .4); transition: left .2s; z-index: 3; }
.ld-imark { width: 0; height: 0; top: auto !important; bottom: 0; margin-left: -6px; border: 6px solid transparent; border-bottom-color: var(--accent-2); z-index: 4; }
.ld-imark.ok { border-bottom-color: var(--green); }
.ld-imark.warn { border-bottom-color: var(--amber); }
.ld-imark.bad { border-bottom-color: var(--red); }
.ld-ticks { position: relative; height: 13px; font-size: 10px; color: var(--dim); font-family: var(--mono); }
.ld-ticks span { position: absolute; transform: translateX(-50%); }
.ld-ticks span:first-child { transform: none; }
.ld-ticks span:last-child { transform: translateX(-100%); }
.ld-ticks span.tgt { color: #4ade80; font-weight: 600; }

/* Mini-histórico (2 min) */
.ld-sparkbox { display: grid; gap: 3px; }
.ld-spark { width: 100%; height: 56px; display: block; border-radius: 8px; background: var(--bg); border: 1px solid var(--line); }
.ld-spark .band { fill: var(--green-bg); }
.ld-spark .tgt { stroke: rgba(34, 197, 94, .55); stroke-dasharray: 3 3; stroke-width: 1; }
.ld-spark .area { fill: rgba(139, 92, 246, .16); }
.ld-spark .line { fill: none; stroke: var(--accent-2); stroke-width: 1.6; }
.ld-sparkax { display: flex; justify-content: space-between; font-size: 10px; color: var(--dim); }
.ld-spark.empty { height: 56px; display: flex; gap: 6px; align-items: center; justify-content: center; font-size: 11.5px; color: var(--dim); border-style: dashed; background: transparent; }

.ld-hint, .ld-err { margin: 0; font-size: 12px; display: flex; gap: 7px; align-items: flex-start; color: var(--muted); overflow-wrap: anywhere; }
.ld-hint svg, .ld-err svg { flex: none; margin-top: 2px; }
.ld-err { color: #f87171; }
.ld-hint code { color: var(--cyan); white-space: nowrap; }

/* Rodapé: ações e alvo da fonte */
.ld-foot { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; padding-top: 12px; border-top: 1px solid var(--line); }
.ld-tsel { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); min-width: 0; }
.ld-tsel select { background: transparent; border: 1px solid var(--line-2); border-radius: 7px; color: var(--text); font-size: 11.5px; padding: 4px 6px; max-width: 210px; min-width: 0; }
.ld-tsel select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Sem sinal agora: os números são da última leitura */
.ld-card.stale .ld-main, .ld-card.stale .ld-ruler, .ld-card.stale .ld-sparkbox { opacity: .45; filter: saturate(.4); transition: opacity .3s; }

/* Parado: compacto */
.ld-card.off { gap: 12px; }
.ld-card.off .ld-ico { filter: grayscale(1); opacity: .7; }
.ld-idle { display: flex; align-items: center; gap: 14px; }
.ld-idle .grow { flex: 1; min-width: 0; display: grid; gap: 2px; font-size: 12.5px; }
.ld-idle b { font-family: var(--mono); font-size: 18px; color: var(--muted); font-weight: 600; }
.ld-idle b small { font-family: inherit; font-size: 11px; color: var(--dim); font-weight: 500; }

/* Gráfico */
.ld-chartcard { margin-top: 16px; }
.ld-chartcard.ld-watch { margin: 0 0 24px; }   /* observação no topo, logo abaixo dos indicadores */
.ld-chartcard .seg button { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ld-tlabel { fill: #4ade80; font-size: 10.5px; font-family: var(--mono); }
.ld-now { fill: var(--accent-2); stroke: var(--panel); stroke-width: 2; }
.ld-now.ok { fill: var(--green); }
.ld-now.warn { fill: var(--amber); }
.ld-now.bad { fill: var(--red); }

@media (max-width: 900px) {
  .ld-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ld-preset { justify-items: stretch; width: 100%; }
  .ld-spec { justify-content: flex-start; }
}
@media (max-width: 520px) {
  .ld-main { grid-template-columns: minmax(0, 1fr); }
  .ld-big { border-right: 0; padding-right: 0; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
  .ld-tsel { margin-left: 0; width: 100%; }
  .ld-tsel select { max-width: none; flex: 1; }
  .ld-chartcard .card-head { flex-wrap: wrap; }
  .ld-chartcard .right { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) { .ld-state.live i { animation: none; } .ld-fill, .ld-needle { transition: none; } }
