/* Protótipo do fluxo de caixa projetado (assets/js/prototipos/caixa.js). Só o que não existe em prototipo.css. Prefixo pt-cx-. */
.pt-cx b.is-neg { color: var(--danger); }
.pt-cx-sub { margin-top: 2px; font-size: 12.5px; color: var(--muted); }

/* KPIs com estado */
.pt-kpi.is-neg { border-color: #FCA5A5; background: #FFF7F7; }
.pt-kpi.is-neg b { color: var(--danger); }
.pt-kpi.is-warn { border-color: #FCD34D; background: #FFFBEB; }
.pt-kpi.is-warn b { color: var(--warning); }
.pt-kpi.is-pos b { color: var(--success); }
.pt-kpis--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* Faixa com o efeito da última mudança */
.pt-cx-efeito { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 12px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-size: 12.5px; color: var(--text); }
.pt-cx-efeito .icon { margin-top: 1px; }
.pt-cx-efeito s { color: var(--subtle); }

/* Aviso de risco na projeção */
.pt-cx-alert { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 14px; padding: 12px 14px; border: 1px solid #FCD34D; border-radius: 12px; background: var(--warning-bg); font-size: 13px; line-height: 1.5; color: var(--text); }
.pt-cx-alert > .icon { width: 18px; height: 18px; margin-top: 1px; color: var(--warning); }
.pt-cx-alert.is-neg { border-color: #FCA5A5; background: var(--danger-bg); }
.pt-cx-alert.is-neg > .icon { color: var(--danger); }
.pt-cx-alert.is-ok { border-color: #86EFAC; background: var(--success-bg); }
.pt-cx-alert.is-ok > .icon { color: var(--success); }
.pt-cx-alert b { color: var(--ink); }
.pt-cx-alert__o { margin-top: 4px; color: var(--muted); }
.pt-cx-alert .pt-actions { margin: 8px 0 0; }

/* Gráfico */
.pt-cx-chartbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.pt-cx-leg { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin: 0; font-size: 11.5px; color: var(--muted); }
.pt-cx-leg i { display: inline-block; width: 14px; height: 0; margin-right: -6px; border-top: 2px solid var(--ink); vertical-align: middle; }
.pt-cx-leg i.is-min { border-top: 2px dashed var(--warning); }
.pt-cx-leg i.is-base { border-top: 2px dashed var(--subtle); }
.pt-cx-readout { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; min-height: 42px; margin: 4px 0 6px; padding: 7px 10px; border-radius: 9px; background: var(--surface); font-size: 12.5px; color: var(--muted); }
.pt-cx-readout > b { color: var(--ink); }
.pt-cx-readout small { flex-basis: 100%; font-size: 11.5px; color: var(--subtle); }
.pt-cx-chart { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: #fff; cursor: crosshair; touch-action: pan-x pan-y; }
.pt-cx-chart:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.pt-cx-chart svg { display: block; width: 100%; min-width: 560px; height: auto; }
.pt-cx-grid { stroke: var(--line); stroke-width: 1; }
.pt-cx-ax { font-family: var(--font); font-size: 11px; fill: var(--subtle); }
.pt-cx-ax--min { fill: var(--warning); font-weight: 600; paint-order: stroke; stroke: #fff; stroke-width: 3px; }
.pt-cx-area { fill: rgba(10, 10, 10, .06); }
.pt-cx-area.is-neg { fill: rgba(185, 28, 28, .14); }
.pt-cx-zero { stroke: var(--line-strong); stroke-width: 1.5; }
.pt-cx-min { stroke: var(--warning); stroke-width: 1.5; stroke-dasharray: 5 4; }
.pt-cx-base { fill: none; stroke: var(--subtle); stroke-width: 1.5; stroke-dasharray: 4 4; }
.pt-cx-line { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; }
.pt-cx-line.is-neg { stroke: var(--danger); }
.pt-cx-dot { fill: var(--ink); stroke: #fff; stroke-width: 2; }
.pt-cx-dot.is-neg { fill: var(--danger); }
.pt-cx-lbl { font-family: var(--font); font-size: 11.5px; font-weight: 700; fill: var(--ink); paint-order: stroke; stroke: #fff; stroke-width: 4px; stroke-linejoin: round; }
.pt-cx-lbl.is-neg { fill: var(--danger); }
.pt-cx-cur line { stroke: var(--ink); stroke-width: 1; stroke-dasharray: 2 3; }
.pt-cx-cur circle { fill: #fff; stroke: var(--ink); stroke-width: 2; }
.pt-cx-hit { fill: transparent; }
.pt-cx-h4 { margin: 18px 0 8px; font-size: 13px; font-weight: 600; color: var(--ink); }
.pt-cx-in { color: var(--success); }

/* Situação */
.pt-cx-st { display: inline-block; padding: 1px 8px; border-radius: var(--pill); background: var(--surface-2); font-size: 11px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.pt-cx-st--ok { background: var(--success-bg); color: var(--success); }
.pt-cx-st--warn { background: var(--warning-bg); color: var(--warning); }
.pt-cx-st--neg { background: var(--danger-bg); color: var(--danger); }
.pt-cx-st--new { background: var(--ink); color: #fff; }

/* Contas */
.pt-cx-mini { margin: 0; font-size: 12.5px; color: var(--muted); }
.pt-cx-mini b { color: var(--ink); }
.pt-cx-mini b.is-neg { color: var(--danger); }
.pt-cx-list { display: grid; gap: 6px; max-height: 560px; overflow-y: auto; padding-right: 2px; overscroll-behavior: contain; }
.pt-cx-row {
  display: grid; grid-template-columns: 52px minmax(0, 1fr) auto minmax(0, 230px); align-items: center; gap: 4px 12px;
  padding: 9px 12px; border: 1px solid var(--line); border-left: 3px solid var(--line-strong); border-radius: 10px; background: #fff;
}
.pt-cx-row.is-r { border-left-color: #16A34A; }
.pt-cx-row.is-p { border-left-color: var(--ink); }
.pt-cx-row.is-out { opacity: .55; }
.pt-cx-date b { display: block; font-size: 13.5px; color: var(--ink); }
.pt-cx-date small, .pt-cx-desc small { font-size: 11.5px; color: var(--subtle); }
.pt-cx-desc { min-width: 0; }
.pt-cx-desc b { display: block; overflow: hidden; font-size: 13.5px; color: var(--ink); white-space: nowrap; text-overflow: ellipsis; }
.pt-cx-desc small { display: block; }
.pt-cx-val { display: grid; justify-items: end; gap: 3px; }
.pt-cx-val b { font-size: 13.5px; color: var(--ink); white-space: nowrap; }
.pt-cx-row.is-r .pt-cx-val b { color: var(--success); }
.pt-cx-acts { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px; }

/* Cenários */
.pt-cx-cen { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 12px; align-items: start; }
.pt-cx-ctrl { display: grid; gap: 14px; }
.pt-cx-ctrl h4 { margin: 0; }
.pt-cx-ctrl .pt-link { justify-self: start; }
.pt-cx-res { min-width: 0; }
.pt-cx-res .pt-cx-leg { margin-bottom: 4px; }
.pt-cx-range { display: grid; gap: 6px; font-size: 12.5px; }
.pt-cx-range > span { display: flex; justify-content: space-between; gap: 8px; }
.pt-cx-range b { color: var(--ink); }
.pt-cx-range output { font-weight: 600; color: var(--muted); white-space: nowrap; }
.pt-cx-range input { width: 100%; margin: 0; accent-color: var(--ink); }
.pt-cx-switch { position: relative; display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 10px; align-items: start; font-size: 12.5px; cursor: pointer; }
.pt-cx-switch input { position: absolute; opacity: 0; width: 34px; height: 20px; margin: 0; cursor: pointer; }
.pt-cx-switch__ui { position: relative; width: 34px; height: 20px; border-radius: var(--pill); background: var(--line-strong); transition: background-color .15s; }
.pt-cx-switch__ui::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .15s var(--ease); }
.pt-cx-switch input:checked + .pt-cx-switch__ui { background: var(--ink); }
.pt-cx-switch input:checked + .pt-cx-switch__ui::after { transform: translateX(14px); }
.pt-cx-switch input:focus-visible + .pt-cx-switch__ui { outline: 2px solid var(--ink); outline-offset: 2px; }
.pt-cx-switch b { display: block; color: var(--ink); }
.pt-cx-switch small { display: block; font-size: 11.5px; line-height: 1.4; color: var(--muted); }

/* Alertas */
.pt-cx-al { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 12px; align-items: start; }
.pt-cx-chat { border: 1px solid var(--line); }
.pt-cx-chat .chat__body { max-height: 440px; overflow-y: auto; }
.pt-cx-chat .qr-group { width: min(88%, 340px); }
.pt-cx-chat .qr { width: 100%; border: 0; font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; }
.pt-cx-chat .qr span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.pt-cx-chat .qr:hover { background: #F5F6F6; }
.pt-cx-chat .qr:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }
.pt-cx-chat .chat__system { max-width: 92%; text-align: center; }
.pt-cx-regras .pt-btn { width: 100%; justify-content: center; }
.pt-cx-dl { display: grid; gap: 8px; margin: 0 0 12px; }
.pt-cx-dl div { padding: 8px 10px; border-radius: 8px; background: var(--surface); }
.pt-cx-dl dt { font-size: 11px; color: var(--muted); }
.pt-cx-dl dd { margin: 2px 0 0; font-size: 13px; font-weight: 600; color: var(--ink); }
.pt-cx-note { display: flex; gap: 6px; align-items: flex-start; margin-top: 12px; line-height: 1.45; }

@media (max-width: 980px) {
  .pt-cx-cen, .pt-cx-al { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .pt-kpis--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .pt-kpis--3 .pt-kpi { padding: 8px; }
  .pt-kpis--3 .pt-kpi:last-child { grid-column: 1 / -1; }
  .pt-kpis--3 .pt-kpi b { font-size: 15px; }
  .pt-cx-row { grid-template-columns: 46px minmax(0, 1fr) auto; }
  .pt-cx-acts { grid-column: 2 / -1; justify-content: flex-start; }
  .pt-cx-acts:empty { display: none; }
  .pt-cx-chat .qr-group { width: 100%; }
}
