/* ============================================================ */
/* assets/css/style.css — FinancePro v2                        */
/* Design moderno inspirado em fintechs (Nubank, Inter, Wise)  */
/* ============================================================ */

/* ---- Google Fonts (auto-hospedadas via CSS nativo) ---------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

:root {
    /* ---- Paleta principal ---------------------------------- */
    --primary:        #6366f1;
    --primary-dark:   #4f46e5;
    --primary-light:  #a5b4fc;
    --primary-bg:     rgba(99,102,241,.08);

    --success:        #10b981;
    --success-light:  rgba(16,185,129,.12);
    --danger:         #ef4444;
    --danger-light:   rgba(239,68,68,.12);
    --warning:        #f59e0b;
    --warning-light:  rgba(245,158,11,.12);
    --info:           #3b82f6;
    --info-light:     rgba(59,130,246,.12);

    /* ---- Superfícies (tema claro) ------------------------- */
    --bg:             #f0f2f8;
    --bg-card:        #ffffff;
    --bg-sidebar:     #0f172a;
    --bg-header:      #ffffff;
    --bg-hover:       #f8fafc;
    --bg-input:       #f8fafc;

    /* ---- Texto -------------------------------------------- */
    --text:           #0f172a;
    --text-secondary: #64748b;
    --text-tertiary:  #94a3b8;
    --text-inverse:   #ffffff;

    /* ---- Bordas / sombras --------------------------------- */
    --border:         #e2e8f0;
    --border-focus:   #6366f1;
    --shadow-sm:      0 1px 3px rgba(0,0,0,.06),0 1px 2px rgba(0,0,0,.04);
    --shadow:         0 4px 16px rgba(0,0,0,.08);
    --shadow-md:      0 8px 32px rgba(0,0,0,.10);
    --shadow-lg:      0 20px 60px rgba(0,0,0,.14);

    /* ---- Medidas ------------------------------------------ */
    --sidebar-w:      260px;
    --header-h:       68px;
    --radius:         14px;
    --radius-sm:      8px;
    --radius-lg:      20px;
    --radius-xl:      28px;
    --transition:     all .25s cubic-bezier(.4,0,.2,1);

    /* Aliases para compatibilidade reversa */
    --primary-color:  var(--primary);
    --primary-hover:  var(--primary-dark);
    --success-color:  var(--success);
    --danger-color:   var(--danger);
    --warning-color:  var(--warning);
    --bg-primary:     var(--bg);
    --bg-secondary:   var(--bg);
    --border-color:   var(--border);
}

/* ============================================================ */
/* RESET & BASE                                                  */
/* ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; display: block; }

/* ============================================================ */
/* LAYOUT                                                        */
/* ============================================================ */
.app-container {
    display: flex;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-w);
    min-width: 0;
    transition: var(--transition);
}

/* ============================================================ */
/* SIDEBAR                                                       */
/* ============================================================ */
.sidebar {
    width: var(--sidebar-w);
    background: var(--bg-sidebar);
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    z-index: 200;
    overflow-y: auto;
    overflow-x: hidden;
    transition: var(--transition);
    border-right: 1px solid rgba(255,255,255,.05);
}

/* Scrollbar fina na sidebar */
.sidebar::-webkit-scrollbar { width: 3px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 2px; }

.sidebar-header {
    padding: 28px 22px 20px;
    border-bottom: 1px solid rgba(255,255,255,.06);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 6px;
}

.sidebar-logo-icon {
    width: 40px; height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem;
    box-shadow: 0 4px 14px rgba(99,102,241,.4);
}

.sidebar-logo h2 {
    font-size: 1.25rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: -.3px;
}

.sidebar-user {
    font-size: .78rem;
    color: rgba(255,255,255,.45);
    padding-left: 52px;
}

/* Grupos do menu */
.sidebar-group-label {
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: rgba(255,255,255,.3);
    padding: 18px 22px 8px;
}

.sidebar-menu { padding: 10px 0 20px; flex: 1; }
.sidebar-menu ul { list-style: none; }

.sidebar-menu li a {
    display: flex;
    align-items: center;
    padding: 11px 22px;
    color: rgba(255,255,255,.6);
    text-decoration: none;
    border-left: 3px solid transparent;
    border-radius: 0;
    transition: var(--transition);
    font-size: .88rem;
    font-weight: 500;
    gap: 0;
    position: relative;
}

.sidebar-menu li a .icon {
    width: 36px; height: 36px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem;
    margin-right: 12px;
    flex-shrink: 0;
    background: transparent;
    transition: var(--transition);
}

.sidebar-menu li a:hover {
    color: #fff;
    background: rgba(255,255,255,.06);
    border-left-color: rgba(99,102,241,.5);
}

.sidebar-menu li a:hover .icon {
    background: rgba(99,102,241,.2);
}

.sidebar-menu li a.active {
    color: #fff;
    background: rgba(99,102,241,.15);
    border-left-color: var(--primary);
    font-weight: 600;
}

.sidebar-menu li a.active .icon {
    background: var(--primary);
    box-shadow: 0 4px 12px rgba(99,102,241,.4);
}

.sidebar-divider {
    border: none;
    border-top: 1px solid rgba(255,255,255,.06);
    margin: 10px 22px;
}

/* ============================================================ */
/* HEADER                                                        */
/* ============================================================ */
.top-header {
    background: var(--bg-header);
    height: var(--header-h);
    padding: 0 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0; z-index: 100;
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(12px);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.breadcrumb {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Toggle menu mobile */
.menu-toggle-btn {
    display: none;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    width: 40px; height: 40px;
    align-items: center; justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--text);
    transition: var(--transition);
}

.menu-toggle-btn:hover { background: var(--border); }

/* Botão de tema */
.theme-btn {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem;
    cursor: pointer;
    color: var(--text);
    transition: var(--transition);
}

.theme-btn:hover { background: var(--border); transform: scale(1.05); }

/* Notificações */
.notification-dropdown { position: relative; }

.notification-btn {
    position: relative;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem;
    cursor: pointer;
    color: var(--text);
    transition: var(--transition);
}

.notification-btn:hover { background: var(--border); }

.notification-badge {
    position: absolute;
    top: -4px; right: -4px;
    background: var(--danger);
    color: #fff;
    border-radius: 50%;
    min-width: 18px; height: 18px;
    font-size: .65rem;
    font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid var(--bg-header);
    padding: 0 3px;
}

.notification-panel {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 360px;
    max-height: 480px;
    z-index: 1000;
    border: 1px solid var(--border);
    overflow: hidden;
    animation: slideDown .2s ease;
}

.notification-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 20px 14px;
    border-bottom: 1px solid var(--border);
}

.notification-panel-header h3 { font-size: .95rem; font-weight: 700; }

.mark-all-read {
    background: none;
    border: none;
    color: var(--primary);
    font-size: .8rem;
    cursor: pointer;
    font-weight: 600;
}

.notification-list { overflow-y: auto; max-height: 380px; }

.notification-item {
    display: flex;
    gap: 12px;
    padding: 14px 18px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: var(--transition);
    align-items: flex-start;
}

.notification-item:hover { background: var(--bg-hover); }
.notification-item.unread { background: var(--primary-bg); }
.notification-item:last-child { border-bottom: none; }

.notification-item-icon {
    width: 36px; height: 36px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
    background: var(--bg);
}

.notification-item-content { flex: 1; min-width: 0; }
.notification-item-title { font-size: .85rem; font-weight: 600; margin-bottom: 2px; }
.notification-item-message { font-size: .8rem; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notification-item-time { font-size: .72rem; color: var(--text-tertiary); margin-top: 3px; }

.notification-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.notification-empty .empty-icon { font-size: 2.5rem; margin-bottom: 10px; }

/* User dropdown */
.user-dropdown { position: relative; }

.user-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 50px;
    padding: 5px 14px 5px 5px;
    cursor: pointer;
    color: var(--text);
    transition: var(--transition);
}

.user-btn:hover { background: var(--border); }

.user-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700;
    font-size: .9rem;
}

.user-name { font-size: .85rem; font-weight: 600; }
.dropdown-arrow { font-size: .55rem; color: var(--text-tertiary); }

.user-menu-panel {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    min-width: 230px;
    z-index: 1000;
    border: 1px solid var(--border);
    overflow: hidden;
    animation: slideDown .2s ease;
}

.user-menu-panel a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 18px;
    color: var(--text);
    font-size: .88rem;
    transition: var(--transition);
}

.user-menu-panel a:hover { background: var(--bg-hover); }

/* ============================================================ */
/* CARDS                                                         */
/* ============================================================ */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 24px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

/* Stat cards — design fintech */
.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 24px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--card-accent, var(--primary)), transparent);
}

.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }

.stat-card-inner { display: flex; justify-content: space-between; align-items: flex-start; }

.stat-label {
    font-size: .78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .8px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.stat-value {
    font-size: 1.85rem;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -.5px;
    color: var(--text);
}

.stat-value.positive { color: var(--success); }
.stat-value.negative { color: var(--danger); }

.stat-change {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 8px;
    font-size: .78rem;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 20px;
}

.stat-change.up { background: var(--success-light); color: var(--success); }
.stat-change.down { background: var(--danger-light); color: var(--danger); }
.stat-change.neutral { background: var(--bg); color: var(--text-secondary); }

.stat-icon {
    width: 52px; height: 52px;
    border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

/* ============================================================ */
/* FORMULÁRIOS                                                   */
/* ============================================================ */
.form-group { margin-bottom: 18px; }

label {
    display: block;
    font-size: .82rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    letter-spacing: .2px;
}

.form-control {
    width: 100%;
    padding: 11px 14px;
    background: var(--bg-input);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: .9rem;
    font-family: inherit;
    transition: var(--transition);
    outline: none;
    -webkit-appearance: none;
}

.form-control:focus {
    border-color: var(--primary);
    background: var(--bg-card);
    box-shadow: 0 0 0 3px rgba(99,102,241,.12);
}

.form-control::placeholder { color: var(--text-tertiary); }

.form-control.error {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(239,68,68,.1);
}

select.form-control {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2364748b' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

textarea.form-control { resize: vertical; min-height: 90px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* Ícone no input */
.input-icon-wrapper { position: relative; }
.input-icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); font-size: 1rem; pointer-events: none; }
.input-icon + .form-control { padding-left: 40px; }

/* ============================================================ */
/* BOTÕES                                                        */
/* ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    border: 1.5px solid transparent;
    font-size: .88rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    text-decoration: none;
    line-height: 1;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-sm { padding: 7px 14px; font-size: .8rem; border-radius: 7px; }
.btn-lg { padding: 13px 28px; font-size: 1rem; border-radius: var(--radius); }
.btn-block { width: 100%; justify-content: center; }

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    box-shadow: 0 4px 14px rgba(99,102,241,.3);
}
.btn-primary:hover { box-shadow: 0 6px 20px rgba(99,102,241,.4); color: #fff; }

.btn-secondary { background: var(--bg); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--border); }

.btn-success {
    background: linear-gradient(135deg, var(--success), #059669);
    color: #fff;
    box-shadow: 0 4px 14px rgba(16,185,129,.25);
}
.btn-success:hover { box-shadow: 0 6px 20px rgba(16,185,129,.35); color: #fff; }

.btn-danger {
    background: linear-gradient(135deg, #f87171, var(--danger));
    color: #fff;
    box-shadow: 0 4px 14px rgba(239,68,68,.25);
}
.btn-danger:hover { box-shadow: 0 6px 20px rgba(239,68,68,.35); color: #fff; }

.btn-warning { background: linear-gradient(135deg, #fbbf24, var(--warning)); color: #fff; }
.btn-info { background: linear-gradient(135deg, #60a5fa, var(--info)); color: #fff; }

.btn-ghost { background: transparent; color: var(--text-secondary); border-color: transparent; }
.btn-ghost:hover { background: var(--bg); color: var(--text); }

.btn-outline-primary { background: transparent; color: var(--primary); border-color: var(--primary); }
.btn-outline-primary:hover { background: var(--primary); color: #fff; }

.btn-outline-danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn-outline-danger:hover { background: var(--danger); color: #fff; }

.btn-outline-success { background: transparent; color: var(--success); border-color: var(--success); }
.btn-outline-success:hover { background: var(--success); color: #fff; }

.btn-light { background: var(--bg-card); color: var(--text); border-color: var(--border); }
.btn-light:hover { background: var(--bg); }

.btn-icon {
    width: 38px; height: 38px;
    padding: 0; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 1rem;
}

.btn-icon.btn-sm { width: 30px; height: 30px; font-size: .85rem; }
.btn-icon.btn-lg { width: 48px; height: 48px; font-size: 1.2rem; }

/* ============================================================ */
/* BADGES                                                        */
/* ============================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 11px;
    border-radius: 20px;
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    white-space: nowrap;
}

.badge-success { background: var(--success-light); color: var(--success); }
.badge-danger  { background: var(--danger-light);  color: var(--danger);  }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-info    { background: var(--info-light);    color: var(--info);    }
.badge-primary { background: var(--primary-bg);    color: var(--primary); }
.badge-secondary { background: var(--bg); color: var(--text-secondary); }

/* ============================================================ */
/* TABELAS                                                       */
/* ============================================================ */
.table-container, .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: .88rem;
}

table thead th {
    background: var(--bg);
    padding: 12px 16px;
    text-align: left;
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .8px;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

table tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    vertical-align: middle;
}

table tbody tr { transition: var(--transition); }
table tbody tr:hover { background: var(--bg-hover); }
table tbody tr:last-child td { border-bottom: none; }

table tfoot td, table tfoot th {
    padding: 14px 16px;
    font-weight: 700;
    background: var(--bg);
    border-top: 2px solid var(--border);
}

/* ============================================================ */
/* MODAIS                                                        */
/* ============================================================ */

/* ── Seletor de mês/ano (Orçamentos, etc.) ──────────────────── */
.month-selector select,
.month-selector .form-control {
    padding: 7px 12px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    color: var(--text);
    font-size: .88rem;
    font-weight: 500;
    cursor: pointer;
    transition: border-color .2s;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}
.month-selector select:focus,
.month-selector .form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}
.month-selector select:hover { border-color: var(--primary); }

.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.modal.show { display: flex; animation: fadeIn .2s ease; }

.modal-content {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: 32px;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: slideUp .25s ease;
    position: relative;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 { font-size: 1.1rem; font-weight: 700; }

.modal-close {
    background: var(--bg);
    border: none;
    width: 32px; height: 32px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    color: var(--text-secondary);
    transition: var(--transition);
}

.modal-close:hover { background: var(--danger-light); color: var(--danger); }

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

/* ============================================================ */
/* GRÁFICOS CSS NATIVOS                                          */
/* ============================================================ */

/* --- Gráfico de barras verticais --- */
.chart-container { width: 100%; }
.chart-title { font-size: .9rem; font-weight: 700; margin-bottom: 16px; color: var(--text); }

.chart-bar {
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    height: 180px;
    gap: 8px;
    padding: 0 4px;
    position: relative;
}

/* Linhas horizontais de grade */
.chart-bar::before {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        to bottom,
        var(--border) 0px,
        var(--border) 1px,
        transparent 1px,
        transparent 25%
    );
    pointer-events: none;
    opacity: .4;
}

.chart-bar-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    height: 100%;
    justify-content: flex-end;
    gap: 6px;
}

.chart-bar-value {
    font-size: .65rem;
    color: var(--text-secondary);
    font-weight: 600;
    white-space: nowrap;
    text-align: center;
}

.chart-bar-fill {
    width: 100%;
    max-width: 48px;
    background: linear-gradient(to top, var(--primary-dark), var(--primary));
    border-radius: 6px 6px 0 0;
    min-height: 4px;
    transition: height .6s cubic-bezier(.34,1.56,.64,1);
    box-shadow: 0 -3px 10px rgba(99,102,241,.25);
    position: relative;
}

.chart-bar-fill:hover {
    filter: brightness(1.1);
    box-shadow: 0 -4px 16px rgba(99,102,241,.4);
}

.chart-bar-label {
    font-size: .7rem;
    color: var(--text-secondary);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 56px;
    font-weight: 500;
}

/* --- Donut chart SVG puro --- */
.donut-chart-wrapper {
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
}

.donut-chart-svg { flex-shrink: 0; }

.donut-legend {
    flex: 1;
    min-width: 140px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.donut-legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: .83rem;
}

.donut-legend-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.donut-legend-name { color: var(--text-secondary); flex: 1; }
.donut-legend-value { font-weight: 700; color: var(--text); }

/* --- Gráfico de linhas CSS --- */
.line-chart-wrapper {
    width: 100%;
    overflow-x: auto;
}

.line-chart-svg {
    width: 100%;
    min-width: 500px;
    height: 200px;
    overflow: visible;
}

/* --- Barras de progresso --- */
.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 4px;
    transition: width .6s cubic-bezier(.34,1.56,.64,1);
    background: linear-gradient(90deg, var(--primary), var(--primary-dark));
}

.progress-bar.thin { height: 5px; }
.progress-bar.thick { height: 12px; }

/* Barras de progresso coloridas */
.progress-fill.success { background: linear-gradient(90deg, var(--success), #059669); }
.progress-fill.warning { background: linear-gradient(90deg, var(--warning), #d97706); }
.progress-fill.danger  { background: linear-gradient(90deg, var(--danger), #dc2626); }
.progress-fill.info    { background: linear-gradient(90deg, var(--info), #2563eb); }

/* --- "Pie" chart via barras de progresso (forma de pizza) --- */
.pie-chart { display: flex; flex-direction: column; gap: 14px; }

.pie-item { display: flex; flex-direction: column; gap: 6px; }

.pie-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pie-label { font-size: .83rem; color: var(--text); font-weight: 500; }
.pie-value { font-size: .83rem; font-weight: 700; color: var(--text); }
.pie-percent { font-size: .75rem; color: var(--text-secondary); text-align: right; }

/* ============================================================ */
/* ALERTAS & NOTIFICAÇÕES TOAST                                  */
/* ============================================================ */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 18px;
    font-size: .88rem;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    border: 1.5px solid transparent;
}

.alert-error   { background: var(--danger-light);  color: var(--danger);  border-color: rgba(239,68,68,.25); }
.alert-success { background: var(--success-light); color: var(--success); border-color: rgba(16,185,129,.25); }
.alert-warning { background: var(--warning-light); color: var(--warning); border-color: rgba(245,158,11,.25); }
.alert-info    { background: var(--info-light);    color: var(--info);    border-color: rgba(59,130,246,.25); }

/* Toast notifications */
.notifications-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 380px;
    pointer-events: none;
}

.notification {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 14px 16px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    animation: slideInRight .3s ease;
    pointer-events: all;
    border-left: 4px solid transparent;
}

.notification-success { border-left-color: var(--success); }
.notification-error   { border-left-color: var(--danger); }
.notification-warning { border-left-color: var(--warning); }
.notification-info    { border-left-color: var(--info); }

.notification-content { flex: 1; }
.notification-title { font-size: .85rem; font-weight: 700; margin-bottom: 2px; }
.notification-description { font-size: .8rem; color: var(--text-secondary); }
.notification-icon { font-size: 1.2rem; flex-shrink: 0; }
.notification-close { background: none; border: none; cursor: pointer; color: var(--text-tertiary); font-size: .9rem; padding: 2px; }

/* ============================================================ */
/* EMPTY STATE                                                   */
/* ============================================================ */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-secondary);
}

.empty-state .icon { font-size: 3rem; margin-bottom: 12px; opacity: .6; }
.empty-state h3 { font-size: 1rem; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.empty-state p { font-size: .88rem; margin-bottom: 20px; }

/* ============================================================ */
/* UTILITÁRIOS                                                   */
/* ============================================================ */
.d-flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.flex-column { flex-direction: column; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.align-center { align-items: center; }
.align-start { align-items: flex-start; }
.align-end { align-items: flex-end; }

.gap-5  { gap: 5px; }  .gap-8 { gap: 8px; }
.gap-10 { gap: 10px; } .gap-12 { gap: 12px; }
.gap-15 { gap: 15px; } .gap-16 { gap: 16px; }
.gap-20 { gap: 20px; } .gap-24 { gap: 24px; }

.mt-5 { margin-top: 5px; }   .mt-10 { margin-top: 10px; }
.mt-15 { margin-top: 15px; } .mt-20 { margin-top: 20px; }
.mt-30 { margin-top: 30px; }
.mb-5 { margin-bottom: 5px; }   .mb-10 { margin-bottom: 10px; }
.mb-15 { margin-bottom: 15px; } .mb-20 { margin-bottom: 20px; }
.mb-30 { margin-bottom: 30px; }
.ml-10 { margin-left: 10px; } .mr-10 { margin-right: 10px; }
.p-10 { padding: 10px; } .p-15 { padding: 15px; }
.p-20 { padding: 20px; } .p-24 { padding: 24px; }
.p-30 { padding: 30px; }

.text-center  { text-align: center; }
.text-right   { text-align: right; }
.text-left    { text-align: left; }

.text-success { color: var(--success) !important; }
.text-danger  { color: var(--danger)  !important; }
.text-warning { color: var(--warning) !important; }
.text-info    { color: var(--info)    !important; }
.text-primary { color: var(--primary) !important; }
.text-muted   { color: var(--text-secondary) !important; }
.text-sm      { font-size: .82rem; }
.text-xs      { font-size: .72rem; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }

.w-100 { width: 100%; }
.h-100 { height: 100%; }
.rounded  { border-radius: var(--radius-sm); }
.rounded-lg { border-radius: var(--radius); }
.rounded-xl { border-radius: var(--radius-xl); }
.shadow    { box-shadow: var(--shadow); }
.shadow-lg { box-shadow: var(--shadow-lg); }
.hidden    { display: none !important; }

/* ============================================================ */
/* KEYFRAMES                                                     */
/* ============================================================ */
@keyframes fadeIn      { from { opacity:0; } to { opacity:1; } }
@keyframes slideDown   { from { opacity:0; transform:translateY(-10px); } to { opacity:1; transform:none; } }
@keyframes slideUp     { from { opacity:0; transform:translateY(20px);  } to { opacity:1; transform:none; } }
@keyframes slideInRight{ from { opacity:0; transform:translateX(24px);  } to { opacity:1; transform:none; } }
@keyframes fadeOut     { from { opacity:1; } to { opacity:0; } }
@keyframes pulse       { 0%,100% { opacity:1; } 50% { opacity:.5; } }
@keyframes spin        { to { transform:rotate(360deg); } }


/* ============================================================ */
/* LAYOUT GRID — .dashboard-cards  .row  .col                   */
/* Classes usadas em todas as páginas do sistema                 */
/* ============================================================ */

/* Grid de cards — 3 colunas no desktop, adapta automaticamente */
.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

/* Row / Col — layout de duas colunas igual ao Bootstrap */
.row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.col {
    min-width: 0; /* evita overflow em grid */
}

/* Card internals — card-title / card-value / card-subtitle */
.card-title {
    font-size: .78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .7px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.card-value {
    font-size: 1.75rem;
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -.4px;
    color: var(--text);
    word-break: break-word;
}

.card-subtitle {
    font-size: .82rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: .75rem;
    font-weight: 600;
    white-space: nowrap;
}
.badge-success  { background: var(--success-light, #d1fae5); color: var(--success, #10b981); }
.badge-danger   { background: var(--danger-light,  #fee2e2); color: var(--danger,  #ef4444); }
.badge-warning  { background: var(--warning-light, #fef3c7); color: var(--warning, #f59e0b); }
.badge-info     { background: rgba(99,102,241,.12);           color: var(--primary, #6366f1); }

/* Progress bar */
.progress-bar {
    background: var(--border);
    border-radius: 999px;
    height: 10px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    border-radius: 999px;
    transition: width .5s ease;
}
.progress-fill.success { background: var(--success, #10b981); }
.progress-fill.warning { background: var(--warning, #f59e0b); }
.progress-fill.danger  { background: var(--danger,  #ef4444); }
.progress-fill.primary { background: var(--primary, #6366f1); }

/* Alert / flash messages */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius);
    margin-bottom: 18px;
    font-size: .9rem;
    font-weight: 500;
    border-left: 4px solid transparent;
}
.alert-success { background: var(--success-light, #d1fae5); color: var(--success, #059669); border-color: var(--success, #059669); }
.alert-error   { background: var(--danger-light,  #fee2e2); color: var(--danger, #dc2626);  border-color: var(--danger,  #dc2626); }
.alert-warning { background: var(--warning-light, #fef3c7); color: var(--warning, #d97706); border-color: var(--warning, #d97706); }
.alert-info    { background: rgba(99,102,241,.08);           color: var(--primary, #6366f1); border-color: var(--primary, #6366f1); }

/* Utilitários */
.mt-10  { margin-top: 10px;  }
.mt-20  { margin-top: 20px;  }
.mb-10  { margin-bottom: 10px; }
.mb-20  { margin-bottom: 20px; }
.gap-10 { gap: 10px; }
.gap-20 { gap: 20px; }
.p-20   { padding: 20px; }
.text-center { text-align: center; }
.text-success { color: var(--success, #10b981) !important; }
.text-danger  { color: var(--danger,  #ef4444) !important; }
.text-warning { color: var(--warning, #f59e0b) !important; }
.text-secondary { color: var(--text-secondary); }
.d-flex   { display: flex; }
.align-center   { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.flex-wrap       { flex-wrap: wrap; }

/* btn-block */
.btn-block { width: 100%; display: block; text-align: center; }

/* table base */
table { width: 100%; border-collapse: collapse; }
table th {
    background: var(--bg-secondary);
    padding: 12px 14px;
    text-align: left;
    font-size: .78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-secondary);
    white-space: nowrap;
}
table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    font-size: .9rem;
    vertical-align: middle;
}
table tbody tr:last-child td { border-bottom: none; }
table tbody tr:hover { background: var(--bg-secondary); }

.table-container { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-container table { min-width: 540px; }

/* checkbox label */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: .9rem;
}

/* ── RESPONSIVIDADE das novas classes ───────────────────────── */
@media (max-width: 1024px) {
    .dashboard-cards {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    }
}

@media (max-width: 768px) {
    .dashboard-cards {
        grid-template-columns: 1fr 1fr;
        gap: 14px;
    }
    .row {
        grid-template-columns: 1fr;
        gap: 14px;
    }
}

@media (max-width: 480px) {
    .dashboard-cards {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    .card-value { font-size: 1.45rem; }
}

/* ============================================================ */
/* DASHBOARD WIDGETS                                             */
/* ============================================================ */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.welcome-banner {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, #818cf8 100%);
    color: #fff;
    padding: 28px 32px;
    border-radius: var(--radius-xl);
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    position: relative;
    overflow: hidden;
}

.welcome-banner::before {
    content: '';
    position: absolute;
    top: -60px; right: -60px;
    width: 200px; height: 200px;
    border-radius: 50%;
    background: rgba(255,255,255,.08);
}

.welcome-banner::after {
    content: '';
    position: absolute;
    bottom: -40px; right: 120px;
    width: 120px; height: 120px;
    border-radius: 50%;
    background: rgba(255,255,255,.05);
}

.welcome-text h2 { font-size: 1.6rem; font-weight: 800; margin-bottom: 4px; }
.welcome-text p  { opacity: .8; font-size: .95rem; }

.quick-actions { display: flex; gap: 10px; flex-wrap: wrap; position: relative; z-index: 1; }

.quick-action-btn {
    background: rgba(255,255,255,.15);
    color: #fff;
    border: 1px solid rgba(255,255,255,.25);
    padding: 9px 18px;
    border-radius: 50px;
    text-decoration: none;
    font-size: .85rem;
    font-weight: 600;
    display: flex; align-items: center; gap: 7px;
    transition: var(--transition);
    backdrop-filter: blur(8px);
}

.quick-action-btn:hover {
    background: rgba(255,255,255,.25);
    color: #fff;
    transform: translateY(-2px);
}

/* ============================================================ */
/* MINI LIST (transactions, upcoming)                            */
/* ============================================================ */
.mini-list { list-style: none; }

.mini-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    gap: 12px;
}

.mini-list li:last-child { border-bottom: none; }

.mini-list .item-icon {
    width: 38px; height: 38px;
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    margin-right: 4px;
    font-size: 1rem;
    flex-shrink: 0;
}

.mini-list .item-info { flex: 1; min-width: 0; }
.mini-list .item-title { font-weight: 600; font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-list .item-subtitle { font-size: .78rem; color: var(--text-secondary); }
.mini-list .item-value { font-weight: 700; font-size: .92rem; white-space: nowrap; }

/* ============================================================ */
/* CATEGORY ITEMS (barras horizontais)                           */
/* ============================================================ */
.category-item {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 14px;
}

.category-info { flex: 1; }
.category-name { font-size: .85rem; font-weight: 500; margin-bottom: 5px; }
.category-value { font-size: .78rem; color: var(--text-secondary); }

/* ============================================================ */
/* FORM CARD                                                     */
/* ============================================================ */
.form-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 28px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
}

.form-card h3 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-container { padding: 24px; }

/* ============================================================ */
/* SEARCH INPUT                                                  */
/* ============================================================ */
.search-wrapper {
    position: relative;
    flex: 1;
}

.search-wrapper .search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
    pointer-events: none;
}

#search-input {
    padding-left: 36px;
}

/* ============================================================ */
/* CHIPS / FILTER BUTTONS                                        */
/* ============================================================ */
.filter-btn {
    padding: 8px 16px;
    border-radius: 50px;
    border: 1.5px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: .82rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.filter-btn:hover { border-color: var(--primary); color: var(--primary); }
.filter-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ============================================================ */
/* RESPONSIVE                                                    */
/* ============================================================ */
@media (max-width: 1024px) {
    :root { --sidebar-w: 220px; }
}

@media (max-width: 768px) {
    :root { --sidebar-w: 280px; }

    .sidebar {
        transform: translateX(-100%);
        position: fixed;
        z-index: 200;
    }
    .sidebar.mobile-show { transform: translateX(0); }

    .main-content { margin-left: 0 !important; }

    .menu-toggle-btn { display: flex !important; }

    .top-header { padding: 0 16px; }

    .user-name { display: none; }

    .dashboard-grid { grid-template-columns: 1fr 1fr; }

    .form-row, .form-row-3 { grid-template-columns: 1fr; }

    .modal-content { padding: 20px; margin: 12px; max-width: calc(100% - 24px); }

    .notification-panel, .user-menu-panel {
        width: 100%;
        position: fixed;
        top: var(--header-h);
        left: 0; right: 0;
        border-radius: 0;
    }

    .welcome-banner { padding: 20px; }
    .welcome-text h2 { font-size: 1.3rem; }

    .hide-mobile { display: none !important; }
}

@media (max-width: 480px) {
    .dashboard-grid { grid-template-columns: 1fr; }
    .card, .form-card { padding: 16px; }
    .stat-value { font-size: 1.5rem; }
    .chart-bar { height: 140px; }
}

@media print {
    .sidebar, .top-header, .btn, .modal { display: none !important; }
    .main-content { margin-left: 0 !important; width: 100% !important; }
    .card { break-inside: avoid; box-shadow: none; border: 1px solid #ddd; }
}
