/* ----------------------------------------------------
   DESIGN SYSTEM & CSS RESET
   ---------------------------------------------------- */
:root {
    --bg-color: #0B0F19;
    --card-bg: rgba(15, 23, 42, 0.45);
    --card-border: rgba(255, 255, 255, 0.05);
    
    --text-primary: #F8FAFC;
    --text-secondary: #94A3B8;
    
    --neon-purple: #2563EB;
    --neon-teal: #00f5ff;
    --neon-gradient: linear-gradient(135deg, #2563EB 0%, #00f5ff 100%);
    
    --color-success: #00FF87;
    --color-danger: #FF3B30;
    
    --safe-area-top: env(safe-area-inset-top, 20px);
    --safe-area-bottom: env(safe-area-inset-bottom, 20px);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    overflow-x: hidden;
    line-height: 1.4;
    display: flex;
    justify-content: center;
}

/* ----------------------------------------------------
   SPLASH & TRANSIÇÕES DE CICLO DE VIDA (PWA / MOBILE)
   ---------------------------------------------------- */
.app-splash {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    background: radial-gradient(circle at 50% 35%, #111827 0%, #0A0E17 55%, #070a10 100%);
    transition: opacity 0.5s ease, transform 0.5s ease, visibility 0.5s;
}

.app-transition-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: radial-gradient(circle at 50% 40%, #0f172a 0%, #0A0E17 70%);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.28s ease, visibility 0.28s ease;
}

.app-transition-overlay.active {
    opacity: 1;
    visibility: visible;
}

.app-transition-overlay.resume-flash {
    background: radial-gradient(circle at 50% 40%, rgba(0, 245, 255, 0.08) 0%, #0A0E17 65%);
    animation: overlayResume 0.55s ease both;
}

.app-splash-glow {
    position: absolute;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 245, 255, 0.18) 0%, transparent 70%);
    pointer-events: none;
    animation: splashGlow 2.2s ease-in-out infinite alternate;
}

.app-splash-logo {
    width: 88px;
    height: 88px;
    object-fit: contain;
    filter: drop-shadow(0 0 16px rgba(0, 245, 255, 0.45));
    animation: splashLogoIn 0.65s cubic-bezier(0.22, 1, 0.36, 1) both;
    position: relative;
    z-index: 1;
}

.app-splash-title {
    font-size: 28px;
    position: relative;
    z-index: 1;
    animation: splashTitleIn 0.55s ease 0.12s both;
}

.app-splash.app-splash-out {
    opacity: 0;
    transform: scale(1.03);
    visibility: hidden;
    pointer-events: none;
}

.app-splash.app-splash-gone {
    display: none !important;
}

body.app-booting #app-container,
body.app-booting .login-overlay {
    opacity: 0;
}

body.app-resume-flash #app-container:not(.app-hidden),
body.app-resume-flash .login-overlay {
    animation: appResumeIn 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}

body.app-leaving #app-container,
body.app-leaving .login-overlay {
    opacity: 0 !important;
    transform: scale(0.97) translateY(10px);
    transition: opacity 0.28s ease, transform 0.28s ease;
    pointer-events: none;
}

body.app-entering #app-container:not(.app-hidden),
body.app-entering .login-overlay {
    animation: appEnter 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes splashGlow {
    from { opacity: 0.45; transform: scale(0.92); }
    to { opacity: 1; transform: scale(1.08); }
}

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

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

@keyframes appEnter {
    from { opacity: 0; transform: translateY(18px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes appResumeIn {
    from { opacity: 0.2; transform: scale(0.96) translateY(12px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes overlayResume {
    from { opacity: 1; }
    to { opacity: 0; visibility: hidden; }
}

@media (prefers-reduced-motion: reduce) {
    .app-splash,
    .app-splash-logo,
    .app-splash-title,
    .app-splash-glow,
    body.app-entering #app-container,
    body.app-entering .login-overlay,
    body.app-resume-flash #app-container,
    body.app-resume-flash .login-overlay {
        animation: none !important;
        transition: none !important;
    }

    .app-splash.app-splash-out {
        transform: none;
    }
}

body.app-backgrounded .wallet-logo-image,
body.app-backgrounded .animated-logo-text,
body.app-backgrounded .animated-logo-text-small,
body.app-backgrounded .settings-gear {
    animation-play-state: paused !important;
}

/* ----------------------------------------------------
   CONTAINER PRINCIPAL (Simula iPhone no Desktop, 100% no Mobile)
   ---------------------------------------------------- */
#app-container {
    width: 100%;
    max-width: 450px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    background-color: var(--bg-color);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.8);
    border-left: 1px solid rgba(255, 255, 255, 0.03);
    border-right: 1px solid rgba(255, 255, 255, 0.03);
    will-change: opacity, transform;
}

.app-hidden {
    display: none !important;
}

/* ----------------------------------------------------
   TELA DE LOGIN OVERLAY
   ---------------------------------------------------- */
.login-overlay {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    margin: 0 auto;
    z-index: 1000;
    width: 100%;
    max-width: 450px;
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding:
        max(24px, env(safe-area-inset-top, 0px))
        20px
        max(24px, env(safe-area-inset-bottom, 0px));
    background: radial-gradient(circle at top right, #0F172A 0%, #0B0F19 60%);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.8);
    border-left: 1px solid rgba(255, 255, 255, 0.03);
    border-right: 1px solid rgba(255, 255, 255, 0.03);
    overflow-y: auto;
    will-change: opacity, transform;
}

.login-card {
    width: 100%;
    max-width: 340px;
    flex: 0 0 auto;
    margin: 0;
    text-align: center;
    display: block;
    padding: 36px 26px 30px;
    border-radius: 24px;
    background: linear-gradient(165deg, rgba(22, 30, 48, 0.96) 0%, rgba(12, 17, 28, 0.98) 100%);
    border: 1px solid rgba(0, 245, 255, 0.28);
    box-shadow:
        0 0 0 1px rgba(37, 99, 235, 0.15),
        0 20px 50px rgba(0, 0, 0, 0.55),
        0 0 40px rgba(0, 245, 255, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.07);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.login-card .logo-area {
    margin-bottom: 26px;
    width: 100%;
}

.login-card .logo-area p {
    color: var(--text-secondary);
    font-size: 0.88rem;
    line-height: 1.45;
    max-width: 260px;
    margin: 0 auto;
}

.login-card .form-group {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.login-card .form-group input {
    margin-bottom: 0;
}

/* Animação de Flutuação */
@keyframes float {
    0% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-5px) rotate(3deg); }
    100% { transform: translateY(0px) rotate(0deg); }
}

@keyframes float-small {
    0% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-2px) rotate(2deg); }
    100% { transform: translateY(0px) rotate(0deg); }
}

/* Animação de Gradiente Deslocante */
@keyframes shimmer {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.wallet-logo-icon {
    font-size: 64px;
    color: var(--neon-teal);
    animation: float 3s ease-in-out infinite;
    filter: drop-shadow(0 0 10px rgba(0, 245, 255, 0.4));
}

.wallet-logo-icon-small {
    font-size: 22px;
    color: var(--neon-teal);
    animation: float-small 3s ease-in-out infinite;
    filter: drop-shadow(0 0 4px rgba(0, 245, 255, 0.4));
    vertical-align: middle;
    margin-right: 4px;
}

.animated-logo-text {
    font-family: 'Outfit', sans-serif;
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -1px;
    margin-bottom: 10px;
    background: linear-gradient(270deg, var(--neon-purple), var(--neon-teal), var(--neon-purple));
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shimmer 4s linear infinite;
    display: inline-block;
}

.animated-logo-text-small {
    font-family: 'Outfit', sans-serif;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(270deg, var(--neon-purple), var(--neon-teal), var(--neon-purple));
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shimmer 4s linear infinite;
}

/* Engrenagem Animada */
.settings-gear {
    font-size: 24px;
    color: var(--text-secondary);
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1), color 0.3s ease;
}

.icon-btn-header:hover .settings-gear, .icon-btn-header:focus .settings-gear {
    transform: rotate(360deg);
    color: var(--neon-teal);
    filter: drop-shadow(0 0 6px rgba(0, 245, 255, 0.5));
}

.logo-area p {
    color: var(--text-secondary);
    font-size: 14px;
    padding: 0 10px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
}

input, select {
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    padding: 16px;
    color: #fff;
    font-size: 16px;
    outline: none;
    font-family: inherit;
    transition: all 0.3s ease;
}

input:focus, select:focus {
    border-color: var(--neon-teal);
    background-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 10px rgba(0, 245, 255, 0.15);
}

.error-msg {
    color: var(--color-danger);
    font-size: 13px;
    display: none;
    text-align: left;
    padding-left: 5px;
}

.btn-primary {
    background: var(--neon-gradient);
    border: none;
    border-radius: 14px;
    padding: 16px;
    color: #FFF;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary:active {
    transform: scale(0.96);
    opacity: 0.9;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    padding: 14px;
    color: #FFF;
    font-weight: 500;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:active {
    transform: scale(0.97);
    background: rgba(255, 255, 255, 0.1);
}

.w-100 {
    width: 100%;
}

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

/* ----------------------------------------------------
   HEADER (Estilo iOS)
   ---------------------------------------------------- */
.app-header {
    background-color: rgba(10, 14, 23, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--card-border);
    padding: calc(var(--safe-area-top) + 10px) 20px 12px 20px;
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--neon-teal);
    font-size: 18px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.app-title {
    font-family: 'Outfit', sans-serif;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.icon-btn-header {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.icon-btn-header:active {
    background: rgba(255, 255, 255, 0.05);
    color: var(--color-danger);
}

/* ----------------------------------------------------
   CONTEÚDO E TABS
   ---------------------------------------------------- */
.app-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    padding-bottom: calc(var(--safe-area-bottom) + 80px);
}

.tab-pane {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-pane.active {
    display: block;
}

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

/* ----------------------------------------------------
   GLASSMOPHISM CARD
   ---------------------------------------------------- */
.glass-card {
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 20px;
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
}

/* Card Principal de Saldo */
.main-balance-card {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.15) 0%, rgba(0, 245, 255, 0.1) 100%), var(--card-bg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.card-label {
    font-size: 13px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    display: block;
    margin-bottom: 6px;
}

.balance-value {
    font-family: 'Outfit', sans-serif;
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 12px;
    letter-spacing: -0.5px;
}

.balance-metrics {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 12px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 12px;
}

.metric-item {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
}

.metric-label {
    color: var(--text-secondary);
}

.metric-val {
    font-weight: 600;
}

.metric-val.positive {
    color: var(--color-success);
}

.metric-val.negative {
    color: var(--color-danger);
}

/* ----------------------------------------------------
   CHARTS & SECTIONS
   ---------------------------------------------------- */
.chart-card h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 16px;
    margin-bottom: 15px;
}

.chart-container {
    height: 180px;
    position: relative;
    margin-bottom: 15px;
}

.chart-center-info {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    pointer-events: none; /* Deixa cliques e hovers passarem para o Canvas do Chart.js */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 2;
}

.chart-center-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary, rgba(255, 255, 255, 0.5));
    font-weight: 500;
}

.chart-center-value {
    font-family: 'Outfit', sans-serif;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary, #ffffff);
    margin-top: 2px;
}

.chart-back-btn {
    position: absolute;
    top: 5px;
    left: 5px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
}

.chart-back-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.05);
}

.chart-back-btn:active {
    transform: scale(0.95);
}

.chart-legend {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 12px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

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

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 10px 0 15px 0;
}

.section-header h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 17px;
    font-weight: 600;
}

.badge {
    background-color: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 4px 10px;
    font-size: 12px;
    color: var(--text-secondary);
}

/* ----------------------------------------------------
   LISTA DE ATIVOS
   ---------------------------------------------------- */
.assets-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.asset-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 14px 16px;
    transition: transform 0.2s ease;
}

.asset-item:active {
    transform: scale(0.98);
}

.asset-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.asset-icon-box {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background-color: rgba(255, 255, 255, 0.03);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--neon-teal);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.asset-info {
    display: flex;
    flex-direction: column;
}

.asset-ticker {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 15px;
}

.asset-category {
    font-size: 12px;
    color: var(--text-secondary);
}

.asset-right {
    text-align: right;
    display: flex;
    flex-direction: column;
}

.asset-value {
    font-weight: 600;
    font-size: 15px;
}

.asset-sub {
    font-size: 12px;
    color: var(--text-secondary);
}

/* ----------------------------------------------------
   FORMS & LAYOUTS
   ---------------------------------------------------- */
.form-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.input-row {
    display: flex;
    gap: 10px;
}

.input-row input, .input-row select {
    flex: 1;
    width: 50%;
}

/* ----------------------------------------------------
   UPLOAD CARD
   ---------------------------------------------------- */
.upload-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 25px 20px;
}

.upload-icon {
    font-size: 44px;
    color: var(--neon-purple);
    margin-bottom: 12px;
}

.upload-card h4 {
    font-family: 'Outfit', sans-serif;
    font-size: 15px;
    margin-bottom: 6px;
}

.upload-card p {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 15px;
    line-height: 1.5;
}

.file-input {
    display: none;
}

.status-msg {
    margin-top: 10px;
    font-size: 13px;
    font-weight: 500;
}

/* ----------------------------------------------------
   LISTA HISTÓRICO
   ---------------------------------------------------- */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 14px 16px;
}

.history-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.history-badge {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 12px;
}

.history-badge.buy {
    background-color: rgba(0, 255, 135, 0.1);
    color: var(--color-success);
    border: 1px solid rgba(0, 255, 135, 0.2);
}

.history-badge.sell {
    background-color: rgba(255, 59, 48, 0.1);
    color: var(--color-danger);
    border: 1px solid rgba(255, 59, 48, 0.2);
}

.history-badge.div {
    background-color: rgba(0, 245, 255, 0.1);
    color: var(--neon-teal);
    border: 1px solid rgba(0, 245, 255, 0.2);
}

.history-details {
    display: flex;
    flex-direction: column;
}

.history-ticker {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 14px;
}

.history-date {
    font-size: 11px;
    color: var(--text-secondary);
}

.history-right {
    text-align: right;
    display: flex;
    align-items: center;
    gap: 12px;
}

.history-price {
    display: flex;
    flex-direction: column;
}

.delete-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.delete-btn:active {
    color: var(--color-danger);
    background-color: rgba(255, 59, 48, 0.1);
}

.edit-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.edit-btn:active {
    color: var(--neon-purple, #2563EB);
    background-color: rgba(37, 99, 235, 0.1);
}

/* ----------------------------------------------------
   CONFIG CARDS & BACKUPS
   ---------------------------------------------------- */
.config-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

.config-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.config-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.config-icon.green {
    background-color: rgba(0, 255, 135, 0.1);
    color: var(--color-success);
}

.config-card h4 {
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    margin-bottom: 2px;
}

.config-card p {
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.3;
}

.backups-list {
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.backup-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 12px 14px;
}

.backup-item-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.backup-meta {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.backup-name {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 13px;
    word-break: break-all;
}

.backup-date {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.restore-btn-action {
    background-color: rgba(0, 245, 255, 0.1);
    color: var(--neon-teal);
    border: 1px solid rgba(0, 245, 255, 0.2);
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.restore-btn-action:active {
    transform: scale(0.95);
    background-color: rgba(0, 245, 255, 0.2);
}

.delete-backup-btn {
    background-color: rgba(255, 77, 109, 0.1);
    color: var(--color-danger, #ff4d6d);
    border: 1px solid rgba(255, 77, 109, 0.25);
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.delete-backup-btn:active {
    transform: scale(0.95);
    background-color: rgba(255, 77, 109, 0.2);
}

.about-logo {
    font-size: 54px;
    background: var(--neon-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 10px;
}

.about-card h4 {
    font-family: 'Outfit', sans-serif;
    font-size: 16px;
    margin-bottom: 5px;
}

.about-card p {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.about-card small {
    font-size: 10px;
    color: var(--text-secondary);
}

/* ----------------------------------------------------
   WIDGETS & FEEDBACKS (Dólar e Autocomplete)
   ---------------------------------------------------- */
.dollar-widget-header {
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 6px 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.dollar-label {
    color: var(--text-secondary);
}

.dollar-val {
    color: var(--color-success);
}

.ticker-feedback-msg {
    font-size: 11px;
    font-weight: 500;
    padding-left: 2px;
    min-height: 15px;
    margin-bottom: 5px;
    transition: all 0.2s ease;
}

.ticker-feedback-msg.searching {
    color: var(--neon-teal);
}

.ticker-feedback-msg.success {
    color: var(--color-success);
}

.ticker-feedback-msg.error {
    color: var(--color-danger);
}

/* ----------------------------------------------------
   TAB NAV BAR (Estilo iOS fixo embaixo)
   ---------------------------------------------------- */
.app-nav {
    position: absolute;
    bottom: 0;
    width: 100%;
    background-color: rgba(10, 14, 23, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--card-border);
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    padding-top: 6px;
    padding-bottom: calc(var(--safe-area-bottom) + 6px);
    z-index: 100;
}

.nav-tab {
    background: none;
    border: none;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    min-width: 0;
    padding: 4px 2px;
    transition: color 0.2s ease;
}

.nav-tab ion-icon {
    font-size: 20px;
}

.nav-tab span {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    letter-spacing: 0.01em;
}

.nav-label-full {
    display: none;
}

.nav-tab .active-icon {
    display: none;
}

.nav-tab.active {
    color: var(--neon-teal);
}

.nav-tab.active .inactive-icon {
    display: none;
}

.nav-tab.active .active-icon {
    display: block;
    animation: bounce 0.3s ease;
}

.nav-tab[data-tab="tab-desempenho"].active {
    color: #ff9f1c;
}

@keyframes bounce {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

/* ----------------------------------------------------
   RESPONSIVIDADE WEB/DESKTOP (Telas > 768px)
   ---------------------------------------------------- */
@media (min-width: 769px) {
    body {
        align-items: center;
        min-height: 100vh;
        padding: 20px;
    }

    #app-container {
        max-width: 1200px;
        height: 85vh;
        min-height: 650px;
        border-radius: 24px;
        border: 1px solid var(--card-border);
        display: grid;
        grid-template-columns: 240px 1fr;
        grid-template-rows: auto 1fr;
        grid-template-areas: 
            "nav header"
            "nav content";
        box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7);
        overflow: hidden;
    }

    /* Header no Desktop */
    .app-header {
        grid-area: header;
        position: relative;
        padding: 20px 30px;
        border-bottom: 1px solid var(--card-border);
        background-color: rgba(10, 14, 23, 0.5);
    }

    /* Sidebar Menu Lateral */
    .app-nav {
        grid-area: nav;
        position: relative;
        height: 100%;
        width: 100%;
        background-color: rgba(20, 28, 45, 0.4);
        border-right: 1px solid var(--card-border);
        border-top: none;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        gap: 8px;
        padding: 24px 12px;
        padding-bottom: 24px;
        grid-template-columns: unset;
    }

    .nav-tab {
        flex-direction: row;
        justify-content: flex-start;
        align-items: center;
        padding: 12px 16px;
        width: 100%;
        gap: 10px;
        font-size: 14px;
        border-radius: 12px;
        transition: all 0.3s ease;
        flex: none;
        min-height: 44px;
    }

    .nav-tab span {
        white-space: normal;
    }

    .nav-label-short {
        display: none;
    }

    .nav-label-full {
        display: inline;
    }

    .nav-tab ion-icon {
        font-size: 20px;
    }

    .nav-tab:hover {
        background-color: rgba(255, 255, 255, 0.04);
        color: var(--neon-teal);
    }

    .nav-tab.active {
        background-color: rgba(0, 245, 255, 0.08);
        border: 1px solid rgba(0, 245, 255, 0.15);
    }

    /* Conteúdo Principal */
    .app-content {
        grid-area: content;
        padding: 30px;
        height: 100%;
        overflow-y: auto;
        padding-bottom: 40px;
    }

    /* Grid do Dashboard no Desktop (Lado a Lado) */
    #tab-inicio {
        display: none;
    }
    #tab-inicio.active {
        display: grid;
        grid-template-columns: 1.2fr 1fr;
        gap: 25px;
    }

    .main-balance-card {
        grid-column: span 1;
        margin-bottom: 0 !important;
        height: 100%;
    }

    .highlight-grid {
        grid-column: span 1;
        display: flex;
        flex-direction: column;
        gap: 12px;
        height: 100%;
        margin-bottom: 0 !important;
    }

    .highlight-card {
        flex: 1;
        display: flex;
        flex-direction: column;
        justify-content: center;
        margin-bottom: 0 !important;
    }
    
    .chart-card {
        grid-column: span 2;
        margin-bottom: 0 !important;
        height: auto;
        min-height: 240px;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
    }

    .section-header, .assets-list {
        grid-column: span 2;
    }
    
    .assets-list {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 15px;
    }

    .asset-item {
        margin-bottom: 0;
    }

    /* Ocultar safe-area do iOS no Desktop */
    .app-header, .app-nav {
        padding-top: 20px;
        padding-bottom: 20px;
    }
}

/* ----------------------------------------------------
   NOVOS ESTILOS: GRÁFICOS DINÂMICOS & AGENDA DE PROVENTOS
   ---------------------------------------------------- */
.chart-tabs-header {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
    padding-bottom: 6px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.chart-tabs-header::-webkit-scrollbar {
    display: none;
}

.chart-tab-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

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

.chart-tab-btn.active {
    background: var(--neon-gradient);
    border-color: transparent;
    color: #FFF;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

/* Botão de autolançamento de proventos */
.launch-btn {
    background: rgba(0, 255, 135, 0.08);
    border: 1px solid rgba(0, 255, 135, 0.15);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.launch-btn:hover {
    background: rgba(0, 255, 135, 0.2);
    transform: scale(1.05);
}

.launch-btn:active {
    transform: scale(0.95);
}

.forecast-meta-bar {
    font-size: 11px;
    color: var(--text-secondary);
    text-align: center;
    padding: 6px 10px;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
}

.forecast-inline-warning {
    font-size: 12px;
    color: #ff9f1c;
    text-align: center;
    margin: 0 0 8px;
    padding: 8px 12px;
    background: rgba(255, 159, 28, 0.08);
    border-radius: 8px;
}

.forecast-ticker-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
}

.forecast-status-badge,
.forecast-source-badge {
    font-size: 9px;
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
}

.history-item.forecast-launched {
    opacity: 0.65;
}

.forecast-warning-card {
    margin-bottom: 10px;
}

.balance-usd-equiv {
    margin: 4px 0 0;
    font-size: 13px;
    color: var(--neon-teal);
    font-weight: 500;
}

.forecast-section-hint {
    font-size: 12px;
    color: var(--text-secondary);
    margin: -4px 0 10px;
    line-height: 1.4;
}

.projection-summary-card {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 10px;
    padding: 12px 14px !important;
}

.projection-summary-label {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.projection-summary-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--neon-teal);
}

.projection-summary-sub {
    font-size: 11px;
    color: var(--text-secondary);
}

.projection-item {
    border-left: 2px solid rgba(255, 159, 28, 0.35);
}

.etf-history-card {
    margin-bottom: 10px;
    padding: 10px 12px !important;
}

.etf-history-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 6px;
}

.etf-history-ticker {
    font-weight: 700;
    font-size: 14px;
}

.etf-history-meta {
    font-size: 11px;
    color: var(--text-secondary);
}

.etf-history-total {
    font-size: 12px;
    color: var(--neon-teal);
    margin-bottom: 8px;
}

.etf-payments-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.etf-payment-row {
    display: grid;
    grid-template-columns: 72px 1fr auto;
    gap: 8px;
    font-size: 12px;
    align-items: center;
}

.etf-payment-date {
    color: var(--text-secondary);
}

.etf-payment-amount {
    font-weight: 600;
}

.etf-payment-src {
    font-size: 10px;
    color: var(--text-secondary);
    text-align: right;
}

.forecast-empty-msg {
    font-size: 12px;
    text-align: center;
    padding: 12px 8px;
    margin: 0 0 10px;
    line-height: 1.45;
}

.performance-card {
    margin-bottom: 14px;
    padding: 14px 16px !important;
    min-height: calc(100vh - 180px);
}

.performance-hint {
    font-size: 11px;
    color: var(--text-secondary);
    margin: 0 0 10px;
    line-height: 1.4;
}

.performance-period-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
}

.performance-period-btn {
    flex: 1;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-secondary);
    border-radius: 8px;
    padding: 6px 0;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.performance-period-btn.active {
    color: var(--neon-teal);
    border-color: rgba(0, 245, 255, 0.35);
    background: rgba(0, 245, 255, 0.08);
}

.performance-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.performance-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.performance-item-left {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.performance-ticker {
    font-weight: 700;
    font-size: 14px;
}

.performance-meta {
    font-size: 11px;
    color: var(--text-secondary);
}

.performance-item-right {
    text-align: right;
    flex-shrink: 0;
}

.performance-pct {
    display: block;
    font-size: 16px;
    font-weight: 700;
}

.performance-pct.positive {
    color: var(--color-success);
}

.performance-pct.negative {
    color: var(--color-danger);
}

.performance-sub {
    display: block;
    font-size: 10px;
    color: var(--text-secondary);
    margin-top: 2px;
    max-width: 140px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.performance-cash-row {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 8px;
    align-items: end;
    margin-bottom: 6px;
}

.performance-cash-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 11px;
    color: var(--text-secondary);
}

.performance-cash-field input {
    width: 100%;
    padding: 8px 10px;
    font-size: 13px;
}

.performance-cash-save {
    width: auto !important;
    padding: 0 12px !important;
    height: 38px !important;
    font-size: 12px !important;
    flex-shrink: 0;
}

.performance-cash-hint {
    font-size: 10px;
    color: var(--text-secondary);
    margin: 0 0 12px;
    line-height: 1.35;
}

.performance-item-expanded {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px 0 !important;
}

.performance-item-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
}

.performance-share-block {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    padding: 10px;
}

.performance-share-row {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.performance-share-row strong {
    color: var(--text-primary);
}

.performance-share-progress-wrap {
    height: 6px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 6px;
}

.performance-share-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #ff9f1c, var(--neon-teal));
    border-radius: 999px;
    min-width: 2%;
}

.performance-share-meta {
    font-size: 10px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.performance-share-options {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.share-option-btn {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    width: 100%;
    text-align: left;
    background: rgba(0, 245, 255, 0.06);
    border: 1px solid rgba(0, 245, 255, 0.15);
    border-radius: 8px;
    padding: 8px 10px;
    cursor: pointer;
    color: var(--text-primary);
    font-family: inherit;
}

.share-option-btn:active {
    transform: scale(0.98);
}

.share-option-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--neon-teal);
}

.share-option-detail {
    font-size: 10px;
    color: var(--text-secondary);
}

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

/* Ajustes de compactação geral no layout do mobile */
.glass-card {
    padding: 12px 14px !important;
    border-radius: 16px !important;
}

.main-balance-card {
    padding: 16px !important;
}

.asset-item, .history-item {
    padding: 10px 12px !important;
    border-radius: 12px !important;
    margin-bottom: 8px !important;
}

.section-header h3 {
    font-size: 14px !important;
}

.form-grid input, .form-grid select {
    padding: 10px 12px !important;
    font-size: 13px !important;
    border-radius: 10px !important;
}

.btn-primary, .btn-secondary {
    padding: 10px 14px !important;
    font-size: 13px !important;
    border-radius: 10px !important;
}

.app-content {
    padding: 12px 16px 80px 16px !important;
}

.app-header {
    padding-top: calc(var(--safe-area-top) + 4px) !important;
    padding-bottom: 8px !important;
}

/* Destaques do Dia */
.highlight-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 12px;
}

.highlight-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 12px !important;
}

.highlight-title {
    font-size: 10px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 500;
}

.highlight-info {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-top: 2px;
}

.highlight-ticker {
    font-family: 'Outfit', sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: #ffffff;
}

.highlight-value {
    font-size: 12px;
    font-weight: bold;
}

.highlight-card.positive .highlight-value {
    color: var(--color-success);
}

.highlight-card.negative .highlight-value {
    color: var(--color-danger);
}

.highlight-card.positive {
    border-left: 3px solid var(--color-success) !important;
}

.highlight-card.negative {
    border-left: 3px solid var(--color-danger) !important;
}

/* Watchlist Badges */
.watchlist-badge-del {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    cursor: pointer;
    border-radius: 50%;
    transition: background-color 0.2s, color 0.2s;
}

.watchlist-badge-del:hover {
    background-color: rgba(255, 59, 48, 0.1);
    color: var(--color-danger);
}

/* Botão Sair Vermelho Neon Animado na Barra de Navegação */
.neon-logout-nav-btn {
    color: #ff3b30 !important;
    transition: all 0.3s ease;
    animation: neon-nav-pulse 2s infinite alternate ease-in-out;
}

@keyframes neon-nav-pulse {
    0% {
        text-shadow: 0 0 2px rgba(255, 59, 48, 0.4), 0 0 6px rgba(255, 59, 48, 0.2);
    }
    100% {
        text-shadow: 0 0 6px rgba(255, 59, 48, 0.9), 0 0 14px rgba(255, 59, 48, 0.6);
    }
}

.neon-logout-nav-btn:hover {
    color: #ffffff !important;
    text-shadow: 0 0 6px #ffffff !important;
    background-color: rgba(255, 59, 48, 0.15) !important;
}

/* No desktop, garantir que se comporte como os outros itens mas com brilho neon */
@media (min-width: 768px) {
    .neon-logout-nav-btn:hover {
        background-color: rgba(255, 59, 48, 0.15) !important;
        border: 1px solid rgba(255, 59, 48, 0.4) !important;
        box-shadow: 0 0 10px rgba(255, 59, 48, 0.3) !important;
    }
}
