*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root,
[data-theme="light"] {
    --bg: #f5f7fa;
    --surface: #ffffff;
    --surface-2: #f0f2f5;
    --border: #e2e8f0;
    --text: #1e293b;
    --text-muted: #64748b;
    --primary: #6c63ff;
    --primary-dark: #5a52d5;
    --receita: #059669;
    --receita-bg: rgba(5, 150, 105, 0.1);
    --despesa: #dc2626;
    --despesa-bg: rgba(220, 38, 38, 0.1);
    --warning: #d97706;
    --warning-bg: rgba(217, 119, 6, 0.1);
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 24px rgba(15, 23, 42, 0.08);
    --overlay: rgba(15, 23, 42, 0.35);
    --auth-gradient: linear-gradient(160deg, #f0f4ff 0%, #e8eeff 50%, #f5f7fa 100%);
    --nav-height: 64px;
    --header-height: 140px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

[data-theme="dark"] {
    --bg: #0f0f1a;
    --surface: #1a1a2e;
    --surface-2: #22223a;
    --border: #2d2d4a;
    --text: #e8e8f0;
    --text-muted: #8888a8;
    --primary: #6c63ff;
    --primary-dark: #5a52d5;
    --receita: #00c896;
    --receita-bg: rgba(0, 200, 150, 0.12);
    --despesa: #ff6b6b;
    --despesa-bg: rgba(255, 107, 107, 0.12);
    --warning: #ffc107;
    --warning-bg: rgba(255, 193, 7, 0.12);
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    --overlay: rgba(0, 0, 0, 0.6);
    --auth-gradient: linear-gradient(160deg, #0f0f1a 0%, #1a1a3e 50%, #0f0f1a 100%);
}

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100dvh;
    overflow-x: hidden;
}

/* ── AUTH ── */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100dvh;
    padding: 24px 16px;
    background: var(--auth-gradient);
    position: relative;
}

.auth-theme-wrap {
    position: absolute;
    top: 16px;
    right: 16px;
}

.auth-container {
    width: 100%;
    max-width: 400px;
}

.auth-logo { text-align: center; margin-bottom: 28px; }

.logo-box {
    width: 180px;
    height: 44px;
    margin: 0 auto 12px;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
}

[data-theme="light"] .logo-box {
    background-image: url('../logo/logocolorida.png');
}

[data-theme="dark"] .logo-box {
    background-image: url('../logo/logobranca.png');
}

.auth-logo p { color: var(--text-muted); font-size: 0.875rem; margin-top: 4px; }

/* ── PERFIL PF/PJ ── */
.perfil-badge {
    border: 1px solid var(--primary);
    background: rgba(108, 99, 255, 0.12);
    color: var(--primary);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 20px;
    cursor: pointer;
    flex-shrink: 0;
    letter-spacing: 0.3px;
}

.modal-perfil {
    z-index: 500;
    align-items: center;
    padding: 16px;
}

.modal-perfil-content {
    border-radius: var(--radius);
    max-width: 420px;
    text-align: center;
}

.perfil-title {
    font-size: 1.2rem;
    margin-bottom: 6px;
}

.perfil-subtitle {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 20px;
}

.perfil-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

.perfil-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 18px 12px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-2);
    color: var(--text);
    cursor: pointer;
    transition: border-color 0.2s, transform 0.15s;
    touch-action: manipulation;
}

.perfil-card:active { transform: scale(0.98); }

.perfil-card[data-perfil="pf"]:hover,
.perfil-card[data-perfil="pf"]:focus {
    border-color: var(--primary);
}

.perfil-card[data-perfil="pj"]:hover,
.perfil-card[data-perfil="pj"]:focus {
    border-color: var(--receita);
}

.perfil-icon { font-size: 1.75rem; line-height: 1; }

.perfil-card strong { font-size: 0.9rem; }

.perfil-card small {
    color: var(--text-muted);
    font-size: 0.75rem;
    line-height: 1.3;
}

#btn-perfil-cancel {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
    margin-top: 4px;
}

@media (max-width: 380px) {
    .perfil-options { grid-template-columns: 1fr; }
}

/* ── CONFIGURAÇÕES ADMIN ── */
.modal-config-content {
    border-radius: var(--radius) var(--radius) 0 0;
    max-height: 90dvh;
}

#modal-lancamento {
    align-items: center;
    padding: 16px;
}

.modal-lancamento-content {
    border-radius: var(--radius);
    max-width: 480px;
    max-height: min(92dvh, 720px);
    overflow-y: auto;
    padding: 20px 16px;
    box-shadow: var(--shadow);
}

.modal-lancamento-content .tipo-toggle {
    margin-bottom: 16px;
}

.config-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.config-tab {
    flex: 1;
    padding: 10px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
}

.config-tab.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.config-panel { display: none; }
.config-panel.active { display: block; }

.config-section-title {
    font-size: 0.9rem;
    margin-bottom: 12px;
    color: var(--text-muted);
}

.config-check.form-group label.check-label {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 0;
    font-size: 0.9rem;
    color: var(--text);
    text-transform: none;
    letter-spacing: 0;
    cursor: pointer;
    line-height: 1.4;
}

.config-check input[type="checkbox"] {
    width: 22px;
    height: 22px;
    min-width: 22px;
    padding: 0;
    margin: 0;
    border: 2px solid var(--border);
    border-radius: 4px;
    background: var(--surface);
    -webkit-appearance: checkbox;
    appearance: auto;
    accent-color: var(--primary);
    cursor: pointer;
    flex-shrink: 0;
}

.admin-user-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
    max-height: 280px;
    overflow-y: auto;
}

.admin-user-item {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px;
}

.admin-user-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 8px;
}

.admin-user-item strong { font-size: 0.9rem; display: block; }
.admin-user-item small { color: var(--text-muted); font-size: 0.75rem; }

.admin-badge {
    font-size: 0.65rem;
    padding: 2px 8px;
    border-radius: 20px;
    background: rgba(108, 99, 255, 0.15);
    color: var(--primary);
    font-weight: 700;
    text-transform: uppercase;
    flex-shrink: 0;
}

.admin-user-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.admin-user-actions button {
    font-size: 0.75rem;
    padding: 5px 10px;
}

.auth-tabs {
    display: flex;
    background: var(--surface);
    border-radius: var(--radius);
    padding: 4px;
    margin-bottom: 24px;
}

.auth-tab {
    flex: 1;
    padding: 10px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
}

.auth-tab.active {
    background: var(--primary);
    color: #fff;
}

.auth-tab.hidden { display: none; }

.auth-form { display: none; }
.auth-form.active { display: block; }

/* ── FORMS ── */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group input:not([type="checkbox"]):not([type="radio"]),
.form-group select {
    width: 100%;
    padding: 12px 14px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
    -webkit-appearance: none;
}

.form-group input:not([type="checkbox"]):not([type="radio"]):focus,
.form-group select:focus { border-color: var(--primary); }

.form-row { display: flex; gap: 12px; }
.flex-1 { flex: 1; }

/* ── BUTTONS ── */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    touch-action: manipulation;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:active { transform: scale(0.98); }

.btn-block { width: 100%; }

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}
.btn-icon:hover { color: var(--text); background: var(--surface-2); }

.btn-danger {
    background: transparent;
    color: var(--despesa);
    border: 1px solid var(--despesa);
    padding: 6px 12px;
    font-size: 0.8rem;
    border-radius: 6px;
    cursor: pointer;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-weight: 600;
}

/* ── ALERTS ── */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    margin-top: 16px;
}
.alert-error { background: var(--despesa-bg); color: var(--despesa); border: 1px solid var(--despesa); }
.hidden { display: none !important; }

/* ── APP HEADER ── */
.app-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--surface);
    padding: 12px 16px 16px;
    border-bottom: 1px solid var(--border);
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    gap: 8px;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
    overflow: hidden;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.user-greeting {
    font-size: 0.875rem;
    line-height: 1.35;
    color: var(--text-muted);
}
.user-greeting strong { color: var(--text); font-weight: 600; }

#btn-theme .icon-sun,
#btn-theme .icon-moon { display: none; }
[data-theme="light"] #btn-theme .icon-moon { display: block; }
[data-theme="dark"] #btn-theme .icon-sun { display: block; }

.saldo-card {
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    border-radius: var(--radius);
    padding: 16px 20px;
    text-align: center;
}

.saldo-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 1px; opacity: 0.8; }
.saldo-value { display: block; font-size: 1.75rem; font-weight: 700; margin: 4px 0 8px; }
.saldo-details { display: flex; justify-content: center; gap: 16px; font-size: 0.8rem; opacity: 0.85; }

/* ── MAIN ── */
.app-main {
    padding: 16px;
    padding-bottom: calc(var(--nav-height) + var(--safe-bottom) + 16px);
    max-width: 600px;
    margin: 0 auto;
}

.page { display: none; }
.page.active { display: block; }

.page-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0;
}

.page-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.page-header-row .page-title { flex: 1; min-width: 0; }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 16px;
}

/* ── TIPO TOGGLE ── */
.tipo-toggle {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.tipo-btn {
    flex: 1;
    padding: 12px;
    border: 2px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.tipo-btn.active[data-tipo="receita"] {
    border-color: var(--receita);
    background: var(--receita-bg);
    color: var(--receita);
}

.tipo-btn.active[data-tipo="despesa"] {
    border-color: var(--despesa);
    background: var(--despesa-bg);
    color: var(--despesa);
}

/* ── EXTRATO LIST ── */
.list-container { display: flex; flex-direction: column; gap: 8px; }

.list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
}

.list-item-icon {
    width: 40px; height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.list-item-icon.receita { background: var(--receita-bg); color: var(--receita); }
.list-item-icon.despesa { background: var(--despesa-bg); color: var(--despesa); }

.list-item-info { flex: 1; min-width: 0; }
.list-item-info .desc { font-weight: 600; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item-info .meta { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }

.list-item-valor { font-weight: 700; font-size: 0.95rem; white-space: nowrap; }
.list-item-valor.receita { color: var(--receita); }
.list-item-valor.despesa { color: var(--despesa); }

.list-item-actions { flex-shrink: 0; }

.list-item-agendado {
    border-style: dashed;
    opacity: 0.92;
}

.list-item-agendado .list-item-icon {
    border: 1px dashed currentColor;
    background: transparent;
}

.extrato-mes-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0 0 10px 2px;
}

.empty-state {
    text-align: center;
    padding: 48px 16px;
    color: var(--text-muted);
}

/* ── CLIENTES ── */
.clientes-grid { display: flex; flex-direction: column; gap: 12px; }

.cliente-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    cursor: pointer;
    transition: border-color 0.2s;
}
.cliente-card:active { border-color: var(--primary); }

.cliente-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.cliente-card-header h3 { font-size: 1rem; font-weight: 700; flex: 1; min-width: 0; }

.cliente-card-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.btn-del-cliente {
    background: var(--despesa-bg);
    color: var(--despesa);
    border: 1px solid var(--despesa);
    padding: 4px 8px;
    font-size: 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
}

.cliente-totais {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}

.cliente-total-item { text-align: center; }
.cliente-total-item .label { display: block; font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; }
.cliente-total-item .value { display: block; font-size: 0.85rem; font-weight: 700; margin-top: 2px; }

.cliente-historico { border-top: 1px solid var(--border); padding-top: 10px; }
.cliente-historico .hist-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 0.8rem;
}

.status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}
.status-badge.pago { background: var(--receita-bg); color: var(--receita); }
.status-badge.pendente { background: var(--warning-bg); color: var(--warning); }
.status-badge.atrasado { background: var(--despesa-bg); color: var(--despesa); }

/* ── MODAL ── */
.modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: var(--overlay);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: var(--surface);
    border-radius: var(--radius) var(--radius) 0 0;
    width: 100%;
    max-width: 600px;
    max-height: 85dvh;
    overflow-y: auto;
    padding: 20px 16px calc(20px + var(--safe-bottom));
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.modal-header h3 { font-size: 1.1rem; }
.modal-close { font-size: 1.5rem; line-height: 1; }

.modal-historico { margin-top: 20px; border-top: 1px solid var(--border); padding-top: 16px; }
.modal-historico h4 { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 10px; text-transform: uppercase; }

/* ── RESUMO ── */
.resumo-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}

.resumo-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    text-align: center;
}

.resumo-card.receita { border-color: rgba(0,200,150,0.3); }
.resumo-card.despesa { border-color: rgba(255,107,107,0.3); }
.resumo-card.saldo { border-color: rgba(108,99,255,0.3); }
.resumo-card.aberto { border-color: rgba(255,193,7,0.3); }

.resumo-label { display: block; font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.resumo-value { display: block; font-size: 1.1rem; font-weight: 700; margin-top: 4px; }
.resumo-card.receita .resumo-value { color: var(--receita); }
.resumo-card.despesa .resumo-value { color: var(--despesa); }
.resumo-card.saldo .resumo-value { color: var(--primary); }
.resumo-card.aberto .resumo-value { color: var(--warning); }

.chart-card h3, .mes-atual-card h3 {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.chart-card canvas { max-height: 220px; }

.mes-atual-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    text-align: center;
}
.mes-atual-grid .label { display: block; font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; }
.mes-atual-grid .value { display: block; font-size: 1rem; font-weight: 700; margin-top: 4px; }
.mes-atual-grid .value.receita { color: var(--receita); }
.mes-atual-grid .value.despesa { color: var(--despesa); }

/* ── BOTTOM NAV ── */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    align-items: stretch;
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding-bottom: var(--safe-bottom);
    max-width: 600px;
    margin: 0 auto;
    box-shadow: 0 -2px 16px rgba(15, 23, 42, 0.05);
}

@media (min-width: 601px) {
    .bottom-nav { left: 50%; transform: translateX(-50%); }
}

.nav-group {
    flex: 1;
    display: flex;
    align-items: stretch;
    min-width: 0;
}

.nav-group-left { justify-content: space-evenly; }
.nav-group-right { justify-content: space-evenly; }

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    min-height: var(--nav-height);
    min-width: 0;
    padding: 8px 4px 10px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.65rem;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.2s;
    touch-action: manipulation;
}

.nav-group .nav-item {
    flex: 1;
    max-width: 88px;
}

.nav-item.active { color: var(--primary); }
.nav-item svg { transition: transform 0.2s; flex-shrink: 0; }
.nav-item.active:not(.nav-main) svg { transform: scale(1.06); }

.nav-main {
    flex: 0 0 72px;
    width: 72px;
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
}

.nav-main-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    flex-shrink: 0;
    transition: transform 0.15s ease, background 0.15s ease;
}

.nav-main:active .nav-main-btn {
    transform: scale(0.94);
}

.nav-main.active .nav-main-btn {
    background: var(--primary-dark);
}

.nav-main-btn svg {
    stroke: #fff;
    width: 22px;
    height: 22px;
}

/* ── DASHBOARD TIMELINE ── */
.dash-timeline-card {
    padding: 8px 4px 16px;
    overflow: visible;
}

.dash-timeline-sub {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 8px;
    padding: 0 8px;
}

.dash-timeline {
    overflow: visible;
}

.dash-timeline-chart {
    position: relative;
    height: 230px;
    padding: 8px 4px 0;
    overflow: visible;
}

.dash-timeline-svg {
    position: absolute;
    left: 0;
    right: 0;
    top: 36px;
    height: 130px;
    width: 100%;
    overflow: visible;
    pointer-events: none;
}

.dash-timeline-area {
    fill: url(#dash-area-grad);
    opacity: 0;
}

.dash-timeline-path {
    fill: none;
    stroke: url(#dash-line-grad);
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
}

.dash-timeline-animate .dash-timeline-area {
    animation: dashAreaIn 1s ease 0.5s forwards;
}

.dash-timeline-animate .dash-timeline-path {
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    animation: dashLineDraw 1.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes dashLineDraw {
    to { stroke-dashoffset: 0; }
}

@keyframes dashAreaIn {
    to { opacity: 1; }
}

.dash-timeline-points {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: stretch;
    padding: 0 2px;
}

.dash-timeline-point {
    flex: 1;
    position: relative;
    border: none;
    background: transparent;
    padding: 0;
    cursor: pointer;
    min-width: 0;
    opacity: 1;
    transform: none;
}

.dash-timeline-animate .dash-timeline-point {
    opacity: 0;
    transform: translateY(8px);
    animation: dashPointIn 0.55s cubic-bezier(0.34, 1.4, 0.64, 1) var(--point-delay, 0s) forwards;
}

.dash-timeline-chart:not(.dash-timeline-animate) .dash-timeline-area {
    opacity: 1;
}

.dash-timeline-chart:not(.dash-timeline-animate) .dash-timeline-path {
    stroke-dasharray: none;
    stroke-dashoffset: 0;
}

@keyframes dashPointIn {
    to { opacity: 1; transform: translateY(0); }
}

.dash-timeline-value {
    position: absolute;
    left: 50%;
    top: calc(36px + (var(--point-y, 40) * 1.45px) - 46px);
    transform: translateX(-50%) scale(0.92);
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
    transition: all 0.35s cubic-bezier(0.34, 1.2, 0.64, 1);
    z-index: 2;
    max-width: 92px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dash-timeline-point:first-child .dash-timeline-value {
    left: 50%;
    transform: translateX(-30%) scale(0.92);
}

.dash-timeline-point:last-child .dash-timeline-value {
    left: 50%;
    transform: translateX(-70%) scale(0.92);
}

.dash-timeline-point.active .dash-timeline-value {
    background: var(--primary);
    color: #fff;
    padding: 6px 12px;
    border-radius: 10px;
    font-size: 0.78rem;
    transform: translateX(-50%) scale(1);
    box-shadow: 0 4px 14px rgba(108, 99, 255, 0.4);
    max-width: none;
    overflow: visible;
}

.dash-timeline-point:first-child.active .dash-timeline-value {
    transform: translateX(-20%) scale(1);
}

.dash-timeline-point:last-child.active .dash-timeline-value {
    transform: translateX(-80%) scale(1);
}

.dash-timeline-dot {
    position: absolute;
    left: 50%;
    top: calc(36px + (var(--point-y, 40) * 1.45px));
    transform: translate(-50%, -50%) scale(1);
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: var(--surface);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
    transition: all 0.35s cubic-bezier(0.34, 1.2, 0.64, 1);
}

.dash-timeline-dot span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    opacity: 0.45;
    transition: all 0.35s ease;
}

.dash-timeline-point:hover .dash-timeline-dot {
    transform: translate(-50%, -50%) scale(1.12);
    border-color: var(--primary);
}

.dash-timeline-point.active .dash-timeline-dot {
    border-color: var(--primary);
    transform: translate(-50%, -50%) scale(1.2);
    animation: dashDotPulse 2s ease-in-out infinite;
}

.dash-timeline-point.active .dash-timeline-dot span {
    background: var(--primary);
    opacity: 1;
    transform: scale(1.15);
}

@keyframes dashDotPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(108, 99, 255, 0.45); }
    50% { box-shadow: 0 0 0 10px rgba(108, 99, 255, 0); }
}

.dash-timeline-connector {
    position: absolute;
    left: 50%;
    top: calc(36px + (var(--point-y, 40) * 1.45px) + 14px);
    bottom: 36px;
    width: 0;
    border-left: 2px dotted var(--border);
    transform: translateX(-50%) scaleY(0);
    transform-origin: top;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.34, 1.2, 0.64, 1);
}

.dash-timeline-point.active .dash-timeline-connector {
    opacity: 1;
    transform: translateX(-50%) scaleY(1);
    border-color: var(--text-muted);
}

.dash-timeline-month {
    position: absolute;
    left: 50%;
    bottom: 6px;
    transform: translateX(-50%);
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.04em;
    padding: 5px 12px;
    border-radius: 10px;
    border: 1px solid transparent;
    transition: all 0.35s cubic-bezier(0.34, 1.2, 0.64, 1);
}

.dash-timeline-point.active .dash-timeline-month {
    color: var(--primary);
    border-color: var(--primary);
    background: rgba(108, 99, 255, 0.08);
}

.dash-mes-card {
    animation: dashCardIn 0.5s ease 0.3s both;
}

@keyframes dashCardIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.dash-mes-card { margin-top: 16px; }

.dash-mes-title {
    font-size: 1rem;
    margin-bottom: 14px;
}

.dash-mes-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    text-align: center;
}

.dash-mes-label {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.dash-mes-valor {
    display: block;
    font-size: 0.95rem;
    font-weight: 700;
}

.dash-mes-valor.receita { color: var(--receita); }
.dash-mes-valor.despesa { color: var(--despesa); }

/* ── TOAST ── */
.toast {
    position: fixed;
    bottom: calc(var(--nav-height) + var(--safe-bottom) + 16px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--surface-2);
    color: var(--text);
    padding: 12px 24px;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 600;
    box-shadow: var(--shadow);
    z-index: 300;
    white-space: nowrap;
    animation: toastIn 0.3s ease;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(-50%) translateY(20px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ── AGENDA TABS ── */
.agenda-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
}
.agenda-tab {
    flex: 1;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
}
.agenda-tab.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}
.agenda-panel { display: none; }
.agenda-panel.active { display: block; }
.recorrente-hint { color: var(--receita); }

/* ── PARCELAS ── */
.parcelar-fields {
    padding: 12px;
    margin-bottom: 12px;
    background: var(--surface-2);
    border-radius: var(--radius);
    border: 1px dashed var(--border);
}
.parcelar-total {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--despesa);
    margin: 0;
}
.resumo-sub {
    display: block;
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 4px;
    font-weight: 500;
}
.parcelas-list { display: flex; flex-direction: column; gap: 10px; }
.parc-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    cursor: pointer;
    transition: border-color 0.2s;
}
.parc-card:active { border-color: var(--primary); }
.parc-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 8px;
}
.parc-card-header h4 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    flex: 1;
}
.parc-badge {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 20px;
    white-space: nowrap;
}
.parc-badge.ok { background: rgba(34, 197, 94, 0.15); color: var(--receita); }
.parc-badge.warn { background: rgba(251, 191, 36, 0.15); color: #d97706; }
.parc-badge.danger { background: rgba(239, 68, 68, 0.15); color: var(--despesa); }
.parc-progress {
    height: 6px;
    background: var(--surface-2);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}
.parc-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #8b5cf6);
    border-radius: 3px;
    transition: width 0.3s;
}
.parc-progress-bar.receita-bar {
    background: linear-gradient(90deg, #22c55e, #16a34a);
}
.parc-card-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
}
.parc-card-meta strong { color: var(--text); }
.modal-parcelamento { max-height: 90vh; overflow-y: auto; }
.parc-modal-resumo {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 12px;
    text-align: center;
    font-size: 0.75rem;
}
.parc-modal-resumo div {
    background: var(--surface-2);
    padding: 8px 4px;
    border-radius: var(--radius);
}
.parc-modal-resumo span { display: block; color: var(--text-muted); font-size: 0.65rem; }
.parc-modal-resumo strong { font-size: 0.85rem; }
.parc-modal-lista { max-height: 220px; overflow-y: auto; margin-bottom: 12px; }
.parc-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.8rem;
}
.parc-item:last-child { border-bottom: none; }
.parc-item-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    flex-shrink: 0;
    background: var(--surface-2);
}
.parc-item.pago .parc-item-num,
.parc-item.adiantado .parc-item-num { background: rgba(34, 197, 94, 0.15); color: var(--receita); }
.parc-item.atrasado .parc-item-num { background: rgba(239, 68, 68, 0.15); color: var(--despesa); }
.parc-item-info { flex: 1; }
.parc-item-info .venc { color: var(--text-muted); font-size: 0.7rem; }
.parc-item-valor { font-weight: 700; white-space: nowrap; }
.parc-modal-actions .btn { margin-bottom: 8px; }
.parc-modal-actions .btn:last-child { margin-bottom: 0; }
.parcelas-resumo { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 400px) {
    .parcelas-resumo { grid-template-columns: 1fr; }
    .nav-item { font-size: 0.58rem; padding: 8px 2px 10px; }
    .nav-item:not(.nav-main) svg { width: 20px; height: 20px; }
    .nav-main-btn { width: 36px; height: 36px; }
    .nav-main-btn svg { width: 20px; height: 20px; }
}

/* ── RESPONSIVE ── */
@media (min-width: 768px) {
    .auth-container { max-width: 420px; }
    .app-main { max-width: 640px; }
    .resumo-cards { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 360px) {
    .saldo-value { font-size: 1.5rem; }
    .resumo-value { font-size: 0.95rem; }
    .cliente-totais { grid-template-columns: 1fr; gap: 4px; }
}
