/* ============================================================
   FinançasPro — Tema escuro premium (dark glassmorphism 2026)
   Paleta: #0a0e27 / #1a1a2e / #16213e + accent #00d4aa + violet #8b5cf6
   ============================================================ */
:root {
    --bg-0: #07091a;
    --bg-1: #0f1226;
    --bg-2: #16213e;
    --bg-3: #1f2a48;
    --bg-glass: rgba(22, 33, 62, 0.55);
    --bg-glass-2: rgba(15, 18, 38, 0.6);
    --border: rgba(255, 255, 255, 0.08);
    --border-light: rgba(255, 255, 255, 0.14);
    --accent: #00d4aa;
    --accent-2: #00b894;
    --violet: #8b5cf6;
    --violet-2: #6d28d9;
    --pink: #ec4899;
    --orange: #fb923c;
    --income: #00d4aa;
    --expense: #ff6b6b;
    --positive: #22d3ee;
    --text: #f5f7fb;
    --text-dim: #a3aed0;
    --text-mute: #6b7891;
    --danger: #ff4757;
    --warning: #ffa502;
    --radius: 16px;
    --radius-sm: 10px;
    --radius-lg: 22px;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.45);
    --shadow-glow: 0 8px 32px rgba(0, 212, 170, 0.25);
    --transition: 240ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
    /* Reserva o espaço do scrollbar para evitar shift horizontal entre páginas */
    scrollbar-gutter: stable;
}
html, body {
    height: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-0);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    font-size: 15px;
    line-height: 1.5;
    overflow-x: hidden;
}

/* Background com mesh gradient sutil — fixo, não rola */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 800px 600px at 10% -10%, rgba(0, 212, 170, 0.12), transparent 60%),
        radial-gradient(ellipse 700px 500px at 90% 100%, rgba(139, 92, 246, 0.10), transparent 60%),
        radial-gradient(ellipse 500px 500px at 50% 50%, rgba(15, 18, 38, 0.6), transparent 70%),
        var(--bg-0);
    z-index: -1;
    pointer-events: none;
}

button, input, select, textarea { font-family: inherit; font-size: 1rem; }
button { cursor: pointer; border: none; background: none; color: inherit; }
a { color: var(--accent); text-decoration: none; }
.hidden { display: none !important; }

/* ===== Layout principal com sidebar (desktop) ===== */
.app-shell {
    display: flex;
    min-height: 100vh;
    width: 100%;
}
.app-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}
.sidebar {
    display: none; /* mobile: usa bottom-nav */
}

/* ===== Topbar ===== */
.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: rgba(7, 9, 26, 0.7);
    backdrop-filter: blur(16px) saturate(140%);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
    border-bottom: 1px solid var(--border);
}
.topbar-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar-brand strong {
    display: block;
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}
.topbar-brand small {
    display: block;
    color: var(--text-dim);
    font-size: 12px;
}
.topbar-actions { display: flex; gap: 10px; align-items: center; }

.brand-logo {
    width: 64px; height: 64px;
    margin: 0 auto 14px;
    border-radius: 18px;
    background: linear-gradient(135deg, var(--accent), var(--violet));
    display: flex; align-items: center; justify-content: center;
    font-weight: 900; font-size: 32px;
    color: var(--bg-0);
    box-shadow: 0 12px 32px rgba(0, 212, 170, 0.35), 0 0 0 1px rgba(255,255,255,0.1) inset;
    position: relative;
    overflow: hidden;
}
.brand-logo::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 30% 20%, rgba(255,255,255,0.4), transparent 50%);
    pointer-events: none;
}
.brand-logo.small {
    width: 42px; height: 42px;
    font-size: 22px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 212, 170, 0.3);
    margin: 0;
    flex-shrink: 0;
}

.icon-btn {
    width: 40px; height: 40px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg-glass);
    color: var(--text);
    border: 1px solid var(--border);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: var(--transition);
}
.icon-btn:hover {
    background: var(--bg-3);
    color: var(--accent);
    border-color: var(--accent);
    transform: translateY(-1px);
}

/* ===== Mini perfil clicável (sidebar/topbar) ===== */
.profile-mini {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px 12px;
    text-decoration: none;
    color: inherit;
    border-radius: 10px;
    transition: var(--transition);
}
.profile-mini:hover { background: rgba(255,255,255,0.04); }

/* ===== Banner de trial ===== */
.trial-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 14px 18px;
    margin-bottom: 18px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.20), rgba(0, 212, 170, 0.10));
    border: 1px solid rgba(139, 92, 246, 0.4);
    border-radius: var(--radius);
    color: var(--text);
    text-decoration: none;
    font-size: 14px;
    transition: var(--transition);
}
.trial-banner:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(139, 92, 246, 0.25); }
.trial-banner strong { color: var(--violet); }

/* ===== Conteúdo principal ===== */
.content {
    padding: 20px;
    max-width: 1280px;
    width: 100%;
    margin: 0 auto;
    padding-bottom: 110px;
    flex: 1;
}
.content h2 {
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 4px;
    letter-spacing: -0.025em;
    background: linear-gradient(180deg, var(--text) 30%, var(--text-dim));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.content > h2 + .subtitle, .content > h2 + p { margin-bottom: 22px; }
.subtitle { color: var(--text-dim); margin-bottom: 18px; font-size: 14px; }

/* ===== Bottom nav (mobile) ===== */
.bottom-nav {
    position: fixed;
    bottom: 16px;
    left: 16px; right: 16px;
    z-index: 25;
    display: flex;
    background: rgba(15, 18, 38, 0.85);
    backdrop-filter: blur(20px) saturate(140%);
    -webkit-backdrop-filter: blur(20px) saturate(140%);
    border: 1px solid var(--border-light);
    border-radius: 20px;
    padding: 8px;
    box-shadow: var(--shadow-lg);
}
.nav-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 4px;
    color: var(--text-dim);
    font-size: 11px;
    font-weight: 600;
    transition: var(--transition);
    border-radius: 14px;
    text-decoration: none;
    position: relative;
}
.nav-btn.active {
    color: var(--accent);
    background: rgba(0, 212, 170, 0.10);
}
.nav-btn:hover { color: var(--text); }

/* ===== Cards genéricos com glassmorphism ===== */
.card, .chart-block, .transaction-form, .user-form, .filters,
.account-card, .user-item, .transaction-item, .auth-card, .assistant-card {
    background: var(--bg-glass);
    border: 1px solid var(--border);
    backdrop-filter: blur(14px) saturate(140%);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
}

/* ===== Hero balance card ===== */
.hero-card {
    position: relative;
    border-radius: var(--radius-lg);
    padding: 28px 24px;
    margin-bottom: 20px;
    background:
        linear-gradient(135deg, rgba(0, 212, 170, 0.18), rgba(139, 92, 246, 0.14) 60%, rgba(22, 33, 62, 0.7) 100%),
        var(--bg-2);
    border: 1px solid var(--border-light);
    overflow: hidden;
    box-shadow: var(--shadow-lg), 0 0 0 1px rgba(0,212,170,0.06) inset;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}
.hero-card::before {
    content: '';
    position: absolute;
    top: -50%; right: -20%;
    width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(0, 212, 170, 0.25), transparent 60%);
    pointer-events: none;
}
.hero-card::after {
    content: '';
    position: absolute;
    bottom: -40%; left: -10%;
    width: 350px; height: 350px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.18), transparent 60%);
    pointer-events: none;
}
.hero-content { position: relative; z-index: 1; }
.hero-label {
    font-size: 12px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}
.hero-balance {
    font-size: 44px;
    font-weight: 900;
    margin-top: 6px;
    letter-spacing: -0.04em;
    line-height: 1.1;
    background: linear-gradient(180deg, #ffffff, #b8c5d9);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.hero-balance .currency { font-size: 20px; vertical-align: super; opacity: 0.7; margin-right: 4px; }
.hero-balance.negative { background: linear-gradient(180deg, #ff8a8a, #ff4757); -webkit-background-clip: text; color: transparent; }
.hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.hero-meta-item { flex: 1; min-width: 120px; }
.hero-meta-label {
    font-size: 11px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}
.hero-meta-value {
    font-size: 18px;
    font-weight: 700;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.hero-meta-value.income { color: var(--income); }
.hero-meta-value.expense { color: var(--expense); }

/* ===== Period selector (Hoje/Semana/Mês/Ano) ===== */
.period-tabs {
    display: inline-flex;
    background: var(--bg-glass);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 18px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
.period-tab {
    padding: 8px 14px;
    border-radius: 8px;
    color: var(--text-dim);
    font-size: 13px;
    font-weight: 600;
    transition: var(--transition);
    text-decoration: none;
}
.period-tab.active {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: var(--bg-0);
    box-shadow: 0 4px 12px rgba(0, 212, 170, 0.3);
}

/* ===== Cards de métricas ===== */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}
.card {
    border-radius: var(--radius);
    padding: 18px;
    border-left: 3px solid var(--text-mute);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}
.card:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: var(--shadow); }
.card.income { border-left-color: var(--income); }
.card.expense { border-left-color: var(--expense); }
.card.balance.positive { border-left-color: var(--accent); }
.card.balance.negative { border-left-color: var(--danger); }
.card-label {
    font-size: 11px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
}
.card-icon {
    width: 28px; height: 28px;
    border-radius: 8px;
    background: var(--bg-3);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 4px;
}
.card.income .card-icon { background: rgba(0, 212, 170, 0.15); color: var(--income); }
.card.expense .card-icon { background: rgba(255, 107, 107, 0.15); color: var(--expense); }
.card strong {
    display: block;
    font-size: 26px;
    font-weight: 800;
    margin-top: 8px;
    letter-spacing: -0.025em;
    line-height: 1.1;
}
.card.income strong { color: var(--income); }
.card.expense strong { color: var(--expense); }
.card.balance.positive strong { color: var(--accent); }
.card.balance.negative strong { color: var(--danger); }
.card small { display: block; font-size: 12px; margin-top: 6px; color: var(--text-dim); }
.card small.up { color: var(--danger); font-weight: 600; }
.card small.down { color: var(--accent); font-weight: 600; }

.card-spark {
    position: absolute;
    bottom: 0; right: 0;
    width: 80px;
    height: 36px;
    opacity: 0.5;
    pointer-events: none;
}

/* ===== Top categorias (com barras de progresso) ===== */
.top-categories {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.cat-row { display: flex; align-items: center; gap: 12px; }
.cat-color {
    width: 12px; height: 12px;
    border-radius: 4px;
    flex-shrink: 0;
}
.cat-name { flex: 1; font-size: 14px; font-weight: 600; }
.cat-amount { font-weight: 700; font-size: 14px; color: var(--text); }
.cat-bar {
    grid-column: 1 / -1;
    height: 6px;
    border-radius: 99px;
    background: var(--bg-3);
    overflow: hidden;
}
.cat-bar-fill {
    height: 100%;
    border-radius: 99px;
    background: linear-gradient(90deg, var(--accent), var(--violet));
    transition: width 600ms cubic-bezier(0.4, 0, 0.2, 1);
}
.cat-item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 6px 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}
.cat-item:last-child { border-bottom: none; }
.cat-item .cat-meta { display: flex; align-items: center; gap: 10px; }
.cat-percent { color: var(--text-dim); font-size: 11px; font-weight: 600; }

/* ===== Charts ===== */
.chart-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-bottom: 16px;
}
@media (min-width: 900px) { .chart-grid { grid-template-columns: 1.3fr 1fr; } }
.chart-block {
    border-radius: var(--radius);
    padding: 22px;
}
.chart-block h3 {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 14px;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}
.chart-block h3 small { color: var(--text-dim); font-weight: 500; font-size: 12px; }
.chart-block canvas { max-height: 280px; }
.empty {
    text-align: center;
    color: var(--text-dim);
    padding: 30px 10px;
    font-size: 14px;
}

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

/* ===== Transações ===== */
.transactions-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.transaction-item {
    border-radius: var(--radius);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: var(--transition);
}
.transaction-item:hover { border-color: var(--accent); transform: translateX(2px); }
.transaction-icon {
    width: 42px; height: 42px;
    border-radius: 12px;
    background: var(--bg-3);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    font-weight: 700;
}
.transaction-item.expense .transaction-icon { background: rgba(255, 107, 107, 0.15); color: var(--expense); }
.transaction-item.income  .transaction-icon { background: rgba(0, 212, 170, 0.15); color: var(--income); }
.transaction-info { flex: 1; min-width: 0; }
.transaction-info strong {
    display: block;
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.transaction-info small { color: var(--text-dim); font-size: 12px; }
.transaction-amount { font-weight: 800; font-size: 16px; flex-shrink: 0; letter-spacing: -0.01em; }
.transaction-amount.expense { color: var(--expense); }
.transaction-amount.income  { color: var(--income); }
.transaction-actions { display: flex; gap: 6px; margin-left: 4px; }
.icon-btn-sm {
    width: 32px; height: 32px;
    border-radius: 8px;
    background: var(--bg-3);
    color: var(--text-dim);
    display: inline-flex; align-items: center; justify-content: center;
    border: none;
    transition: var(--transition);
}
.icon-btn-sm:hover { background: var(--bg-2); color: var(--accent); }
.icon-btn-sm.danger:hover { color: var(--danger); }
.transactions-list.compact .transaction-item { padding: 10px 12px; }

/* ===== Botões ===== */
.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: var(--bg-0);
    font-weight: 700;
    padding: 13px 22px;
    border-radius: var(--radius-sm);
    font-size: 15px;
    transition: var(--transition);
    text-decoration: none;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 14px rgba(0, 212, 170, 0.3);
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 212, 170, 0.42);
}
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
    background: var(--bg-glass);
    color: var(--text);
    font-weight: 600;
    padding: 11px 18px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    transition: var(--transition);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.btn-secondary:hover { background: var(--bg-2); border-color: var(--border-light); }

.btn-danger {
    background: rgba(255, 71, 87, 0.15);
    color: var(--danger);
    font-weight: 600;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    border: 1px solid rgba(255, 71, 87, 0.3);
}
.btn-danger:hover { background: rgba(255, 71, 87, 0.25); }

/* ===== Inputs ===== */
input, select, textarea {
    background: rgba(7, 9, 26, 0.6);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    outline: none;
    transition: var(--transition);
    width: 100%;
}
input:focus, select:focus, textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 212, 170, 0.18);
    background: rgba(7, 9, 26, 0.8);
}
label { display: flex; flex-direction: column; gap: 6px; }
label > span { font-size: 13px; font-weight: 500; color: var(--text-dim); }
label.checkbox { flex-direction: row; align-items: center; gap: 8px; font-size: 13px; color: var(--text-dim); }
label.checkbox input { width: auto; }

.transaction-form, .user-form, .filters {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    border-radius: var(--radius);
    padding: 22px;
    margin-bottom: 18px;
}
.transaction-form .full,
.transaction-form .type-toggle,
.transaction-form .form-actions { grid-column: 1 / -1; }
.user-form { grid-template-columns: 1fr; }
.filters { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); padding: 16px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* Toggle de tipo */
.type-toggle {
    display: flex;
    background: var(--bg-0);
    border-radius: var(--radius-sm);
    padding: 4px;
    gap: 4px;
}
.type-option { flex: 1; cursor: pointer; }
.type-option input { display: none; }
.type-option span {
    display: block;
    text-align: center;
    padding: 14px;
    font-weight: 700;
    border-radius: 8px;
    color: var(--text-dim);
    transition: var(--transition);
}
.type-option.expense input:checked + span { background: rgba(255, 107, 107, 0.15); color: var(--expense); box-shadow: 0 4px 12px rgba(255, 107, 107, 0.15); }
.type-option.income input:checked + span  { background: rgba(0, 212, 170, 0.15); color: var(--income); box-shadow: 0 4px 12px rgba(0, 212, 170, 0.15); }

/* ===== Usuários ===== */
.users-list { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; }
.user-item {
    border-radius: var(--radius);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 14px;
}
.user-avatar {
    width: 44px; height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--violet));
    color: var(--bg-0);
    display: flex; align-items: center; justify-content: center;
    font-weight: 800;
    flex-shrink: 0;
    font-size: 16px;
}
.user-info { flex: 1; }
.user-info strong { display: block; font-size: 15px; }
.user-info small { color: var(--text-dim); font-size: 12px; }
.badge {
    background: rgba(0, 212, 170, 0.15);
    color: var(--accent);
    font-size: 10px;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 6px;
    margin-left: 6px;
    vertical-align: middle;
    border: 1px solid rgba(0, 212, 170, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.badge.owner-badge {
    background: rgba(139, 92, 246, 0.18);
    color: var(--violet);
    border-color: rgba(139, 92, 246, 0.4);
}

/* ===== Tela de auth ===== */
.auth-screen {
    min-height: calc(100vh - 60px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.auth-card {
    width: 100%;
    max-width: 440px;
    border-radius: 24px;
    padding: 36px 30px;
    box-shadow: var(--shadow-lg);
    animation: fade-in .5s ease;
}
.brand { text-align: center; margin-bottom: 26px; }
.brand h1 {
    font-size: 30px;
    font-weight: 900;
    letter-spacing: -0.025em;
}
.brand h1 span {
    background: linear-gradient(135deg, var(--accent), var(--violet));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.brand-sub { color: var(--text-dim); font-size: 14px; margin-top: 6px; }
.tabs {
    display: flex;
    background: var(--bg-0);
    border-radius: var(--radius-sm);
    padding: 4px;
    margin-bottom: 24px;
}
.tab {
    flex: 1;
    text-align: center;
    padding: 11px;
    border-radius: 8px;
    font-weight: 700;
    color: var(--text-dim);
    font-size: 14px;
    text-decoration: none;
    transition: var(--transition);
}
.tab.active {
    background: var(--bg-2);
    color: var(--text);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.form-error {
    color: var(--danger);
    font-size: 13px;
    text-align: center;
    background: rgba(255, 71, 87, 0.08);
    padding: 8px;
    border-radius: 8px;
}

.alert {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 14px;
    border: 1px solid;
    animation: fade-in .25s ease;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.alert-success { background: rgba(0, 212, 170, 0.10); border-color: var(--accent); color: var(--accent); }
.alert-error   { background: rgba(255, 71, 87, 0.10); border-color: var(--danger); color: var(--danger); }

/* ===== Owner header ===== */
.owner-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 22px;
    flex-wrap: wrap;
}
.owner-header h2 { margin-bottom: 0; }

/* Lista de contas (owner) */
.account-list { display: flex; flex-direction: column; gap: 10px; }
.account-card {
    border-radius: var(--radius);
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}
.account-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.account-icon {
    width: 48px; height: 48px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--violet), var(--violet-2));
    color: white;
    font-weight: 800;
    font-size: 22px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.account-info { flex: 1; min-width: 0; }
.account-info strong { display: block; font-size: 15px; }
.account-info small { color: var(--text-dim); font-size: 12px; }
.account-amount { font-weight: 800; color: var(--accent); }
.account-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ===== Toast ===== */
.toast {
    position: fixed;
    bottom: 110px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 18, 38, 0.95);
    color: var(--text);
    padding: 14px 22px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--accent);
    box-shadow: var(--shadow-lg);
    z-index: 100;
    animation: toast-in .3s ease;
    max-width: 90%;
    text-align: center;
    font-size: 14px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}
.toast.error { border-color: var(--danger); color: var(--danger); }

/* ===== Paginação ===== */
.pagination-wrap { margin-top: 18px; display: flex; justify-content: center; }
.pagination-wrap nav { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; }
.pagination-wrap a, .pagination-wrap span {
    background: var(--bg-glass);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 8px 12px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 13px;
    backdrop-filter: blur(8px);
}
.pagination-wrap a:hover { border-color: var(--accent); }

/* ============================================================
   AI CLOUD - Botão flutuante e painel da Johonna
   ============================================================ */
.ai-cloud-btn {
    position: fixed;
    bottom: 100px;
    right: 20px;
    z-index: 50;
    width: 64px; height: 64px;
    border-radius: 50%;
    background:
        radial-gradient(circle at 30% 25%, rgba(255,255,255,0.45), transparent 50%),
        linear-gradient(135deg, var(--violet), var(--accent));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow:
        0 12px 32px rgba(139, 92, 246, 0.45),
        0 0 0 1px rgba(255,255,255,0.15) inset;
    transition: var(--transition);
    animation: float 3s ease-in-out infinite;
}
.ai-cloud-btn::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--violet), var(--accent));
    z-index: -1;
    filter: blur(20px);
    opacity: 0.5;
    animation: pulse-glow 2s ease-in-out infinite;
}
.ai-cloud-btn:hover {
    transform: scale(1.1) translateY(-4px);
    box-shadow: 0 16px 40px rgba(139, 92, 246, 0.6);
}
.ai-cloud-spark {
    position: absolute;
    top: 8px; right: 10px;
    color: white;
    font-size: 14px;
    opacity: 0.9;
    animation: sparkle 2s ease-in-out infinite;
}

@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes pulse-glow { 0%, 100% { opacity: 0.4; } 50% { opacity: 0.7; } }
@keyframes sparkle { 0%, 100% { opacity: 0.4; transform: scale(0.9); } 50% { opacity: 1; transform: scale(1.2); } }

.ai-panel {
    position: fixed;
    bottom: 100px;
    right: 20px;
    z-index: 50;
    width: calc(100vw - 40px);
    max-width: 380px;
    height: 70vh;
    max-height: 600px;
    background: var(--bg-glass-2);
    backdrop-filter: blur(28px) saturate(160%);
    -webkit-backdrop-filter: blur(28px) saturate(160%);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    animation: slide-up .35s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}
@keyframes slide-up { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.ai-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 18px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(0, 212, 170, 0.05));
}
.ai-panel-header strong { display: block; font-size: 15px; font-weight: 700; }
.ai-panel-header small { color: var(--text-dim); font-size: 12px; }

.chat {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    padding: 16px;
}
.chat-bubble {
    padding: 12px 16px;
    border-radius: 18px;
    max-width: 85%;
    font-size: 14px;
    line-height: 1.45;
    animation: bubble-in .3s ease;
    word-wrap: break-word;
}
@keyframes bubble-in { from { opacity: 0; transform: translateY(8px) scale(0.95); } to { opacity: 1; transform: translateY(0) scale(1); } }
.chat-bubble.bot {
    background: var(--bg-3);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    border: 1px solid var(--border);
}
.chat-bubble.user {
    background: linear-gradient(135deg, var(--accent), var(--violet));
    color: var(--bg-0);
    align-self: flex-end;
    border-bottom-right-radius: 4px;
    font-weight: 600;
}
.chat-bubble.loading { opacity: 0.7; font-style: italic; }
.chat-bubble.error { color: var(--danger); border-color: rgba(255, 71, 87, 0.4); }

.chat-form {
    display: flex;
    gap: 8px;
    padding: 14px;
    border-top: 1px solid var(--border);
}
.chat-form input { flex: 1; }
.btn-send {
    width: 46px;
    height: 46px;
    flex-shrink: 0;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: var(--bg-0);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    border: none;
}
.btn-send:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(0, 212, 170, 0.35); }
.btn-send.mic { background: linear-gradient(135deg, var(--violet), var(--violet-2)); }
.btn-send.mic.recording {
    background: linear-gradient(135deg, var(--danger), #c0392b);
    animation: pulse 1.4s infinite;
}

/* ===== Página Johonna standalone (PWA) ===== */
.johonna-screen {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    background: var(--bg-0);
}
.johonna-header {
    padding: 20px;
    padding-top: calc(20px + env(safe-area-inset-top, 0px));
    background: linear-gradient(180deg, rgba(139, 92, 246, 0.12), transparent);
    text-align: center;
}
.johonna-avatar {
    width: 72px;
    height: 72px;
    margin: 0 auto 12px;
    border-radius: 50%;
    background:
        radial-gradient(circle at 30% 25%, rgba(255,255,255,0.4), transparent 50%),
        linear-gradient(135deg, var(--violet), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 12px 32px rgba(139, 92, 246, 0.45);
    animation: float 3s ease-in-out infinite;
}
.johonna-header h1 {
    font-size: 22px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent), var(--violet));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.johonna-header p { color: var(--text-dim); font-size: 13px; margin-top: 4px; }
.johonna-chat {
    flex: 1;
    overflow-y: auto;
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.johonna-input {
    display: flex;
    gap: 8px;
    padding: 14px;
    padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--border);
    background: var(--bg-1);
}

/* ===== Animações compartilhadas ===== */
@keyframes fade-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 71, 87, 0.5); }
    50% { box-shadow: 0 0 0 14px rgba(255, 71, 87, 0); }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes toast-in {
    from { opacity: 0; transform: translate(-50%, 12px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}
@keyframes count-up {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== Responsivo (tablet+) ===== */
@media (min-width: 768px) {
    .content { padding: 32px; padding-bottom: 110px; }
    .content h2 { font-size: 30px; }
    .hero-balance { font-size: 56px; }
    .card strong { font-size: 30px; }
    .topbar { padding: 18px 32px; }
    .ai-cloud-btn { width: 70px; height: 70px; }
}

/* ===== Sidebar lateral (desktop) ===== */
@media (min-width: 1024px) {
    body { display: block; }
    .app-shell {
        display: grid;
        grid-template-columns: 240px 1fr;
        min-height: 100vh;
    }
    .sidebar {
        display: flex;
        flex-direction: column;
        position: sticky;
        top: 0;
        height: 100vh;
        padding: 24px 16px;
        background: var(--bg-glass);
        backdrop-filter: blur(16px) saturate(140%);
        -webkit-backdrop-filter: blur(16px) saturate(140%);
        border-right: 1px solid var(--border);
        gap: 4px;
    }
    .sidebar-brand {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 0 12px 24px;
        margin-bottom: 12px;
        border-bottom: 1px solid var(--border);
    }
    .sidebar-brand h1 {
        font-size: 18px;
        font-weight: 800;
        letter-spacing: -0.02em;
    }
    .sidebar-brand h1 span {
        background: linear-gradient(135deg, var(--accent), var(--violet));
        -webkit-background-clip: text;
        background-clip: text;
        color: transparent;
    }
    .sidebar .nav-btn {
        flex-direction: row;
        justify-content: flex-start;
        gap: 14px;
        padding: 12px 14px;
        font-size: 14px;
        border-radius: 12px;
        width: 100%;
        /* Borda transparente reservada — evita shift quando o item vira .active */
        border: 1px solid transparent;
    }
    .sidebar .nav-btn svg { width: 20px; height: 20px; }
    .sidebar .nav-btn.active {
        background: linear-gradient(135deg, rgba(0, 212, 170, 0.15), rgba(139, 92, 246, 0.05));
        border-color: rgba(0, 212, 170, 0.2);
    }
    .sidebar-spacer { flex: 1; }
    .sidebar-footer {
        padding: 12px;
        border-top: 1px solid var(--border);
        margin-top: 12px;
    }
    .bottom-nav { display: none; }
    .topbar { display: none; }
    .content { padding: 32px 40px; padding-bottom: 40px; max-width: none; }
    .ai-cloud-btn { bottom: 28px; right: 28px; }
    .ai-panel { bottom: 28px; right: 28px; max-height: 70vh; }
}
