/* Financeiro, DAS, teto do MEI, OFX e precificação (carregado após app.css) */
.fin-in { color: var(--success); }
.fin-out { color: var(--danger); }
.fin-neutral { color: var(--ink-2); }
.fin-amount { font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; }
.fin-amount--in::before { content: "+ "; }
.fin-amount--out::before { content: "− "; }
.fin-amount--muted { opacity: .55; font-weight: 600; }

/* Gráfico SVG inline (12 meses) */
.fin-chart { width: 100%; height: auto; display: block; overflow: visible; }
.fin-chart .bar-in { fill: var(--success); opacity: .85; }
.fin-chart .bar-out { fill: var(--danger); opacity: .7; }
.fin-chart .bar-in.is-current, .fin-chart .bar-out.is-current { opacity: 1; }
.fin-chart .axis { stroke: var(--border); stroke-width: 1; }
.fin-chart .label { fill: var(--ink-3); font-size: 10px; font-family: var(--font); }
.fin-chart .line-result { fill: none; stroke: var(--primary); stroke-width: 2; stroke-linejoin: round; }
.fin-chart .dot-result { fill: var(--primary); }
.fin-legend { display: flex; gap: var(--sp-4); font-size: var(--fs-xs); color: var(--ink-2); flex-wrap: wrap; }
.fin-legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.fin-legend .l-in::before { background: var(--success); }
.fin-legend .l-out::before { background: var(--danger); opacity: .7; }
.fin-legend .l-result::before { background: var(--primary); height: 3px; border-radius: 2px; }

/* Tipo do lançamento (segmented com cor) */
.fin-kind { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.fin-kind label { border: 1px solid var(--border-strong); border-radius: var(--r-md); padding: 10px 8px; text-align: center; font-weight: 600; font-size: var(--fs-sm); cursor: pointer; color: var(--ink-2); background: var(--surface); }
.fin-kind input { position: absolute; opacity: 0; width: 0; height: 0; }
.fin-kind label:has(input:checked) { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.fin-kind label[data-kind="entrada"]:has(input:checked) { border-color: var(--success); color: var(--success); background: var(--success-soft); }
.fin-kind label[data-kind="saida"]:has(input:checked) { border-color: var(--danger); color: var(--danger); background: var(--danger-soft); }
.fin-amount-input { font-size: var(--fs-2xl); font-weight: 700; text-align: right; height: 56px; }

/* Lista de lançamentos */
.fin-list .list-row { align-items: center; }
.fin-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--border-strong); flex: 0 0 10px; }
.fin-day { font-size: var(--fs-xs); color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; padding: var(--sp-3) var(--sp-4) var(--sp-1); background: var(--surface-2); border-bottom: 1px solid var(--border); }
.fin-row-actions { display: flex; gap: 4px; flex-wrap: wrap; }
.fin-row-actions form { display: inline; }
.fin-filters { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-2); }
@media (min-width: 720px) { .fin-filters { grid-template-columns: repeat(4, 1fr); } }
.fin-totals { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-2); }
.fin-totals .stat { padding: var(--sp-3); }
.fin-totals .stat__value { font-size: var(--fs-md); white-space: nowrap; }

/* Contas */
.fin-account { display: flex; align-items: center; gap: var(--sp-3); }
.fin-account__swatch { width: 36px; height: 36px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; color: #fff; flex: 0 0 36px; }

/* Teto do MEI */
.mei-bar { position: relative; height: 18px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); overflow: visible; }
.mei-bar__fill { height: 100%; border-radius: 999px; background: var(--success); transition: width .3s; }
.mei-bar__fill.is-atencao { background: var(--warning); }
.mei-bar__fill.is-alerta { background: #F97316; }
.mei-bar__fill.is-excedido, .mei-bar__fill.is-retroativo { background: var(--danger); }
.mei-bar__fill.is-projected { position: absolute; top: 0; left: 0; opacity: .25; }
.mei-bar__mark { position: absolute; top: -6px; width: 2px; height: 30px; background: var(--ink-3); opacity: .6; }
.mei-bar__mark span { position: absolute; top: 30px; left: 50%; transform: translateX(-50%); font-size: 10px; color: var(--ink-3); white-space: nowrap; }
.mei-months { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
@media (min-width: 720px) { .mei-months { grid-template-columns: repeat(12, 1fr); } }
.mei-month { text-align: center; font-size: var(--fs-xs); }
.mei-month__bar { height: 56px; display: flex; align-items: flex-end; justify-content: center; }
.mei-month__bar i { display: block; width: 70%; background: var(--primary); border-radius: 4px 4px 0 0; min-height: 2px; }
.mei-month.is-over i { background: var(--danger); }
.mei-month__label { color: var(--ink-3); margin-top: 4px; }

/* DAS */
.das-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-2); }
@media (min-width: 720px) { .das-grid { grid-template-columns: repeat(4, 1fr); } }
.das-card { border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--sp-3); background: var(--surface); display: flex; flex-direction: column; gap: 4px; min-height: 120px; }
.das-card.is-pago { border-color: var(--success); background: var(--success-soft); }
.das-card.is-atrasado { border-color: var(--danger); background: var(--danger-soft); }
.das-card.is-pendente.is-current { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); }
.das-card.is-futuro, .das-card.is-antes_abertura { opacity: .55; border-style: dashed; }
.das-card__month { font-weight: 700; }
.das-card__amount { font-size: var(--fs-lg); font-weight: 700; font-variant-numeric: tabular-nums; }
.das-card__due { font-size: var(--fs-xs); color: var(--ink-3); }
.das-card .btn { margin-top: auto; }

/* OFX */
.ofx-row { border-bottom: 1px solid var(--border); padding: var(--sp-3) var(--sp-4); display: grid; gap: var(--sp-2); }
.ofx-row:last-child { border-bottom: 0; }
.ofx-row__head { display: flex; justify-content: space-between; gap: var(--sp-3); align-items: flex-start; }
.ofx-row__memo { font-weight: 600; word-break: break-word; }
.ofx-row__meta { font-size: var(--fs-xs); color: var(--ink-3); }
.ofx-row.is-skip { opacity: .55; }
.ofx-choice { display: flex; gap: 4px; flex-wrap: wrap; }
.ofx-choice label { border: 1px solid var(--border-strong); border-radius: 999px; padding: 4px 10px; font-size: var(--fs-xs); font-weight: 600; cursor: pointer; color: var(--ink-2); }
.ofx-choice input { position: absolute; opacity: 0; }
.ofx-choice label:has(input:checked) { background: var(--primary); border-color: var(--primary); color: #fff; }
.ofx-detail { display: none; }
.ofx-row[data-action="match"] .ofx-detail--match, .ofx-row[data-action="create"] .ofx-detail--create { display: grid; gap: var(--sp-2); }
@media (min-width: 720px) { .ofx-row[data-action="create"] .ofx-detail--create { grid-template-columns: 1fr 1fr; } }

/* Fluxo de caixa */
.flow-table td.neg { color: var(--danger); font-weight: 700; }
.flow-chart .area { fill: var(--primary-soft); }
.flow-chart .line { fill: none; stroke: var(--primary); stroke-width: 2; }
.flow-chart .zero { stroke: var(--danger); stroke-dasharray: 4 3; stroke-width: 1; }

/* DRE */
.dre-line { display: flex; justify-content: space-between; gap: var(--sp-3); padding: 8px 0; border-bottom: 1px solid var(--border); }
.dre-line--group { font-weight: 700; }
.dre-line--sub { padding-left: var(--sp-5); font-size: var(--fs-sm); color: var(--ink-2); border-bottom: 1px dashed var(--border); }
.dre-line--total { font-weight: 800; font-size: var(--fs-lg); border-bottom: 2px solid var(--ink); border-top: 1px solid var(--ink); }

/* Precificação */
.price-result { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
.price-cmp { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-xs); font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.price-cmp--abaixo { background: var(--danger-soft); color: var(--danger); }
.price-cmp--acima { background: var(--info-soft); color: var(--info); }
.price-cmp--ok { background: var(--success-soft); color: var(--success); }
.price-cmp--sem_preco, .price-cmp--sem_dados { background: var(--surface-2); color: var(--ink-3); }
.price-hours { width: 72px; text-align: right; }

/* Widget do painel */
.fin-widget__grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-2); }
.fin-widget__kpi { background: var(--surface-2); border-radius: var(--r-md); padding: var(--sp-3); }
.fin-widget__kpi b { display: block; font-size: var(--fs-lg); font-variant-numeric: tabular-nums; }
.fin-widget__kpi span { font-size: var(--fs-xs); color: var(--ink-3); }

/* Atalhos */
.fin-shortcuts { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-2); }
.fin-shortcuts a { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: var(--sp-3) var(--sp-1); border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--border); text-decoration: none !important; color: var(--ink-2); font-size: var(--fs-xs); font-weight: 600; text-align: center; min-height: 72px; justify-content: center; }
.fin-shortcuts a:active { background: var(--surface-2); }

/* Ajustes visuais */
.stat--primary a { color: inherit; text-decoration: underline; }
.fin-table .num { white-space: nowrap; }
