/* ============================================
   SISTEMA FINANCEIRO PESSOAL v1.1.0
   CSS Unificado - Base v1.0.0 + Refinamentos
============================================ */

/* ============================================
   VARIÁVEIS CSS
============================================ */
:root {
    /* Cores de fundo */
    --bg-body: #0f172a;
    --bg-sidebar: #020617;
    --bg-surface: #1e293b;
    --bg-surface-hover: #334155;
    --bg-highlight: #334155;
    
    /* Cores de texto */
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-tertiary: #64748b;

    /* Cores funcionais */
    --color-success: #34d399;
    --color-danger: #f87171;
    --color-warning: #fbbf24;
    --color-info: #38bdf8;
    --color-brand: #818cf8;
    --color-purple: #a855f7;
    
    /* Efeitos visuais */
    --radius-md: 12px;
    --radius-lg: 16px;
    --border-color: rgba(255, 255, 255, 0.08);
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.05);
}

/* ============================================
   RESET E BASE
============================================ */
* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
    outline: none; 
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-body);
    color: var(--text-primary);
    font-family: "vinila", sans-serif;
    font-weight: 400;
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ============================================
   SIDEBAR - Navegação lateral
============================================ */
.sidebar {
    width: 80px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 0;
    flex-shrink: 0;
    transition: width 0.3s ease;
    z-index: 100;
}

.nav-menu { 
    list-style: none; 
    width: 100%; 
    display: flex; 
    flex-direction: column; 
    gap: 8px; 
    padding-top: 24px; 
}

.nav-item {
    width: 100%; 
    padding: 14px;
    display: flex; 
    align-items: center; 
    gap: 16px; 
    justify-content: center;
    color: var(--text-tertiary); 
    cursor: pointer;
    transition: 0.2s; 
    border-left: 3px solid transparent;
}

.nav-item:hover { 
    color: var(--text-primary); 
    background: rgba(255,255,255,0.03); 
}

.nav-item.active { 
    color: var(--color-brand); 
    background: rgba(129, 140, 248, 0.08); 
    border-left-color: var(--color-brand); 
}

.nav-icon { font-size: 1.4rem; }
.nav-label { 
    display: none;
    font-size: 0.95rem; 
    font-weight: 500; 
    white-space: nowrap; 
}

@media(min-width: 769px) {
    .sidebar:hover { 
        width: 240px; 
        align-items: flex-start; 
    }
    .sidebar:hover .nav-item { 
        justify-content: flex-start; 
        padding-left: 28px; 
    }
    .sidebar:hover .nav-label { 
        display: block; 
        animation: fadeIn 0.3s; 
    }
}

/* ============================================
   CONTEÚDO PRINCIPAL
============================================ */
.main-content { 
    flex: 1;
    overflow-y: auto;
    padding: 32px; 
    position: relative;
    padding-bottom: 40px;
}

/* ============================================
   MOBILE - Adaptações
============================================ */
@media (max-width: 768px) {
    body { flex-direction: column; }
    
    .sidebar {
        position: fixed;
        bottom: 0; 
        left: 0;
        width: 100%; 
        height: 70px;
        flex-direction: row;
        border-right: none;
        border-top: 1px solid var(--border-color);
        padding: 0;
        background: rgba(2, 6, 23, 0.95);
        backdrop-filter: blur(12px);
        justify-content: space-around;
    }

    .nav-menu { 
        flex-direction: row; 
        height: 100%; 
        justify-content: space-around; 
        padding: 0; 
        gap: 0; 
    }
    
    .nav-item { 
        flex-direction: column; 
        gap: 4px; 
        padding: 10px 16px; 
        border-left: none; 
        border-top: 3px solid transparent;
        height: 100%; 
        justify-content: center;
    }
    
    .nav-item.active { 
        border-left-color: transparent; 
        border-top-color: var(--color-brand); 
    }
    
    .nav-icon { font-size: 1.25rem; }
    .nav-label { 
        display: block; 
        font-size: 0.7rem; 
        opacity: 0.9; 
    }
    
    .main-content { 
        padding: 20px; 
        padding-bottom: 90px;
    }
    
    .page-title { font-size: 1.3rem; }
}

/* ============================================
   HEADER COM BUSCA GLOBAL [NOVO]
============================================ */
.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    gap: 20px;
    position: relative;
    z-index: 50;
}

.page-header { margin-bottom: 24px; }
.page-title { font-size: 1.5rem; font-weight: 700; white-space: nowrap; }
.page-subtitle { font-size: 0.9rem; color: var(--text-tertiary); margin-top: 4px; }

/* Busca Global */
.global-search-container {
    flex: 1;
    max-width: 500px;
    position: relative;
}

.global-search-input {
    width: 100%;
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--border-color);
    padding: 12px 40px 12px 44px;
    border-radius: 20px;
    color: var(--text-primary);
    font-family: inherit;
    transition: 0.2s;
    font-size: 0.95rem;
}

.global-search-input:focus {
    background: var(--bg-surface);
    border-color: var(--color-brand);
}

.search-icon {
    position: absolute;
    left: 16px;
    top: 12px;
    color: var(--text-tertiary);
}

.btn-clear {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 4px;
    display: none;
    line-height: 1;
    border-radius: 50%;
    transition: 0.2s;
    width: 24px;
    height: 24px;
    align-items: center;
    justify-content: center;
}

.btn-clear:hover {
    background: rgba(255,255,255,0.1);
    color: var(--text-primary);
}

/* Dropdown Busca Instantânea */
.instant-search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-top: 8px;
    padding: 8px 0;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    z-index: 200;
    display: none;
}

.instant-search-dropdown.open { display: block; }

.instant-header {
    padding: 8px 16px;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-tertiary);
    font-weight: 600;
    letter-spacing: 0.5px;
}

.instant-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    cursor: pointer;
    transition: 0.2s;
    border-left: 3px solid transparent;
}

.instant-item:hover {
    background: var(--bg-surface-hover);
    border-left-color: var(--color-brand);
}

.instant-icon {
    width: 32px;
    height: 32px;
    background: rgba(255,255,255,0.05);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.instant-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.instant-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
}

.instant-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.instant-value {
    font-family: "vinila", monospace;
    font-size: 0.9rem;
    font-weight: 600;
}

.instant-footer {
    border-top: 1px solid var(--border-color);
    padding: 10px 16px;
    margin-top: 4px;
    font-size: 0.8rem;
    color: var(--color-brand);
    cursor: pointer;
    text-align: center;
}

.instant-footer:hover { text-decoration: underline; }

.hl { color: var(--color-brand); font-weight: 700; }

/* ============================================
   TOOLBAR [NOVO]
============================================ */
.toolbar {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

/* Seletor de Mês */
.month-selector {
    display: flex;
    align-items: center;
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 4px;
    position: relative;
}

.btn-nav {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.btn-nav:hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
}

.current-month-trigger {
    padding: 0 12px;
    font-weight: 600;
    font-size: 0.9rem;
    min-width: 120px;
    text-align: center;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 32px;
    border-radius: 6px;
    transition: 0.2s;
}

.current-month-trigger:hover { background: var(--bg-surface-hover); }

.chevron-down {
    font-size: 0.7rem;
    transition: transform 0.2s;
}

/* Dropdown Data */
.date-dropdown {
    position: absolute;
    top: 110%;
    left: 0;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 10px;
    z-index: 100;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    display: none;
    min-width: 200px;
}

.date-dropdown.open {
    display: block;
    animation: fadeIn 0.2s;
}

.date-option {
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.date-option:hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
}

.date-option.active {
    color: var(--color-brand);
    font-weight: 600;
}

/* ============================================
   SEGMENTED CONTROL [NOVO]
============================================ */
.segmented-control {
    display: flex;
    background: var(--bg-body);
    padding: 4px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

.segmented-option { position: relative; }
.segmented-option input { display: none; }

.segmented-label {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    transition: all 0.2s;
    border: 1px solid transparent;
}

.segmented-label:hover { color: var(--text-primary); }

.segmented-option input:checked + .segmented-label {
    background: var(--bg-surface-hover);
    color: white;
    border-color: rgba(255,255,255,0.1);
}

.segmented-option input[value="entrada"]:checked + .segmented-label {
    background: rgba(52, 211, 153, 0.15);
    color: var(--color-success);
    border-color: rgba(52, 211, 153, 0.3);
}

.segmented-option input[value="saida"]:checked + .segmented-label {
    background: rgba(248, 113, 113, 0.15);
    color: var(--color-danger);
    border-color: rgba(248, 113, 113, 0.3);
}

/* Filtros Desktop */
.desktop-filters {
    display: flex;
    gap: 10px;
    margin-left: auto;
    align-items: center;
}

.filter-select {
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-family: inherit;
    cursor: pointer;
}

.filter-select:hover {
    border-color: var(--text-tertiary);
    color: var(--text-primary);
}

.filter-select option { background: var(--bg-body); }

/* Ações Mobile */
.mobile-actions {
    display: none;
    margin-left: auto;
    gap: 8px;
}

.btn-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.btn-icon.active {
    background: var(--color-brand);
    color: white;
    border-color: var(--color-brand);
}

@media (max-width: 768px) {
    .desktop-filters { display: none; }
    .mobile-actions { display: flex; }
}

/* ============================================
   SUMÁRIO DE TOTAIS [NOVO]
============================================ */
.summary-stats-row {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
    align-items: center;
}

.summary-stat {
    padding: 10px 16px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: 0.2s;
}

.summary-stat:hover { border-color: var(--text-tertiary); }
.summary-stat .label { color: var(--text-tertiary); font-weight: 500; }
.summary-stat .value { font-family: "vinila", monospace; font-weight: 700; font-size: 1rem; }

/* ============================================
   CARDS DE TRANSAÇÃO [NOVO]
============================================ */
.transaction-list, .pending-list { margin-top: 16px; }

.day-header {
    position: sticky;
    top: 0;
    background: var(--bg-body);
    padding: 10px 0;
    margin: 20px 0 10px 0;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-tertiary);
    border-bottom: 1px solid var(--border-color);
    z-index: 10;
}

.trans-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    display: grid;
    grid-template-columns: 32px 48px 1fr auto;
    align-items: center;
    gap: 16px;
    margin-bottom: 10px;
    transition: 0.2s;
    cursor: pointer;
}

.trans-card:hover {
    transform: translateX(4px);
    background: var(--bg-surface-hover);
}

.trans-icon-box {
    width: 48px;
    height: 48px;
    background: rgba(255,255,255,0.03);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

.trans-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.trans-name {
    font-size: 1rem;
    font-weight: 600;
}

.trans-meta {
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

.trans-financial {
    text-align: right;
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: flex-end;
}

.trans-value {
    font-family: "vinila", monospace;
    font-size: 1rem;
    font-weight: 700;
}

.status-pill {
    font-size: 0.7rem;
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: 600;
}

.status-pill.paid {
    background: rgba(52, 211, 153, 0.15);
    color: var(--color-success);
}

.status-pill.pending {
    background: rgba(251, 191, 36, 0.15);
    color: var(--color-warning);
}

/* ============================================
   CARDS DE PENDÊNCIA [NOVO]
============================================ */
.group-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 24px 0 12px 0;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding-left: 4px;
}

.group-header.urgent { color: var(--color-danger); }
.group-header.today { color: var(--color-warning); }

.pending-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    display: grid;
    grid-template-columns: 24px 42px 1fr auto;
    align-items: center;
    gap: 16px;
    margin-bottom: 10px;
    transition: 0.2s;
    cursor: pointer;
}

.pending-card:hover {
    transform: translateX(4px);
    background: var(--bg-surface-hover);
}

.pending-card.overdue { border-left: 4px solid var(--color-danger); }
.pending-card.today { border-left: 4px solid var(--color-warning); }

.btn-check-action {
    width: 24px;
    height: 24px;
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: 0.2s;
    color: var(--text-tertiary);
}

.btn-check-action svg {
    width: 100%;
    height: 100%;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    transition: 0.2s;
}

.btn-check-action:hover {
    color: var(--color-success);
    transform: scale(1.15);
}

.icon-box {
    width: 42px;
    height: 42px;
    background: rgba(255,255,255,0.03);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.p-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.p-name {
    font-size: 0.95rem;
    font-weight: 600;
}

.p-meta {
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

.p-financial {
    text-align: right;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.p-value {
    font-family: "vinila", monospace;
    font-size: 1rem;
    font-weight: 700;
}

.p-date {
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

.p-date.overdue { color: var(--color-danger); font-weight: 600; }
.p-date.today { color: var(--color-warning); font-weight: 600; }

/* ============================================
   BOTTOM SHEET (MOBILE) [NOVO]
============================================ */
.bottom-sheet-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: 0.3s;
}

.bottom-sheet-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: var(--bg-surface);
    border-radius: 20px 20px 0 0;
    padding: 20px;
    z-index: 1000;
    transform: translateY(100%);
    transition: 0.3s ease;
    max-height: 80vh;
    overflow-y: auto;
}

.bottom-sheet.open { transform: translateY(0); }

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

.sheet-title {
    font-size: 1.1rem;
    font-weight: 600;
}

.sheet-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.sheet-btn {
    width: 100%;
    padding: 14px;
    background: var(--color-brand);
    border: none;
    border-radius: 10px;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    margin-top: 20px;
}

/* ============================================
   BENTO GRID - Dashboard
============================================ */
.bento-grid {
    display: grid; 
    grid-template-columns: repeat(12, 1fr); 
    gap: 20px;
    grid-auto-rows: minmax(100px, auto);
}

.col-span-4 { grid-column: span 4; }
.col-span-6 { grid-column: span 6; }
.col-span-8 { grid-column: span 8; }
.col-span-12 { grid-column: span 12; }
.row-span-2 { grid-row: span 2; }

@media (max-width: 1200px) {
    .col-span-4 { grid-column: span 6; }
    .col-span-8 { grid-column: span 12; }
}

@media (max-width: 768px) {
    .bento-grid { 
        display: flex; 
        flex-direction: column; 
        gap: 16px; 
    }
    .col-span-4, .col-span-6, .col-span-8, .col-span-12 { width: 100%; }
}

/* ============================================
   CARDS - Dashboard
============================================ */
.card {
    background: var(--glass-bg); 
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border); 
    border-radius: var(--radius-lg);
    padding: 20px; 
    position: relative; 
    overflow: hidden;
}

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

.card-title { 
    font-size: 0.9rem; 
    color: var(--text-secondary); 
    font-weight: 500; 
    text-transform: uppercase; 
    letter-spacing: 0.5px; 
}

/* Balance Hero */
.balance-hero { 
    background: linear-gradient(145deg, var(--bg-surface), #151e2e); 
    border: 1px solid rgba(129, 140, 248, 0.2);
}

.balance-amount {
    font-size: 2.2rem; 
    font-weight: 700; 
    margin: 8px 0;
    background: linear-gradient(to right, #fff, #94a3b8); 
    -webkit-background-clip: text; 
    -webkit-text-fill-color: transparent;
}

@media(max-width: 480px) { 
    .balance-amount { font-size: 1.8rem; } 
}

/* Context Breakdown */
.context-breakdown {
    display: flex; 
    gap: 16px; 
    margin-top: 12px; 
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.context-item {
    flex: 1; 
    padding: 10px; 
    background: rgba(0,0,0,0.2); 
    border-radius: 8px;
}

.context-label { 
    font-size: 0.75rem; 
    color: var(--text-tertiary); 
    margin-bottom: 4px; 
}

.context-value { font-size: 0.85rem; }

.context-value.clickable { 
    cursor: pointer; 
    text-decoration: underline; 
    text-decoration-color: transparent; 
    transition: 0.2s; 
}

.context-value.clickable:hover { 
    text-decoration-color: currentColor; 
}

.context-values { display: flex; gap: 12px; }

/* ============================================
   TIPOGRAFIA
============================================ */
.font-mono { font-family: "vinila", monospace; font-weight: 500; }
.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.text-lg { font-size: 1.1rem; }
.text-muted { color: var(--text-secondary); }
.text-success { color: var(--color-success); }
.text-danger { color: var(--color-danger); }
.text-warning { color: var(--color-warning); }
.text-overdue { color: var(--color-danger) !important; }
.font-bold { font-weight: 600; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.hidden { display: none !important; }

/* ============================================
   GRÁFICOS - Dashboard
============================================ */
.chart-container { width: 100%; height: 200px; position: relative; }
svg.chart-svg { overflow: visible; width: 100%; height: 100%; }
.chart-line { fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.chart-area { fill-opacity: 0.15; }
.chart-dot { cursor: pointer; transition: transform 0.2s; }
.chart-dot:hover { transform: scale(1.3); }
.chart-value-label {
    font-size: 0.7rem; 
    font-weight: 600; 
    fill: var(--text-primary);
    text-anchor: middle; 
    pointer-events: none;
}

.chart-filter-btn {
    padding: 4px 12px; 
    font-size: 0.75rem; 
    border-radius: 12px;
    background: rgba(255,255,255,0.05); 
    color: var(--text-tertiary);
    cursor: pointer; 
    transition: 0.2s;
}

.chart-filter-btn:hover { 
    background: rgba(255,255,255,0.1); 
    color: var(--text-primary); 
}

.chart-filter-btn.active { 
    background: var(--color-brand); 
    color: white; 
}

/* ============================================
   LISTAS - Dashboard
============================================ */
.account-row { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    padding: 12px 0; 
    border-bottom: 1px solid rgba(255,255,255,0.05);
    cursor: pointer;
    transition: 0.2s;
}

.account-row:last-child { border-bottom: none; }

.account-row:hover { 
    background: rgba(255,255,255,0.02); 
    margin: 0 -12px; 
    padding: 12px; 
    border-radius: 8px; 
}

.account-dot { width: 10px; height: 10px; border-radius: 50%; }

/* Mini Transaction */
.mini-transaction {
    display: flex; 
    justify-content: space-between; 
    align-items: center;
    padding: 12px 0; 
    border-bottom: 1px solid rgba(255,255,255,0.04);
}

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

/* Today Alert */
.today-alert-link {
    display: inline-flex; 
    align-items: center; 
    gap: 6px;
    padding: 8px 14px; 
    margin-top: 12px;
    background: rgba(251, 191, 36, 0.15); 
    border: 1px solid rgba(251, 191, 36, 0.3);
    border-radius: 8px; 
    font-size: 0.85rem; 
    color: var(--color-warning);
    cursor: pointer; 
    transition: 0.2s;
}

.today-alert-link:hover { background: rgba(251, 191, 36, 0.25); }
.today-alert-link .alert-count { font-weight: 700; text-decoration: underline; }

/* Summary Cards */
.summary-cards { 
    display: grid; 
    grid-template-columns: 1fr 1fr; 
    gap: 12px; 
    margin-bottom: 20px; 
}

.summary-card {
    background: var(--glass-bg); 
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md); 
    padding: 16px;
    cursor: pointer; 
    transition: 0.2s;
}

.summary-card:hover { 
    background: var(--bg-surface-hover); 
    transform: translateY(-2px); 
}

.summary-card.danger { border-left: 4px solid var(--color-danger); }
.summary-card.success { border-left: 4px solid var(--color-success); }

/* ============================================
   MODAIS
============================================ */
.modal-overlay {
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%;
    background: rgba(0, 0, 0, 0.85); 
    z-index: 1000;
    display: none; 
    justify-content: center; 
    align-items: center; 
    padding: 20px;
}

.modal-overlay.open { display: flex; }

.modal-container {
    background: var(--bg-surface); 
    width: 100%; 
    max-width: 500px;
    max-height: 95vh; 
    border-radius: var(--radius-lg); 
    padding: 0;
    display: flex; 
    flex-direction: column; 
    animation: modalIn 0.3s ease;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

@keyframes modalIn { 
    from { 
        opacity: 0; 
        transform: scale(0.95) translateY(10px); 
    } 
    to { 
        opacity: 1; 
        transform: scale(1) translateY(0); 
    } 
}

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

.modal-title { font-size: 1.1rem; font-weight: 600; }

.btn-close { 
    background: none; 
    border: none; 
    color: var(--text-secondary); 
    font-size: 1.5rem; 
    cursor: pointer; 
    padding: 5px;
    line-height: 1; 
    transition: 0.2s; 
}

.btn-close:hover { color: var(--text-primary); }

.modal-body { 
    overflow-y: auto; 
    flex: 1;
    padding: 20px;
    overscroll-behavior: contain;
}

/* ============================================
   FORMULÁRIOS - Modal Add/Edit [REFINADO]
============================================ */
/* Segmented Control no Modal */
.modal-body .segmented-control {
    background: rgba(0,0,0,0.2);
    margin-bottom: 24px;
    overflow-x: auto;
}

.modal-body .segmented-option { flex: 1; min-width: 60px; }

.modal-body .segmented-label {
    justify-content: center;
    padding: 10px 4px;
    white-space: nowrap;
}

.segmented-option input[value="saida"]:checked + .segmented-label {
    background: var(--color-danger);
    color: white;
    box-shadow: 0 2px 8px rgba(248, 113, 113, 0.25);
}

.segmented-option input[value="entrada"]:checked + .segmented-label {
    background: var(--color-success);
    color: white;
    box-shadow: 0 2px 8px rgba(52, 211, 153, 0.25);
}

.segmented-option input[value="transferencia"]:checked + .segmented-label {
    background: rgba(168, 85, 247, 0.15);
    border-color: var(--color-purple);
    color: white;
}

.segmented-option input[value="balanco"]:checked + .segmented-label {
    background: rgba(251, 191, 36, 0.15);
    border-color: var(--color-warning);
    color: white;
}

/* Big Amount Input */
.big-amount-wrapper {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    margin-bottom: 24px;
    width: 100%;
}

.currency-symbol {
    font-size: 1.5rem;
    color: var(--text-tertiary);
    margin-bottom: 10px;
    margin-right: 4px;
    font-weight: 500;
}

.big-amount-input {
    background: transparent;
    border: none;
    border-bottom: 2px solid var(--border-color);
    font-size: 3.5rem;
    font-weight: 700;
    color: var(--text-primary);
    width: 100%;
    text-align: center;
    font-family: "vinila", monospace;
    padding: 0 0 4px 0;
    transition: 0.2s;
    letter-spacing: -1px;
}

.big-amount-input:focus { border-color: var(--color-brand); }
.big-amount-input::placeholder { color: rgba(255,255,255,0.1); }

/* Form Grid */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.col-full { grid-column: span 2; }

.form-group { margin-bottom: 0; }

.form-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-tertiary);
    margin-bottom: 6px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-input, .form-select {
    width: 100%;
    padding: 12px;
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    transition: 0.2s;
}

.form-input:focus, .form-select:focus {
    border-color: var(--color-brand);
    background: var(--bg-surface);
}

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

@media(max-width: 500px) { 
    .form-row, .form-grid { grid-template-columns: 1fr; }
    .col-full { grid-column: span 1; }
}

/* Status Checkbox */
.status-checkbox {
    display: block;
    cursor: pointer;
}

.status-checkbox input { display: none; }

.status-box {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 0.95rem;
    transition: 0.2s;
}

.status-checkbox input:checked + .status-box {
    background: rgba(52, 211, 153, 0.15);
    border-color: var(--color-success);
    color: var(--color-success);
}

/* Context Toggle */
.context-toggle-wrapper {
    display: flex;
    gap: 8px;
    background: var(--bg-body);
    padding: 6px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

.context-option {
    flex: 1;
    cursor: pointer;
}

.context-option input { display: none; }

.context-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    border-radius: 6px;
    font-size: 1.2rem;
    transition: 0.2s;
    opacity: 0.5;
}

.context-option input:checked + .context-icon {
    background: var(--bg-surface-hover);
    opacity: 1;
}

/* Extra Actions */
.extra-actions {
    display: flex;
    gap: 10px;
    margin: 16px 0;
}

.btn-extra {
    flex: 1;
    padding: 10px;
    background: transparent;
    border: 1px dashed var(--border-color);
    border-radius: 8px;
    color: var(--text-tertiary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: 0.2s;
    font-family: inherit;
}

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

.btn-extra.active {
    border-style: solid;
    border-color: var(--color-brand);
    color: var(--color-brand);
    background: rgba(129, 140, 248, 0.1);
}

/* Extra Panel */
.extra-panel {
    display: none;
    padding: 16px;
    background: rgba(0,0,0,0.2);
    border-radius: 10px;
    margin-bottom: 16px;
    animation: fadeIn 0.2s;
}

.extra-panel.visible { display: block; }

/* Balance Type */
.balance-type-selector {
    display: flex;
    gap: 10px;
}

.balance-option {
    flex: 1;
    cursor: pointer;
}

.balance-option input { display: none; }

.balance-label {
    display: block;
    padding: 12px;
    text-align: center;
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.9rem;
    transition: 0.2s;
}

.balance-option input[value="positivo"]:checked + .balance-label {
    background: rgba(52, 211, 153, 0.15);
    border-color: var(--color-success);
    color: var(--color-success);
}

.balance-option input[value="negativo"]:checked + .balance-label {
    background: rgba(248, 113, 113, 0.15);
    border-color: var(--color-danger);
    color: var(--color-danger);
}

/* Submit Button */
.btn-submit {
    width: 100%;
    padding: 14px;
    background: var(--color-brand);
    border: none;
    border-radius: 10px;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: 0.2s;
    margin-top: 16px;
}

.btn-submit:hover { background: #6366f1; }

/* ============================================
   CONFIGURAÇÕES [NOVO]
============================================ */
.settings-container {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 32px;
    align-items: start;
}

.settings-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: sticky;
    top: 20px;
}

.nav-group-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-tertiary);
    margin: 16px 0 8px 12px;
    font-weight: 600;
}

.nav-group-title:first-child { margin-top: 0; }

.settings-tab {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 10px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: 0.2s;
    border: 1px solid transparent;
    font-size: 0.9rem;
}

.settings-tab:hover {
    background: rgba(255,255,255,0.03);
    color: var(--text-primary);
}

.settings-tab.active {
    background: var(--bg-surface);
    border-color: var(--border-color);
    color: var(--text-primary);
    font-weight: 600;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.tab-icon { width: 20px; text-align: center; font-size: 1.1rem; }

.settings-content { min-height: 400px; }

.settings-panel {
    display: none;
    animation: fadeIn 0.3s ease;
}

.settings-panel.active { display: block; }

.panel-header {
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 16px;
}

.panel-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.panel-desc {
    font-size: 0.85rem;
    color: var(--text-tertiary);
}

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

.config-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid var(--border-color);
}

.config-row:last-child { border-bottom: none; padding-bottom: 0; }
.config-row:first-child { padding-top: 0; }

.config-info { flex: 1; padding-right: 20px; }
.config-label { display: block; font-weight: 500; font-size: 0.95rem; margin-bottom: 4px; }
.config-sub { display: block; font-size: 0.8rem; color: var(--text-tertiary); }

.btn-outline {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    background: transparent;
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.85rem;
    transition: 0.2s;
}

.btn-outline:hover {
    border-color: var(--text-tertiary);
    background: rgba(255,255,255,0.03);
}

.btn-danger {
    color: var(--color-danger);
    border-color: rgba(248, 113, 113, 0.3);
}

.btn-danger:hover {
    background: rgba(248, 113, 113, 0.1);
    border-color: var(--color-danger);
}

/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input { opacity: 0; width: 0; height: 0; }

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-surface-hover);
    transition: .4s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider { background-color: var(--color-brand); }
input:checked + .slider:before { transform: translateX(20px); }

/* Category List Item */
.cat-list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(0,0,0,0.2);
    border-radius: 8px;
    margin-bottom: 8px;
}

.cat-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.05);
    border-radius: 6px;
}

@media (max-width: 768px) {
    .settings-container {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .settings-nav {
        flex-direction: row;
        overflow-x: auto;
        padding-bottom: 8px;
        position: relative;
        top: 0;
        border-bottom: 1px solid var(--border-color);
        margin: 0 -20px;
        padding: 0 20px 12px 20px;
    }
    
    .nav-group-title { display: none; }
    
    .settings-tab {
        white-space: nowrap;
        padding: 8px 14px;
        background: rgba(255,255,255,0.03);
        border: 1px solid var(--border-color);
    }
    
    .settings-tab.active {
        background: var(--color-brand);
        color: white;
        border-color: var(--color-brand);
    }
    
    .config-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .config-action {
        width: 100%;
        display: flex;
        justify-content: flex-end;
    }
}

/* ============================================
   GRÁFICO DE PIZZA - Modal
============================================ */
.chart-distribution { 
    display: flex; 
    gap: 30px; 
    align-items: flex-start; 
}

.pie-chart-container { 
    width: 200px; 
    height: 200px; 
    position: relative; 
    flex-shrink: 0; 
}

.pie-chart { 
    width: 100%; 
    height: 100%; 
    border-radius: 50%; 
}

.pie-center {
    position: absolute; 
    top: 50%; 
    left: 50%; 
    transform: translate(-50%, -50%);
    width: 90px; 
    height: 90px; 
    background: var(--bg-surface); 
    border-radius: 50%;
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    justify-content: center;
}

.pie-center-value { font-size: 0.85rem; font-weight: 700; }
.pie-center-label { font-size: 0.65rem; color: var(--text-tertiary); }

.chart-legend-list { 
    flex: 1; 
    min-width: 0; 
    max-height: 300px; 
    overflow-y: auto; 
}

.legend-row { 
    display: flex; 
    align-items: center; 
    gap: 12px; 
    padding: 10px 0; 
    border-bottom: 1px solid rgba(255,255,255,0.05); 
}

.legend-row:last-child { border-bottom: none; }

.legend-color { 
    width: 12px; 
    height: 12px; 
    border-radius: 4px; 
    flex-shrink: 0; 
}

.legend-info { flex: 1; }
.legend-name { font-size: 0.9rem; }
.legend-value { font-size: 0.8rem; color: var(--text-tertiary); }
.legend-percent { font-weight: 600; font-size: 0.9rem; }

.pie-tooltip {
    position: absolute; 
    padding: 8px 12px; 
    background: var(--bg-body);
    border: 1px solid var(--border-color); 
    border-radius: 8px;
    font-size: 0.85rem; 
    pointer-events: none; 
    z-index: 10;
    opacity: 0; 
    transition: opacity 0.2s; 
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.pie-tooltip.visible { opacity: 1; }

@media(max-width: 600px) { 
    .chart-distribution { 
        flex-direction: column; 
        align-items: center; 
    } 
    .pie-chart-container { 
        width: 180px; 
        height: 180px; 
    }
}

/* ============================================
   FAB BUTTON
============================================ */
.fab-button {
    position: fixed; 
    bottom: 100px; 
    right: 24px;
    width: 56px; 
    height: 56px; 
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-brand), #6366f1);
    border: none; 
    color: white; 
    font-size: 1.5rem;
    cursor: pointer; 
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
    transition: 0.3s; 
    z-index: 50;
    display: flex; 
    align-items: center; 
    justify-content: center;
}

.fab-button:hover { 
    transform: scale(1.1); 
    box-shadow: 0 6px 25px rgba(99, 102, 241, 0.5); 
}

@media(min-width: 769px) { 
    .fab-button { bottom: 32px; } 
}

/* ============================================
   VIEW SECTIONS
============================================ */
.view-section { 
    display: none; 
    animation: fadeIn 0.3s ease; 
}

.view-section.active { display: block; }

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

/* ============================================
   SCROLLBAR
============================================ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { 
    background: rgba(255,255,255,0.1); 
    border-radius: 3px; 
}
::-webkit-scrollbar-thumb:hover { 
    background: rgba(255,255,255,0.2); 
}

/* ============================================
   TOAST
============================================ */
.toast {
    position: fixed; 
    bottom: 100px; 
    left: 50%; 
    transform: translateX(-50%);
    background: var(--color-success); 
    color: var(--bg-body); 
    padding: 12px 24px;
    border-radius: 8px; 
    font-weight: 600; 
    z-index: 2000;
    animation: fadeIn 0.3s ease; 
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

@media(min-width: 769px) { 
    .toast { bottom: 40px; } 
}

/* ============================================
   TOOLTIP
============================================ */
.tooltip-trigger { position: relative; cursor: help; }

.tooltip-content {
    position: absolute; 
    bottom: 100%; 
    left: 50%; 
    transform: translateX(-50%);
    background: var(--bg-body); 
    border: 1px solid var(--border-color);
    padding: 8px 12px; 
    border-radius: 8px; 
    font-size: 0.8rem;
    white-space: nowrap; 
    opacity: 0; 
    pointer-events: none;
    transition: 0.2s; 
    z-index: 9999; 
    margin-bottom: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.tooltip-trigger:hover .tooltip-content { opacity: 1; }

/* ============================================
   CLICKABLE NAME
============================================ */
.clickable-name {
    cursor: pointer; 
    color: var(--color-brand);
    text-decoration: underline; 
    text-decoration-color: transparent;
    transition: 0.2s;
}

.clickable-name:hover { 
    text-decoration-color: var(--color-brand); 
}

/* ============================================
   DATA TABLE (Modal Tables)
============================================ */
.data-table { 
    width: 100%; 
    border-collapse: collapse; 
    min-width: 400px; 
    font-size: 0.9rem; 
}

.data-table th {
    text-align: left; 
    padding: 12px 10px; 
    color: var(--text-tertiary);
    font-size: 0.75rem; 
    text-transform: uppercase; 
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color); 
    white-space: nowrap; 
    font-weight: 500;
}

.data-table td { 
    padding: 12px 10px; 
    border-bottom: 1px solid rgba(255,255,255,0.04); 
    vertical-align: middle; 
}

.data-table tr:hover { background: rgba(255,255,255,0.02); }
.data-table tr:last-child td { border-bottom: none; }

/* ============================================
   STATUS BADGES
============================================ */
.status-badge { 
    padding: 4px 10px; 
    border-radius: 20px; 
    font-size: 0.7rem; 
    font-weight: 600;
    text-transform: capitalize;
}

.status-done, .status-badge.status-done { 
    background: rgba(52, 211, 153, 0.15); 
    color: var(--color-success); 
}

.status-pending, .status-badge.status-pending { 
    background: rgba(251, 191, 36, 0.15); 
    color: var(--color-warning); 
}

/* ============================================
   TYPOGRAPHY HELPERS
============================================ */
.text-2xl { font-size: 1.5rem; }
/* Botões de Ação na Lista [Novo] */
.btn-icon-action {
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
    font-size: 1.1rem;
}

.btn-icon-action:hover {
    background: rgba(255, 255, 255, 0.1);
}

.btn-icon-action.text-danger:hover {
    color: var(--color-danger);
    background: rgba(248, 113, 113, 0.1);
}

.trans-left-actions {
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-check-action.checked {
    color: var(--color-success);
}

.hidden { display: none !important; }
