/* Tema escuro (padrão) */
:root,
[data-theme="dark"] {
    --bg: #0f1419;
    --surface: #1a2332;
    --surface2: #243044;
    --text: #e8edf4;
    --muted: #8b9cb3;
    --border: #2d3a4f;
    --accent: #3b82f6;
    --receita: #22c55e;
    --despesa: #ef4444;
    --saldo: #f59e0b;
    --status-pago-bg: rgba(34, 197, 94, 0.22);
    --status-pago-border: #22c55e;
    --status-pago-text: #86efac;
    --status-pendente-bg: rgba(234, 179, 8, 0.22);
    --status-pendente-border: #eab308;
    --status-pendente-text: #fde047;
    --status-atrasado-bg: rgba(239, 68, 68, 0.22);
    --status-atrasado-border: #ef4444;
    --status-atrasado-text: #fca5a5;
    --radius: 10px;
    --font: 'Segoe UI', system-ui, sans-serif;
}

/* Tema claro */
[data-theme="light"] {
    --bg: #f1f5f9;
    --surface: #ffffff;
    --surface2: #e2e8f0;
    --text: #0f172a;
    --muted: #64748b;
    --border: #cbd5e1;
    --accent: #2563eb;
    --receita: #16a34a;
    --despesa: #dc2626;
    --saldo: #d97706;
    --status-pago-bg: rgba(22, 163, 74, 0.15);
    --status-pago-border: #16a34a;
    --status-pago-text: #15803d;
    --status-pendente-bg: rgba(202, 138, 4, 0.18);
    --status-pendente-border: #ca8a04;
    --status-pendente-text: #a16207;
    --status-atrasado-bg: rgba(220, 38, 38, 0.15);
    --status-atrasado-border: #dc2626;
    --status-atrasado-text: #b91c1c;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    transition: background .2s, color .2s;
}

.app-body {
    display: flex;
    min-height: 100vh;
    height: 100vh;
    overflow: hidden;
    align-items: stretch;
}
.app-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar {
    width: 240px;
    flex-shrink: 0;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: sticky;
    top: 0;
    overflow: auto;
    z-index: 40;
}
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .9rem 1rem;
    color: var(--text);
    text-decoration: none;
    border-bottom: 1px solid var(--border);
}
.sidebar-brand strong { display: block; font-size: .95rem; line-height: 1.2; }
.sidebar-brand small { display: block; color: var(--muted); font-size: .75rem; }
.sidebar-nav {
    display: flex;
    flex-direction: column;
    padding: .7rem .65rem 1.25rem;
    gap: .15rem;
}
.sidebar-label {
    margin: .85rem .55rem .3rem;
    font-size: .68rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 700;
}
.sidebar-label:first-child { margin-top: .2rem; }
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: .55rem;
    color: var(--muted);
    text-decoration: none;
    padding: .52rem .65rem;
    border-radius: 8px;
    font-size: .92rem;
}
.sidebar-nav a svg { flex-shrink: 0; opacity: .9; }
.sidebar-nav a:hover { background: var(--surface2); color: var(--text); }
.sidebar-nav a.active {
    background: color-mix(in srgb, var(--accent) 22%, var(--surface2));
    color: var(--text);
    font-weight: 600;
}
.sidebar-toggle {
    display: none;
    border: none;
    background: var(--surface2);
    color: var(--text);
    width: 38px;
    height: 38px;
    border-radius: 8px;
    cursor: pointer;
    place-items: center;
    padding: 0;
}
.sidebar-toggle:hover { background: var(--accent); color: #fff; }
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 35;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .7rem 1.25rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.topbar-page {
    flex: 1;
    min-width: 0;
}
.topbar-page strong {
    display: block;
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.brand { display: flex; align-items: center; gap: .75rem; }
.brand-icon {
    width: 42px; height: 42px; border-radius: 10px;
    background: transparent;
    display: grid; place-items: center; flex-shrink: 0;
    color: #fff;
    overflow: hidden;
}
.brand-icon svg { display: block; }
.brand-icon img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.brand small { display: block; color: var(--muted); }

.nav { display: flex; gap: .5rem; flex-wrap: wrap; flex: 1; justify-content: center; }
.nav a {
    color: var(--muted); text-decoration: none; padding: .5rem .9rem;
    border-radius: 8px; font-size: .92rem;
}
.nav a:hover, .nav a.active { background: var(--surface2); color: var(--text); }

.theme-switch {
    display: flex; gap: .25rem; background: var(--surface2);
    border-radius: 999px; padding: .2rem;
}
.theme-btn {
    border: none; background: transparent; cursor: pointer;
    padding: .35rem .55rem; border-radius: 999px; font-size: 1rem; line-height: 1;
    color: var(--muted); display: grid; place-items: center;
}
.theme-btn:hover { background: var(--bg); color: var(--text); }
.theme-btn.active { background: var(--accent); box-shadow: 0 0 0 1px var(--accent); color: #fff; }
.theme-btn svg { display: block; }

.container { max-width: 100%; margin: 0 auto; padding: .85rem 1rem; flex: 1; overflow: auto; }

.toolbar {
    display: flex; align-items: center; justify-content: space-between;
    gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap;
}
.toolbar h1 { margin: 0; font-size: 1.35rem; }

.legend {
    display: flex; gap: .6rem; flex-wrap: wrap; margin-bottom: 1rem;
}
.legend-item {
    font-size: .78rem; padding: .25rem .55rem; border-radius: 6px;
    border: 1px solid transparent;
}

.cards-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem; margin-bottom: 1.25rem;
}
.dashboard-alerts-root { margin-bottom: 1.25rem; }
.stat-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 1rem 1.1rem;
}
.stat-card span { color: var(--muted); font-size: .85rem; }
.stat-card strong { display: block; font-size: 1.4rem; margin-top: .25rem; }
.stat-card.receita strong { color: var(--receita); }
.stat-card.despesa strong { color: var(--despesa); }
.stat-card.saldo strong.pos { color: var(--receita); }
.stat-card.saldo strong.neg { color: var(--despesa); }

.year-hero-card {
    margin-bottom: 1.25rem;
    padding: 1.35rem 1.5rem;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--surface);
}
.year-hero-card.is-positive {
    border-color: color-mix(in srgb, var(--receita) 55%, var(--border));
    background: linear-gradient(135deg, color-mix(in srgb, var(--receita) 18%, var(--surface)), var(--surface));
    box-shadow: 0 12px 32px color-mix(in srgb, var(--receita) 12%, transparent);
}
.year-hero-card.is-negative {
    border-color: color-mix(in srgb, var(--despesa) 55%, var(--border));
    background: linear-gradient(135deg, color-mix(in srgb, var(--despesa) 18%, var(--surface)), var(--surface));
    box-shadow: 0 12px 32px color-mix(in srgb, var(--despesa) 12%, transparent);
}
.year-hero-kicker {
    margin: 0 0 .35rem;
    font-size: .82rem;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 600;
}
.year-hero-title {
    margin: 0;
    font-size: clamp(1.15rem, 2.5vw, 1.65rem);
    font-weight: 600;
    line-height: 1.35;
    color: var(--text);
}
.year-hero-card.is-positive .year-hero-title strong { color: var(--receita); }
.year-hero-card.is-negative .year-hero-title strong { color: var(--despesa); }

.dashboard-page .legend-status .legend-item {
    font-size: .88rem;
    font-weight: 700;
    padding: .45rem .85rem;
    border-width: 2px;
    border-style: solid;
    box-shadow: 0 1px 0 rgba(0, 0, 0, .06);
}
.dashboard-page .legend-item.cell-pago {
    background: color-mix(in srgb, var(--status-pago-border) 26%, var(--surface)) !important;
    border-color: var(--status-pago-border) !important;
    color: var(--status-pago-text) !important;
}
.dashboard-page .legend-item.cell-pendente {
    background: color-mix(in srgb, var(--status-pendente-border) 26%, var(--surface)) !important;
    border-color: var(--status-pendente-border) !important;
    color: var(--status-pendente-text) !important;
}
.dashboard-page .legend-item.cell-atrasado {
    background: color-mix(in srgb, var(--status-atrasado-border) 26%, var(--surface)) !important;
    border-color: var(--status-atrasado-border) !important;
    color: var(--status-atrasado-text) !important;
}
.dashboard-page .cell-edit.cell-pago {
    background: color-mix(in srgb, var(--status-pago-border) 22%, var(--surface)) !important;
    border-left: 4px solid var(--status-pago-border) !important;
    color: var(--status-pago-text) !important;
}
.dashboard-page .cell-edit.cell-pendente {
    background: color-mix(in srgb, var(--status-pendente-border) 22%, var(--surface)) !important;
    border-left: 4px solid var(--status-pendente-border) !important;
    color: var(--status-pendente-text) !important;
}
.dashboard-page .cell-edit.cell-atrasado {
    background: color-mix(in srgb, var(--status-atrasado-border) 22%, var(--surface)) !important;
    border-left: 4px solid var(--status-atrasado-border) !important;
    color: var(--status-atrasado-text) !important;
}
.dashboard-page .cell-edit.cell-pago .input-cell,
.dashboard-page .cell-edit.cell-pendente .input-cell,
.dashboard-page .cell-edit.cell-atrasado .input-cell {
    color: var(--text) !important;
    font-weight: 700;
}
.dashboard-page .cell-edit.cell-pago .input-cell::placeholder,
.dashboard-page .cell-edit.cell-pendente .input-cell::placeholder,
.dashboard-page .cell-edit.cell-atrasado .input-cell::placeholder {
    color: var(--muted) !important;
    opacity: 1;
}
.dashboard-page .cell-edit.cell-pago .input-cell:focus,
.dashboard-page .cell-edit.cell-pendente .input-cell:focus,
.dashboard-page .cell-edit.cell-atrasado .input-cell:focus,
.dashboard-page .cell-edit.cell-pago .input-cell:hover,
.dashboard-page .cell-edit.cell-pendente .input-cell:hover,
.dashboard-page .cell-edit.cell-atrasado .input-cell:hover {
    color: var(--text) !important;
    background: var(--bg) !important;
}
.dashboard-page .btn-pago.is-pago {
    background: var(--status-pago-border);
    border-color: var(--status-pago-border);
    color: #fff;
    font-weight: 700;
}
[data-theme="dark"] .dashboard-page .legend-item.cell-pago,
[data-theme="dark"] .dashboard-page .cell-edit.cell-pago {
    background: color-mix(in srgb, var(--status-pago-border) 32%, var(--surface)) !important;
}
[data-theme="dark"] .dashboard-page .legend-item.cell-pendente,
[data-theme="dark"] .dashboard-page .cell-edit.cell-pendente {
    background: color-mix(in srgb, var(--status-pendente-border) 32%, var(--surface)) !important;
}
[data-theme="dark"] .dashboard-page .legend-item.cell-atrasado,
[data-theme="dark"] .dashboard-page .cell-edit.cell-atrasado {
    background: color-mix(in srgb, var(--status-atrasado-border) 32%, var(--surface)) !important;
}
[data-theme="light"] .dashboard-page .legend-item.cell-pago,
[data-theme="light"] .dashboard-page .cell-edit.cell-pago {
    background: color-mix(in srgb, var(--status-pago-border) 18%, #fff) !important;
}
[data-theme="light"] .dashboard-page .legend-item.cell-pendente,
[data-theme="light"] .dashboard-page .cell-edit.cell-pendente {
    background: color-mix(in srgb, var(--status-pendente-border) 20%, #fff) !important;
}
[data-theme="light"] .dashboard-page .legend-item.cell-atrasado,
[data-theme="light"] .dashboard-page .cell-edit.cell-atrasado {
    background: color-mix(in srgb, var(--status-atrasado-border) 18%, #fff) !important;
}

.card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 1rem;
}
.table-wrap { overflow: auto; padding: 0; }
.table-fit { overflow-x: hidden; }

.sheet-resizable {
    table-layout: fixed;
    width: 100%;
    min-width: 0;
}
.sheet-compact {
    font-size: .72rem;
}
.sheet-compact th,
.sheet-compact td {
    padding: .28rem .2rem;
}

.resizable-th {
    position: relative;
    overflow: hidden;
}
.resizable-th .th-text {
    display: block;
    padding-right: 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.col-resizer {
    position: absolute;
    top: 0;
    right: 0;
    width: 7px;
    height: 100%;
    cursor: col-resize;
    user-select: none;
    z-index: 4;
    touch-action: none;
}
.col-resizer:hover,
.col-resizer.active {
    background: color-mix(in srgb, var(--accent) 55%, transparent);
}
body.col-resizing {
    cursor: col-resize !important;
    user-select: none !important;
}
body.col-resizing * {
    cursor: col-resize !important;
}

table { width: 100%; border-collapse: collapse; font-size: .82rem; }
th, td { padding: .45rem .5rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { background: var(--surface2); color: var(--muted); font-weight: 600; text-align: left; position: sticky; top: 0; z-index: 2; }
th.mes-vigente { color: var(--accent); box-shadow: inset 0 -2px 0 var(--accent); }
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.strong { font-weight: 700; }
.pos { color: var(--receita); }
.neg { color: var(--despesa); }
.muted { color: var(--muted); }

.sheet .sticky-col {
    position: sticky; left: 0;
    min-width: 0; z-index: 1; border-right: 1px solid var(--border);
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Linha de categoria — destaque em toda a largura */
.sheet .row-cat td {
    background: color-mix(in srgb, var(--cat-color) 20%, var(--surface)) !important;
    font-weight: 600;
    border-top: 2px solid color-mix(in srgb, var(--cat-color) 50%, var(--border));
    border-bottom: 1px solid color-mix(in srgb, var(--cat-color) 35%, var(--border));
    color: var(--text);
}
.sheet .row-cat .sticky-col {
    background: color-mix(in srgb, var(--cat-color) 20%, var(--surface)) !important;
    box-shadow: inset 4px 0 0 var(--cat-color);
}
.row-cat .dot {
    display: inline-block; width: 8px; height: 8px; border-radius: 50%;
    background: var(--cat-color); margin-right: 6px;
}
.cat-edit-row {
    display: flex;
    align-items: center;
    gap: .35rem;
    min-width: 0;
}
.cat-edit-row .cat-title {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.drag-handle-cat {
    color: color-mix(in srgb, var(--cat-color) 70%, var(--muted));
}

.task-edit-row {
    display: flex;
    align-items: center;
    gap: .15rem;
    min-width: 0;
}
.drag-handle {
    flex-shrink: 0;
    width: 16px;
    height: 22px;
    padding: 0;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: var(--muted);
    cursor: grab;
    font-size: .65rem;
    letter-spacing: -1px;
    line-height: 1;
    display: grid;
    place-items: center;
}
.drag-handle:hover {
    background: var(--surface2);
    color: var(--text);
}
.drag-handle:active,
.row-task.is-dragging .drag-handle {
    cursor: grabbing;
}
.row-task.is-dragging,
.row-grupo.is-dragging {
    opacity: .55;
}
.row-task.drag-over,
.row-cat.drag-over,
.row-grupo.drag-over {
    box-shadow: inset 0 2px 0 var(--accent);
}
.task-rename-form {
    flex: 1;
    min-width: 0;
    margin: 0;
}
.input-task-name {
    width: 100%;
    min-width: 0;
    background: transparent;
    border: 1px solid transparent;
    color: inherit;
    font: inherit;
    font-weight: 500;
    padding: .15rem .25rem;
    border-radius: 4px;
}
.input-task-name:hover,
.input-task-name:focus {
    border-color: var(--accent);
    background: var(--bg);
    outline: none;
}
.task-dia {
    flex-shrink: 0;
    color: var(--muted);
    font-size: .68rem;
    font-weight: 500;
    white-space: nowrap;
    padding-right: .1rem;
}
.task-dia-form {
    display: inline-flex;
    align-items: center;
    gap: .15rem;
    margin: 0;
    flex-shrink: 0;
}
.task-dia-label {
    color: var(--muted);
    font-size: .68rem;
    font-weight: 500;
}
.input-task-dia {
    width: 2.2rem;
    min-width: 0;
    background: transparent;
    border: 1px solid transparent;
    color: inherit;
    font: inherit;
    font-size: .68rem;
    font-weight: 600;
    padding: .1rem .15rem;
    border-radius: 4px;
    text-align: center;
    -moz-appearance: textfield;
}
.input-task-dia::-webkit-outer-spin-button,
.input-task-dia::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.input-task-dia:hover,
.input-task-dia:focus {
    border-color: var(--accent);
    background: var(--bg);
    outline: none;
}
.task-del-form { margin: 0; flex-shrink: 0; }
.btn-del-x {
    width: 18px;
    height: 18px;
    padding: 0;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-size: .95rem;
    line-height: 1;
    display: grid;
    place-items: center;
}
.btn-del-x:hover {
    background: var(--status-atrasado-bg);
    color: var(--status-atrasado-text);
}

/* Atividades — recuo visual dentro da categoria */
.sheet .row-task .sticky-col {
    background: var(--surface);
    padding-left: 1.1rem;
    border-left: 3px solid color-mix(in srgb, var(--border) 80%, transparent);
}
.sheet .row-task .task-name {
    position: relative;
}
.sheet .row-task .task-name::before {
    content: '';
}
.row-task td:not(.sticky-col) {
    background: color-mix(in srgb, var(--surface) 92%, var(--bg));
}

.row-total td { background: var(--surface2); font-weight: 700; }

/* Cores de status nas células */
.cell-pago,
.legend-item.cell-pago {
    background: var(--status-pago-bg) !important;
    border-color: var(--status-pago-border) !important;
    color: var(--status-pago-text);
}
.cell-pendente,
.legend-item.cell-pendente {
    background: var(--status-pendente-bg) !important;
    border-color: var(--status-pendente-border) !important;
    color: var(--status-pendente-text);
}
.cell-atrasado,
.legend-item.cell-atrasado {
    background: var(--status-atrasado-bg) !important;
    border-color: var(--status-atrasado-border) !important;
    color: var(--status-atrasado-text);
}
.cell-edit.cell-pago,
.cell-edit.cell-pendente,
.cell-edit.cell-atrasado {
    border-left: 3px solid var(--status-pago-border);
}
.cell-edit.cell-pendente { border-left-color: var(--status-pendente-border); }
.cell-edit.cell-atrasado { border-left-color: var(--status-atrasado-border); }
.cell-neutro,
.cell-edit.cell-neutro {
    background: transparent !important;
    border-left-color: transparent !important;
    color: inherit;
}
.mes-vigente-col { outline: 1px dashed color-mix(in srgb, var(--accent) 35%, transparent); }

.cell-wrap {
    display: flex; align-items: center; justify-content: flex-end; gap: .15rem;
}
.cell-form { margin: 0; flex: 1; }
.cell-toggle { margin: 0; }

.input-cell {
    width: 100%; min-width: 0; background: transparent; border: 1px solid transparent;
    color: inherit; text-align: right; padding: .12rem .15rem; border-radius: 3px;
    font-size: .7rem;
}
.input-cell::placeholder {
    color: var(--muted);
    opacity: 1;
    text-align: center;
}
.input-cell:placeholder-shown {
    text-align: center;
    color: var(--muted);
}
.input-cell:hover, .input-cell:focus { border-color: var(--accent); background: var(--bg); outline: none; color: var(--text); text-align: right; }
form.is-saving { opacity: .7; pointer-events: none; }

.btn-pago {
    border: 1px solid var(--border); background: var(--surface2); color: var(--muted);
    width: 16px; height: 16px; border-radius: 3px; cursor: pointer; font-size: .6rem;
    padding: 0; line-height: 1; flex-shrink: 0;
}
.btn-pago:hover { border-color: var(--accent); color: var(--text); }
.btn-pago.is-pago {
    background: var(--status-pago-border); color: #fff; border-color: var(--status-pago-border);
}

.btn {
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--accent); color: #fff; border: none; border-radius: 8px;
    padding: .55rem 1rem; font-size: .9rem; cursor: pointer; text-decoration: none;
}
.btn:hover { filter: brightness(1.08); color: #fff; }
.btn-sm { padding: .35rem .65rem; font-size: .8rem; }
.btn-ghost { background: var(--surface2); color: var(--text); }
.btn-ghost:hover { color: var(--text); }
.btn-danger { background: #b91c1c; color: #fff; }
.inline-form { display: flex; gap: .5rem; align-items: end; flex-wrap: wrap; }
.input-sm { width: 90px; padding: .35rem .5rem; border-radius: 6px; border: 1px solid var(--border); background: var(--bg); color: var(--text); }

.filters { display: flex; gap: .5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.filters a {
    padding: .4rem .8rem; border-radius: 999px; text-decoration: none;
    color: var(--muted); background: var(--surface); border: 1px solid var(--border);
}
.filters a.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.form-grid {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem;
}
.form-grid label { display: flex; flex-direction: column; gap: .35rem; font-size: .88rem; color: var(--muted); }
.form-grid label.full { grid-column: 1 / -1; }
.form-grid input, .form-grid select, .form-grid textarea {
    padding: .55rem .65rem; border-radius: 8px; border: 1px solid var(--border);
    background: var(--bg); color: var(--text); font-size: .95rem;
}
.form-actions { margin-top: .5rem; }

.pill {
    display: inline-block; padding: .15rem .5rem; border-radius: 999px;
    font-size: .78rem; font-weight: 600;
}
.badge-dia {
    display: inline-grid; place-items: center; width: 32px; height: 32px;
    border-radius: 8px; background: var(--surface2); font-weight: 700;
}
.badge-pago { background: var(--status-pago-bg); color: var(--status-pago-text); border: 1px solid var(--status-pago-border); }
.badge-pendente { background: var(--status-pendente-bg); color: var(--status-pendente-text); border: 1px solid var(--status-pendente-border); }
.badge-atrasado { background: var(--status-atrasado-bg); color: var(--status-atrasado-text); border: 1px solid var(--status-atrasado-border); }

.status-badge {
    display: inline-block; padding: .2rem .5rem; border-radius: 6px; font-size: .78rem; font-weight: 600;
}
.status-pago { background: var(--status-pago-bg); color: var(--status-pago-text); border: 1px solid var(--status-pago-border); }
.status-pendente { background: var(--status-pendente-bg); color: var(--status-pendente-text); border: 1px solid var(--status-pendente-border); }
.status-atrasado { background: var(--status-atrasado-bg); color: var(--status-atrasado-text); border: 1px solid var(--status-atrasado-border); }

.row-status.row-pago td { background: color-mix(in srgb, var(--status-pago-bg) 50%, var(--surface)); }
.row-status.row-pendente td { background: color-mix(in srgb, var(--status-pendente-bg) 50%, var(--surface)); }
.row-status.row-atrasado td { background: color-mix(in srgb, var(--status-atrasado-bg) 50%, var(--surface)); }

.actions { display: flex; gap: .35rem; align-items: center; }
.actions form { margin: 0; }

.bulk-bar {
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
    margin-bottom: .75rem;
    padding: .55rem .75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.bulk-select-all {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-size: .88rem;
    color: var(--muted);
    cursor: pointer;
}
.bulk-count { color: var(--muted); font-size: .85rem; margin-right: auto; }
.col-check { width: 36px; text-align: center; }
.col-check input { width: 16px; height: 16px; cursor: pointer; }
#btn-excluir-lote:disabled { opacity: .45; cursor: not-allowed; }
tr.inactive { opacity: .5; }
.color-swatch { display: inline-block; width: 20px; height: 20px; border-radius: 4px; }

.alert { padding: .75rem 1rem; border-radius: 8px; margin-bottom: 1rem; }
.alert-ok { background: var(--status-pago-bg); color: var(--status-pago-text); border: 1px solid var(--status-pago-border); }
.alert-erro { background: var(--status-atrasado-bg); color: var(--status-atrasado-text); border: 1px solid var(--status-atrasado-border); }
.hint, .empty { color: var(--muted); font-size: .88rem; }
.hint-card h3 { margin-top: 0; }
.hint-card ul { margin: 0; padding-left: 1.2rem; color: var(--muted); }

/* --- Dashboards por Ano --- */
.toolbar-sub { margin: .25rem 0 0; color: var(--muted); font-size: .9rem; width: 100%; }
.section-title { margin: 0 0 .75rem; font-size: 1rem; }
.compare-table-wrap { margin-bottom: 1.25rem; overflow: auto; }
.row-current-year td { background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
.pill-current {
    background: color-mix(in srgb, var(--accent) 20%, var(--surface));
    color: var(--accent);
    font-size: .7rem;
    padding: .1rem .45rem;
    border-radius: 999px;
    margin-left: .35rem;
    font-weight: 600;
}

.years-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1rem;
}
.year-dashboard { padding: 1.1rem; }
.year-dashboard.year-current {
    border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 25%, transparent);
}
.year-dashboard-head {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: .75rem; margin-bottom: 1rem;
}
.year-dashboard-head h2 { margin: 0; font-size: 1.5rem; }

.year-stats {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem;
    margin-bottom: 1rem;
}
.year-stat {
    background: var(--surface2); border-radius: 8px; padding: .55rem .65rem;
    text-align: center;
}
.year-stat span { display: block; font-size: .72rem; color: var(--muted); }
.year-stat strong { font-size: .95rem; }

.chart-block { margin-bottom: 1rem; }
.chart-block h3 { margin: 0 0 .5rem; font-size: .82rem; color: var(--muted); font-weight: 600; }

.bar-chart, .stack-chart {
    display: flex; align-items: flex-end; gap: 3px; height: 100px;
    padding: 0 .15rem;
}
.bar-col, .stack-col {
    flex: 1; display: flex; flex-direction: column; align-items: center;
    min-width: 0;
}
.bar-col.bar-vigente .bar-track { outline: 1px dashed var(--accent); }
.bar-track {
    width: 100%; height: 80px; display: flex; align-items: flex-end;
    background: var(--surface2); border-radius: 4px 4px 0 0;
}
.bar-fill {
    width: 100%; border-radius: 3px 3px 0 0; min-height: 0;
    transition: height .2s;
}
.bar-fill.bar-pos { background: var(--receita); }
.bar-fill.bar-neg { background: var(--despesa); }

.stack-pair {
    width: 100%; height: 80px; display: flex; align-items: flex-end;
    gap: 1px; background: var(--surface2); border-radius: 4px 4px 0 0;
    padding: 0 1px;
}
.stack-bar { flex: 1; border-radius: 2px 2px 0 0; min-height: 0; }
.stack-bar.stack-rec { background: var(--receita); opacity: .85; }
.stack-bar.stack-des { background: var(--despesa); opacity: .85; }

.bar-label { font-size: .62rem; color: var(--muted); margin-top: .2rem; }

.chart-legend-inline {
    display: flex; gap: 1rem; margin-top: .35rem; font-size: .75rem; color: var(--muted);
}
.chart-legend-inline span { display: inline-flex; align-items: center; gap: .3rem; }
.dot-rec, .dot-des {
    display: inline-block; width: 8px; height: 8px; border-radius: 2px;
}
.dot-rec { background: var(--receita); }
.dot-des { background: var(--despesa); }

.year-meta {
    border-top: 1px solid var(--border); padding-top: .75rem;
    display: flex; flex-direction: column; gap: .5rem;
}
.meta-item { display: flex; flex-wrap: wrap; gap: .35rem; }
.checkbox-label {
    flex-direction: row !important; align-items: center; gap: .5rem;
    color: var(--text) !important; cursor: pointer;
}
.checkbox-label input { width: auto; }
.code-block {
    background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
    padding: .75rem 1rem; font-size: .82rem; overflow-x: auto;
}
.hint-card a { color: var(--accent); }

.empty-state { text-align: center; padding: 2rem; }

.toast-area {
    position: fixed;
    top: 4.5rem;
    right: 1rem;
    z-index: 10050;
    display: flex;
    flex-direction: column;
    gap: .4rem;
    pointer-events: none;
}
.toast {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    padding: .55rem .85rem;
    border-radius: 8px;
    font-size: .85rem;
    box-shadow: 0 8px 24px rgba(0,0,0,.25);
    animation: toast-in .18s ease-out;
}
.toast-ok { border-color: var(--status-pago-border); }
.toast-erro { border-color: var(--status-atrasado-border); color: var(--status-atrasado-text); }
.toast-out { opacity: 0; transform: translateY(-6px); transition: .2s; }
@keyframes toast-in {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: none; }
}

body.modal-open { overflow: hidden; }
.app-modal[hidden] { display: none !important; }
.app-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: grid;
    place-items: center;
    padding: 1rem;
}
.app-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(8, 12, 20, .62);
    backdrop-filter: blur(2px);
}
.app-modal-dialog {
    position: relative;
    z-index: 1;
    width: min(1100px, 96vw);
    max-height: min(90vh, 920px);
    display: flex;
    flex-direction: column;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0,0,0,.45);
    overflow: hidden;
}
.app-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .85rem 1rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}
.app-modal-head h2 {
    margin: 0;
    font-size: 1.05rem;
}
.app-modal-close {
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 8px;
    background: var(--surface2);
    color: var(--text);
    font-size: 1.3rem;
    cursor: pointer;
    line-height: 1;
    display: grid;
    place-items: center;
    padding: 0;
}
.app-modal-close:hover { background: var(--accent); color: #fff; }
.app-modal-close svg { display: block; }
.app-modal-body {
    padding: 1rem;
    overflow: auto;
}
.embed-root .toolbar h1 { font-size: 1.15rem; }

@media (max-width: 768px) {
    .form-grid { grid-template-columns: 1fr; }
    .sheet .sticky-col { min-width: 0; }
    .table-fit { overflow-x: auto; }
    .nav { order: 3; width: 100%; justify-content: flex-start; }
    .app-modal-dialog { width: 100%; max-height: 94vh; }
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        transform: translateX(-100%);
        transition: transform .2s ease;
        box-shadow: 8px 0 28px rgba(0,0,0,.35);
    }
    .app-body.sidebar-open .sidebar { transform: none; }
    .app-body.sidebar-open .sidebar-backdrop { display: block; }
    .sidebar-toggle { display: grid; }
    .topbar-page { display: none; }
}

/* ——— Landing / Auth / SaaS ——— */
.lp-body { min-height: 100vh; display: flex; flex-direction: column; }
.lp-topbar {
    display: flex; align-items: center; justify-content: space-between;
    gap: 1rem; padding: 1rem 1.5rem; flex-wrap: wrap;
    background: rgba(26, 35, 50, 0.85); backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20;
}
.lp-logo { display: flex; align-items: center; gap: .6rem; color: var(--text); text-decoration: none; }
.lp-nav { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.lp-nav a { color: var(--muted); text-decoration: none; }
.lp-nav a:hover { color: var(--text); }
.lp-nav a.btn,
.lp-nav a.btn:hover { color: #fff; }

.lp-hero {
    padding: 4.5rem 1.5rem 3.5rem;
    background:
        radial-gradient(ellipse 80% 60% at 20% 20%, rgba(59,130,246,.25), transparent),
        radial-gradient(ellipse 70% 50% at 80% 0%, rgba(34,197,94,.12), transparent),
        linear-gradient(180deg, var(--surface) 0%, var(--bg) 100%);
}
.lp-hero-inner { max-width: 720px; margin: 0 auto; }
.lp-brand {
    font-size: .85rem; letter-spacing: .12em; text-transform: uppercase;
    color: var(--accent); margin: 0 0 .75rem; font-weight: 600;
}
.lp-hero h1 {
    font-size: clamp(1.85rem, 4vw, 2.75rem); line-height: 1.15;
    margin: 0 0 1rem; font-weight: 700;
}
.lp-lead { color: var(--muted); font-size: 1.1rem; margin: 0 0 1.75rem; max-width: 36rem; }
.lp-cta { display: flex; gap: .75rem; flex-wrap: wrap; }
.btn-lg { padding: .75rem 1.35rem; font-size: 1rem; }

.lp-section { padding: 3rem 1.5rem; max-width: 1100px; margin: 0 auto; width: 100%; box-sizing: border-box; }
.lp-section h2 { margin: 0 0 .5rem; font-size: 1.6rem; }
.lp-section-lead { color: var(--muted); margin: 0 0 1.75rem; }
.lp-features {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.25rem;
}
.lp-features article {
    padding: 1.25rem; border-radius: var(--radius);
    background: var(--surface); border: 1px solid var(--border);
}
.lp-features h3 { margin: 0 0 .5rem; font-size: 1.05rem; }
.lp-features p { margin: 0; color: var(--muted); font-size: .95rem; }

.lp-plans { padding-bottom: 2rem; }
.lp-plan-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.25rem;
}
.lp-plan {
    position: relative; padding: 1.5rem; border-radius: 14px;
    background: var(--surface); border: 1px solid var(--border);
    display: flex; flex-direction: column; gap: .5rem;
}
.lp-plan.is-featured {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent), 0 12px 40px rgba(59,130,246,.15);
}
.lp-badge {
    position: absolute; top: .75rem; right: .75rem;
    font-size: .7rem; background: var(--accent); color: #fff;
    padding: .2rem .5rem; border-radius: 999px; font-weight: 600;
}
.lp-price { font-size: 1.75rem; font-weight: 700; margin: .25rem 0; }
.lp-plan ul { margin: .5rem 0 1rem; padding-left: 1.1rem; color: var(--muted); flex: 1; }
.lp-plan .btn { align-self: stretch; text-align: center; }

.lp-footer-cta { text-align: center; padding-bottom: 4rem; }
.lp-site-footer {
    margin-top: auto; padding: 1.5rem; text-align: center;
    color: var(--muted); font-size: .85rem; border-top: 1px solid var(--border);
}

.auth-card {
    max-width: 420px; margin: 2.5rem auto; padding: 1.75rem;
    background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
}
.auth-card h1 { margin: 0 0 .35rem; font-size: 1.45rem; }
.stack-form { display: flex; flex-direction: column; gap: .85rem; margin-top: 1.25rem; }
.stack-form label { display: flex; flex-direction: column; gap: .35rem; font-size: .9rem; color: var(--muted); }
.stack-form .input, .input {
    padding: .55rem .7rem; border-radius: 8px; border: 1px solid var(--border);
    background: var(--bg); color: var(--text); font: inherit;
}

.password-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    width: 100%;
    max-width: 100%;
    vertical-align: middle;
}
.password-wrap.is-inline { width: auto; }
.password-wrap .input,
.password-wrap .input-sm {
    width: 100%;
    padding-right: 2.35rem;
    box-sizing: border-box;
}
.password-toggle {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    display: grid;
    place-items: center;
    padding: 0;
    line-height: 0;
}
.password-toggle:hover { color: var(--text); background: var(--surface2); }
.password-toggle svg { display: block; pointer-events: none; }
.auth-links { margin-top: 1.25rem; color: var(--muted); font-size: .9rem; }
.auth-links a { color: var(--accent); }

.topbar-right { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.user-chip {
    font-size: .85rem; color: var(--muted); max-width: 140px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.admin-actions { display: flex; flex-direction: column; gap: .4rem; align-items: flex-start; }
.admin-actions .inline-form { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }

@media (max-width: 640px) {
    .lp-hero { padding: 3rem 1.25rem 2.5rem; }
    .admin-actions { font-size: .85rem; }
}

/* Landing product shots */
.lp-hero { display: flex; flex-direction: column; gap: 2.5rem; align-items: stretch; }
.lp-hero-visual {
    max-width: 1080px; width: 100%; margin: 0 auto; padding: 0 1.5rem 0.5rem;
}
.lp-hero-visual img {
    display: block; width: 100%; height: auto; border-radius: 14px;
    border: 1px solid var(--border);
    box-shadow: 0 24px 60px rgba(0,0,0,.35);
}
.lp-showcase {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 1.25rem;
}
.lp-shot {
    margin: 0; display: flex; flex-direction: column; gap: .75rem;
    background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
    overflow: hidden;
}
.lp-shot-wide { grid-column: 1 / -1; }
.lp-shot img {
    display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover;
    background: #0b1016;
}
.lp-shot figcaption {
    padding: 0 1.1rem 1.1rem; display: flex; flex-direction: column; gap: .25rem;
}
.lp-shot figcaption strong { font-size: 1.05rem; }
.lp-shot figcaption span { color: var(--muted); font-size: .92rem; }

@media (max-width: 800px) {
    .lp-showcase { grid-template-columns: 1fr; }
}
.lp-showcase-2 { grid-template-columns: 1fr 1fr; }
@media (max-width: 800px) { .lp-showcase-2 { grid-template-columns: 1fr; } }
.auth-forgot { margin: -.35rem 0 0; text-align: right; font-size: .88rem; }
.auth-forgot a { color: var(--accent); text-decoration: none; }
.auth-forgot a:hover { text-decoration: underline; }

.lic-badge {
    display: inline-block; padding: .2rem .55rem; border-radius: 999px;
    font-size: .78rem; font-weight: 600; white-space: nowrap;
}
.lic-badge.lic-ok { background: var(--status-pago-bg); color: var(--status-pago-text); border: 1px solid var(--status-pago-border); }
.lic-badge.lic-warn { background: var(--status-pendente-bg); color: var(--status-pendente-text); border: 1px solid var(--status-pendente-border); }
.lic-badge.lic-expired { background: var(--status-atrasado-bg); color: var(--status-atrasado-text); border: 1px solid var(--status-atrasado-border); }
.admin-cadastro-form { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; }
.admin-cadastro-form label { display: flex; flex-direction: column; gap: .3rem; font-size: .9rem; color: var(--muted); }

/* Support chat */
.nav-badge, .chat-badge, .chat-fab-badge {
    display: inline-block; min-width: 1.1rem; padding: 0 .35rem;
    margin-left: .25rem; border-radius: 999px; font-size: .7rem; font-weight: 700;
    background: var(--despesa); color: #fff; line-height: 1.3; text-align: center;
}
.chat-fab {
    position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 40;
    width: 54px; height: 54px; border-radius: 50%;
    display: grid; place-items: center; text-decoration: none; font-size: 1.4rem;
    background: var(--accent); color: #fff;
    box-shadow: 0 10px 28px rgba(0,0,0,.35);
}
.chat-fab svg { display: block; }
.chat-fab:hover { filter: brightness(1.08); }
.chat-fab-badge {
    position: absolute; top: -2px; right: -2px; margin: 0;
}
.chat-card { display: flex; flex-direction: column; gap: .75rem; min-height: 420px; }
.chat-status { display: flex; justify-content: space-between; align-items: center; gap: .75rem; flex-wrap: wrap; font-size: .9rem; }
.chat-messages {
    flex: 1; min-height: 280px; max-height: 55vh; overflow: auto;
    padding: 1rem; border-radius: 12px; background: var(--bg); border: 1px solid var(--border);
    display: flex; flex-direction: column; gap: .65rem;
}
.chat-bubble {
    max-width: min(78%, 520px); padding: .65rem .85rem; border-radius: 12px;
    background: var(--surface2); border: 1px solid var(--border);
}
.chat-bubble.chat-cliente { align-self: flex-end; background: rgba(59,130,246,.18); border-color: rgba(59,130,246,.35); }
.chat-bubble.chat-admin { align-self: flex-start; }
.chat-meta { display: flex; justify-content: space-between; gap: .75rem; font-size: .75rem; color: var(--muted); margin-bottom: .25rem; }
.chat-text { white-space: pre-wrap; word-break: break-word; }
.chat-compose { display: flex; gap: .6rem; align-items: flex-end; }
.chat-compose textarea {
    flex: 1; resize: vertical; min-height: 52px; padding: .65rem .75rem;
    border-radius: 10px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font: inherit;
}
.support-admin {
    display: grid; grid-template-columns: 300px 1fr; gap: 1rem; align-items: start;
}
.support-list h2 { margin: 0 0 .75rem; font-size: 1.05rem; }
.support-thread-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .35rem; max-height: 70vh; overflow: auto; }
.support-thread-list a {
    display: block; padding: .7rem .75rem; border-radius: 10px; text-decoration: none;
    color: var(--text); border: 1px solid transparent;
}
.support-thread-list li.is-active a, .support-thread-list a:hover {
    background: var(--surface2); border-color: var(--border);
}
.support-thread-list small, .support-preview, .support-meta {
    display: block; color: var(--muted); font-size: .8rem; margin-top: .15rem;
}
.support-preview { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.support-panel-head { margin-bottom: .5rem; }
@media (max-width: 900px) {
    .support-admin { grid-template-columns: 1fr; }
    .support-thread-list { max-height: 220px; }
}

/* Admin tabs */
.admin-tabs {
    display: flex; flex-wrap: wrap; gap: .4rem;
    margin: 0 0 1.25rem; padding: .35rem;
    background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
}
.admin-tab {
    appearance: none; border: none; background: transparent; color: var(--muted);
    text-decoration: none; padding: .55rem .95rem; border-radius: 9px;
    font: inherit; font-weight: 600; font-size: .92rem; cursor: pointer;
}
.admin-tab:hover { color: var(--text); background: var(--surface2); }
.admin-tab.is-active {
    color: #fff; background: var(--accent);
}
.admin-tab-panels > .card { margin-top: 0; }
.auth-form-error { margin-top: 1rem; }
.auth-card .alert-erro { border-width: 1px; }

/* Previsão — simulação de juros */
.previsao-app { display: flex; flex-direction: column; gap: 1rem; }
.previsao-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: end; }
.previsao-taxa-field { display: flex; flex-direction: column; gap: .35rem; }
.previsao-taxa-row {
    display: flex;
    align-items: stretch;
    gap: .4rem;
    min-width: 0;
}
.previsao-taxa-row .input { flex: 1; min-width: 0; }
.previsao-taxa-row .previsao-period { flex-shrink: 0; align-self: stretch; }
.previsao-period {
    display: flex; gap: .25rem; background: var(--surface2);
    border-radius: 999px; padding: .2rem; width: fit-content;
    align-items: center;
}
.previsao-period-btn {
    appearance: none; border: none; background: transparent;
    color: var(--muted); cursor: pointer; font: inherit; font-weight: 600;
    font-size: .82rem; padding: .32rem .7rem; border-radius: 999px;
}
.previsao-period-btn:hover { color: var(--text); }
.previsao-period-btn.is-active {
    background: var(--accent); color: #fff;
}
.previsao-hint { margin: .85rem 0 0; font-size: .85rem; }
.previsao-table-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: .75rem; flex-wrap: wrap; margin-bottom: .75rem;
}
.previsao-table-head .section-title { margin: 0; }
.previsao-table-scroll { max-height: 420px; overflow: auto; }
.previsao-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}
.previsao-kpis .stat-card { margin: 0; }
.previsao-kpi-foot {
    margin: .55rem 0 0;
    font-size: .88rem;
    font-weight: 500;
    line-height: 1.45;
    color: var(--muted);
}
.previsao-results { display: flex; flex-direction: column; gap: .85rem; }
.previsao-motivation {
    margin: 0;
    padding: .85rem 1rem;
    border-radius: var(--radius);
    border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
    background: color-mix(in srgb, var(--accent) 10%, var(--surface));
    color: var(--text);
    font-size: .92rem;
    font-weight: 600;
}
.previsao-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.previsao-compare { display: flex; flex-direction: column; gap: .85rem; }
.previsao-compare-intro { margin: 0; font-size: .88rem; }
.previsao-compare-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}
.previsao-compare-col {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    background: var(--surface2);
}
.previsao-compare-col-alt {
    border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
    background: color-mix(in srgb, var(--accent) 8%, var(--surface));
}
.previsao-compare-col h3 {
    margin: 0 0 .75rem;
    font-size: .95rem;
}
.previsao-compare-aporte-label {
    display: flex;
    flex-direction: column;
    gap: .35rem;
    margin-bottom: .75rem;
    font-size: .85rem;
    color: var(--muted);
}
.previsao-compare-metrics {
    display: grid;
    gap: .55rem;
    margin: 0;
}
.previsao-compare-metrics div {
    display: flex;
    justify-content: space-between;
    gap: .75rem;
    font-size: .88rem;
}
.previsao-compare-metrics dt { margin: 0; color: var(--muted); }
.previsao-compare-metrics dd {
    margin: 0;
    font-weight: 700;
    text-align: right;
    color: var(--text);
}
.previsao-compare-metrics dd.pos { color: var(--receita); }
.previsao-compare-diff {
    margin: 0;
    padding: .75rem 1rem;
    border-radius: var(--radius);
    background: color-mix(in srgb, var(--receita) 12%, var(--surface));
    border: 1px solid color-mix(in srgb, var(--receita) 35%, var(--border));
    color: var(--text);
    font-size: .9rem;
    font-weight: 600;
}
#prev-compare-toggle.is-active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.previsao-chart-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: .75rem; flex-wrap: wrap;
}
.previsao-chart-head .section-title { margin: 0; }
.previsao-legend {
    display: flex; gap: 1rem; flex-wrap: wrap;
    font-size: .82rem; color: var(--muted);
}
.previsao-legend i {
    display: inline-block; width: 14px; height: 3px; border-radius: 2px;
    margin-right: .35rem; vertical-align: middle;
}
.previsao-legend .lg-pat { background: var(--accent); height: 3px; }
.previsao-legend .lg-aportes { background: var(--muted); }
.previsao-legend .lg-meta { background: var(--saldo); }
.previsao-chart-wrap { position: relative; margin-top: .75rem; }
.previsao-chart-wrap svg { width: 100%; height: auto; display: block; }
.previsao-chart-wrap--js { height: 360px; }
.previsao-chart-wrap--js canvas { width: 100% !important; height: 100% !important; }
.previsao-tip {
    position: absolute; pointer-events: none;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 8px; padding: .4rem .6rem; font-size: .8rem;
    box-shadow: 0 8px 24px rgba(0,0,0,.25); white-space: nowrap; z-index: 3;
}
.previsao-table-card tbody tr.is-goal td { background: color-mix(in srgb, var(--saldo) 16%, transparent); }
.apos-real-grid { grid-template-columns: minmax(200px, 280px); }
.apos-inicial-form, .apos-cell-form { margin: 0; }
.sidebar-nav a { white-space: normal; }
#onboarding-overlay[hidden] { display: none !important; }
body.onboarding-open { overflow: hidden; }
@media (max-width: 900px) {
    .previsao-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .previsao-compare-grid { grid-template-columns: 1fr; }
    .apos-real-grid { grid-template-columns: 1fr; }
}
